Browse Source

Nc fix(nc-gui): group by shared view invalid password issue while fetching group by data (#8316)

* fix(nc-gui): group by shared view invalid password issue

* fix(test): groupby test fail issue

* fix(test): small changes
pull/8329/head
Ramesh Mane 7 months ago committed by GitHub
parent
commit
d269e0229e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 41
      packages/nc-gui/composables/useViewGroupBy.ts
  2. 5
      tests/playwright/pages/Dashboard/Grid/Group.ts

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

@ -3,7 +3,16 @@ import type { ColumnType, LinkToAnotherRecordType, LookupType, SelectOptionsType
import type { Ref } from 'vue' import type { Ref } from 'vue'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { extractSdkResponseErrorMsg } from '../utils' import { extractSdkResponseErrorMsg } from '../utils'
import { GROUP_BY_VARS, ref, storeToRefs, useApi, useBase, useMetas, useViewColumnsOrThrow } from '#imports' import {
GROUP_BY_VARS,
SharedViewPasswordInj,
ref,
storeToRefs,
useApi,
useBase,
useMetas,
useViewColumnsOrThrow,
} from '#imports'
import type { Group, GroupNestedIn, Row } from '#imports' import type { Group, GroupNestedIn, Row } from '#imports'
const excludedGroupingUidt = [UITypes.Attachment, UITypes.QrCode, UITypes.Barcode] const excludedGroupingUidt = [UITypes.Attachment, UITypes.QrCode, UITypes.Barcode]
@ -25,6 +34,8 @@ export const useViewGroupBy = (view: Ref<ViewType | undefined>, where?: Computed
const { getMeta } = useMetas() const { getMeta } = useMetas()
const sharedViewPassword = inject(SharedViewPasswordInj, ref(null))
const groupBy = computed<{ column: ColumnType; sort: string; order?: number }[]>(() => { const groupBy = computed<{ column: ColumnType; sort: string; order?: number }[]>(() => {
const tempGroupBy: { column: ColumnType; sort: string; order?: number }[] = [] const tempGroupBy: { column: ColumnType; sort: string; order?: number }[] = []
Object.values(gridViewCols.value).forEach((col) => { Object.values(gridViewCols.value).forEach((col) => {
@ -236,16 +247,24 @@ export const useViewGroupBy = (view: Ref<ViewType | undefined>, where?: Computed
sort: `${groupby.sort === 'desc' ? '-' : ''}${groupby.column.title}`, sort: `${groupby.sort === 'desc' ? '-' : ''}${groupby.column.title}`,
column_name: groupby.column.title, column_name: groupby.column.title,
} as any) } as any)
: await api.public.dataGroupBy(sharedView.value!.uuid!, { : await api.public.dataGroupBy(
offset: ((group.paginationData.page ?? 0) - 1) * (group.paginationData.pageSize ?? groupByGroupLimit.value), sharedView.value!.uuid!,
limit: group.paginationData.pageSize ?? groupByGroupLimit.value, {
...params, offset: ((group.paginationData.page ?? 0) - 1) * (group.paginationData.pageSize ?? groupByGroupLimit.value),
where: nestedWhere, limit: group.paginationData.pageSize ?? groupByGroupLimit.value,
sort: `${groupby.sort === 'desc' ? '-' : ''}${groupby.column.title}`, ...params,
column_name: groupby.column.title, where: nestedWhere,
sortsArr: sorts.value, sort: `${groupby.sort === 'desc' ? '-' : ''}${groupby.column.title}`,
filtersArr: nestedFilters.value, column_name: groupby.column.title,
}) sortsArr: sorts.value,
filtersArr: nestedFilters.value,
},
{
headers: {
'xc-password': sharedViewPassword.value,
},
},
)
const tempList: Group[] = response.list.reduce((acc: Group[], curr: Record<string, any>) => { const tempList: Group[] = response.list.reduce((acc: Group[], curr: Record<string, any>) => {
const keyExists = acc.find( const keyExists = acc.find(

5
tests/playwright/pages/Dashboard/Grid/Group.ts

@ -75,6 +75,11 @@ export class GroupPageObject extends BasePage {
}) { }) {
const gridWrapper = this.get({ indexMap }); const gridWrapper = this.get({ indexMap });
await gridWrapper.scrollIntoViewIfNeeded(); await gridWrapper.scrollIntoViewIfNeeded();
await gridWrapper.locator('.nc-group-table').waitFor({ state: 'visible' });
await gridWrapper.locator(`.nc-group-table .nc-grid-row:nth-child(${rowIndex + 1})`).waitFor({ state: 'visible' });
await gridWrapper await gridWrapper
.locator(`.nc-group-table .nc-grid-row:nth-child(${rowIndex + 1}) [data-title="${columnHeader}"]`) .locator(`.nc-group-table .nc-grid-row:nth-child(${rowIndex + 1}) [data-title="${columnHeader}"]`)
.scrollIntoViewIfNeeded(); .scrollIntoViewIfNeeded();

Loading…
Cancel
Save