Browse Source

chore(gui-v2): include hm and mm columns in lookup

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3057/head
Pranav C 2 years ago
parent
commit
73a8f9099f
  1. 23
      packages/nc-gui-v2/components/smartsheet-column/LookupOptions.vue
  2. 3
      scripts/sdk/swagger.json

23
packages/nc-gui-v2/components/smartsheet-column/LookupOptions.vue

@ -1,4 +1,5 @@
<script setup lang="ts">
import type { ColumnType, LinkToAnotherRecordType, TableType } from 'nocodb-sdk'
import { UITypes, isSystemColumn } from 'nocodb-sdk'
import { useColumnCreateStoreOrThrow } from '#imports'
import { MetaInj } from '~/context'
@ -27,25 +28,17 @@ const refTables = $computed(() => {
return []
}
// todo: type issues with ColumnType so we have to cast to any
return (
meta.columns
?.filter((c: any) => c.uidt === UITypes.LinkToAnotherRecord && c.colOptions?.type !== 'bt' && !c.system)
.map((c) => ({
col: c.colOptions,
column: c,
...tables.find((t) => t.id === (c.colOptions as any)?.fk_related_model_id),
}))
.filter((table: any) => table.col?.fk_related_model_id === table.id && !table.mm) ?? []
)
return meta.columns
.filter((c) => c.uidt === UITypes.LinkToAnotherRecord && !c.system)
.map((c) => ({
.filter((c: ColumnType) => c.uidt === UITypes.LinkToAnotherRecord && !c.system)
.map<TableType & { col: LinkToAnotherRecordType; column: ColumnType }>((c: ColumnType) => ({
col: c.colOptions,
column: c,
...tables.find((t) => t.id === c.colOptions.fk_related_model_id),
...tables.find((t) => t.id === (c.colOptions as LinkToAnotherRecordType).fk_related_model_id),
}))
.filter((table) => table.col.fk_related_model_id === table.id && !table.mm)
.filter(
(table: TableType & { col: LinkToAnotherRecordType; column: ColumnType }) =>
table.col.fk_related_model_id === table.id && !table.mm,
)
})
const columns = $computed(() => {

3
scripts/sdk/swagger.json

@ -6233,6 +6233,9 @@
"order": {
"type": "number"
},
"mm": {
"type": "boolean"
},
"columns": {
"type": "array",
"items": {

Loading…
Cancel
Save