Browse Source

Merge pull request #5490 from nocodb/fix/ltar-shared-form

fix(nocodb): LTAR list in shared form / grid
pull/5494/head
Raju Udava 2 years ago committed by GitHub
parent
commit
8eb0b81f44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      packages/nocodb/src/lib/controllers/publicControllers/publicData.ctl.ts
  2. 8
      packages/nocodb/src/lib/services/dbData/index.ts
  3. 20
      packages/nocodb/src/lib/services/public/publicData.svc.ts
  4. 23
      tests/playwright/pages/Dashboard/common/Cell/index.ts
  5. 2
      tests/playwright/tests/viewGridShare.spec.ts

4
packages/nocodb/src/lib/controllers/publicControllers/publicData.ctl.ts

@ -96,11 +96,11 @@ router.post(
);
router.get(
'/api/v1/db/public/shared-view/:sharedViewUuid/rows/:rowId/mm/:colId',
'/api/v1/db/public/shared-view/:sharedViewUuid/rows/:rowId/mm/:columnId',
catchError(publicMmList)
);
router.get(
'/api/v1/db/public/shared-view/:sharedViewUuid/rows/:rowId/hm/:colId',
'/api/v1/db/public/shared-view/:sharedViewUuid/rows/:rowId/hm/:columnId',
catchError(publicHmList)
);

8
packages/nocodb/src/lib/services/dbData/index.ts

@ -131,9 +131,7 @@ export async function getDataList(param: {
count = await baseModel.count(listArgs);
} catch (e) {
console.log(e);
NcError.internalServerError(
'Internal Server Error, check server log for more details'
);
NcError.internalServerError('Please check server log for more details');
}
return new PagedResponseImpl(data, {
@ -642,9 +640,7 @@ export async function dataReadByViewId(param: {
);
} catch (e) {
console.log(e);
NcError.internalServerError(
'Internal Server Error, check server log for more details'
);
NcError.internalServerError('Please check server log for more details');
}
}

20
packages/nocodb/src/lib/services/public/publicData.svc.ts

@ -69,10 +69,7 @@ export async function dataList(param: {
count = await baseModel.count(listArgs);
} catch (e) {
console.log(e);
// show empty result instead of throwing error here
// e.g. search some text in a numeric field
NcError.internalServerError('Please try after some time');
NcError.internalServerError('Please check server log for more details');
}
return new PagedResponseImpl(data, { ...param.query, count });
@ -294,6 +291,7 @@ export async function relDataList(param: {
}
const column = await Column.get({ colId: param.columnId });
const colOptions = await column.getColOptions<LinkToAnotherRecordColumn>();
const model = await colOptions.getRelatedTable();
@ -306,25 +304,27 @@ export async function relDataList(param: {
dbDriver: await NcConnectionMgrv2.get(base),
});
const { ast } = await getAst({
const { ast, dependencyFields } = await getAst({
query: param.query,
model,
extractOnlyPrimaries: true,
});
let data = [];
let count = 0;
try {
data = data = await nocoExecute(
ast,
await baseModel.list(param.query),
await baseModel.list(dependencyFields),
{},
param.query
dependencyFields
);
count = await baseModel.count(param.query);
count = await baseModel.count(dependencyFields);
} catch (e) {
// show empty result instead of throwing error here
// e.g. search some text in a numeric field
console.log(e);
NcError.internalServerError('Please check server log for more details');
}
return new PagedResponseImpl(data, { ...param.query, count });

23
tests/playwright/pages/Dashboard/common/Cell/index.ts

@ -264,9 +264,11 @@ export class CellPageObject extends BasePage {
columnHeader,
count,
value,
verifyChildList = false,
}: CellProps & {
count?: number;
value: string[];
verifyChildList?: boolean;
}) {
// const count = value.length;
const cell = await this.get({ index, columnHeader });
@ -281,6 +283,27 @@ export class CellPageObject extends BasePage {
for (let i = 0; i < value.length; ++i) {
await expect(await chips.nth(i).locator('.name')).toHaveText(value[i]);
}
if (verifyChildList) {
// open child list
await this.get({ index, columnHeader }).hover();
const arrow_expand = await this.get({ index, columnHeader }).locator('.nc-arrow-expand');
// arrow expand doesn't exist for bt columns
if (await arrow_expand.count()) {
await arrow_expand.click();
// wait for child list to open
await this.rootPage.waitForSelector('.nc-modal-child-list:visible');
// verify child list count & contents
const childList = await this.rootPage.locator('.ant-card:visible');
expect(await childList.count()).toBe(count);
// close child list
await this.rootPage.locator('.nc-modal-child-list').locator('button.ant-modal-close:visible').click();
}
}
}
async unlinkVirtualCell({ index, columnHeader }: CellProps) {

2
tests/playwright/tests/viewGridShare.spec.ts

@ -90,7 +90,7 @@ test.describe('Shared view', () => {
// verify virtual records
for (const record of expectedVirtualRecordsByDb) {
await sharedPage.grid.cell.verifyVirtualCell(record);
await sharedPage.grid.cell.verifyVirtualCell({ ...record, verifyChildList: true });
}
/**

Loading…
Cancel
Save