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
0248f966
Commit
0248f966
authored
5 years ago
by
Angelina Filippova
Browse files
Options
Downloads
Patches
Plain Diff
Remove delete buttons from settings that can't be deleted
parent
39775cf9
No related branches found
No related tags found
1 merge request
!77
Ability to remove settings from db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/views/settings/components/Inputs.vue
+10
-7
10 additions, 7 deletions
src/views/settings/components/Inputs.vue
src/views/settings/components/Setting.vue
+42
-10
42 additions, 10 deletions
src/views/settings/components/Setting.vue
with
52 additions
and
17 deletions
src/views/settings/components/Inputs.vue
+
10
−
7
View file @
0248f966
...
...
@@ -2,7 +2,7 @@
<el-form-item
:label-width=
"customLabelWidth"
:class=
"labelClass"
>
<span
slot=
"label"
>
{{
setting
.
label
}}
<el-tooltip
content=
"This would remove the setting from the DB"
placement=
"right"
>
<el-tooltip
v-if=
"canBeDeleted"
content=
"This would remove the setting from the DB"
placement=
"right"
>
<el-button
icon=
"el-icon-delete"
circle
size=
"mini"
style=
"margin-left:5px"
@
click=
"removeSetting"
/>
</el-tooltip>
</span>
...
...
@@ -99,6 +99,12 @@ export default {
RateLimitInput
},
props
:
{
canBeDeleted
:
{
type
:
Boolean
,
default
:
function
()
{
return
false
}
},
customLabelWidth
:
{
type
:
String
,
default
:
function
()
{
...
...
@@ -202,12 +208,9 @@ export default {
{
group
,
key
:
parentKey
,
input
:
setting
.
key
,
value
:
valueForState
})
},
async
removeSetting
()
{
const
config
=
[{
group
:
this
.
settingGroup
.
group
,
key
:
this
.
settingGroup
.
key
,
delete
:
true
,
subkeys
:
[
this
.
setting
.
key
]
}]
const
config
=
this
.
settingGroup
.
key
?
[{
group
:
this
.
settingGroup
.
group
,
key
:
this
.
settingGroup
.
key
,
delete
:
true
,
subkeys
:
[
this
.
setting
.
key
]
}]
:
[{
group
:
this
.
settingGroup
.
group
,
key
:
this
.
setting
.
key
,
delete
:
true
}]
try
{
await
this
.
$store
.
dispatch
(
'
RemoveSetting
'
,
config
)
}
catch
(
e
)
{
...
...
This diff is collapsed.
Click to expand it.
src/views/settings/components/Setting.vue
+
42
−
10
View file @
0248f966
...
...
@@ -8,7 +8,8 @@
<inputs
:setting-group=
"settingGroup"
:setting=
"setting"
:data=
"data"
/>
:data=
"data"
:can-be-deleted=
"true"
/>
</div>
<div
v-for=
"setting in emailAdapterChildren"
...
...
@@ -16,7 +17,8 @@
<inputs
:setting-group=
"settingGroup"
:setting=
"setting"
:data=
"data"
/>
:data=
"data"
:can-be-deleted=
"true"
/>
</div>
</div>
<div
v-else
>
...
...
@@ -26,20 +28,35 @@
:setting-group=
"settingGroup"
:setting=
"setting"
:data=
"data"
:nested=
"false"
/>
:nested=
"false"
:can-be-deleted=
"true"
/>
</div>
<div
v-if=
"compound(setting)"
>
<el-form-item
:label=
"`$
{setting.label}:`"/>
<div
v-for=
"subSetting in setting.children"
:key=
"subSetting.key"
>
<div
v-if=
"!setting.children"
>
<inputs
:setting-group=
"settingGroup"
:setting-parent=
"[setting, subSetting]"
:setting=
"subSetting"
:setting=
"setting"
:data=
"data[setting.key]"
:nested=
"true"
/>
:nested=
"true"
:can-be-deleted=
"true"
/>
</div>
<div
v-if=
"!setting.children"
>
<inputs
:setting-group=
"settingGroup"
:setting=
"setting"
:data=
"data[setting.key]"
:nested=
"true"
/>
<div
v-else
>
<el-form-item>
<span
slot=
"label"
>
{{
setting
.
label
}}
:
<el-tooltip
content=
"This would remove the setting from the DB"
placement=
"right"
>
<el-button
icon=
"el-icon-delete"
circle
size=
"mini"
style=
"margin-left:5px"
@
click=
"removeSetting(setting.key)"
/>
</el-tooltip>
</span>
</el-form-item>
<div
v-for=
"subSetting in setting.children"
:key=
"subSetting.key"
>
<inputs
:setting-group=
"settingGroup"
:setting-parent=
"[setting, subSetting]"
:setting=
"subSetting"
:data=
"data[setting.key]"
:nested=
"true"
/>
</div>
</div>
<div
class=
"line"
/>
</div>
...
...
@@ -50,6 +67,7 @@
<
script
>
import
Inputs
from
'
./Inputs
'
import
i18n
from
'
@/lang
'
export
default
{
name
:
'
Setting
'
,
...
...
@@ -86,6 +104,20 @@ export default {
type
.
includes
(
'
keyword
'
)
||
key
===
'
:replace
'
},
async
removeSetting
(
key
)
{
const
config
=
this
.
settingGroup
.
key
?
[{
group
:
this
.
settingGroup
.
group
,
key
:
this
.
settingGroup
.
key
,
delete
:
true
,
subkeys
:
[
key
]
}]
:
[{
group
:
this
.
settingGroup
.
group
,
key
,
delete
:
true
}]
try
{
await
this
.
$store
.
dispatch
(
'
RemoveSetting
'
,
config
)
}
catch
(
e
)
{
return
}
this
.
$message
({
type
:
'
success
'
,
message
:
i18n
.
t
(
'
settings.successfullyRemoved
'
)
})
},
updateSetting
(
value
,
tab
,
input
)
{
this
.
$store
.
dispatch
(
'
UpdateSettings
'
,
{
tab
,
data
:
{
[
input
]:
value
}})
}
...
...
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