Skip to content

Commit

Permalink
feat: add warning slot
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavxc committed May 2, 2024
1 parent 878ca41 commit e13413a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/nc-gui/components/general/DeleteModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ onKeyStroke('Enter', () => {
</div>

<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">
<NcButton type="secondary" @click="visible = false">
{{ $t('general.cancel') }}
Expand Down
28 changes: 28 additions & 0 deletions packages/nc-gui/components/smartsheet/header/DeleteColumnModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,31 @@ const { loadTables } = useBase()
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 () => {
if (!column?.value) return
Expand Down Expand Up @@ -71,5 +96,8 @@ const onDelete = async () => {
</div>
</div>
</template>

<!-- disable for time being - internal discussion required -->
<!-- <template v-if="warningMsg" #warning>{{ warningMsg }}</template> -->
</GeneralDeleteModal>
</template>

1 comment on commit e13413a

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR changes have been deployed. Please run the following command to verify:

docker run -d -p 8888:8080 nocodb/nocodb-timely:0.205.0-pr-8367-20240502-0911

Please sign in to comment.