diff --git a/packages/nc-gui/components/cell/ReadOnlyUser.vue b/packages/nc-gui/components/cell/ReadOnlyUser.vue new file mode 100644 index 0000000000..0330bb97bf --- /dev/null +++ b/packages/nc-gui/components/cell/ReadOnlyUser.vue @@ -0,0 +1,22 @@ + + + diff --git a/packages/nc-gui/components/cell/User.vue b/packages/nc-gui/components/cell/User.vue index 4025149940..4eac73c484 100644 --- a/packages/nc-gui/components/cell/User.vue +++ b/packages/nc-gui/components/cell/User.vue @@ -27,7 +27,7 @@ import { import MdiCloseCircle from '~icons/mdi/close-circle' interface Props { - modelValue?: UserFieldRecordType[] | string | null + modelValue?: UserFieldRecordType[] | UserFieldRecordType | string | null rowIndex?: number location?: 'cell' | 'filter' forceMulti?: boolean @@ -113,17 +113,18 @@ const vModel = computed({ return acc }, [] as { label: string; value: string }[]) } else { - selected = - modelValue?.reduce((acc, item) => { - const label = item?.display_name || item?.email - if (label) { - acc.push({ - label, - value: item.id, - }) - } - return acc - }, [] as { label: string; value: string }[]) || [] + selected = modelValue + ? (Array.isArray(modelValue) ? modelValue : [modelValue]).reduce((acc, item) => { + const label = item?.display_name || item?.email + if (label) { + acc.push({ + label, + value: item.id, + }) + } + return acc + }, [] as { label: string; value: string }[]) + : [] } return selected diff --git a/packages/nc-gui/components/erd/utils.ts b/packages/nc-gui/components/erd/utils.ts index 078c4b3fbf..97f4182185 100644 --- a/packages/nc-gui/components/erd/utils.ts +++ b/packages/nc-gui/components/erd/utils.ts @@ -175,9 +175,10 @@ export function useErdElements(tables: MaybeRef, props: MaybeRef config.value.showAllColumns || (!config.value.showAllColumns && isLinksOrLTAR(col)), - ) || [] + metasWithIdAsKey.value[table.id].columns?.filter((col) => { + if ([UITypes.CreatedBy, UITypes.LastModifiedBy].includes(col.uidt as UITypes) && col.system) return false + return config.value.showAllColumns || (!config.value.showAllColumns && isLinksOrLTAR(col)) + }) || [] const pkAndFkColumns = columns .filter(() => config.value.showPkAndFk) diff --git a/packages/nc-gui/components/smartsheet/Form.vue b/packages/nc-gui/components/smartsheet/Form.vue index 6a95516f8d..3525912603 100644 --- a/packages/nc-gui/components/smartsheet/Form.vue +++ b/packages/nc-gui/components/smartsheet/Form.vue @@ -43,6 +43,8 @@ const hiddenColTypes = [ UITypes.SpecificDBType, UITypes.CreatedTime, UITypes.LastModifiedTime, + UITypes.CreatedBy, + UITypes.LastModifiedBy, ] const { isMobileMode, user } = useGlobal() diff --git a/packages/nc-gui/components/smartsheet/VirtualCell.vue b/packages/nc-gui/components/smartsheet/VirtualCell.vue index 47e8c7c4d9..6a34c88dbb 100644 --- a/packages/nc-gui/components/smartsheet/VirtualCell.vue +++ b/packages/nc-gui/components/smartsheet/VirtualCell.vue @@ -1,6 +1,6 @@ diff --git a/packages/nc-gui/components/smartsheet/grid/Table.vue b/packages/nc-gui/components/smartsheet/grid/Table.vue index df2e62e353..066a963e76 100644 --- a/packages/nc-gui/components/smartsheet/grid/Table.vue +++ b/packages/nc-gui/components/smartsheet/grid/Table.vue @@ -2,7 +2,15 @@ import axios from 'axios' import { nextTick } from '@vue/runtime-core' import { type ColumnReqType, type ColumnType, type PaginatedType, type TableType, type ViewType } from 'nocodb-sdk' -import { UITypes, ViewTypes, isCreatedOrLastModifiedTimeCol, isLinksOrLTAR, isSystemColumn, isVirtualCol } from 'nocodb-sdk' +import { + UITypes, + ViewTypes, + isCreatedOrLastModifiedByCol, + isCreatedOrLastModifiedTimeCol, + isLinksOrLTAR, + isSystemColumn, + isVirtualCol, +} from 'nocodb-sdk' import { useColumnDrag } from './useColumnDrag' import usePaginationShortcuts from './usePaginationShortcuts' @@ -1011,7 +1019,8 @@ const showFillHandle = computed( isLookup(fields.value[activeCell.col]) || isRollup(fields.value[activeCell.col]) || isFormula(fields.value[activeCell.col]) || - isCreatedOrLastModifiedTimeCol(fields.value[activeCell.col]) + isCreatedOrLastModifiedTimeCol(fields.value[activeCell.col]) || + isCreatedOrLastModifiedByCol(fields.value[activeCell.col]) ), ) @@ -1574,7 +1583,8 @@ onKeyStroke('ArrowDown', onDown) (isLookup(columnObj) || isRollup(columnObj) || isFormula(columnObj) || - isCreatedOrLastModifiedTimeCol(columnObj)) && + isCreatedOrLastModifiedTimeCol(columnObj) || + isCreatedOrLastModifiedByCol(columnObj)) && hasEditPermission && isCellSelected(rowIndex, colIndex), '!border-r-blue-400 !border-r-3': toBeDroppedColId === columnObj.id, diff --git a/packages/nc-gui/components/smartsheet/header/Menu.vue b/packages/nc-gui/components/smartsheet/header/Menu.vue index 7782e4919f..fe85fe6feb 100644 --- a/packages/nc-gui/components/smartsheet/header/Menu.vue +++ b/packages/nc-gui/components/smartsheet/header/Menu.vue @@ -129,6 +129,7 @@ const duplicateVirtualColumn = async () => { id: undefined, colOptions: undefined, order: undefined, + system: false, } try { @@ -166,7 +167,17 @@ const duplicateVirtualColumn = async () => { const openDuplicateDlg = async () => { if (!column?.value) return - if (column.value.uidt && [UITypes.Lookup, UITypes.Rollup].includes(column.value.uidt as UITypes)) { + if ( + column.value.uidt && + [ + UITypes.Lookup, + UITypes.Rollup, + UITypes.CreatedTime, + UITypes.LastModifiedTime, + UITypes.CreatedBy, + UITypes.LastModifiedBy, + ].includes(column.value.uidt as UITypes) + ) { duplicateVirtualColumn() } else { const gridViewColumnList = (await $api.dbViewColumn.list(view.value?.id as string)).list diff --git a/packages/nc-gui/components/smartsheet/header/VirtualCellIcon.ts b/packages/nc-gui/components/smartsheet/header/VirtualCellIcon.ts index 1dfee0a8d5..2a884ff1b6 100644 --- a/packages/nc-gui/components/smartsheet/header/VirtualCellIcon.ts +++ b/packages/nc-gui/components/smartsheet/header/VirtualCellIcon.ts @@ -65,6 +65,9 @@ const renderIcon = (column: ColumnType, relationColumn?: ColumnType) => { case UITypes.CreatedTime: case UITypes.LastModifiedTime: return { icon: iconMap.datetime, color: 'text-grey' } + case UITypes.CreatedBy: + case UITypes.LastModifiedBy: + return { icon: iconMap.phUser, color: 'text-grey' } } return { icon: iconMap.generic, color: 'text-grey' } diff --git a/packages/nc-gui/components/smartsheet/toolbar/CreateGroupBy.vue b/packages/nc-gui/components/smartsheet/toolbar/CreateGroupBy.vue index b548925055..82785365f7 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/CreateGroupBy.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/CreateGroupBy.vue @@ -1,6 +1,6 @@