Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Géocontrib Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
GéoContrib
Géocontrib Frontend
Commits
45515e8e
Commit
45515e8e
authored
Nov 17, 2021
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
update colorsStyleList not only at update of customForm
parent
f41f9ba0
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!138
REDMINE_ISSUE-12426
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/store/modules/feature_type.js
+11
-5
11 additions, 5 deletions
src/store/modules/feature_type.js
with
11 additions
and
5 deletions
src/store/modules/feature_type.js
+
11
−
5
View file @
45515e8e
...
...
@@ -6,6 +6,11 @@ axios.defaults.headers.common['X-CSRFToken'] = (name => {
return
(
value
!==
null
)
?
unescape
(
value
[
1
])
:
null
;
})(
'
csrftoken
'
);
const
getColorsStyles
=
(
customForms
)
=>
customForms
.
filter
(
customForm
=>
customForm
.
options
&&
customForm
.
options
.
length
).
map
(
el
=>
{
//* in dropdown, value is the name and name is the label to be displayed, could be changed...
return
{
value
:
el
.
name
,
name
:
el
.
label
,
options
:
el
.
options
}
});
const
feature_type
=
{
namespaced
:
true
,
...
...
@@ -36,26 +41,27 @@ const feature_type = {
},
SET_CUSTOM_FORMS
(
state
,
customForms
)
{
state
.
customForms
=
customForms
;
state
.
colorsStyleList
=
getColorsStyles
(
state
.
customForms
);
},
ADD_CUSTOM_FORM
(
state
,
customForm
)
{
state
.
customForms
=
[...
state
.
customForms
,
customForm
];
state
.
colorsStyleList
=
getColorsStyles
(
state
.
customForms
);
},
UPDATE_CUSTOM_FORM
(
state
,
payload
)
{
const
index
=
state
.
customForms
.
findIndex
((
el
)
=>
el
.
dataKey
===
payload
.
dataKey
);
if
(
index
!==
-
1
)
{
state
.
customForms
[
index
]
=
payload
;
//* trigger update of available options for colors style in feature_type_edit
state
.
colorsStyleList
=
state
.
customForms
.
filter
(
cust
=>
cust
.
options
&&
cust
.
options
.
length
).
map
(
el
=>
{
//* in dropdown, value is the name and name is the label to be displayed, could be changed...
return
{
value
:
el
.
name
,
name
:
el
.
label
,
options
:
el
.
options
}
})
//* trigger update of available options for colors style in feature_type_edit (getters not working)
state
.
colorsStyleList
=
getColorsStyles
(
state
.
customForms
);
}
},
REMOVE_CUSTOM_FORM
(
state
,
payload
)
{
state
.
customForms
=
state
.
customForms
.
filter
(
form
=>
form
.
dataKey
!==
payload
);
state
.
colorsStyleList
=
getColorsStyles
(
state
.
customForms
);
},
EMPTY_CUSTOM_FORMS
(
state
)
{
state
.
customForms
=
[];
state
.
colorsStyleList
=
[];
},
SET_IMPORT_FEATURE_TYPES_DATA
(
state
,
payload
)
{
state
.
importFeatureTypeData
=
payload
;
...
...
...
...
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