Browse Source

fix: global search, group by, filter

pull/7373/head
mertmit 11 months ago
parent
commit
542b3f135d
  1. 2
      packages/nc-gui/components/smartsheet/grid/GroupBy.vue
  2. 9
      packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue
  3. 2
      packages/nc-gui/composables/useMultiSelect/index.ts
  4. 8
      packages/nc-gui/composables/useViewGroupBy.ts
  5. 3
      packages/nocodb/src/db/conditionV2.ts

2
packages/nc-gui/components/smartsheet/grid/GroupBy.vue

@ -169,7 +169,7 @@ const parseKey = (group: Group) => {
return [parseStringDateTime(key, timeFormats[0], false)]
}
if (key && group.column?.uidt === UITypes.User) {
if (key && [UITypes.User, UITypes.CreatedBy, UITypes.LastModifiedBy].includes(group.column?.uidt as UITypes)) {
try {
const parsedKey = JSON.parse(key)
return [parsedKey]

9
packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue

@ -19,6 +19,7 @@ import {
isPercent,
isRating,
isReadonlyDateTime,
isReadonlyUser,
isSingleSelect,
isTextArea,
isTime,
@ -87,6 +88,7 @@ const checkTypeFunctions = {
isTextArea,
isLinks: (col: ColumnType) => col.uidt === UITypes.Links,
isUser,
isReadonlyUser,
}
type FilterType = keyof typeof checkTypeFunctions
@ -155,6 +157,7 @@ const componentMap: Partial<Record<FilterType, any>> = computed(() => {
isFloat: Float,
isLinks: Integer,
isUser: User,
isReadonlyUser: User,
}
})
@ -181,6 +184,12 @@ const componentProps = computed(() => {
case 'isUser': {
return { forceMulti: true }
}
case 'isReadonlyUser': {
if (['anyof', 'nanyof'].includes(props.filter.comparison_op!)) {
return { forceMulti: true }
}
return {}
}
default: {
return {}
}

2
packages/nc-gui/composables/useMultiSelect/index.ts

@ -112,7 +112,7 @@ export function useMultiSelect(
textToCopy = !!textToCopy
}
if (columnObj.uidt === UITypes.User || columnObj.uidt === UITypes.CreatedBy || columnObj.uidt === UITypes.LastModifiedBy) {
if ([UITypes.User, UITypes.CreatedBy, UITypes.LastModifiedBy].includes(columnObj.uidt as UITypes)) {
if (textToCopy && Array.isArray(textToCopy)) {
textToCopy = textToCopy
.map((user: UserFieldRecordType) => {

8
packages/nc-gui/composables/useViewGroupBy.ts

@ -90,7 +90,7 @@ export const useViewGroupBy = (view: Ref<ViewType | undefined>, where?: Computed
return value ? GROUP_BY_VARS.TRUE : GROUP_BY_VARS.FALSE
}
if (col.uidt === UITypes.User || col.uidt === UITypes.CreatedBy || col.uidt === UITypes.LastModifiedBy) {
if ([UITypes.User, UITypes.CreatedBy, UITypes.LastModifiedBy].includes(col.uidt as UITypes)) {
if (!value) {
return GROUP_BY_VARS.NULL
}
@ -161,11 +161,7 @@ export const useViewGroupBy = (view: Ref<ViewType | undefined>, where?: Computed
acc += `${acc.length ? '~and' : ''}(${curr.title},${curr.key === GROUP_BY_VARS.TRUE ? 'checked' : 'notchecked'})`
} else if ([UITypes.Date, UITypes.DateTime].includes(curr.column_uidt as UITypes)) {
acc += `${acc.length ? '~and' : ''}(${curr.title},eq,exactDate,${curr.key})`
} else if (
curr.column_uidt === UITypes.User ||
curr.column_uidt === UITypes.CreatedBy ||
curr.column_uidt === UITypes.LastModifiedBy
) {
} else if ([UITypes.User, UITypes.CreatedBy, UITypes.LastModifiedBy].includes(curr.column_uidt as UITypes)) {
try {
const value = JSON.parse(curr.key)
acc += `${acc.length ? '~and' : ''}(${curr.title},gb_eq,${value.map((v: any) => v.id).join(',')})`

3
packages/nocodb/src/db/conditionV2.ts

@ -458,6 +458,9 @@ const parseConditionV2 = async (
) &&
['like', 'nlike'].includes(filter.comparison_op)
) {
// get column name for CreatedBy, LastModifiedBy
column.column_name = await getColumnName(column);
const baseUsers = await BaseUser.getUsersList({
base_id: column.base_id,
});

Loading…
Cancel
Save