Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
admin-fe
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eugenij
admin-fe
Commits
961bf8ae
Commit
961bf8ae
authored
Dec 19, 2019
by
Angelina Filippova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix processing values with type map
parent
529a8469
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
src/store/modules/normalizers.js
src/store/modules/normalizers.js
+5
-5
src/store/modules/settings.js
src/store/modules/settings.js
+1
-1
No files found.
src/store/modules/normalizers.js
View file @
961bf8ae
...
...
@@ -107,7 +107,7 @@ export const valueHasTuples = (key, value) => {
valueIsArrayOfNonObjects
}
export
const
wrapUpdatedSettings
=
(
group
,
settings
)
=>
{
export
const
wrapUpdatedSettings
=
(
group
,
settings
,
currentState
)
=>
{
return
Object
.
keys
(
settings
).
map
((
key
)
=>
{
if
(
settings
[
key
].
_value
)
{
const
value
=
settings
[
key
].
_value
[
0
]
===
'
atom
'
&&
settings
[
key
].
_value
[
1
].
length
>
1
...
...
@@ -115,11 +115,11 @@ export const wrapUpdatedSettings = (group, settings) => {
:
settings
[
key
].
_value
[
1
]
return
{
group
,
key
,
value
}
}
return
{
group
,
key
,
value
:
wrapValues
(
settings
[
key
])
}
return
{
group
,
key
,
value
:
wrapValues
(
settings
[
key
]
,
currentState
[
group
][
key
]
)
}
})
}
const
wrapValues
=
settings
=>
{
const
wrapValues
=
(
settings
,
currentState
)
=>
{
return
Object
.
keys
(
settings
).
map
(
setting
=>
{
const
[
type
,
value
]
=
Array
.
isArray
(
settings
[
setting
])
?
settings
[
setting
]
:
[
''
,
settings
[
setting
]]
if
(
type
===
'
keyword
'
||
type
.
includes
(
'
keyword
'
))
{
...
...
@@ -129,11 +129,11 @@ const wrapValues = settings => {
}
else
if
(
type
.
includes
(
'
tuple
'
)
&&
Array
.
isArray
(
value
))
{
return
{
'
tuple
'
:
[
setting
,
{
'
tuple
'
:
value
}]
}
}
else
if
(
type
===
'
map
'
)
{
const
object
Value
=
Object
.
keys
(
value
).
reduce
((
acc
,
key
)
=>
{
const
map
Value
=
Object
.
keys
(
value
).
reduce
((
acc
,
key
)
=>
{
acc
[
key
]
=
value
[
key
][
1
]
return
acc
},
{})
return
{
'
tuple
'
:
[
setting
,
objectValue
]
}
return
{
'
tuple
'
:
[
setting
,
{
...
currentState
[
setting
],
...
mapValue
}
]
}
}
else
if
(
setting
===
'
:ip
'
)
{
const
ip
=
value
.
split
(
'
.
'
).
map
(
s
=>
parseInt
(
s
,
10
))
return
{
'
tuple
'
:
[
setting
,
{
'
tuple
'
:
ip
}]
}
...
...
src/store/modules/settings.js
View file @
961bf8ae
...
...
@@ -86,7 +86,7 @@ const settings = {
},
{})
const
configs
=
Object
.
keys
(
updatedData
).
reduce
((
acc
,
group
)
=>
{
return
[...
acc
,
...
wrapUpdatedSettings
(
group
,
updatedData
[
group
])]
return
[...
acc
,
...
wrapUpdatedSettings
(
group
,
updatedData
[
group
]
,
state
.
settings
)]
},
[])
const
response
=
await
updateSettings
(
configs
,
getters
.
authHost
,
getters
.
token
)
commit
(
'
SET_SETTINGS
'
,
response
.
data
.
configs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment