Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-webui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-webui
Commits
663d105d
Commit
663d105d
authored
1 year ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
DOC: add in code documentation
parent
d29f7c47
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!123
Release 0.13.0
,
!121
FIX: breaking datetime in edit mode
Pipeline
#41864
passed
1 year ago
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/js/caosdb.js
+5
-4
5 additions, 4 deletions
src/core/js/caosdb.js
src/core/js/edit_mode.js
+2
-0
2 additions, 0 deletions
src/core/js/edit_mode.js
with
7 additions
and
4 deletions
src/core/js/caosdb.js
+
5
−
4
View file @
663d105d
...
@@ -330,9 +330,11 @@ var getEntityIdVersion = function (entity) {
...
@@ -330,9 +330,11 @@ var getEntityIdVersion = function (entity) {
}
}
/**
/**
* Take a date
and
a time and format it into a CaosDB compatible representation.
* Take a date
,
a time and
subseconds and
format it into a CaosDB compatible representation.
* @param date A date
* @param date A date
* @param time A time
* @param time A time
* @param subsec fractions of a seconds part of the time stamp; Must be empty
* string if not used
* @return A CaosDB compatible representation.
* @return A CaosDB compatible representation.
*/
*/
function
input2caosdbDate
(
date
,
time
,
subsec
)
{
function
input2caosdbDate
(
date
,
time
,
subsec
)
{
...
@@ -370,13 +372,13 @@ var getAllEntityPermissions = function (entity) {
...
@@ -370,13 +372,13 @@ var getAllEntityPermissions = function (entity) {
}
}
/**
/**
* Take a datetime from caosdb and return a date
and
a time
* Take a datetime from caosdb and return a date
,
a time
and the subseconds
* suitable for html inputs.
* suitable for html inputs.
*
*
* If the text contains only a date it is returned.
* If the text contains only a date it is returned.
*
*
* @param text The string from CaosDB.
* @param text The string from CaosDB.
* @return A
new
string for the input element.
* @return A
list of
string
s
for the input element
s
.
*/
*/
function
caosdb2InputDate
(
text
)
{
function
caosdb2InputDate
(
text
)
{
if
(
text
.
includes
(
"
T
"
))
{
if
(
text
.
includes
(
"
T
"
))
{
...
@@ -385,7 +387,6 @@ function caosdb2InputDate(text) {
...
@@ -385,7 +387,6 @@ function caosdb2InputDate(text) {
if
(
spl
[
1
].
includes
(
"
.
"
))
{
if
(
spl
[
1
].
includes
(
"
.
"
))
{
subsec
=
spl
[
1
].
split
(
'
.
'
)[
1
]
subsec
=
spl
[
1
].
split
(
'
.
'
)[
1
]
}
}
//TODO subsecond resolution is IGNORED!!!
return
[
spl
[
0
],
spl
[
1
].
substring
(
0
,
8
),
subsec
];
return
[
spl
[
0
],
spl
[
1
].
substring
(
0
,
8
),
subsec
];
}
}
return
[
text
];
return
[
text
];
...
...
This diff is collapsed.
Click to expand it.
src/core/js/edit_mode.js
+
2
−
0
View file @
663d105d
...
@@ -513,6 +513,7 @@ var edit_mode = new function () {
...
@@ -513,6 +513,7 @@ var edit_mode = new function () {
var
_parse_single_datetime
=
function
(
field
)
{
var
_parse_single_datetime
=
function
(
field
)
{
let
time
=
$
(
field
).
find
(
"
:input[type='time']
"
).
val
()
let
time
=
$
(
field
).
find
(
"
:input[type='time']
"
).
val
()
let
date
=
$
(
field
).
find
(
"
:input[type='date']
"
).
val
();
let
date
=
$
(
field
).
find
(
"
:input[type='date']
"
).
val
();
// subseconds are stored in the subsec attribue of the input element
let
subsec
=
$
(
field
).
find
(
"
:input[type='time']
"
).
attr
(
'
subsec
'
);
let
subsec
=
$
(
field
).
find
(
"
:input[type='time']
"
).
attr
(
'
subsec
'
);
if
(
time
)
{
if
(
time
)
{
return
input2caosdbDate
(
date
,
time
,
subsec
);
return
input2caosdbDate
(
date
,
time
,
subsec
);
...
@@ -978,6 +979,7 @@ var edit_mode = new function () {
...
@@ -978,6 +979,7 @@ var edit_mode = new function () {
let
date
=
dateandtime
[
0
];
let
date
=
dateandtime
[
0
];
if
(
dateandtime
.
length
>
1
)
{
if
(
dateandtime
.
length
>
1
)
{
let
time
=
dateandtime
[
1
];
let
time
=
dateandtime
[
1
];
// subseconds are stored in the subsec attribue of the input element
result
=
"
<span><input type='date' value='
"
+
date
+
"
'/>
"
+
result
=
"
<span><input type='date' value='
"
+
date
+
"
'/>
"
+
"
<input type='time' subsec='
"
+
dateandtime
[
2
]
+
"
' value='
"
+
time
+
"
'/></span>
"
;
"
<input type='time' subsec='
"
+
dateandtime
[
2
]
+
"
' value='
"
+
time
+
"
'/></span>
"
;
}
else
if
(
property
.
value
&&
((
property
.
name
||
""
).
toLowerCase
()
==
"
year
"
||
(
date
.
match
(
/-/g
)
||
[]).
length
==
0
))
{
}
else
if
(
property
.
value
&&
((
property
.
name
||
""
).
toLowerCase
()
==
"
year
"
||
(
date
.
match
(
/-/g
)
||
[]).
length
==
0
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment