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'
112103import NcActionButton from ' @nextcloud/vue/components/NcActionButton'
113104import NcActionRouter from ' @nextcloud/vue/components/NcActionRouter'
114105import NcActionSeparator from ' @nextcloud/vue/components/NcActionSeparator'
115- import NcDialog from ' @nextcloud/vue/components/NcDialog'
116106import NcListItem from ' @nextcloud/vue/components/NcListItem'
117107import NcLoadingIcon from ' @nextcloud/vue/components/NcLoadingIcon'
118108import 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