Skip to content

Commit 93b7360

Browse files
authored
Merge pull request #532 from YunoHost/supportpurge
[enh] add --purge option in app uninstall modal
2 parents 52d7b93 + 88d1908 commit 93b7360

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

app/src/i18n/locales/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@
136136
"license": "License"
137137
},
138138
"potential_alternative_to": "Potential alternative to:",
139+
"uninstall": {
140+
"purge_desc": "Remove the data directory associated with the app (this is usually data you uploaded yourself using the app)."
141+
},
139142
"upgrade": {
140143
"confirm": {
141144
"apps": "Apps that will be upgraded",

app/src/views/app/AppInfo.vue

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</b-button>
6565

6666
<b-button
67-
@click="uninstall"
67+
v-b-modal.uninstall-modal
6868
id="uninstall"
6969
variant="danger"
7070
:class="{ 'ml-auto': !app.url }"
@@ -262,6 +262,19 @@
262262
</b-list-group>
263263
</card>
264264

265+
<b-modal
266+
v-if="app"
267+
id="uninstall-modal" :title="$t('confirm_uninstall', { name: id })"
268+
header-bg-variant="warning" :body-class="{ 'd-none': !app.supports_purge }" body-bg-variant=""
269+
@ok="uninstall"
270+
>
271+
<b-form-group v-if="app.supports_purge">
272+
<b-form-checkbox v-model="purge">
273+
{{ $t('app.uninstall.purge_desc', { name: id }) }}
274+
</b-form-checkbox>
275+
</b-form-group>
276+
</b-modal>
277+
265278
<template #skeleton>
266279
<card-info-skeleton :item-count="8" />
267280
<card-form-skeleton />
@@ -306,6 +319,7 @@ export default {
306319
loading: true,
307320
app: undefined,
308321
form: undefined,
322+
purge: false,
309323
config_panel_err: null,
310324
config: {
311325
panels: [
@@ -408,7 +422,7 @@ export default {
408422
links: [
409423
['license', `https://spdx.org/licenses/${app.manifest.upstream.license}`],
410424
...['website', 'admindoc', 'userdoc', 'code'].map((key) => ([key, app.manifest.upstream[key]])),
411-
['package', app.from_catalog.git.url],
425+
['package', app.from_catalog.git?.url],
412426
['forum', `https://forum.yunohost.org/tag/${app.manifest.id}`]
413427
].filter(([key, val]) => !!val),
414428
doc: {
@@ -429,6 +443,7 @@ export default {
429443
is_default: app.is_default,
430444
supports_change_url: app.supports_change_url,
431445
supports_config_panel: app.supports_config_panel,
446+
supports_purge: app.supports_purge,
432447
permissions
433448
}
434449
if (app.settings.domain && app.settings.path) {
@@ -518,12 +533,8 @@ export default {
518533
},
519534
520535
async uninstall () {
521-
const confirmed = await this.$askConfirmation(
522-
this.$i18n.t('confirm_uninstall', { name: this.id })
523-
)
524-
if (!confirmed) return
525-
526-
api.delete('apps/' + this.id, {}, { key: 'apps.uninstall', name: this.app.label }).then(() => {
536+
const data = this.purge === true ? { purge: 1 } : {}
537+
api.delete('apps/' + this.id, data, { key: 'apps.uninstall', name: this.app.label }).then(() => {
527538
this.$router.push({ name: 'app-list' })
528539
})
529540
}

0 commit comments

Comments
 (0)