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
19b5285c
Commit
19b5285c
authored
1 year ago
by
Timm Fitschen
Browse files
Options
Downloads
Plain Diff
Merge branch 'f-fix-datetime' into 'dev'
FIX: breaking datetime in edit mode See merge request
!121
parents
7a372ef8
f6bd17b6
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!123
Release 0.13.0
,
!121
FIX: breaking datetime in edit mode
Pipeline
#41984
passed
1 year ago
Stage: setup
Stage: test
Changes
4
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
src/core/js/caosdb.js
+17
-7
17 additions, 7 deletions
src/core/js/caosdb.js
src/core/js/edit_mode.js
+6
-3
6 additions, 3 deletions
src/core/js/edit_mode.js
test/core/js/modules/caosdb.js.js
+16
-0
16 additions, 0 deletions
test/core/js/modules/caosdb.js.js
with
40 additions
and
10 deletions
CHANGELOG.md
+
1
−
0
View file @
19b5285c
...
@@ -50,6 +50,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
...
@@ -50,6 +50,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[
caosdb-webui#226
](
https://gitlab.com/caosdb/caosdb-webui/-/issues/226
)
[
caosdb-webui#226
](
https://gitlab.com/caosdb/caosdb-webui/-/issues/226
)
*
Fixed broken download of referenced files in the export of select statements.
*
Fixed broken download of referenced files in the export of select statements.
https://gitlab.com/linkahead/linkahead-webui/-/issues/238
https://gitlab.com/linkahead/linkahead-webui/-/issues/238
*
Fixed breaking timestamps due to whitespace
[
caosdb-webui#239
](
https://gitlab.com/caosdb/caosdb-webui/-/issues/239
)
### Security ###
### Security ###
...
...
This diff is collapsed.
Click to expand it.
src/core/js/caosdb.js
+
17
−
7
View file @
19b5285c
...
@@ -330,13 +330,19 @@ var getEntityIdVersion = function (entity) {
...
@@ -330,13 +330,19 @@ var getEntityIdVersion = function (entity) {
}
}
/**
/**
* Take a date
and
a time and format it into a LinkAhead compatible representation.
* Take a date
,
a time and
subseconds and
format it into a LinkAhead 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 LinkAhead compatible representation.
* @return A LinkAhead compatible representation.
*/
*/
function
input2caosdbDate
(
date
,
time
)
{
function
input2caosdbDate
(
date
,
time
,
subsec
)
{
return
date
+
"
T
"
+
time
;
let
res
=
date
+
"
T
"
+
time
;
if
(
subsec
!=
""
){
res
=
res
+
"
.
"
+
subsec
;
}
return
res
}
}
/**
/**
...
@@ -366,18 +372,22 @@ var getAllEntityPermissions = function (entity) {
...
@@ -366,18 +372,22 @@ 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 LinkAhead.
* @param text The string from LinkAhead.
* @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
"
))
{
var
spl
=
text
.
split
(
"
T
"
);
var
spl
=
text
.
trim
().
split
(
"
T
"
);
return
[
spl
[
0
],
spl
[
1
].
substring
(
0
,
8
)];
var
subsec
=
""
if
(
spl
[
1
].
includes
(
"
.
"
))
{
subsec
=
spl
[
1
].
split
(
'
.
'
)[
1
]
}
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
+
6
−
3
View file @
19b5285c
...
@@ -513,8 +513,10 @@ var edit_mode = new function () {
...
@@ -513,8 +513,10 @@ 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
'
);
if
(
time
)
{
if
(
time
)
{
return
input2caosdbDate
(
date
,
time
);
return
input2caosdbDate
(
date
,
time
,
subsec
);
}
else
{
}
else
{
return
date
;
return
date
;
}
}
...
@@ -975,10 +977,11 @@ var edit_mode = new function () {
...
@@ -975,10 +977,11 @@ var edit_mode = new function () {
dateandtime
=
caosdb2InputDate
(
property
.
value
);
dateandtime
=
caosdb2InputDate
(
property
.
value
);
}
}
let
date
=
dateandtime
[
0
];
let
date
=
dateandtime
[
0
];
if
(
dateandtime
.
length
==
2
)
{
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' 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
))
{
// Year
// Year
result
=
"
<input type='number' value='
"
+
date
+
"
'/>
"
;
result
=
"
<input type='number' value='
"
+
date
+
"
'/>
"
;
...
...
This diff is collapsed.
Click to expand it.
test/core/js/modules/caosdb.js.js
+
16
−
0
View file @
19b5285c
...
@@ -661,3 +661,19 @@ QUnit.test("getPropertyFromElement", async function(assert) {
...
@@ -661,3 +661,19 @@ QUnit.test("getPropertyFromElement", async function(assert) {
});
});
});
});
QUnit
.
test
(
"
input2caosdbDate
"
,
function
(
assert
)
{
assert
.
ok
(
input2caosdbDate
);
assert
.
equal
(
input2caosdbDate
(
"
2023-10-18
"
,
"
10:10:10
"
,
"
1234
"
),
"
2023-10-18T10:10:10.1234
"
)
assert
.
equal
(
input2caosdbDate
(
"
2023-10-18
"
,
"
10:10:10
"
,
""
),
"
2023-10-18T10:10:10
"
)
});
QUnit
.
test
(
"
caosdb2InputDate
"
,
function
(
assert
)
{
assert
.
ok
(
caosdb2InputDate
);
arr1
=
caosdb2InputDate
(
"
2023-10-18T10:10:10.1234
"
)
arr2
=
[
"
2023-10-18
"
,
"
10:10:10
"
,
"
1234
"
]
assert
.
ok
(
arr1
.
length
===
arr2
.
length
&&
arr1
.
every
((
value
,
index
)
=>
value
===
arr2
[
index
]))
assert
.
ok
(
arr1
.
length
===
arr2
.
length
&&
arr1
.
every
((
value
,
index
)
=>
value
===
arr2
[
index
]))
arr1
=
caosdb2InputDate
(
"
2023-10-18T10:10:10
"
)
arr2
=
[
"
2023-10-18
"
,
"
10:10:10
"
,
""
]
});
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