Browse Source

fix(gui-v2): allow id column creation if pk missing

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3005/head
Pranav C 2 years ago
parent
commit
996d91ef49
  1. 5
      packages/nc-gui-v2/components/smartsheet-column/EditOrAdd.vue

5
packages/nc-gui-v2/components/smartsheet-column/EditOrAdd.vue

@ -5,6 +5,7 @@ import { MetaInj, ReloadViewDataHookInj } from '~/context'
import { uiTypes } from '~/utils/columnUtils'
import MdiPlusIcon from '~icons/mdi/plus-circle-outline'
import MdiMinusIcon from '~icons/mdi/minus-circle-outline'
import MdiIdentifierIcon from '~icons/mdi/identifier'
interface Props {
editColumnDropdown: boolean
@ -37,7 +38,7 @@ const columnToValidate = [UITypes.Email, UITypes.URL, UITypes.PhoneNumber]
const uiTypesOptions = computed<typeof uiTypes>(() => {
return [
...uiTypes.filter((t) => !isEdit || !t.virtual),
...(!isEdit && meta?.value?.columns?.every((c) => !c.pk)
...(!isEdit?.value && meta?.value?.columns?.every((c) => !c.pk)
? [
{
name: 'ID',
@ -107,7 +108,7 @@ watch(
</a-form-item>
<a-form-item :label="$t('labels.columnType')">
<a-select v-model:value="formState.uidt" size="small" class="nc-column-name-input" @change="onUidtOrIdTypeChange">
<a-select-option v-for="opt in uiTypesOptions" :key="opt.name" :value="opt.name" v-bind="validateInfos.uidt">
<a-select-option v-for="opt of uiTypesOptions" :key="opt.name" :value="opt.name" v-bind="validateInfos.uidt">
<div class="flex gap-1 align-center text-xs">
<component :is="opt.icon" class="text-grey" />
{{ opt.name }}

Loading…
Cancel
Save