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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-webui
Commits
8512dd97
Commit
8512dd97
authored
2 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
AUDIT: Review f-map-list
parent
f289b9ab
No related branches found
No related tags found
2 merge requests
!73
REL: Release 0.7.0
,
!71
F map list
Pipeline
#22657
passed
2 years ago
Stage: linting
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/js/caosdb.js
+3
-2
3 additions, 2 deletions
src/core/js/caosdb.js
src/core/js/ext_map.js
+29
-25
29 additions, 25 deletions
src/core/js/ext_map.js
with
32 additions
and
27 deletions
src/core/js/caosdb.js
+
3
−
2
View file @
8512dd97
...
...
@@ -5,8 +5,8 @@
* Copyright (C) 2018-2020 Alexander Schlemmer
* Copyright (C) 2018 Research Group Biomedical Physics,
* Max-Planck-Institute for Dynamics and Self-Organization Göttingen
* Copyright (C) 2019-202
0
IndiScale GmbH (info@indiscale.com)
* Copyright (C) 2019-202
0
Timm Fitschen (t.fitschen@indiscale.com)
* Copyright (C) 2019-202
2
IndiScale GmbH (info@indiscale.com)
* Copyright (C) 2019-202
2
Timm Fitschen (t.fitschen@indiscale.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
...
...
@@ -765,6 +765,7 @@ var _constructXpaths = function (selectors) {
* (or an array of values, when the entity has list properties).
*/
var
getPropertyValues
=
function
(
entities
,
selectors
)
{
// @review Florian Spreckelsen 2022-05-06
const
entity_iter
=
entities
.
evaluate
(
"
/Response/Record
"
,
entities
);
const
table
=
[];
...
...
This diff is collapsed.
Click to expand it.
src/core/js/ext_map.js
+
29
−
25
View file @
8512dd97
...
...
@@ -543,6 +543,7 @@ var caosdb_map = new function () {
* recordtype)
*/
this
.
_set_subprops_at_top
=
function
(
entities
,
depth
,
datamodel
)
{
// @review Florian Spreckelsen 2022-05-06
var
latlong
=
caosdb_map
.
_get_leaf_prop
(
entities
,
depth
,
datamodel
);
for
(
let
rec_id
in
latlong
)
{
...
...
@@ -550,13 +551,13 @@ var caosdb_map = new function () {
const
is_list_lng
=
Array
.
isArray
(
latlong
[
rec_id
][
0
]);
var
lat
,
lng
;
if
(
is_list_lat
)
{
var
lat_val
=
`<Value>
${
latlong
[
rec_id
][
0
].
join
(
"
</Value><Value>
"
)}
</Value>`
;
lat
=
`<Property name="
${
datamodel
.
lat
}
" datatype="LIST<lat>">
${
lat_val
}
</Property>`
;
var
lng_val
=
`<Value>
${
latlong
[
rec_id
][
1
].
join
(
"
</Value><Value>
"
)}
</Value>`
;
lng
=
`<Property name="
${
datamodel
.
lng
}
" datatype="LIST<lng>">
${
lng_val
}
</Property>`
;
var
lat_val
=
`<Value>
${
latlong
[
rec_id
][
0
].
join
(
"
</Value><Value>
"
)}
</Value>`
;
lat
=
`<Property name="
${
datamodel
.
lat
}
" datatype="LIST<lat>">
${
lat_val
}
</Property>`
;
var
lng_val
=
`<Value>
${
latlong
[
rec_id
][
1
].
join
(
"
</Value><Value>
"
)}
</Value>`
;
lng
=
`<Property name="
${
datamodel
.
lng
}
" datatype="LIST<lng>">
${
lng_val
}
</Property>`
;
}
else
{
lat
=
`<Property name="
${
datamodel
.
lat
}
">
${
latlong
[
rec_id
][
0
]}
</Property>`
;
lng
=
`<Property name="
${
datamodel
.
lng
}
">
${
latlong
[
rec_id
][
1
]}
</Property>`
;
lat
=
`<Property name="
${
datamodel
.
lat
}
">
${
latlong
[
rec_id
][
0
]}
</Property>`
;
lng
=
`<Property name="
${
datamodel
.
lng
}
">
${
latlong
[
rec_id
][
1
]}
</Property>`
;
}
let
tmp_rec
=
caosdb_map
.
_get_toplvl_rec_with_id
(
entities
,
rec_id
);
tmp_rec
.
append
(
str2xml
(
lat
).
firstElementChild
);
...
...
@@ -605,6 +606,7 @@ var caosdb_map = new function () {
* @returns {HTMLElement} a popup element.
*/
this
.
_make_map_popup
=
function
(
entity
,
datamodel
,
lat
,
lng
)
{
// @review Florian Spreckelsen 2022-05-06
const
role_label
=
$
(
entity
).
find
(
"
.label.caosdb-f-entity-role
"
).
first
().
clone
();
const
parent_list
=
caosdb_map
.
make_parent_labels
(
entity
);
...
...
@@ -871,8 +873,8 @@ var caosdb_map = new function () {
let
panel
=
this
.
create_map_panel
();
if
(
!
show
)
{
$
(
panel
).
hide
();
if
(
!
show
)
{
$
(
panel
).
hide
();
}
$
(
'
nav
'
).
first
().
after
(
panel
);
...
...
@@ -1007,8 +1009,8 @@ var caosdb_map = new function () {
}
this
.
config
=
config
;
var
show_map
=
config
.
show
;
if
(
sessionStorage
[
"
caosdb_map.show
"
])
{
show_map
=
JSON
.
parse
(
sessionStorage
[
"
caosdb_map.show
"
]);
if
(
sessionStorage
[
"
caosdb_map.show
"
])
{
show_map
=
JSON
.
parse
(
sessionStorage
[
"
caosdb_map.show
"
]);
}
this
.
init_select_handler
();
this
.
init_view_change_handler
();
...
...
@@ -1108,8 +1110,8 @@ var caosdb_map = new function () {
// indicate that the map is ready: map button is present and
// map is hidden or shown but initialized in either case.
this
.
_map
.
whenReady
(()
=>
{
document
.
body
.
dispatchEvent
(
caosdb_map
.
map_ready
);
this
.
_map
.
whenReady
(()
=>
{
document
.
body
.
dispatchEvent
(
caosdb_map
.
map_ready
);
});
}
catch
(
err
)
{
logger
.
error
(
"
Could not initialize the map.
"
,
...
...
@@ -1544,8 +1546,9 @@ var caosdb_map = new function () {
* @param {mapEntityPopupGenerator} [make_popup] - creates popup content.
* @returns {L.Marker} the marker for the map.
*/
var
_create_single_entity_marker
=
function
(
map_entity
,
datamodel
,
lat
,
lng
,
icon_options
,
zIndexOffset
,
make_popup
)
{
var
_create_single_entity_marker
=
function
(
map_entity
,
datamodel
,
lat
,
lng
,
icon_options
,
zIndexOffset
,
make_popup
)
{
// @review Florian Spreckelsen 2022-05-06
var
marker
=
L
.
marker
([
lat
,
lng
],
{
icon
:
L
.
divIcon
(
icon_options
)
});
...
...
@@ -1572,9 +1575,10 @@ var caosdb_map = new function () {
* @returns {L.Marker[]} an array of markers for the map.
*/
this
.
create_entity_markers
=
function
(
entities
,
datamodel
,
make_popup
,
zIndexOffset
,
icon_options
)
{
zIndexOffset
,
icon_options
)
{
// @review Florian Spreckelsen 2022-05-06
logger
.
trace
(
"
enter create_entity_markers
"
,
entities
,
datamodel
,
zIndexOffset
,
icon_options
);
zIndexOffset
,
icon_options
);
var
ret
=
[]
for
(
const
map_entity
of
entities
)
{
...
...
@@ -1601,11 +1605,11 @@ var caosdb_map = new function () {
}
// both array's length must match
if
(
is_list_lng
!==
is_list_lat
||
(
is_list_lat
&&
is_list_lng
&&
lat_vals
.
length
!==
lng_vals
.
length
))
{
logger
.
error
(
"
Cannot show this entity on the map.
"
+
"
Its lat/long properties have different lenghts:
"
,
if
(
is_list_lng
!==
is_list_lat
||
(
is_list_lat
&&
is_list_lng
&&
lat_vals
.
length
!==
lng_vals
.
length
))
{
logger
.
error
(
"
Cannot show this entity on the map.
"
+
"
Its lat/long properties have different lenghts:
"
,
map_entity
);
continue
;
}
...
...
@@ -1616,15 +1620,15 @@ var caosdb_map = new function () {
// [lng1, lng2, ... lngN]
// into one
// [[lat1,lng1],[lat2,lng2],... [latN,lngN]]
var
latlngs
=
lat_vals
.
map
(
function
(
e
,
i
)
{
var
latlngs
=
lat_vals
.
map
(
function
(
e
,
i
)
{
return
[
e
,
lng_vals
[
i
]];
});
logger
.
debug
(
`create point marker(s) at
${
latlngs
}
for`
,
map_entity
);
map_entity
);
for
(
let
latlng
of
latlngs
)
{
var
marker
=
_create_single_entity_marker
(
map_entity
,
datamodel
,
latlng
[
0
],
latlng
[
1
],
icon_options
,
zIndexOffset
,
make_popup
);
datamodel
,
latlng
[
0
],
latlng
[
1
],
icon_options
,
zIndexOffset
,
make_popup
);
ret
.
push
(
marker
);
}
...
...
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