Browse Source

MapView: 'Mapped by' column values should always be delivered - WIP

pull/4749/head
Daniel Spaude 2 years ago
parent
commit
0da97ff992
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 2
      packages/nc-gui/components/smartsheet/Kanban.vue
  2. 2
      packages/nc-gui/components/smartsheet/Map.vue
  3. 1
      packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
  4. 3
      packages/nc-gui/composables/useViewColumns.ts
  5. 1
      packages/nc-gui/lib/types.ts
  6. 3
      packages/nocodb-sdk/src/lib/helperFunctions.ts
  7. 8
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts

2
packages/nc-gui/components/smartsheet/Kanban.vue

@ -111,6 +111,7 @@ const isRowEmpty = (record: any, col: any) => {
}
reloadViewDataHook?.on(async () => {
// alert('reloadViewDataHook')
await loadKanbanMeta()
await loadKanbanData()
})
@ -131,6 +132,7 @@ const attachments = (record: any): Attachment[] => {
const reloadAttachments = ref(false)
reloadViewMetaHook?.on(async () => {
alert('reloadViewMetaHook')
await loadKanbanMeta()
reloadAttachments.value = true

2
packages/nc-gui/components/smartsheet/Map.vue

@ -155,10 +155,12 @@ onMounted(async () => {
})
reloadViewMetaHook?.on(async () => {
alert('reloadViewMetaHook')
await loadMapMeta()
})
reloadViewDataHook?.on(async () => {
alert('reloadViewDataHook')
await loadMapData()
})

1
packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue

@ -198,6 +198,7 @@ useMenuCloseOnEsc(open)
v-model:checked="field.show"
v-e="['a:fields:show-hide']"
class="shrink"
:disabled="field.isViewEssentialField"
@change="saveOrUpdate(field, index)"
>
<div class="flex items-center">

3
packages/nc-gui/composables/useViewColumns.ts

@ -25,6 +25,8 @@ export function useViewColumns(
() => isPublic.value || !isUIAllowed('hideAllColumns') || !isUIAllowed('showAllColumns') || isSharedBase.value,
)
const isColumnViewEssential = (column: ColumnType) => column.
const metaColumnById = computed<Record<string, ColumnType>>(() => {
if (!meta.value?.columns) return {}
@ -64,6 +66,7 @@ export function useViewColumns(
...currentColumnField,
order: currentColumnField.order || order++,
system: isSystemColumn(metaColumnById?.value?.[currentColumnField.fk_column_id!]),
isViewEssentialField: isColumnViewEssential(column),
}
})
.sort((a: Field, b: Field) => a.order - b.order)

1
packages/nc-gui/lib/types.ts

@ -32,6 +32,7 @@ export interface Field {
title: string
fk_column_id?: string
system?: boolean
isViewEssentialField?: boolean
}
export type Roles<T extends Role | ProjectRole = Role | ProjectRole> = Record<T | string, boolean>

3
packages/nocodb-sdk/src/lib/helperFunctions.ts

@ -11,6 +11,9 @@ const getSystemColumnsIds = (columns) => {
const getSystemColumns = (columns) => columns.filter(isSystemColumn) || [];
// const isColumnEssentialForView = (col) =>
// col && col.vie
const isSystemColumn = (col) =>
col &&
(col.uidt === UITypes.ForeignKey ||

8
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts

@ -81,13 +81,13 @@ const getAst = async ({
...(await obj),
[col.title]:
allowedCols && (!includePkByDefault || !col.pk)
? allowedCols[col.id] &&
? (allowedCols[col.id] &&
(!isSystemColumn(col) || view.show_system_fields) &&
(!fields?.length || fields.includes(col.title)) &&
value
: fields?.length
value)
: (fields?.length
? fields.includes(col.title) && value
: value,
: value),
};
}, Promise.resolve({}));
};

Loading…
Cancel
Save