Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
admin-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
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
Pleroma
admin-fe
Commits
1b368c77
Commit
1b368c77
authored
5 years ago
by
Angelina Filippova
Browse files
Options
Downloads
Patches
Plain Diff
Move checking partial update to normalizers and fix bugs
parent
edc8fe58
No related branches found
Branches containing commit
No related tags found
1 merge request
!65
Update server configuration
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/store/modules/normalizers.js
+24
-1
24 additions, 1 deletion
src/store/modules/normalizers.js
src/store/modules/settings.js
+3
-19
3 additions, 19 deletions
src/store/modules/settings.js
with
27 additions
and
20 deletions
src/store/modules/normalizers.js
+
24
−
1
View file @
1b368c77
export
const
checkPartialUpdate
=
(
settings
,
updatedSettings
,
description
)
=>
{
return
Object
.
keys
(
updatedSettings
).
reduce
((
acc
,
group
)
=>
{
acc
[
group
]
=
Object
.
keys
(
updatedSettings
[
group
]).
reduce
((
acc
,
key
)
=>
{
debugger
if
(
!
partialUpdate
(
group
,
key
))
{
const
updated
=
Object
.
keys
(
settings
[
group
][
key
]).
reduce
((
acc
,
settingName
)
=>
{
const
setting
=
description
.
find
(
element
=>
element
.
group
===
group
&&
element
.
key
===
key
).
children
.
find
(
child
=>
child
.
key
===
settingName
)
const
type
=
setting
?
setting
.
type
:
''
acc
[
settingName
]
=
[
type
,
settings
[
group
][
key
][
settingName
]]
return
acc
},
{})
acc
[
key
]
=
updated
return
acc
}
acc
[
key
]
=
updatedSettings
[
group
][
key
]
return
acc
},
{})
return
acc
},
{})
}
const
getCurrentValue
=
(
object
,
keys
)
=>
{
if
(
keys
.
length
===
0
)
{
return
object
...
...
@@ -103,7 +126,7 @@ const parseProxyUrl = value => {
return
{
socks5
:
false
,
host
:
null
,
port
:
null
}
}
export
const
partialUpdate
=
(
group
,
key
)
=>
{
const
partialUpdate
=
(
group
,
key
)
=>
{
if
(
group
===
'
:auto_linker
'
&&
key
===
'
:opts
'
)
{
return
false
}
...
...
This diff is collapsed.
Click to expand it.
src/store/modules/settings.js
+
3
−
19
View file @
1b368c77
import
{
fetchDescription
,
fetchSettings
,
removeSettings
,
updateSettings
,
uploadMedia
}
from
'
@/api/settings
'
import
{
parseNonTuples
,
parseTuples
,
partialUpdate
,
valueHasTuples
,
wrapUpdatedSettings
}
from
'
./normalizers
'
import
{
checkPartialUpdate
,
parseNonTuples
,
parseTuples
,
valueHasTuples
,
wrapUpdatedSettings
}
from
'
./normalizers
'
const
settings
=
{
state
:
{
...
...
@@ -70,27 +70,11 @@ const settings = {
await
removeSettings
(
configs
,
getters
.
authHost
,
getters
.
token
)
},
async
SubmitChanges
({
getters
,
commit
,
state
})
{
const
updatedData
=
Object
.
keys
(
state
.
updatedSettings
).
reduce
((
acc
,
group
)
=>
{
acc
[
group
]
=
Object
.
keys
(
state
.
updatedSettings
[
group
]).
reduce
((
acc
,
key
)
=>
{
if
(
!
partialUpdate
(
group
,
key
))
{
const
updated
=
Object
.
keys
(
state
.
settings
[
group
][
key
]).
reduce
((
acc
,
settingName
)
=>
{
const
settingType
=
state
.
description
.
find
(
element
=>
element
.
group
===
group
&&
element
.
key
===
key
).
children
.
find
(
child
=>
child
.
key
===
settingName
).
type
acc
[
settingName
]
=
[
settingType
,
state
.
settings
[
group
][
key
][
settingName
]]
return
acc
},
{})
acc
[
key
]
=
updated
return
acc
}
acc
[
key
]
=
state
.
updatedSettings
[
group
][
key
]
return
acc
},
{})
return
acc
},
{})
const
updatedData
=
checkPartialUpdate
(
state
.
settings
,
state
.
updatedSettings
,
state
.
description
)
const
configs
=
Object
.
keys
(
updatedData
).
reduce
((
acc
,
group
)
=>
{
return
[...
acc
,
...
wrapUpdatedSettings
(
group
,
updatedData
[
group
],
state
.
settings
)]
},
[])
const
response
=
await
updateSettings
(
configs
,
getters
.
authHost
,
getters
.
token
)
commit
(
'
SET_SETTINGS
'
,
response
.
data
.
configs
)
commit
(
'
CLEAR_UPDATED_SETTINGS
'
)
...
...
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