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. 25
      packages/nc-gui/composables/useViewGroupBy.ts
  2. 5
      tests/playwright/pages/Dashboard/Grid/Group.ts

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

@ -3,7 +3,16 @@ import type { ColumnType, LinkToAnotherRecordType, LookupType, SelectOptionsType
import type { Ref } from 'vue'
import { message } from 'ant-design-vue'
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'
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 sharedViewPassword = inject(SharedViewPasswordInj, ref(null))
const groupBy = computed<{ column: ColumnType; sort: string; order?: number }[]>(() => {
const tempGroupBy: { column: ColumnType; sort: string; order?: number }[] = []
Object.values(gridViewCols.value).forEach((col) => {
@ -236,7 +247,9 @@ export const useViewGroupBy = (view: Ref<ViewType | undefined>, where?: Computed
sort: `${groupby.sort === 'desc' ? '-' : ''}${groupby.column.title}`,
column_name: groupby.column.title,
} as any)
: await api.public.dataGroupBy(sharedView.value!.uuid!, {
: await api.public.dataGroupBy(
sharedView.value!.uuid!,
{
offset: ((group.paginationData.page ?? 0) - 1) * (group.paginationData.pageSize ?? groupByGroupLimit.value),
limit: group.paginationData.pageSize ?? groupByGroupLimit.value,
...params,
@ -245,7 +258,13 @@ export const useViewGroupBy = (view: Ref<ViewType | undefined>, where?: Computed
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 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 });
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
.locator(`.nc-group-table .nc-grid-row:nth-child(${rowIndex + 1}) [data-title="${columnHeader}"]`)
.scrollIntoViewIfNeeded();

Loading…
Cancel
Save