add --purge option in app uninstall modal

This commit is contained in:
axolotle 2023-09-29 17:02:36 +02:00
parent c7e6671d57
commit 357e41292e
2 changed files with 21 additions and 7 deletions

View file

@ -136,6 +136,9 @@
"license": "License" "license": "License"
}, },
"potential_alternative_to": "Potential alternative to:", "potential_alternative_to": "Potential alternative to:",
"uninstall": {
"purge_desc": "Remove the data directory associated with the app (this is usually data you uploaded yourself using the app)."
},
"upgrade": { "upgrade": {
"confirm": { "confirm": {
"apps": "Apps that will be upgraded", "apps": "Apps that will be upgraded",

View file

@ -64,7 +64,7 @@
</b-button> </b-button>
<b-button <b-button
@click="uninstall" v-b-modal.uninstall-modal
id="uninstall" id="uninstall"
variant="danger" variant="danger"
:class="{ 'ml-auto': !app.url }" :class="{ 'ml-auto': !app.url }"
@ -262,6 +262,19 @@
</b-list-group> </b-list-group>
</card> </card>
<b-modal
v-if="app"
id="uninstall-modal" :title="$t('confirm_uninstall', { name: id })"
header-bg-variant="warning" :body-class="{ 'd-none': !app.supports_purge }" body-bg-variant=""
@ok="uninstall"
>
<b-form-group v-if="app.supports_purge">
<b-form-checkbox v-model="purge">
{{ $t('app.uninstall.purge_desc', { name: id }) }}
</b-form-checkbox>
</b-form-group>
</b-modal>
<template #skeleton> <template #skeleton>
<card-info-skeleton :item-count="8" /> <card-info-skeleton :item-count="8" />
<card-form-skeleton /> <card-form-skeleton />
@ -306,6 +319,7 @@ export default {
loading: true, loading: true,
app: undefined, app: undefined,
form: undefined, form: undefined,
purge: false,
config_panel_err: null, config_panel_err: null,
config: { config: {
panels: [ panels: [
@ -429,6 +443,7 @@ export default {
is_default: app.is_default, is_default: app.is_default,
supports_change_url: app.supports_change_url, supports_change_url: app.supports_change_url,
supports_config_panel: app.supports_config_panel, supports_config_panel: app.supports_config_panel,
supports_purge: app.supports_purge,
permissions permissions
} }
if (app.settings.domain && app.settings.path) { if (app.settings.domain && app.settings.path) {
@ -518,12 +533,8 @@ export default {
}, },
async uninstall () { async uninstall () {
const confirmed = await this.$askConfirmation( const data = this.purge === true ? {purge: 1} : {}
this.$i18n.t('confirm_uninstall', { name: this.id }) api.delete('apps/' + this.id, data, { key: 'apps.uninstall', name: this.app.label }).then(() => {
)
if (!confirmed) return
api.delete('apps/' + this.id, {}, { key: 'apps.uninstall', name: this.app.label }).then(() => {
this.$router.push({ name: 'app-list' }) this.$router.push({ name: 'app-list' })
}) })
} }