Browse Source

feat: add warning slot

pull/8367/head
Pranav C 5 months ago
parent
commit
bce5ab6d40
  1. 8
      packages/nc-gui/components/general/DeleteModal.vue
  2. 28
      packages/nc-gui/components/smartsheet/header/DeleteColumnModal.vue

8
packages/nc-gui/components/general/DeleteModal.vue

@ -56,7 +56,13 @@ onKeyStroke('Enter', () => {
</div> </div>
<slot name="entity-preview"></slot> <slot name="entity-preview"></slot>
<template v-if="$slots.warning">
<a-alert type="warning" show-icon>
<template #message>
<slot name="warning"></slot>
</template>
</a-alert>
</template>
<div class="flex flex-row gap-x-2 mt-2.5 pt-2.5 justify-end"> <div class="flex flex-row gap-x-2 mt-2.5 pt-2.5 justify-end">
<NcButton type="secondary" size="small" @click="visible = false"> <NcButton type="secondary" size="small" @click="visible = false">
{{ $t('general.cancel') }} {{ $t('general.cancel') }}

28
packages/nc-gui/components/smartsheet/header/DeleteColumnModal.vue

@ -27,6 +27,31 @@ const viewsStore = useViewsStore()
const isLoading = ref(false) const isLoading = ref(false)
// disable for time being - internal discussion required
/*
const warningMsg = computed(() => {
if (!column?.value) return []
const columns = meta?.value?.columns.filter((c) => {
if (isLinksOrLTAR(c) && c.colOptions) {
return (
(c.colOptions as LinkToAnotherRecordType).fk_parent_column_id === column.value?.id ||
(c.colOptions as LinkToAnotherRecordType).fk_child_column_id === column.value?.id ||
(c.colOptions as LinkToAnotherRecordType).fk_mm_child_column_id === column.value?.id ||
(c.colOptions as LinkToAnotherRecordType).fk_mm_parent_column_id === column.value?.id
)
}
return false
})
if (!columns.length) return null
return `This column is used in following Link column${columns.length > 1 ? 's' : ''}: '${columns
.map((c) => c.title)
.join("', '")}'. Deleting this column will also delete the related Link column${columns.length > 1 ? 's' : ''}.`
}) */
const onDelete = async () => { const onDelete = async () => {
if (!column?.value) return if (!column?.value) return
@ -80,5 +105,8 @@ const onDelete = async () => {
</div> </div>
</div> </div>
</template> </template>
<!-- disable for time being - internal discussion required -->
<!-- <template v-if="warningMsg" #warning>{{ warningMsg }}</template> -->
</GeneralDeleteModal> </GeneralDeleteModal>
</template> </template>

Loading…
Cancel
Save