Browse Source

feat(nc-gui): delete stack modal + integrate with deleteStack function

pull/3818/head
Wing-Kam Wong 2 years ago
parent
commit
8b28e24102
  1. 37
      packages/nc-gui/components/smartsheet/Kanban.vue

37
packages/nc-gui/components/smartsheet/Kanban.vue

@ -23,14 +23,23 @@ interface Attachment {
} }
const meta = inject(MetaInj) const meta = inject(MetaInj)
const view = inject(ActiveViewInj) const view = inject(ActiveViewInj)
const reloadViewDataHook = inject(ReloadViewDataHookInj) const reloadViewDataHook = inject(ReloadViewDataHookInj)
const openNewRecordFormHook = inject(OpenNewRecordFormHookInj, createEventHook()) const openNewRecordFormHook = inject(OpenNewRecordFormHookInj, createEventHook())
const expandedFormDlg = ref(false) const expandedFormDlg = ref(false)
const expandedFormRow = ref<RowType>() const expandedFormRow = ref<RowType>()
const expandedFormRowState = ref<Record<string, any>>() const expandedFormRowState = ref<Record<string, any>>()
const deleteStackVModel = ref(false)
const stackToBeDeleted = ref('')
const { const {
loadKanbanData, loadKanbanData,
loadMoreKanbanData, loadMoreKanbanData,
@ -44,6 +53,7 @@ const {
groupingField, groupingField,
groupingFieldColumn, groupingFieldColumn,
countByStack, countByStack,
deleteStack,
} = useKanbanViewData(meta, view as any) } = useKanbanViewData(meta, view as any)
const { isUIAllowed } = useUIPermission() const { isUIAllowed } = useUIPermission()
@ -169,19 +179,23 @@ const kanbanListRef = (kanbanListElement: HTMLElement) => {
} }
} }
const collapseStack = () => { const handleDeleteStackClick = (stackTitle: string) => {
// TODO: deleteStackVModel.value = true
stackToBeDeleted.value = stackTitle
} }
const renameStack = () => { const handleDeleteStackConfirmClick = async () => {
// TODO: await deleteStack(stackToBeDeleted.value)
deleteStackVModel.value = false
} }
const deleteStack = () => { const collapseStack = () => {
// TODO: // TODO:
} }
const deleteStackVModel = ref(false) const renameStack = () => {
// TODO:
}
openNewRecordFormHook?.on(async () => { openNewRecordFormHook?.on(async () => {
const newRow = await addEmptyRow() const newRow = await addEmptyRow()
@ -190,6 +204,7 @@ openNewRecordFormHook?.on(async () => {
</script> </script>
<template> <template>
{{ formattedData.Uncategorized }}
<div class="flex h-full bg-white px-2"> <div class="flex h-full bg-white px-2">
<div class="nc-kanban-container flex my-4 px-3 overflow-x-scroll overflow-y-hidden"> <div class="nc-kanban-container flex my-4 px-3 overflow-x-scroll overflow-y-hidden">
<Draggable <Draggable
@ -243,7 +258,7 @@ openNewRecordFormHook?.on(async () => {
Rename Stack Rename Stack
</div> </div>
</a-menu-item> </a-menu-item>
<a-menu-item @click="deleteStackVModel = true"> <a-menu-item @click="handleDeleteStackClick(stack.title)">
<div class="py-2 flex gap-2 items-center"> <div class="py-2 flex gap-2 items-center">
<mdi-delete class="text-gray-500" /> <mdi-delete class="text-gray-500" />
<!-- TODO: i18n --> <!-- TODO: i18n -->
@ -376,12 +391,14 @@ openNewRecordFormHook?.on(async () => {
</template> </template>
<div> <div>
<!-- TODO: i18n --> <!-- TODO: i18n -->
Deleting this stack will also remove the select option from the `{{ groupingField }}`. The records will move to the Deleting this stack will also remove the select option `{{ stackToBeDeleted }}` from the `{{ groupingField }}`. The records
uncategorized stack. will move to the uncategorized stack.
</div> </div>
<template #footer> <template #footer>
<a-button key="back" @click="deleteStackVModel = false">{{ $t('general.cancel') }}</a-button> <a-button key="back" @click="deleteStackVModel = false">{{ $t('general.cancel') }}</a-button>
<a-button key="submit" type="primary" :loading="loading" @click="deleteStack">{{ $t('general.delete') }}</a-button> <a-button key="submit" type="primary" :loading="loading" @click="handleDeleteStackConfirmClick">
{{ $t('general.delete') }}
</a-button>
</template> </template>
</a-modal> </a-modal>
</template> </template>

Loading…
Cancel
Save