EOX GitLab Instance
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Data Handling
client
Commits
9672d958
Commit
9672d958
authored
2 years ago
by
Lubomir Dolezal
Browse files
Options
Downloads
Patches
Plain Diff
update new recordModel also for cleanup methods
parent
3e39765c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!7
Client performance improvements timeslider
Pipeline
#26955
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/views/RecordsDetailsModalView.js
+52
-38
52 additions, 38 deletions
src/views/RecordsDetailsModalView.js
with
52 additions
and
38 deletions
src/views/RecordsDetailsModalView.js
+
52
−
38
View file @
9672d958
...
...
@@ -97,7 +97,7 @@ const RecordsDetailsModalView = ModalView.extend({
$
(
'
.modal-body
'
).
height
(
`calc(100% -
${
restHeightCombined
}
px)`
);
},
updateRecord
(
recordModel
,
searchModel
,
refreshOnlyRecordDetails
=
false
)
{
updateRecord
(
recordModel
,
searchModel
)
{
let
time
=
recordModel
.
get
(
'
properties
'
).
time
;
if
(
time
instanceof
Date
)
{
time
=
[
time
,
time
];
...
...
@@ -139,10 +139,7 @@ const RecordsDetailsModalView = ModalView.extend({
iframeView
:
this
.
iframeView
,
});
this
.
showChildView
(
'
content
'
,
detailsView
);
if
(
refreshOnlyRecordDetails
)
{
// earlier exit for case when only RecordDetailsView should be redrawn
return
;
}
this
.
filtersModel
.
set
(
'
area
'
,
recordModel
.
attributes
.
geometry
);
this
.
mapModel
.
show
(
recordModel
.
attributes
);
...
...
@@ -195,42 +192,59 @@ const RecordsDetailsModalView = ModalView.extend({
onIframeDisplayToggleChange
()
{
this
.
iframeDisplayEnabled
=
this
.
$
(
'
.iframe-display-toggle
'
).
is
(
'
:checked
'
);
this
.
updateRecord
(...
this
.
records
[
this
.
currentRecordIndex
]
,
true
);
this
.
updateRecord
(...
this
.
records
[
this
.
currentRecordIndex
]);
},
replaceLayerParameters
(
option
,
model
)
{
if
(
typeof
option
.
IdAttached
!=
'
undefined
'
)
{
let
displayOption
=
model
.
get
(
'
detailsDisplay
'
)
?
'
detailsDisplay
'
:
'
display
'
;
const
layerID
=
model
.
get
(
`
${
displayOption
}
.id`
)
+
(
option
.
IdAttached
);
model
.
set
(
`
${
displayOption
}
.extraParameters.LAYERS`
,
layerID
);
}
replaceLayerParameters
(
option
,
layerModel
,
recordModel
)
{
// perform replacing of parameters in underyling model if it was configured
const
replaceList
=
option
.
replace
;
_
.
each
(
replaceList
,
(
config
)
=>
{
if
(
typeof
config
.
target
===
'
string
'
&&
typeof
config
.
value
!==
'
undefined
'
)
{
if
(
config
.
value
.
template
)
{
// interpolate template
const
evaluated
=
_
.
template
(
config
.
value
.
template
,
{
interpolate
:
/
\{\{(
.+
?)\}\}
/g
})(
model
.
toJSON
());
model
.
set
(
config
.
target
,
evaluated
);
let
evaluated
=
null
;
// interpolate template from Record if able
if
(
recordModel
)
{
// special prefix record.something for interpolation
evaluated
=
_
.
template
(
config
.
value
.
template
,
{
interpolate
:
/
\{\{
record
\.(
.+
?)\}\}
/g
})(
recordModel
.
toJSON
());
}
// fallback, interpolate template from layer if able
if
(
typeof
evaluated
===
'
string
'
&&
evaluated
.
includes
(
'
{{
'
))
{
evaluated
=
_
.
template
(
config
.
value
.
template
,
{
interpolate
:
/
\{\{(
.+
?)\}\}
/g
})(
layerModel
.
toJSON
());
}
layerModel
.
set
(
config
.
target
,
evaluated
);
}
else
{
m
odel
.
set
(
config
.
target
,
config
.
value
);
layerM
odel
.
set
(
config
.
target
,
config
.
value
);
}
}
});
if
(
typeof
option
.
IdAttached
!==
'
undefined
'
)
{
// default layerID when adding attachment is layer.id itself
let
displayOption
=
layerModel
.
get
(
'
detailsDisplay
'
)
?
'
detailsDisplay
'
:
'
display
'
;
let
layerID
=
layerModel
.
get
(
`
${
displayOption
}
.id`
);
if
(
layerModel
.
get
(
`
${
displayOption
}
.extraParameters.LAYERS`
))
{
// if extraParameters.LAYERS override was already set during replace
// only append attachment to it
layerID
=
layerModel
.
get
(
`
${
displayOption
}
.extraParameters.LAYERS`
);
}
layerID
=
layerID
+
option
.
IdAttached
;
layerModel
.
set
(
`
${
displayOption
}
.extraParameters.LAYERS`
,
layerID
);
}
},
applySettings
(
m
odel
)
{
let
displayOption
=
m
odel
.
get
(
'
detailsDisplay
'
)
?
'
detailsDisplay
'
:
'
display
'
;
m
odel
.
set
(
`
${
displayOption
}
.variablesParameter`
,
''
);
applySettings
(
layerModel
,
recordM
odel
)
{
let
displayOption
=
layerM
odel
.
get
(
'
detailsDisplay
'
)
?
'
detailsDisplay
'
:
'
display
'
;
layerM
odel
.
set
(
`
${
displayOption
}
.variablesParameter`
,
''
);
// set values from currently chosen form/s in layerModel
const
options
=
m
odel
.
get
(
`
${
displayOption
}
.options`
);
const
options
=
layerM
odel
.
get
(
`
${
displayOption
}
.options`
);
// first reset the unselected options to clear the parameters
_
.
each
(
options
,
(
option
)
=>
{
_
.
each
(
option
.
parameters
,
(
param
)
=>
{
if
(
option
.
isChosen
!==
true
)
{
m
odel
.
set
(
param
.
target
,
''
);
layerM
odel
.
set
(
param
.
target
,
''
);
}
});
});
...
...
@@ -254,43 +268,43 @@ const RecordsDetailsModalView = ModalView.extend({
}
});
// reset isSelected in
m
odel and update it with what is selected in ui
// reset isSelected in
layerM
odel and update it with what is selected in ui
_
.
each
(
param
.
values
,
(
_
,
l
)
=>
{
m
odel
.
set
(
`
${
displayOption
}
.options[
${
i
}
].parameters[
${
j
}
].values[
${
l
}
].isCurrentB1`
,
false
);
m
odel
.
set
(
`
${
displayOption
}
.options[
${
i
}
].parameters[
${
j
}
].values[
${
l
}
].isCurrentB2`
,
false
);
m
odel
.
set
(
`
${
displayOption
}
.options[
${
i
}
].parameters[
${
j
}
].values[
${
l
}
].isCurrentB3`
,
false
);
layerM
odel
.
set
(
`
${
displayOption
}
.options[
${
i
}
].parameters[
${
j
}
].values[
${
l
}
].isCurrentB1`
,
false
);
layerM
odel
.
set
(
`
${
displayOption
}
.options[
${
i
}
].parameters[
${
j
}
].values[
${
l
}
].isCurrentB2`
,
false
);
layerM
odel
.
set
(
`
${
displayOption
}
.options[
${
i
}
].parameters[
${
j
}
].values[
${
l
}
].isCurrentB3`
,
false
);
});
if
(
typeof
param
.
min
===
'
undefined
'
)
{
m
odel
.
set
(
`
${
displayOption
}
.options[
${
i
}
].parameters[
${
j
}
].values[
${
selectedIndices
[
0
]}
].isCurrentB1`
,
true
);
layerM
odel
.
set
(
`
${
displayOption
}
.options[
${
i
}
].parameters[
${
j
}
].values[
${
selectedIndices
[
0
]}
].isCurrentB1`
,
true
);
}
if
(
param
.
selectThree
&&
typeof
param
.
min
===
'
undefined
'
)
{
m
odel
.
set
(
`
${
displayOption
}
.options[
${
i
}
].parameters[
${
j
}
].values[
${
selectedIndices
[
1
]}
].isCurrentB2`
,
true
);
m
odel
.
set
(
`
${
displayOption
}
.options[
${
i
}
].parameters[
${
j
}
].values[
${
selectedIndices
[
2
]}
].isCurrentB3`
,
true
);
layerM
odel
.
set
(
`
${
displayOption
}
.options[
${
i
}
].parameters[
${
j
}
].values[
${
selectedIndices
[
1
]}
].isCurrentB2`
,
true
);
layerM
odel
.
set
(
`
${
displayOption
}
.options[
${
i
}
].parameters[
${
j
}
].values[
${
selectedIndices
[
2
]}
].isCurrentB3`
,
true
);
}
if
(
option
.
isChosen
===
true
)
{
// set options to
m
odel and trigger a reload of layer in map
// set options to
layerM
odel and trigger a reload of layer in map
if
(
param
.
oneToManyMapping
){
let
variables
=
m
odel
.
get
(
param
.
target
)
||
{};
let
variables
=
layerM
odel
.
get
(
param
.
target
)
||
{};
variables
[
param
.
value
]
=
values
.
join
(
'
,
'
)
let
variablesParameter
=
[]
_
.
each
(
_
.
keys
(
variables
),
key
=>
{
variablesParameter
.
push
(
`
${
key
}
=
${
variables
[
key
]}
`
)
});
m
odel
.
set
(
`
${
displayOption
}
.variablesParameter`
,
variablesParameter
.
join
(
'
,
'
));
m
odel
.
set
(
param
.
target
,
variables
);
layerM
odel
.
set
(
`
${
displayOption
}
.variablesParameter`
,
variablesParameter
.
join
(
'
,
'
));
layerM
odel
.
set
(
param
.
target
,
variables
);
}
else
{
m
odel
.
set
(
param
.
target
,
values
.
join
(
'
,
'
));
layerM
odel
.
set
(
param
.
target
,
values
.
join
(
'
,
'
));
}
}
})
});
_
.
each
(
m
odel
.
get
(
`
${
displayOption
}
.options`
),
(
option
)
=>
{
_
.
each
(
layerM
odel
.
get
(
`
${
displayOption
}
.options`
),
(
option
)
=>
{
if
(
option
.
isChosen
===
true
)
{
// if replace was configured for this option, apply it
this
.
replaceLayerParameters
(
option
,
m
odel
);
this
.
replaceLayerParameters
(
option
,
layerModel
,
recordM
odel
);
}
});
},
...
...
@@ -302,7 +316,7 @@ const RecordsDetailsModalView = ModalView.extend({
layerModel
.
set
(
`
${
displayOption
}
.extraParameters.LAYERS`
,
originalID
);
layerModel
.
set
(
`
${
displayOption
}
.extraParameters.VARIABLES`
,
''
);
_
.
each
(
layerModel
.
get
(
`
${
displayOption
}
.options`
),
(
option
,
i
)
=>
option
.
isChosen
=
i
===
0
?
true
:
false
);
this
.
applySettings
(
layerModel
)
this
.
applySettings
(
layerModel
,
recordModel
)
}
});
...
...
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