Skip to content

Commit fa3bef5

Browse files
don9x2Ebackportbot[bot]
authored andcommitted
refactor: format AppNavigationForm.vue
Signed-off-by: don9x2E <revan@kakao.com> [skip ci]
1 parent f810095 commit fa3bef5

1 file changed

Lines changed: 28 additions & 23 deletions

File tree

src/components/AppNavigationForm.vue

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,12 @@
8686
v-if="canEdit && !readOnly"
8787
close-after-click
8888
:disabled="isFormLocked"
89-
@click="showDeleteDialog = true">
89+
@click="onConfirmDelete">
9090
<template #icon>
9191
<IconDelete :size="20" />
9292
</template>
9393
{{ t('forms', 'Delete form') }}
9494
</NcActionButton>
95-
<NcDialog
96-
:open.sync="showDeleteDialog"
97-
:name="t('forms', 'Delete form')"
98-
:message="
99-
t('forms', 'Are you sure you want to delete {title}?', {
100-
title: formTitle,
101-
})
102-
"
103-
:buttons="buttons" />
10495
</template>
10596
</NcListItem>
10697
</template>
@@ -112,7 +103,6 @@ import { showError } from '@nextcloud/dialogs'
112103
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
113104
import NcActionRouter from '@nextcloud/vue/components/NcActionRouter'
114105
import NcActionSeparator from '@nextcloud/vue/components/NcActionSeparator'
115-
import NcDialog from '@nextcloud/vue/components/NcDialog'
116106
import NcListItem from '@nextcloud/vue/components/NcListItem'
117107
import NcLoadingIcon from '@nextcloud/vue/components/NcLoadingIcon'
118108
import axios from '@nextcloud/axios'
@@ -150,7 +140,6 @@ export default {
150140
NcActionButton,
151141
NcActionRouter,
152142
NcActionSeparator,
153-
NcDialog,
154143
NcListItem,
155144
NcLoadingIcon,
156145
},
@@ -176,17 +165,6 @@ export default {
176165
data() {
177166
return {
178167
loading: false,
179-
showDeleteDialog: false,
180-
buttons: [
181-
{
182-
label: t('forms', 'Delete form'),
183-
icon: IconDeleteSvg,
184-
type: 'error',
185-
callback: () => {
186-
this.onDeleteForm()
187-
},
188-
},
189-
],
190168
}
191169
},
192170
@@ -306,6 +284,33 @@ export default {
306284
this.$emit('clone', this.form.id)
307285
},
308286
287+
async onConfirmDelete() {
288+
const dialog = getDialogBuilder(t('forms', 'Delete form'))
289+
.setText(
290+
t('forms', 'Are you sure you want to delete {title}?', {
291+
title: this.formTitle,
292+
}),
293+
)
294+
.setSeverity(DialogSeverity.Error)
295+
.setButtons([
296+
{
297+
label: t('forms', 'Cancel'),
298+
callback: () => {},
299+
variant: 'secondary',
300+
},
301+
{
302+
label: t('forms', 'Delete form'),
303+
callback: () => {
304+
this.onDeleteForm()
305+
},
306+
variant: 'error',
307+
},
308+
])
309+
.build()
310+
311+
await dialog.show()
312+
},
313+
309314
async onToggleArchive() {
310315
try {
311316
// TODO: add loading status feedback ?

0 commit comments

Comments
 (0)