Browse Source

fix: update bt, hm and mm column names

- BT - `TableRead` => `Table`
- HM - `TableList` => `Table List`
- MM - `TableMMList` => `Table List`

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2482/head
Pranav C 2 years ago
parent
commit
2f5f1ef872
  1. 8
      packages/nocodb/src/__tests__/restv2.test.ts
  2. 8
      packages/nocodb/src/lib/meta/api/columnApis.ts
  3. 6
      packages/nocodb/src/lib/meta/api/metaDiffApis.ts
  4. 4
      packages/nocodb/src/lib/meta/api/projectApis.ts
  5. 2
      scripts/cypress/integration/common/1a_table_operations.js
  6. 4
      scripts/cypress/integration/common/1c_sql_view.js
  7. 4
      scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js
  8. 4
      scripts/cypress/integration/common/2b_table_with_m2m_column.js
  9. 2
      scripts/cypress/integration/common/4c_form_view_detailed.js
  10. 6
      scripts/cypress/integration/common/4d_table_view_grid_locked.js
  11. 2
      scripts/cypress/integration/common/4e_form_view_share.js
  12. 2
      scripts/cypress/integration/common/5a_user_role.js
  13. 4
      scripts/cypress/integration/common/6b_downloadCsv.js
  14. 2
      scripts/cypress/integration/common/6f_attachments.js

8
packages/nocodb/src/__tests__/restv2.test.ts

@ -209,7 +209,7 @@ describe('Noco v2 Tests', () => {
type: UITypes.Rollup, type: UITypes.Rollup,
alias: 'filmCount', alias: 'filmCount',
rollupColumn: 'FilmId', rollupColumn: 'FilmId',
relationColumn: 'FilmList', relationColumn: 'Film List',
rollupFunction: 'count' rollupFunction: 'count'
} }
]; ];
@ -413,7 +413,7 @@ describe('Noco v2 Tests', () => {
type: UITypes.Lookup, type: UITypes.Lookup,
alias: 'filmNames', alias: 'filmNames',
lookupColumn: 'Title', lookupColumn: 'Title',
relationColumn: 'FilmList' relationColumn: 'Film List'
}; };
request(app) request(app)
.post(`/nc/${projectId}/generate`) .post(`/nc/${projectId}/generate`)
@ -1335,7 +1335,7 @@ describe('Noco v2 Tests', () => {
type: UITypes.Lookup, type: UITypes.Lookup,
alias: 'filmIds', alias: 'filmIds',
lookupColumn: 'FilmId', lookupColumn: 'FilmId',
relationColumn: 'FilmList' relationColumn: 'Film List'
}, },
{ {
table: 'actor', table: 'actor',
@ -1406,7 +1406,7 @@ describe('Noco v2 Tests', () => {
type: UITypes.Lookup, type: UITypes.Lookup,
alias: 'actorsCountList', alias: 'actorsCountList',
lookupColumn: 'actorsCount', lookupColumn: 'actorsCount',
relationColumn: 'FilmList' relationColumn: 'Film List'
}, },
{ {
table: 'actor', table: 'actor',

8
packages/nocodb/src/lib/meta/api/columnApis.ts

@ -57,7 +57,7 @@ async function createHmAndBtColumn(
{ {
const title = getUniqueColumnAliasName( const title = getUniqueColumnAliasName(
await child.getColumns(), await child.getColumns(),
type === 'bt' ? alias : `${parent.title}Read` type === 'bt' ? alias : `${parent.title}`
); );
await Column.insert<LinkToAnotherRecordColumn>({ await Column.insert<LinkToAnotherRecordColumn>({
title, title,
@ -79,7 +79,7 @@ async function createHmAndBtColumn(
{ {
const title = getUniqueColumnAliasName( const title = getUniqueColumnAliasName(
await parent.getColumns(), await parent.getColumns(),
type === 'hm' ? alias : `${child.title}List` type === 'hm' ? alias : `${child.title} List`
); );
await Column.insert({ await Column.insert({
title, title,
@ -427,7 +427,7 @@ export async function columnAdd(req: Request, res: Response<TableType>) {
await Column.insert({ await Column.insert({
title: getUniqueColumnAliasName( title: getUniqueColumnAliasName(
await child.getColumns(), await child.getColumns(),
`${parent.title}List` `${parent.title} List`
), ),
uidt: UITypes.LinkToAnotherRecord, uidt: UITypes.LinkToAnotherRecord,
type: 'mm', type: 'mm',
@ -447,7 +447,7 @@ export async function columnAdd(req: Request, res: Response<TableType>) {
await Column.insert({ await Column.insert({
title: getUniqueColumnAliasName( title: getUniqueColumnAliasName(
await parent.getColumns(), await parent.getColumns(),
req.body.title ?? `${child.title}List` req.body.title ?? `${child.title} List`
), ),
uidt: UITypes.LinkToAnotherRecord, uidt: UITypes.LinkToAnotherRecord,

6
packages/nocodb/src/lib/meta/api/metaDiffApis.ts

@ -671,7 +671,7 @@ export async function metaDiffSync(req, res) {
if (change.relationType === RelationTypes.BELONGS_TO) { if (change.relationType === RelationTypes.BELONGS_TO) {
const title = getUniqueColumnAliasName( const title = getUniqueColumnAliasName(
childModel.columns, childModel.columns,
`${parentModel.title || parentModel.table_name}Read` `${parentModel.title || parentModel.table_name}`
); );
await Column.insert<LinkToAnotherRecordColumn>({ await Column.insert<LinkToAnotherRecordColumn>({
uidt: UITypes.LinkToAnotherRecord, uidt: UITypes.LinkToAnotherRecord,
@ -785,7 +785,7 @@ export async function extractAndGenerateManyToManyRelations(
await Column.insert<LinkToAnotherRecordColumn>({ await Column.insert<LinkToAnotherRecordColumn>({
title: getUniqueColumnAliasName( title: getUniqueColumnAliasName(
modelA.columns, modelA.columns,
`${modelB.title}List` `${modelB.title} List`
), ),
fk_model_id: modelA.id, fk_model_id: modelA.id,
fk_related_model_id: modelB.id, fk_related_model_id: modelB.id,
@ -803,7 +803,7 @@ export async function extractAndGenerateManyToManyRelations(
await Column.insert<LinkToAnotherRecordColumn>({ await Column.insert<LinkToAnotherRecordColumn>({
title: getUniqueColumnAliasName( title: getUniqueColumnAliasName(
modelB.columns, modelB.columns,
`${modelA.title}List` `${modelA.title} List`
), ),
fk_model_id: modelB.id, fk_model_id: modelB.id,
fk_related_model_id: modelA.id, fk_related_model_id: modelA.id,

4
packages/nocodb/src/lib/meta/api/projectApis.ts

@ -215,7 +215,7 @@ async function populateMeta(base: Base, project: Project): Promise<any> {
uidt: UITypes.LinkToAnotherRecord, uidt: UITypes.LinkToAnotherRecord,
type: 'hm', type: 'hm',
hm, hm,
title: `${hm.title}List` title: `${hm.title} List`
}; };
}), }),
...belongsTo.map(bt => { ...belongsTo.map(bt => {
@ -230,7 +230,7 @@ async function populateMeta(base: Base, project: Project): Promise<any> {
uidt: UITypes.LinkToAnotherRecord, uidt: UITypes.LinkToAnotherRecord,
type: 'bt', type: 'bt',
bt, bt,
title: `${bt.rtitle}Read` title: `${bt.rtitle}`
}; };
}) })
]; ];

2
scripts/cypress/integration/common/1a_table_operations.js

@ -92,7 +92,7 @@ export const genTest = (apiType, dbType) => {
cy.openTableTab("Country", 25); cy.openTableTab("Country", 25);
mainPage mainPage
.getCell("CityList", 1) .getCell("City List", 1)
.find(".name") .find(".name")
.contains("Kabul") .contains("Kabul")
.should("exist"); .should("exist");

4
scripts/cypress/integration/common/1c_sql_view.js

@ -139,8 +139,8 @@ export const genTest = (apiType, dbType) => {
cy.openViewsTab("CustomerList", 25); cy.openViewsTab("CustomerList", 25);
cy.closeViewsTab("CustomerList"); cy.closeViewsTab("CustomerList");
cy.openViewsTab("FilmList", 25); cy.openViewsTab("Film List", 25);
cy.closeViewsTab("FilmList"); cy.closeViewsTab("Film List");
cy.openViewsTab("SalesByFilmCategory", 16); cy.openViewsTab("SalesByFilmCategory", 16);
cy.closeViewsTab("SalesByFilmCategory"); cy.closeViewsTab("SalesByFilmCategory");

4
scripts/cypress/integration/common/2a_table_with_belongs_to_colulmn.js

@ -23,12 +23,12 @@ export const genTest = (apiType, dbType) => {
it("Expand belongs-to column", () => { it("Expand belongs-to column", () => {
// expand first row // expand first row
cy.get('td[data-col="CityList"] div:visible', { cy.get('td[data-col="City List"] div:visible', {
timeout: 12000, timeout: 12000,
}) })
.first() .first()
.click(); .click();
cy.get('td[data-col="CityList"] div .mdi-arrow-expand:visible') cy.get('td[data-col="City List"] div .mdi-arrow-expand:visible')
.first() .first()
.click(); .click();

4
scripts/cypress/integration/common/2b_table_with_m2m_column.js

@ -23,10 +23,10 @@ export const genTest = (apiType, dbType) => {
it("Expand m2m column", () => { it("Expand m2m column", () => {
// expand first row // expand first row
cy.get('td[data-col="FilmList"] div', { timeout: 12000 }) cy.get('td[data-col="Film List"] div', { timeout: 12000 })
.first() .first()
.click({ force: true }); .click({ force: true });
cy.get('td[data-col="FilmList"] div .mdi-arrow-expand') cy.get('td[data-col="Film List"] div .mdi-arrow-expand')
.first() .first()
.click({ force: true }); .click({ force: true });

2
scripts/cypress/integration/common/4c_form_view_detailed.js

@ -119,7 +119,7 @@ export const genTest = (apiType, dbType) => {
.should("exist"); .should("exist");
cy.get(".nc-field-wrapper") cy.get(".nc-field-wrapper")
.eq(1) .eq(1)
.contains("CityList") .contains("City List")
.should("exist"); .should("exist");
cy.get(".nc-field-wrapper") cy.get(".nc-field-wrapper")
.eq(2) .eq(2)

6
scripts/cypress/integration/common/4d_table_view_grid_locked.js

@ -77,18 +77,18 @@ export const genTest = (apiType, dbType) => {
// check if add/ expand options available for 'has many' column type // check if add/ expand options available for 'has many' column type
mainPage mainPage
.getCell("CityList", 1) .getCell("City List", 1)
.click() .click()
.find("button.mdi-plus") .find("button.mdi-plus")
.should(`${vString}exist`); .should(`${vString}exist`);
mainPage mainPage
.getCell("CityList", 1) .getCell("City List", 1)
.click() .click()
.find("button.mdi-arrow-expand") .find("button.mdi-arrow-expand")
.should(`${vString}exist`); .should(`${vString}exist`);
// update row option (right click) - should not be available for Lock view // update row option (right click) - should not be available for Lock view
mainPage.getCell("CityList", 1).rightclick(); mainPage.getCell("City List", 1).rightclick();
cy.get(".menuable__content__active").should( cy.get(".menuable__content__active").should(
`${vString}be.visible` `${vString}be.visible`
); );

2
scripts/cypress/integration/common/4e_form_view_share.js

@ -131,7 +131,7 @@ export const genTest = (apiType, dbType) => {
// all fields, barring removed field should exist // all fields, barring removed field should exist
cy.get('[title="City"]').should("exist"); cy.get('[title="City"]').should("exist");
cy.get('[title="LastUpdate"]').should("exist"); cy.get('[title="LastUpdate"]').should("exist");
cy.get('[title="CountryRead"]').should("exist"); cy.get('[title="Country"]').should("exist");
cy.get('[title="AddressList"]').should("not.exist"); cy.get('[title="AddressList"]').should("not.exist");
// order of LastUpdate & City field is retained // order of LastUpdate & City field is retained

2
scripts/cypress/integration/common/5a_user_role.js

@ -209,7 +209,7 @@ export const genTest = (apiType, dbType) => {
const verifyCsv = (retrievedRecords) => { const verifyCsv = (retrievedRecords) => {
// expected output, statically configured // expected output, statically configured
let storedRecords = [ let storedRecords = [
`City,AddressList,CountryRead`, `City,AddressList,Country`,
`A Corua (La Corua),939 Probolinggo Loop,Spain`, `A Corua (La Corua),939 Probolinggo Loop,Spain`,
`Abha,733 Mandaluyong Place,Saudi Arabia`, `Abha,733 Mandaluyong Place,Saudi Arabia`,
`Abu Dhabi,535 Ahmadnagar Manor,United Arab Emirates`, `Abu Dhabi,535 Ahmadnagar Manor,United Arab Emirates`,

4
scripts/cypress/integration/common/6b_downloadCsv.js

@ -31,7 +31,7 @@ export const genTest = (apiType, dbType) => {
// `Angola,"Benguela, Namibe"`, // `Angola,"Benguela, Namibe"`,
// ]; // ];
let storedRecords = [ let storedRecords = [
['Country','CityList'], ['Country','City List'],
['Afghanistan','Kabul'], ['Afghanistan','Kabul'],
['Algeria','Skikda', 'Bchar', 'Batna'], ['Algeria','Skikda', 'Bchar', 'Batna'],
['American Samoa','Tafuna'], ['American Samoa','Tafuna'],
@ -41,7 +41,7 @@ export const genTest = (apiType, dbType) => {
// if (isPostgres()) { // if (isPostgres()) {
// // order of second entry is different // // order of second entry is different
// storedRecords = [ // storedRecords = [
// `Country,CityList`, // `Country,City List`,
// `Afghanistan,Kabul`, // `Afghanistan,Kabul`,
// `Algeria,"Skikda, Bchar, Batna"`, // `Algeria,"Skikda, Bchar, Batna"`,
// `American Samoa,Tafuna`, // `American Samoa,Tafuna`,

2
scripts/cypress/integration/common/6f_attachments.js

@ -113,7 +113,7 @@ export const genTest = (apiType, dbType) => {
const verifyCsv = (retrievedRecords) => { const verifyCsv = (retrievedRecords) => {
let storedRecords = [ let storedRecords = [
`Country,CityList,testAttach`, `Country,City List,testAttach`,
`Afghanistan,Kabul,1.json(http://localhost:8080/download/p_h0wxjx5kgoq3w4/vw_skyvc7hsp9i34a/2HvU8R.json)`, `Afghanistan,Kabul,1.json(http://localhost:8080/download/p_h0wxjx5kgoq3w4/vw_skyvc7hsp9i34a/2HvU8R.json)`,
]; ];

Loading…
Cancel
Save