Browse Source

feat(nc-gui): add modal for confirmation when deleting attachment

pull/4931/head
Wing-Kam Wong 2 years ago
parent
commit
23f26d86a2
  1. 19
      packages/nc-gui/components/cell/attachment/Modal.vue

19
packages/nc-gui/components/cell/attachment/Modal.vue

@ -53,6 +53,23 @@ function onClick(item: Record<string, any>) {
}
})
}
function onRemoveFileClick(title: any, i: number) {
Modal.confirm({
title: `Do you want to delete '${title}'?`,
wrapClassName: 'nc-modal-attachment-delete',
okText: 'Yes',
okType: 'danger',
cancelText: 'No',
async onOk() {
try {
removeFile(i)
} catch (e: any) {
message.error(e.message)
}
},
})
}
</script>
<template>
@ -103,7 +120,7 @@ function onClick(item: Record<string, any>) {
<MdiCloseCircle
v-if="isSharedForm || (isUIAllowed('tableAttachment') && !isPublic && !isLocked)"
class="nc-attachment-remove"
@click.stop="removeFile(i)"
@click.stop="onRemoveFileClick(item.title, i)"
/>
</a-tooltip>

Loading…
Cancel
Save