Browse Source

refactor: rename row to record

pull/6624/head
Pranav C 1 year ago
parent
commit
6afc439ffc
  1. 2
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  2. 2
      packages/nc-gui/composables/useData.ts
  3. 2
      packages/nc-gui/composables/useExpandedFormStore.ts
  4. 2
      packages/nc-gui/composables/useKanbanViewStore.ts
  5. 2
      packages/nc-gui/composables/useLTARStore.ts
  6. 46
      packages/nc-gui/lang/en.json
  7. 18
      packages/nocodb/src/controllers/data-table.controller.ts
  8. 6
      packages/nocodb/src/db/BaseModelSqlv2.ts
  9. 2
      packages/nocodb/src/db/sql-client/lib/mysql/MysqlClient.ts
  10. 2
      packages/nocodb/src/helpers/PagedResponse.ts
  11. 4
      packages/nocodb/src/helpers/catchError.ts
  12. 6
      packages/nocodb/src/schema/swagger.json
  13. 64
      packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts
  14. 2
      packages/nocodb/tests/unit/rest/tests/viewRow.test.ts

2
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -402,7 +402,7 @@ const onDeleteRowClick = () => {
const onConfirmDeleteRowClick = async () => {
showDeleteRowModal.value = false
await deleteRowById(primaryKey.value)
message.success('Row deleted')
message.success('Record deleted')
reloadTrigger.trigger()
onClose()
showDeleteRowModal.value = false

2
packages/nc-gui/composables/useData.ts

@ -494,7 +494,7 @@ export function useData(args: {
if (res.message) {
message.info(
`Row delete failed: ${`Unable to delete row with ID ${id} because of the following:
`Record delete failed: ${`Unable to delete record with ID ${id} because of the following:
\n${res.message.join('\n')}.\n
Clear the data first & try again`})}`,
)

2
packages/nc-gui/composables/useExpandedFormStore.ts

@ -322,7 +322,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
if (res.message) {
message.info(
`Row delete failed: ${`Unable to delete row with ID ${rowId} because of the following:
`Record delete failed: ${`Unable to delete record with ID ${rowId} because of the following:
\n${res.message.join('\n')}.\n
Clear the data first & try again`})}`,
)

2
packages/nc-gui/composables/useKanbanViewStore.ts

@ -679,7 +679,7 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
if (res.message) {
message.info(
`Row delete failed: ${`Unable to delete row with ID ${id} because of the following:
`Record delete failed: ${`Unable to delete record with ID ${id} because of the following:
\n${res.message.join('\n')}.\n
Clear the data first & try again`})}`,
)

2
packages/nc-gui/composables/useLTARStore.ts

@ -291,7 +291,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
if (res.message) {
message.info(
`Row delete failed: ${`Unable to delete row with ID ${id} because of the following:
`Record delete failed: ${`Unable to delete record with ID ${id} because of the following:
\n${res.message.join('\n')}.\n
Clear the data first & try again`})}`,
)

46
packages/nc-gui/lang/en.json

@ -219,7 +219,7 @@
"orgLevelViewer": "Organization Level Viewer"
},
"sqlVIew": "SQL View",
"rowHeight": "Row Height",
"rowHeight": "Record Height",
"heightClass": {
"short": "Short",
"medium": "Medium",
@ -291,11 +291,11 @@
"dateJoined": "Date Joined",
"tokenName": "Token name",
"inDesktop": "in Desktop",
"rowData": "Row data",
"rowData": "Record data",
"creator": "Creator",
"qrCode": "QR Code",
"termsOfService": "Terms of Service",
"updateSelectedRows": "Update Selected Rows",
"updateSelectedRows": "Update Selected Records",
"noFiltersAdded": "No filters added",
"editCards": "Edit Cards",
"noFieldsFound": "No fields found",
@ -366,7 +366,7 @@
"codeSnippet": "Code Snippet",
"keyboardShortcut": "Keyboard Shortcuts",
"generateRandomName": "Generate Random Name",
"findRowByScanningCode": "Find row by scanning a QR or Barcode",
"findRowByScanningCode": "Find record by scanning a QR or Barcode",
"tokenManagement": "Token Management",
"addNewToken": "Add new token",
"accountSettings": "Account Settings",
@ -561,7 +561,7 @@
"goToDashboard": "Go to Dashboard",
"importing": "Importing",
"formatJson": "Format JSON",
"firstRowAsHeaders": "Use First Row as Headers",
"firstRowAsHeaders": "Use First Record as Headers",
"flattenNested": "Flatten Nested",
"downloadAllowed": "Download allowed",
"weAreHiring": "We are Hiring!",
@ -578,8 +578,8 @@
"agreeToTos": "By signing up, you agree to the Terms of Service",
"welcomeToNc": "Welcome to NocoDB!",
"inviteOnlySignup": "Allow signup only using invite url",
"nextRow": "Next Row",
"prevRow": "Previous Row",
"nextRow": "Next Record",
"prevRow": "Previous Record",
"addRowGrid": "Manually add data in grid view",
"addRowForm": "Enter record data through a form",
"noAccess": "No access",
@ -695,17 +695,17 @@
"deleteTable": "Delete Table",
"addField": "Add new field to this table",
"setDisplay": "Set as Display value",
"addRow": "Add new row",
"saveRow": "Save row",
"addRow": "Add new record",
"saveRow": "Save record",
"saveAndExit": "Save & Exit",
"saveAndStay": "Save & Stay",
"insertRow": "Insert new row",
"duplicateRow": "Duplicate row",
"deleteRow": "Delete row",
"deleteRows": "Delete rows",
"insertRow": "Insert new record",
"duplicateRow": "Duplicate record",
"deleteRow": "Delete record",
"deleteRows": "Delete records",
"predictColumns": "Predict Columns",
"predictFormulas": "Predict Formulas",
"deleteSelectedRow": "Delete selected rows",
"deleteSelectedRow": "Delete selected records",
"importExcel": "Import Excel",
"importCSV": "Import CSV",
"downloadCSV": "Download as CSV",
@ -719,7 +719,7 @@
"changePwd": "Change Password",
"createView": "Create a View",
"shareView": "Share View",
"findRowByCodeScan": "Find row by scan",
"findRowByCodeScan": "Find record by scan",
"fillByCodeScan": "Fill by scan",
"listSharedView": "Shared View List",
"ListView": "Views List",
@ -974,22 +974,22 @@
},
"codeScanner": {
"loadingScanner": "Loading the scanner...",
"selectColumn": "Select a column (QR code or Barcode) that you want to use for finding a row by scanning.",
"moreThanOneRowFoundForCode": "More than one row found for this code. Currently only unique codes are supported.",
"noRowFoundForCode": "No row found for this code for the selected column"
"selectColumn": "Select a column (QR code or Barcode) that you want to use for finding a record by scanning.",
"moreThanOneRowFoundForCode": "More than one record found for this code. Currently only unique codes are supported.",
"noRowFoundForCode": "No record found for this code for the selected column"
},
"map": {
"overLimit": "You're over the limit.",
"closeLimit": "You're getting close to the limit.",
"limitNumber": "The limit of markers shown in a Map View is 1000 records."
},
"footerInfo": "Rows per page",
"footerInfo": "Records per page",
"upload": "Select file to Upload",
"upload_sub": "or drag and drop file",
"excelSupport": "Supported: .xls, .xlsx, .xlsm, .ods, .ots",
"excelURL": "Enter excel file URL",
"csvURL": "Enter CSV file URL",
"footMsg": "# of rows to parse to infer datatype",
"footMsg": "# of records to parse to infer datatype",
"excelImport": "sheet(s) are available for import",
"exportMetadata": "Do you want to export metadata from meta tables?",
"importMetadata": "Do you want to import metadata from meta tables?",
@ -1165,8 +1165,8 @@
"failedToLoadChildrenList": "Failed to load children list",
"deleteFailed": "Delete failed",
"unlinkFailed": "Unlink failed",
"rowUpdateFailed": "Row update failed",
"deleteRowFailed": "Failed to delete row",
"rowUpdateFailed": "Record update failed",
"deleteRowFailed": "Failed to delete record",
"setFormDataFailed": "Failed to set form data",
"formViewUpdateFailed": "Failed to update form view",
"tableNameRequired": "Table name is required",
@ -1209,7 +1209,7 @@
"success": {
"licenseKeyUpdated": "License Key Updated",
"columnDuplicated": "Column duplicated successfully",
"rowDuplicatedWithoutSavedYet": "Row duplicated (not saved)",
"rowDuplicatedWithoutSavedYet": "Record duplicated (not saved)",
"updatedUIACL": "Updated UI ACL for tables successfully",
"pluginUninstalled": "Plugin uninstalled successfully",
"pluginSettingsSaved": "Plugin settings saved successfully",

18
packages/nocodb/src/controllers/data-table.controller.ts

@ -24,7 +24,7 @@ export class DataTableController {
constructor(private readonly dataTableService: DataTableService) {}
// todo: Handle the error case where view doesnt belong to model
@Get('/api/v1/tables/:modelId/rows')
@Get('/api/v1/tables/:modelId/records')
@Acl('dataList')
async dataList(
@Request() req,
@ -43,7 +43,7 @@ export class DataTableController {
res.json(responseData);
}
@Get(['/api/v1/tables/:modelId/rows/count'])
@Get(['/api/v1/tables/:modelId/records/count'])
@Acl('dataCount')
async dataCount(
@Request() req,
@ -60,7 +60,7 @@ export class DataTableController {
res.json(countResult);
}
@Post(['/api/v1/tables/:modelId/rows'])
@Post(['/api/v1/tables/:modelId/records'])
@HttpCode(200)
@Acl('dataInsert')
async dataInsert(
@ -77,7 +77,7 @@ export class DataTableController {
});
}
@Patch(['/api/v1/tables/:modelId/rows'])
@Patch(['/api/v1/tables/:modelId/records'])
@Acl('dataUpdate')
async dataUpdate(
@Request() req,
@ -93,7 +93,7 @@ export class DataTableController {
});
}
@Delete(['/api/v1/tables/:modelId/rows'])
@Delete(['/api/v1/tables/:modelId/records'])
@Acl('dataDelete')
async dataDelete(
@Request() req,
@ -109,7 +109,7 @@ export class DataTableController {
});
}
@Get(['/api/v1/tables/:modelId/rows/:rowId'])
@Get(['/api/v1/tables/:modelId/records/:rowId'])
@Acl('dataRead')
async dataRead(
@Request() req,
@ -125,7 +125,7 @@ export class DataTableController {
});
}
@Get(['/api/v1/tables/:modelId/links/:columnId/rows/:rowId'])
@Get(['/api/v1/tables/:modelId/links/:columnId/records/:rowId'])
@Acl('nestedDataList')
async nestedDataList(
@Request() req,
@ -143,7 +143,7 @@ export class DataTableController {
});
}
@Post(['/api/v1/tables/:modelId/links/:columnId/rows/:rowId'])
@Post(['/api/v1/tables/:modelId/links/:columnId/records/:rowId'])
@Acl('nestedDataLink')
async nestedLink(
@Request() req,
@ -164,7 +164,7 @@ export class DataTableController {
});
}
@Delete(['/api/v1/tables/:modelId/links/:columnId/rows/:rowId'])
@Delete(['/api/v1/tables/:modelId/links/:columnId/records/:rowId'])
@Acl('nestedDataUnlink')
async nestedUnlink(
@Request() req,

6
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -4291,7 +4291,7 @@ class BaseModelSqlv2 {
// validate rowId
if (!row) {
NcError.notFound(`Row with id '${rowId}' not found`);
NcError.notFound(`Record with id '${rowId}' not found`);
}
if (!childIds.length) return;
@ -4516,7 +4516,7 @@ class BaseModelSqlv2 {
// validate rowId
if (!row) {
NcError.notFound(`Row with id '${rowId}' not found`);
NcError.notFound(`Record with id '${rowId}' not found`);
}
if (!childIds.length) return;
@ -4678,7 +4678,7 @@ class BaseModelSqlv2 {
// validate rowId
if (!row) {
NcError.notFound(`Row with id ${id} not found`);
NcError.notFound(`Record with id ${id} not found`);
}
const parentCol = await (

2
packages/nocodb/src/db/sql-client/lib/mysql/MysqlClient.ts

@ -1936,7 +1936,7 @@ class MysqlClient extends KnexClient {
await promisify(jsonfile.writeFile)(
seedSettings,
{
rows: { value: 8, description: 'Maximum number of rows' },
rows: { value: 8, description: 'Maximum number of records' },
foreign_key_rows: {
value: 2,
description: '1:n - Total number foreign key per relation',

2
packages/nocodb/src/helpers/PagedResponse.ts

@ -37,7 +37,7 @@ export class PagedResponseImpl<T> {
if (offset && offset >= +count) {
this.errors = [
{
message: 'Offset is beyond the total number of rows',
message: 'Offset is beyond the total number of records',
},
];
}

4
packages/nocodb/src/helpers/catchError.ts

@ -215,7 +215,7 @@ export function extractDBError(error): {
message = 'A timeout occurred while waiting for a table lock.';
break;
case 'ER_NO_REFERENCED_ROW':
message = 'The referenced row does not exist.';
message = 'The referenced record does not exist.';
break;
case 'ER_ROW_IS_REFERENCED':
message = 'This record is being referenced by other records.';
@ -232,7 +232,7 @@ export function extractDBError(error): {
message = 'A value is required for this field.';
break;
case '23503':
message = 'The referenced row does not exist.';
message = 'The referenced record does not exist.';
break;
case '23514':
message = 'A null value is not allowed for this field.';

6
packages/nocodb/src/schema/swagger.json

@ -15693,7 +15693,7 @@
]
}
},
"/api/v1/tables/{tableId}/rows/{rowId}": {
"/api/v1/tables/{tableId}/records/{rowId}": {
"parameters": [
{
"schema": {
@ -15790,7 +15790,7 @@
}
}
},
"/api/v1/tables/{tableId}/rows/count": {
"/api/v1/tables/{tableId}/records/count": {
"parameters": [
{
"schema": {
@ -15929,7 +15929,7 @@
}
}
},
"/api/v1/tables/{tableId}/links/{columnId}/rows/{rowId}": {
"/api/v1/tables/{tableId}/links/{columnId}/records/{rowId}": {
"parameters": [
{
"schema": {

64
packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts

@ -139,7 +139,7 @@ const verifyColumnsInRsp = (row, columns: ColumnType[]) => {
};
async function ncAxiosGet({
url = `/api/v1/tables/${table.id}/rows`,
url = `/api/v1/tables/${table.id}/records`,
query = {},
status = 200,
}: { url?: string; query?: any; status?: number } = {}) {
@ -153,7 +153,7 @@ async function ncAxiosGet({
}
async function ncAxiosPost({
url = `/api/v1/tables/${table.id}/rows`,
url = `/api/v1/tables/${table.id}/records`,
body = {},
status = 200,
}: { url?: string; body?: any; status?: number } = {}) {
@ -166,7 +166,7 @@ async function ncAxiosPost({
}
async function ncAxiosPatch({
url = `/api/v1/tables/${table.id}/rows`,
url = `/api/v1/tables/${table.id}/records`,
body = {},
status = 200,
}: { url?: string; body?: any; status?: number } = {}) {
@ -179,7 +179,7 @@ async function ncAxiosPatch({
}
async function ncAxiosDelete({
url = `/api/v1/tables/${table.id}/rows`,
url = `/api/v1/tables/${table.id}/records`,
body = {},
status = 200,
}: { url?: string; body?: any; status?: number } = {}) {
@ -200,7 +200,7 @@ async function ncAxiosLinkGet({
msg,
}: { urlParams?: any; query?: any; status?: number; msg?: string } = {}) {
const urlParams = { tableId, linkId, rowId };
const url = `/api/v1/tables/${urlParams.tableId}/links/${urlParams.linkId}/rows/${urlParams.rowId}`;
const url = `/api/v1/tables/${urlParams.tableId}/links/${urlParams.linkId}/records/${urlParams.rowId}`;
const response = await request(context.app)
.get(url)
.set('xc-auth', context.token)
@ -226,7 +226,7 @@ async function ncAxiosLinkAdd({
msg,
}: { urlParams?: any; body?: any; status?: number; msg?: string } = {}) {
const urlParams = { tableId, linkId, rowId };
const url = `/api/v1/tables/${urlParams.tableId}/links/${urlParams.linkId}/rows/${urlParams.rowId}`;
const url = `/api/v1/tables/${urlParams.tableId}/links/${urlParams.linkId}/records/${urlParams.rowId}`;
const response = await request(context.app)
.post(url)
.set('xc-auth', context.token)
@ -253,7 +253,7 @@ async function ncAxiosLinkRemove({
msg,
}: { urlParams?: any; body?: any; status?: number; msg?: string } = {}) {
const urlParams = { tableId, linkId, rowId };
const url = `/api/v1/tables/${urlParams.tableId}/links/${urlParams.linkId}/rows/${urlParams.rowId}`;
const url = `/api/v1/tables/${urlParams.tableId}/links/${urlParams.linkId}/records/${urlParams.rowId}`;
const response = await request(context.app)
.delete(url)
.set('xc-auth', context.token)
@ -310,7 +310,7 @@ function generalDb() {
// read first 4 records
const records = await ncAxiosGet({
url: `/api/v1/tables/${countryTable.id}/rows`,
url: `/api/v1/tables/${countryTable.id}/records`,
query: {
limit: 4,
},
@ -340,7 +340,7 @@ function generalDb() {
// read first 4 records
const records = await ncAxiosGet({
url: `/api/v1/tables/${countryTable.id}/rows`,
url: `/api/v1/tables/${countryTable.id}/records`,
query: {
limit: 4,
},
@ -366,7 +366,7 @@ function generalDb() {
// read first 4 records
const records = await ncAxiosGet({
url: `/api/v1/tables/${countryTable.id}/rows`,
url: `/api/v1/tables/${countryTable.id}/records`,
query: {
limit: 4,
},
@ -381,7 +381,7 @@ function generalDb() {
it('Nested Read - Link to another record', async function () {
const records = await ncAxiosGet({
url: `/api/v1/tables/${countryTable.id}/rows/1`,
url: `/api/v1/tables/${countryTable.id}/records/1`,
});
// extract LTAR column "City List"
@ -398,7 +398,7 @@ function generalDb() {
});
const records = await ncAxiosGet({
url: `/api/v1/tables/${countryTable.id}/rows/1`,
url: `/api/v1/tables/${countryTable.id}/records/1`,
});
expect(records.body.Lookup).to.deep.equal(['Kabul']);
});
@ -414,7 +414,7 @@ function generalDb() {
});
const records = await ncAxiosGet({
url: `/api/v1/tables/${countryTable.id}/rows/1`,
url: `/api/v1/tables/${countryTable.id}/records/1`,
});
expect(records.body.Rollup).to.equal(1);
@ -792,7 +792,7 @@ function textBased() {
it('List: invalid ID', async function () {
// Invalid table ID
await ncAxiosGet({
url: `/api/v1/tables/123456789/rows`,
url: `/api/v1/tables/123456789/records`,
status: unauthorizedResponse,
});
@ -919,7 +919,7 @@ function textBased() {
it('Create: invalid ID', async function () {
// Invalid table ID
await ncAxiosPost({
url: `/api/v1/tables/123456789/rows`,
url: `/api/v1/tables/123456789/records`,
status: unauthorizedResponse,
});
@ -946,19 +946,19 @@ function textBased() {
it('Read: all fields', async function () {
const rsp = await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/100`,
url: `/api/v1/tables/${table.id}/records/100`,
});
});
it('Read: invalid ID', async function () {
// Invalid table ID
await ncAxiosGet({
url: `/api/v1/tables/123456789/rows/100`,
url: `/api/v1/tables/123456789/records/100`,
status: unauthorizedResponse,
});
// Invalid row ID
await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/1000`,
url: `/api/v1/tables/${table.id}/records/1000`,
status: 404,
});
});
@ -984,7 +984,7 @@ function textBased() {
it('Update: partial', async function () {
const recordBeforeUpdate = await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/1`,
url: `/api/v1/tables/${table.id}/records/1`,
});
const rsp = await ncAxiosPatch({
@ -999,7 +999,7 @@ function textBased() {
expect(rsp.body).to.deep.equal([{ Id: 1 }]);
const recordAfterUpdate = await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/1`,
url: `/api/v1/tables/${table.id}/records/1`,
});
expect(recordAfterUpdate.body).to.deep.equal({
...recordBeforeUpdate.body,
@ -1031,7 +1031,7 @@ function textBased() {
it('Update: invalid ID', async function () {
// Invalid table ID
await ncAxiosPatch({
url: `/api/v1/tables/123456789/rows`,
url: `/api/v1/tables/123456789/records`,
body: { Id: 100, SingleLineText: 'some text' },
status: unauthorizedResponse,
});
@ -1055,7 +1055,7 @@ function textBased() {
// check that it's gone
await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/1`,
url: `/api/v1/tables/${table.id}/records/1`,
status: 404,
});
});
@ -1066,11 +1066,11 @@ function textBased() {
// check that it's gone
await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/1`,
url: `/api/v1/tables/${table.id}/records/1`,
status: 404,
});
await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/2`,
url: `/api/v1/tables/${table.id}/records/2`,
status: 404,
});
});
@ -1080,7 +1080,7 @@ function textBased() {
it('Delete: invalid ID', async function () {
// Invalid table ID
await ncAxiosDelete({
url: `/api/v1/tables/123456789/rows`,
url: `/api/v1/tables/123456789/records`,
body: { Id: 100 },
status: unauthorizedResponse,
});
@ -1261,7 +1261,7 @@ function numberBased() {
// read record with Id 401
rsp = await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/401`,
url: `/api/v1/tables/${table.id}/records/401`,
});
expect(rsp.body).to.deep.equal({ ...records[0], Id: 401 });
@ -1452,7 +1452,7 @@ function selectBased() {
// read record with Id 401
rsp = await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/401`,
url: `/api/v1/tables/${table.id}/records/401`,
});
expect(rsp.body).to.deep.equal({ Id: 401, ...records[0] });
@ -1591,7 +1591,7 @@ function dateBased() {
// read record with Id 801
rsp = await ncAxiosGet({
url: `/api/v1/tables/${table.id}/rows/801`,
url: `/api/v1/tables/${table.id}/records/801`,
});
expect(rsp.body).to.deep.equal({ Id: 801, ...records[0] });
@ -2430,9 +2430,9 @@ function linkBased() {
status: 200,
});
// Link List: Invalid query parameter - offset > total rows
// Link List: Invalid query parameter - offset > total records
if (debugMode)
console.log('Link List: Invalid query parameter - offset > total rows');
console.log('Link List: Invalid query parameter - offset > total records');
await ncAxiosLinkGet({
...validParams,
query: { ...validParams.query, offset: 9999 },
@ -2457,9 +2457,9 @@ function linkBased() {
status: 200,
});
// Link List: Invalid query parameter - limit > total rows
// Link List: Invalid query parameter - limit > total records
if (debugMode)
console.log('Link List: Invalid query parameter - limit > total rows');
console.log('Link List: Invalid query parameter - limit > total records');
await ncAxiosLinkGet({
...validParams,
query: { ...validParams.query, limit: 9999 },

2
packages/nocodb/tests/unit/rest/tests/viewRow.test.ts

@ -672,7 +672,7 @@ function viewRowTests() {
.expect(200);
const row = response.body;
if (row['Title'] !== 'Test') throw new Error('Wrong row title');
if (row['Title'] !== 'Test') throw new Error('Wrong record title');
};
it('Create table row grid', async function () {

Loading…
Cancel
Save