Browse Source

refactor: always create lookup on dnd if Link exist

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5848/head
Pranav C 2 years ago
parent
commit
f4800710c2
  1. 14
      packages/nc-gui/components/tabs/Smartsheet.vue

14
packages/nc-gui/components/tabs/Smartsheet.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import type { ColumnType, LinkToAnotherRecordType, TableType } from 'nocodb-sdk'
import { UITypes, isLinksOrLTAR, RelationTypes } from 'nocodb-sdk'
import { UITypes, isLinksOrLTAR } from 'nocodb-sdk'
import {
ActiveViewInj,
FieldsInj,
@ -98,25 +98,13 @@ const onDrop = async (event: DragEvent) => {
return ltarOptions.fk_related_model_id === childMeta.id
})
if (relationCol) {
if (relationCol.colOptions.type === RelationTypes.BELONGS_TO) {
const lookupCol = childMeta.columns?.find((c) => c.pv) ?? childMeta.columns?.[0]
grid.value?.openColumnCreate({
uidt: UITypes.Lookup,
title: `${relationCol.title}Lookup`,
fk_relation_column_id: relationCol.id,
fk_lookup_column_id: lookupCol?.id,
})
} else {
const rollupCol = childMeta.columns?.find((c) => c.pk) ?? childMeta.columns?.[0]
grid.value?.openColumnCreate({
uidt: UITypes.Rollup,
title: `${relationCol.title}Rollup`,
fk_relation_column_id: relationCol.id,
fk_rollup_column_id: rollupCol?.id,
rollup_function: 'max',
})
}
} else {
grid.value?.openColumnCreate({
uidt: UITypes.Links,

Loading…
Cancel
Save