mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 02:25:23 +00:00
fix: block attempts to edit primary key column
Signed-off-by: mertmit <mertmit99@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { UITypes, isVirtualCol } from 'nocodb-sdk'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { computed, inject, useMetas, watchEffect } from '#imports'
|
||||
import { MetaInj, ReloadViewDataHookInj } from '~/context'
|
||||
import { uiTypes } from '~/utils/columnUtils'
|
||||
@@ -9,17 +10,19 @@ import MdiIdentifierIcon from '~icons/mdi/identifier'
|
||||
|
||||
const emit = defineEmits(['submit', 'cancel'])
|
||||
|
||||
const meta = inject(MetaInj)
|
||||
|
||||
const { formState, generateNewColumnMeta, addOrUpdate, onAlter, onUidtOrIdTypeChange, validateInfos, isEdit } =
|
||||
useColumnCreateStoreOrThrow()
|
||||
|
||||
const { getMeta } = useMetas()
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const meta = inject(MetaInj)
|
||||
|
||||
const reloadDataTrigger = inject(ReloadViewDataHookInj)
|
||||
|
||||
const advancedOptions = ref(false)
|
||||
|
||||
const { getMeta } = useMetas()
|
||||
|
||||
const columnToValidate = [UITypes.Email, UITypes.URL, UITypes.PhoneNumber]
|
||||
|
||||
const onlyNameUpdateOnEditColumns = [UITypes.LinkToAnotherRecord, UITypes.Lookup, UITypes.Rollup]
|
||||
@@ -70,6 +73,11 @@ watchEffect(() => {
|
||||
onMounted(() => {
|
||||
if (isEdit.value === false) {
|
||||
generateNewColumnMeta()
|
||||
} else {
|
||||
if (formState.value.pk) {
|
||||
message.info(t('msg.info.editingPKnotSupported'))
|
||||
emit('cancel')
|
||||
}
|
||||
}
|
||||
|
||||
// for cases like formula
|
||||
|
||||
Reference in New Issue
Block a user