Browse Source

feat: hide dlete option from menu for created/updated system column

pull/7304/head
Pranav C 10 months ago
parent
commit
1b708da05b
  1. 11
      packages/nc-gui/components/smartsheet/header/Menu.vue

11
packages/nc-gui/components/smartsheet/header/Menu.vue

@ -1,6 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { ColumnReqType } from 'nocodb-sdk' import type { ColumnReqType } from 'nocodb-sdk'
import { RelationTypes, UITypes, isLinksOrLTAR } from 'nocodb-sdk' import { RelationTypes, UITypes, isLinksOrLTAR } from 'nocodb-sdk'
import { computed } from 'vue'
import { import {
ActiveViewInj, ActiveViewInj,
ColumnInj, ColumnInj,
@ -276,6 +277,14 @@ const onInsertAfter = () => {
isOpen.value = false isOpen.value = false
addColumn() addColumn()
} }
const isDeleteAllowed = computed(() => {
if (!column?.value) return false
if (column.value.uidt && [UITypes.CreateTime, UITypes.LastModifiedTime].includes(column.value.uidt) && column.value.system) {
return false
}
return true
})
</script> </script>
<template> <template>
@ -368,7 +377,7 @@ const onInsertAfter = () => {
</NcMenuItem> </NcMenuItem>
<a-divider v-if="!column?.pv" class="!my-0" /> <a-divider v-if="!column?.pv" class="!my-0" />
<NcMenuItem v-if="!column?.pv" class="!hover:bg-red-50" @click="handleDelete"> <NcMenuItem v-if="!column?.pv && isDeleteAllowed" class="!hover:bg-red-50" @click="handleDelete">
<div class="nc-column-delete nc-header-menu-item text-red-600"> <div class="nc-column-delete nc-header-menu-item text-red-600">
<component :is="iconMap.delete" /> <component :is="iconMap.delete" />
<!-- Delete --> <!-- Delete -->

Loading…
Cancel
Save