Merge branch 'feature/add-confirmation-to-remove-button' into 'develop'

Add dialog window with confirmation to remove button

Closes #105

See merge request pleroma/admin-fe!127
This commit is contained in:
Angelina Filippova 2020-05-03 22:58:04 +00:00
commit 15730cb733
4 changed files with 51 additions and 24 deletions

View file

@ -387,7 +387,8 @@ export default {
corsPlug: 'CORS plug config', corsPlug: 'CORS plug config',
instanceReboot: 'Reboot Instance', instanceReboot: 'Reboot Instance',
restartApp: 'You must restart the instance to apply settings', restartApp: 'You must restart the instance to apply settings',
restartSuccess: 'Instance rebooted successfully!' restartSuccess: 'Instance rebooted successfully!',
removeSettingConfirmation: 'Are you sure you want to remove this setting\'s value from the database?'
}, },
invites: { invites: {
inviteTokens: 'Invite tokens', inviteTokens: 'Invite tokens',

View file

@ -296,17 +296,30 @@ export default {
{ group, key: parentKey, input: setting.key, value: valueForState }) { group, key: parentKey, input: setting.key, value: valueForState })
}, },
async removeSetting() { async removeSetting() {
const config = this.settingGroup.key this.$confirm(
? [{ group: this.settingGroup.group, key: this.settingGroup.key, delete: true, subkeys: [this.setting.key] }] this.$t('settings.removeSettingConfirmation'),
: [{ group: this.settingGroup.group, key: this.setting.key, delete: true }] {
try { confirmButtonText: this.$t('users.ok'),
await this.$store.dispatch('RemoveSetting', config) cancelButtonText: this.$t('users.cancel'),
} catch (e) { type: 'warning'
return }).then(async() => {
} const config = this.settingGroup.key
this.$message({ ? [{ group: this.settingGroup.group, key: this.settingGroup.key, delete: true, subkeys: [this.setting.key] }]
type: 'success', : [{ group: this.settingGroup.group, key: this.setting.key, delete: true }]
message: i18n.t('settings.successfullyRemoved') try {
await this.$store.dispatch('RemoveSetting', config)
} catch (e) {
return
}
this.$message({
type: 'success',
message: i18n.t('settings.successfullyRemoved')
})
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('users.canceled')
})
}) })
}, },
renderMultipleSelect(type) { renderMultipleSelect(type) {

View file

@ -130,17 +130,30 @@ export default {
return marked(desc) return marked(desc)
}, },
async removeSetting(key) { async removeSetting(key) {
const config = this.settingGroup.key this.$confirm(
? [{ group: this.settingGroup.group, key: this.settingGroup.key, delete: true, subkeys: [key] }] this.$t('settings.removeSettingConfirmation'),
: [{ group: this.settingGroup.group, key, delete: true }] {
try { confirmButtonText: this.$t('users.ok'),
await this.$store.dispatch('RemoveSetting', config) cancelButtonText: this.$t('users.cancel'),
} catch (e) { type: 'warning'
return }).then(async() => {
} const config = this.settingGroup.key
this.$message({ ? [{ group: this.settingGroup.group, key: this.settingGroup.key, delete: true, subkeys: [key] }]
type: 'success', : [{ group: this.settingGroup.group, key, delete: true }]
message: i18n.t('settings.successfullyRemoved') try {
await this.$store.dispatch('RemoveSetting', config)
} catch (e) {
return
}
this.$message({
type: 'success',
message: i18n.t('settings.successfullyRemoved')
})
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('users.canceled')
})
}) })
}, },
updateSetting(value, tab, input) { updateSetting(value, tab, input) {

View file

@ -55,7 +55,7 @@
padding-right: 10px; padding-right: 10px;
} }
.el-tabs__header { .el-tabs__header {
z-index: 3000; z-index: 2002;
} }
.esshd-list { .esshd-list {
margin: 0; margin: 0;