- {{ row[relatedTablePrimaryValueProp] }}
+ {{ row[relatedTableDisplayValueProp] }}
(Primary key : {{ getRelatedTableRowId(row) }})
diff --git a/packages/nc-gui/components/virtual-cell/components/ListItems.vue b/packages/nc-gui/components/virtual-cell/components/ListItems.vue
index 2cd3ed1cab..711030c443 100644
--- a/packages/nc-gui/components/virtual-cell/components/ListItems.vue
+++ b/packages/nc-gui/components/virtual-cell/components/ListItems.vue
@@ -32,7 +32,7 @@ const {
childrenExcludedList,
loadChildrenExcludedList,
childrenExcludedListPagination,
- relatedTablePrimaryValueProp,
+ relatedTableDisplayValueProp,
link,
getRelatedTableRowId,
relatedTableMeta,
@@ -201,7 +201,7 @@ const activeRow = (vNode?: InstanceType
) => {
:class="{ 'nc-selected-row': selectedRowIndex === i }"
@click="linkRow(refRow)"
>
- {{ refRow[relatedTablePrimaryValueProp] }}
+ {{ refRow[relatedTableDisplayValueProp] }}
({{ $t('labels.primaryKey') }} : {{ getRelatedTableRowId(refRow) }})
diff --git a/packages/nc-gui/composables/useExpandedFormStore.ts b/packages/nc-gui/composables/useExpandedFormStore.ts
index 90a9dff500..5402b68320 100644
--- a/packages/nc-gui/composables/useExpandedFormStore.ts
+++ b/packages/nc-gui/composables/useExpandedFormStore.ts
@@ -49,7 +49,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
const { sharedView } = useSharedView()
// getters
- const primaryValue = computed(() => {
+ const displayValue = computed(() => {
if (row?.value?.row) {
const col = meta?.value?.columns?.find((c) => c.pv)
@@ -199,7 +199,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
addOrEditStackRow(row.value, isNewRow)
}
- message.success(`${primaryValue.value || 'Row'} updated successfully.`)
+ message.success(`${displayValue.value || 'Row'} updated successfully.`)
changedColumns.value = new Set()
} catch (e: any) {
@@ -237,7 +237,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
isYou,
commentsDrawer,
row,
- primaryValue,
+ displayValue,
save,
changedColumns,
loadRow,
diff --git a/packages/nc-gui/composables/useLTARStore.ts b/packages/nc-gui/composables/useLTARStore.ts
index 1bc22cc1ca..5ed203b7e1 100644
--- a/packages/nc-gui/composables/useLTARStore.ts
+++ b/packages/nc-gui/composables/useLTARStore.ts
@@ -94,14 +94,14 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
await getMeta(colOptions.fk_related_model_id as string)
}
- const relatedTablePrimaryValueProp = computed(() => {
+ const relatedTableDisplayValueProp = computed(() => {
return (relatedTableMeta.value?.columns?.find((c) => c.pv) || relatedTableMeta?.value?.columns?.[0])?.title || ''
})
const relatedTablePrimaryKeyProps = computed(() => {
return relatedTableMeta.value?.columns?.filter((c) => c.pk)?.map((c) => c.title) ?? []
})
- const primaryValueProp = computed(() => {
+ const displayValueProp = computed(() => {
return (meta.value?.columns?.find((c: Required) => c.pv) || relatedTableMeta?.value?.columns?.[0])?.title
})
@@ -125,8 +125,8 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
offset: childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1),
where:
childrenExcludedListPagination.query &&
- `(${relatedTablePrimaryValueProp.value},like,${childrenExcludedListPagination.query})`,
- fields: [relatedTablePrimaryValueProp.value, ...relatedTablePrimaryKeyProps.value],
+ `(${relatedTableDisplayValueProp.value},like,${childrenExcludedListPagination.query})`,
+ fields: [relatedTableDisplayValueProp.value, ...relatedTablePrimaryKeyProps.value],
} as RequestParams,
},
)
@@ -142,8 +142,8 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
offset: childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1),
where:
childrenExcludedListPagination.query &&
- `(${relatedTablePrimaryValueProp.value},like,${childrenExcludedListPagination.query})`,
- fields: [relatedTablePrimaryValueProp.value, ...relatedTablePrimaryKeyProps.value],
+ `(${relatedTableDisplayValueProp.value},like,${childrenExcludedListPagination.query})`,
+ fields: [relatedTableDisplayValueProp.value, ...relatedTablePrimaryKeyProps.value],
} as any,
)
} else {
@@ -160,7 +160,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
// todo: where clause is missing from type
where:
childrenExcludedListPagination.query &&
- `(${relatedTablePrimaryValueProp.value},like,${childrenExcludedListPagination.query})`,
+ `(${relatedTableDisplayValueProp.value},like,${childrenExcludedListPagination.query})`,
} as any,
)
}
@@ -183,7 +183,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
limit: String(childrenListPagination.size),
offset: String(childrenListPagination.size * (childrenListPagination.page - 1)),
where:
- childrenListPagination.query && `(${relatedTablePrimaryValueProp.value},like,${childrenListPagination.query})`,
+ childrenListPagination.query && `(${relatedTableDisplayValueProp.value},like,${childrenListPagination.query})`,
} as any,
)
} else {
@@ -198,7 +198,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
limit: String(childrenListPagination.size),
offset: String(childrenListPagination.size * (childrenListPagination.page - 1)),
where:
- childrenListPagination.query && `(${relatedTablePrimaryValueProp.value},like,${childrenListPagination.query})`,
+ childrenListPagination.query && `(${relatedTableDisplayValueProp.value},like,${childrenListPagination.query})`,
} as any,
)
}
@@ -320,13 +320,13 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
return {
relatedTableMeta,
loadRelatedTableMeta,
- relatedTablePrimaryValueProp,
+ relatedTableDisplayValueProp,
childrenExcludedList,
childrenList,
rowId,
childrenExcludedListPagination,
childrenListPagination,
- primaryValueProp,
+ displayValueProp,
meta,
unlink,
link,
diff --git a/packages/noco-docs/content/en/setup-and-usages/primary-value.md b/packages/noco-docs/content/en/setup-and-usages/display-value.md
similarity index 50%
rename from packages/noco-docs/content/en/setup-and-usages/primary-value.md
rename to packages/noco-docs/content/en/setup-and-usages/display-value.md
index bd297bf2b4..28fd6fd5ab 100644
--- a/packages/noco-docs/content/en/setup-and-usages/primary-value.md
+++ b/packages/noco-docs/content/en/setup-and-usages/display-value.md
@@ -1,40 +1,42 @@
---
-title: "Primary Value"
-description: "Understanding Primary Value in NocoDB!"
+title: "Display Value"
+description: "Understanding Display Value in NocoDB!"
position: 580
category: "Product"
-menuTitle: "Primary Value"
+menuTitle: "Display Value"
---
-## What is a Primary Value ?
-- Primary value as the name stands is the primary or main value within a row of a table that you generally associate that row with.
+## What is a Display Value ?
+
+- Display Value as the name stands is the primary or main value within a row of a table that you generally associate that row with.
- It should be usually associated with a column which is uniquely identifiable. However, this uniqueness is not enforced at the database level.
+- Before v0.105.0, Display Value was known as Primary Value.
-## What is the use of Primary Value ?
-- Within a spreadsheet, primary value are always highlighted so that it is easier to recognise what row we are in.
-- And when LinkToAnotherRecord is created between two tables - it is the primary value that appears in LinkToAnotheRecord column.
+## What is the use of Display Value ?
+- Within a spreadsheet, Display Value are always highlighted so that it is easier to recognise what row we are in.
+- And when LinkToAnotherRecord is created between two tables - it is the Display Value that appears in LinkToAnotheRecord column.
-#### Example : Primary Value highlighted in Actor table
+#### Example : Display Value highlighted in Actor table
-#### Example : Primary Value highlighted in Film table
+#### Example : Display Value highlighted in Film table
-#### Example : Primary Value associated when LinkToAnotherRecord is created
+#### Example : Display Value associated when LinkToAnotherRecord is created
-## How to set Primary Value ?
+## How to set Display Value ?
-Click down arrow in the target column. Click `Set as Primary Value`.
+Click down arrow in the target column. Click `Set as Display Value`.
-
+![image](https://user-images.githubusercontent.com/35857179/219339727-dee5fdea-6db7-4a06-9e48-df7113cc63b1.png)
-## How is Primary Value identfied for existing database tables ?
+## How is Display Value identfied for existing database tables ?
- It is usually the first column after the primary key which is not a number.
- If there is no column which is not a number then the column adjacent to primary key is chosen.
-## Can I change the Primary Value to another column within tables ?
+## Can I change the Display Value to another column within tables ?
-- Yes, you can use the same way mentioned above to set Primary Value.
+- Yes, you can use the same way mentioned above to set Display Value.
diff --git a/packages/noco-docs/content/en/setup-and-usages/table-operations.md b/packages/noco-docs/content/en/setup-and-usages/table-operations.md
index 533e31180d..2aeeae8c43 100644
--- a/packages/noco-docs/content/en/setup-and-usages/table-operations.md
+++ b/packages/noco-docs/content/en/setup-and-usages/table-operations.md
@@ -159,7 +159,7 @@ You can use Quick Import when you have data from external sources such as Airtab
- **Use First Row as Headers**: If it is checked, the first row will be treated as header row.
- **Import Data**: If it is checked, all data will be imported. Otherwise, only table will be created.
![image](https://user-images.githubusercontent.com/35857179/197454479-1ed18dce-1d0b-4ee3-88b3-9b6a132dea2a.png)
-- You can revise the table name by double clicking it, column name and column type. By default, the first column will be chosen as Primary Value and cannot be deleted.
+- You can revise the table name by double clicking it, column name and column type. By default, the first column will be chosen as Display Value and cannot be deleted.
![image](https://user-images.githubusercontent.com/35857179/197454633-5b30323e-2b13-4c55-843a-948c093d373e.png)
- Click `Import` to start importing process. The table will be created and the data will be imported.
![image](https://user-images.githubusercontent.com/35857179/197455547-2d93df5e-a7f0-4c88-af53-990067625967.png)
@@ -172,7 +172,7 @@ You can use Quick Import when you have data from external sources such as Airtab
- **Use First Row as Headers**: If it is checked, the first row will be treated as header row.
- **Import Data**: If it is checked, all data will be imported. Otherwise, only table will be created.
![image](https://user-images.githubusercontent.com/35857179/197455788-8dd8a7d1-38f3-48c3-a05e-6ab0cf25045c.png)
-- You can revise the table name, column name and column type. By default, the first column will be chosen as Primary Value and cannot be deleted.
+- You can revise the table name, column name and column type. By default, the first column will be chosen as Display Value and cannot be deleted.
Note: If your Excel file contains multiple sheets, each sheet will be stored in a separate table.
diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts
index 901e358d8f..ce0ec02ad8 100644
--- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts
+++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts
@@ -119,7 +119,7 @@ const parseConditionV2 = async (
? negatedMapping[filter.comparison_op]
: {}),
fk_model_id: childModel.id,
- fk_column_id: childModel?.primaryValue?.id,
+ fk_column_id: childModel?.displayValue?.id,
}),
knex,
aliasCount
@@ -154,7 +154,7 @@ const parseConditionV2 = async (
? negatedMapping[filter.comparison_op]
: {}),
fk_model_id: parentModel.id,
- fk_column_id: parentModel?.primaryValue?.id,
+ fk_column_id: parentModel?.displayValue?.id,
}),
knex,
aliasCount
@@ -209,7 +209,7 @@ const parseConditionV2 = async (
? negatedMapping[filter.comparison_op]
: {}),
fk_model_id: parentModel.id,
- fk_column_id: parentModel?.primaryValue?.id,
+ fk_column_id: parentModel?.displayValue?.id,
}),
knex,
aliasCount
@@ -841,7 +841,7 @@ async function nestedConditionJoin(
new Filter({
...filter,
fk_model_id: childModel.id,
- fk_column_id: childModel.primaryValue?.id,
+ fk_column_id: childModel.displayValue?.id,
}),
knex,
aliasCount,
@@ -857,7 +857,7 @@ async function nestedConditionJoin(
new Filter({
...filter,
fk_model_id: parentModel.id,
- fk_column_id: parentModel?.primaryValue?.id,
+ fk_column_id: parentModel?.displayValue?.id,
}),
knex,
aliasCount,
@@ -873,7 +873,7 @@ async function nestedConditionJoin(
new Filter({
...filter,
fk_model_id: parentModel.id,
- fk_column_id: parentModel.primaryValue?.id,
+ fk_column_id: parentModel.displayValue?.id,
}),
knex,
aliasCount,
diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts
index 99652cec1c..c7c2b37197 100644
--- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts
+++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts
@@ -269,7 +269,7 @@ async function _formulaQueryBuilder(
);
cn = knex.raw('??.??', [
nestedAlias,
- parentModel?.primaryValue?.column_name,
+ parentModel?.displayValue?.column_name,
]);
}
break;
@@ -283,7 +283,7 @@ async function _formulaQueryBuilder(
);
cn = knex.raw('??.??', [
nestedAlias,
- childModel?.primaryValue?.column_name,
+ childModel?.displayValue?.column_name,
]);
}
break;
@@ -311,7 +311,7 @@ async function _formulaQueryBuilder(
}
cn = knex.raw('??.??', [
nestedAlias,
- parentModel?.primaryValue?.column_name,
+ parentModel?.displayValue?.column_name,
]);
}
@@ -424,7 +424,7 @@ async function _formulaQueryBuilder(
let selectQb;
if (relation.type === 'bt') {
selectQb = knex(parentModel.table_name)
- .select(parentModel?.primaryValue?.column_name)
+ .select(parentModel?.displayValue?.column_name)
.where(
`${parentModel.table_name}.${parentColumn.column_name}`,
knex.raw(`??`, [
@@ -447,7 +447,7 @@ async function _formulaQueryBuilder(
getAggregateFn(fn)({
qb,
knex,
- cn: childModel?.primaryValue?.column_name,
+ cn: childModel?.displayValue?.column_name,
})
)
.wrap('(', ')');
@@ -499,7 +499,7 @@ async function _formulaQueryBuilder(
getAggregateFn(fn)({
qb,
knex,
- cn: parentModel?.primaryValue?.column_name,
+ cn: parentModel?.displayValue?.column_name,
})
)
.wrap('(', ')');
diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts
index 9e6af05f6e..8b8c3def97 100644
--- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts
+++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts
@@ -24,7 +24,7 @@ const getAst = async ({
...(model.primaryKeys
? model.primaryKeys.reduce((o, pk) => ({ ...o, [pk.title]: 1 }), {})
: {}),
- ...(model.primaryValue ? { [model.primaryValue.title]: 1 } : {}),
+ ...(model.displayValue ? { [model.displayValue.title]: 1 } : {}),
};
}
diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/sortV2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/sortV2.ts
index 1e2e5e27ce..9baac9bfd7 100644
--- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/sortV2.ts
+++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/sortV2.ts
@@ -153,7 +153,7 @@ export default async function sortV2(
`${nestedAlias}.${parentColumn.column_name}`,
`${prevAlias}.${childColumn.column_name}`
)
- .select(parentModel?.primaryValue?.column_name);
+ .select(parentModel?.displayValue?.column_name);
}
break;
case UITypes.Formula:
@@ -201,7 +201,7 @@ export default async function sortV2(
await parentModel.getColumns();
const selectQb = knex(parentModel.table_name)
- .select(parentModel?.primaryValue?.column_name)
+ .select(parentModel?.displayValue?.column_name)
.where(
`${parentModel.table_name}.${parentColumn.column_name}`,
knex.raw(`??`, [
diff --git a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/BaseModelXcMeta.ts b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/BaseModelXcMeta.ts
index dc13f6f8df..6548fa7e0c 100644
--- a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/BaseModelXcMeta.ts
+++ b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/BaseModelXcMeta.ts
@@ -1,5 +1,5 @@
import BaseRender from '../../BaseRender';
-import mapDefaultPrimaryValue from '../../../../../meta/helpers/mapDefaultPrimaryValue';
+import mapDefaultDisplayValue from '../../../../../meta/helpers/mapDefaultDisplayValue';
import { UITypes } from 'nocodb-sdk';
abstract class BaseModelXcMeta extends BaseRender {
@@ -79,7 +79,7 @@ abstract class BaseModelXcMeta extends BaseRender {
columnsArr.push(columnObj);
}
- this.mapDefaultPrimaryValue(columnsArr);
+ this.mapDefaultDisplayValue(columnsArr);
return columnsArr;
}
@@ -127,8 +127,8 @@ abstract class BaseModelXcMeta extends BaseRender {
return virtualColumns;
}
- public mapDefaultPrimaryValue(columnsArr: any[]): void {
- mapDefaultPrimaryValue(columnsArr);
+ public mapDefaultDisplayValue(columnsArr: any[]): void {
+ mapDefaultDisplayValue(columnsArr);
}
}
diff --git a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaMssql.ts b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaMssql.ts
index 4e861e14bf..d9180c812f 100644
--- a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaMssql.ts
+++ b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaMssql.ts
@@ -544,7 +544,7 @@ class ModelXcMetaMssql extends BaseModelXcMeta {
columnsArr.push(columnObj);
}
- this.mapDefaultPrimaryValue(columnsArr);
+ this.mapDefaultDisplayValue(columnsArr);
return columnsArr;
}*/
diff --git a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaMysql.ts b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaMysql.ts
index dfb493fcdf..84d478c6d2 100644
--- a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaMysql.ts
+++ b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaMysql.ts
@@ -163,7 +163,7 @@ class ModelXcMetaMysql extends BaseModelXcMeta {
columnsArr.push(columnObj);
}
- this.mapDefaultPrimaryValue(columnsArr);
+ this.mapDefaultDisplayValue(columnsArr);
return columnsArr;
}
*/
diff --git a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaOracle.ts b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaOracle.ts
index 5d7f973ebf..997d886de4 100644
--- a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaOracle.ts
+++ b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaOracle.ts
@@ -163,7 +163,7 @@ class ModelXcMetaOracle extends BaseModelXcMeta {
columnsArr.push(columnObj);
}
- this.mapDefaultPrimaryValue(columnsArr);
+ this.mapDefaultDisplayValue(columnsArr);
return columnsArr;
}
*/
diff --git a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaPg.ts b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaPg.ts
index 3fd6a4a0aa..edc8254221 100644
--- a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaPg.ts
+++ b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaPg.ts
@@ -953,7 +953,7 @@ class ModelXcMetaPg extends BaseModelXcMeta {
columnsArr.push(columnObj);
}
- this.mapDefaultPrimaryValue(columnsArr);
+ this.mapDefaultDisplayValue(columnsArr);
return columnsArr;
}*/
diff --git a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaSnowflake.ts b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaSnowflake.ts
index 07ef5edd72..bcfe3f7a49 100644
--- a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaSnowflake.ts
+++ b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaSnowflake.ts
@@ -953,7 +953,7 @@ class ModelXcMetaSnowflake extends BaseModelXcMeta {
columnsArr.push(columnObj);
}
- this.mapDefaultPrimaryValue(columnsArr);
+ this.mapDefaultDisplayValue(columnsArr);
return columnsArr;
}*/
diff --git a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaSqlite.ts b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaSqlite.ts
index 99c5761b69..f3ae40b1db 100644
--- a/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaSqlite.ts
+++ b/packages/nocodb/src/lib/db/sql-mgr/code/models/xc/ModelXcMetaSqlite.ts
@@ -504,7 +504,7 @@ class ModelXcMetaSqlite extends BaseModelXcMeta {
columnsArr.push(columnObj);
}
- this.mapDefaultPrimaryValue(columnsArr);
+ this.mapDefaultDisplayValue(columnsArr);
return columnsArr;
}
*/
diff --git a/packages/nocodb/src/lib/meta/api/columnApis.ts b/packages/nocodb/src/lib/meta/api/columnApis.ts
index 0617b01e48..97fbb68c06 100644
--- a/packages/nocodb/src/lib/meta/api/columnApis.ts
+++ b/packages/nocodb/src/lib/meta/api/columnApis.ts
@@ -31,7 +31,7 @@ import NcMetaIO from '../NcMetaIO';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { NcError } from '../helpers/catchError';
import getColumnPropsFromUIDT from '../helpers/getColumnPropsFromUIDT';
-import mapDefaultPrimaryValue from '../helpers/mapDefaultPrimaryValue';
+import mapDefaultDisplayValue from '../helpers/mapDefaultDisplayValue';
import NcConnectionMgrv2 from '../../utils/common/NcConnectionMgrv2';
import { metaApiMetrics } from '../helpers/apiMetrics';
import FormulaColumn from '../../models/FormulaColumn';
@@ -1592,11 +1592,11 @@ export async function columnDelete(req: Request, res: Response) {
await table.getColumns();
- const primaryValueColumn = mapDefaultPrimaryValue(table.columns);
- if (primaryValueColumn) {
+ const displayValueColumn = mapDefaultDisplayValue(table.columns);
+ if (displayValueColumn) {
await Model.updatePrimaryColumn(
- primaryValueColumn.fk_model_id,
- primaryValueColumn.id
+ displayValueColumn.fk_model_id,
+ displayValueColumn.id
);
}
diff --git a/packages/nocodb/src/lib/meta/api/dataApis/helpers.ts b/packages/nocodb/src/lib/meta/api/dataApis/helpers.ts
index a6ec17ea5a..aec0e4216e 100644
--- a/packages/nocodb/src/lib/meta/api/dataApis/helpers.ts
+++ b/packages/nocodb/src/lib/meta/api/dataApis/helpers.ts
@@ -225,7 +225,7 @@ export async function serializeCellValue({
await relatedModel.getColumns();
return [...(Array.isArray(value) ? value : [value])]
.map((v) => {
- return v[relatedModel.primaryValue?.title];
+ return v[relatedModel.displayValue?.title];
})
.join(', ');
}
diff --git a/packages/nocodb/src/lib/meta/api/helpers/populateMeta.ts b/packages/nocodb/src/lib/meta/api/helpers/populateMeta.ts
index 8e5f9d2928..ff7861a529 100644
--- a/packages/nocodb/src/lib/meta/api/helpers/populateMeta.ts
+++ b/packages/nocodb/src/lib/meta/api/helpers/populateMeta.ts
@@ -10,7 +10,7 @@ import getTableNameAlias, {
} from '../../helpers/getTableName';
import LinkToAnotherRecordColumn from '../../../models/LinkToAnotherRecordColumn';
import getColumnUiType from '../../helpers/getColumnUiType';
-import mapDefaultPrimaryValue from '../../helpers/mapDefaultPrimaryValue';
+import mapDefaultDisplayValue from '../../helpers/mapDefaultDisplayValue';
import { extractAndGenerateManyToManyRelations } from '../metaDiffApis';
import { ModelTypes, UITypes, ViewTypes } from 'nocodb-sdk';
import { IGNORE_TABLES } from '../../../utils/common/BaseApiBuilder';
@@ -90,7 +90,7 @@ export async function populateMeta(base: Base, project: Project): Promise {
? []
: tableRelations.filter((r) => r.tn === table.tn);
- mapDefaultPrimaryValue(columns);
+ mapDefaultDisplayValue(columns);
// add vitual columns
const virtualColumns = [
diff --git a/packages/nocodb/src/lib/meta/api/metaDiffApis.ts b/packages/nocodb/src/lib/meta/api/metaDiffApis.ts
index e9a0fdff93..35f8118e21 100644
--- a/packages/nocodb/src/lib/meta/api/metaDiffApis.ts
+++ b/packages/nocodb/src/lib/meta/api/metaDiffApis.ts
@@ -14,7 +14,7 @@ import LinkToAnotherRecordColumn from '../../models/LinkToAnotherRecordColumn';
import { getUniqueColumnAliasName } from '../helpers/getUniqueName';
import NcHelp from '../../utils/NcHelp';
import getTableNameAlias, { getColumnNameAlias } from '../helpers/getTableName';
-import mapDefaultPrimaryValue from '../helpers/mapDefaultPrimaryValue';
+import mapDefaultDisplayValue from '../helpers/mapDefaultDisplayValue';
import getColumnUiType from '../helpers/getColumnUiType';
import { metaApiMetrics } from '../helpers/apiMetrics';
@@ -602,7 +602,7 @@ export async function metaDiffSync(req, res) {
await sqlClient.columnList({ tn: table_name })
)?.data?.list?.map((c) => ({ ...c, column_name: c.cn }));
- mapDefaultPrimaryValue(columns);
+ mapDefaultDisplayValue(columns);
const model = await Model.insert(project.id, base.id, {
table_name: table_name,
@@ -630,7 +630,7 @@ export async function metaDiffSync(req, res) {
await sqlClient.columnList({ tn: table_name })
)?.data?.list?.map((c) => ({ ...c, column_name: c.cn }));
- mapDefaultPrimaryValue(columns);
+ mapDefaultDisplayValue(columns);
const model = await Model.insert(project.id, base.id, {
table_name: table_name,
@@ -798,7 +798,7 @@ export async function baseMetaDiffSync(req, res) {
await sqlClient.columnList({ tn: table_name })
)?.data?.list?.map((c) => ({ ...c, column_name: c.cn }));
- mapDefaultPrimaryValue(columns);
+ mapDefaultDisplayValue(columns);
const model = await Model.insert(project.id, base.id, {
table_name: table_name,
@@ -826,7 +826,7 @@ export async function baseMetaDiffSync(req, res) {
await sqlClient.columnList({ tn: table_name })
)?.data?.list?.map((c) => ({ ...c, column_name: c.cn }));
- mapDefaultPrimaryValue(columns);
+ mapDefaultDisplayValue(columns);
const model = await Model.insert(project.id, base.id, {
table_name: table_name,
diff --git a/packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts b/packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts
index 6141d9ce67..ee6b053cd1 100644
--- a/packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts
+++ b/packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts
@@ -237,7 +237,7 @@ async function serializeCellValue({
await relatedModel.getColumns();
return [...(Array.isArray(value) ? value : [value])]
.map((v) => {
- return v[relatedModel.primaryValue?.title];
+ return v[relatedModel.displayValue?.title];
})
.join(', ');
}
diff --git a/packages/nocodb/src/lib/meta/api/sync/helpers/job.ts b/packages/nocodb/src/lib/meta/api/sync/helpers/job.ts
index abe8e02d87..80820cfeaf 100644
--- a/packages/nocodb/src/lib/meta/api/sync/helpers/job.ts
+++ b/packages/nocodb/src/lib/meta/api/sync/helpers/job.ts
@@ -1292,7 +1292,7 @@ export default async (
async function nocoSetPrimary(aTblSchema) {
for (let idx = 0; idx < aTblSchema.length; idx++) {
logDetailed(
- `[${idx + 1}/${aTblSchema.length}] Configuring Primary value : ${
+ `[${idx + 1}/${aTblSchema.length}] Configuring Display value : ${
aTblSchema[idx].name
}`
);
@@ -2232,10 +2232,10 @@ export default async (
logDetailed('Migrating Lookup form Rollup columns completed');
}
}
- logDetailed('Configuring Primary value column');
- // configure primary values
+ logDetailed('Configuring Display Value column');
+ // configure Display Value
await nocoSetPrimary(aTblSchema);
- logDetailed('Configuring primary value column completed');
+ logDetailed('Configuring Display Value column completed');
logBasic('Configuring User(s)');
// add users
diff --git a/packages/nocodb/src/lib/meta/api/tableApis.ts b/packages/nocodb/src/lib/meta/api/tableApis.ts
index 67019bc5cd..8eb3d6a10e 100644
--- a/packages/nocodb/src/lib/meta/api/tableApis.ts
+++ b/packages/nocodb/src/lib/meta/api/tableApis.ts
@@ -20,7 +20,7 @@ import ncMetaAclMw from '../helpers/ncMetaAclMw';
import { xcVisibilityMetaGet } from './modelVisibilityApis';
import View from '../../models/View';
import getColumnPropsFromUIDT from '../helpers/getColumnPropsFromUIDT';
-import mapDefaultPrimaryValue from '../helpers/mapDefaultPrimaryValue';
+import mapDefaultDisplayValue from '../helpers/mapDefaultDisplayValue';
import { NcError } from '../helpers/catchError';
import getTableNameAlias, { getColumnNameAlias } from '../helpers/getTableName';
import Column from '../../models/Column';
@@ -195,7 +195,7 @@ export async function tableCreate(req: Request, res) {
ip: (req as any).clientIp,
}).then(() => {});
- mapDefaultPrimaryValue(req.body.columns);
+ mapDefaultDisplayValue(req.body.columns);
Tele.emit('evt', { evt_type: 'table:created' });
diff --git a/packages/nocodb/src/lib/meta/helpers/mapDefaultPrimaryValue.ts b/packages/nocodb/src/lib/meta/helpers/mapDefaultDisplayValue.ts
similarity index 91%
rename from packages/nocodb/src/lib/meta/helpers/mapDefaultPrimaryValue.ts
rename to packages/nocodb/src/lib/meta/helpers/mapDefaultDisplayValue.ts
index 67c7f38a79..8f12d40d13 100644
--- a/packages/nocodb/src/lib/meta/helpers/mapDefaultPrimaryValue.ts
+++ b/packages/nocodb/src/lib/meta/helpers/mapDefaultDisplayValue.ts
@@ -1,6 +1,6 @@
import { ColumnType } from 'nocodb-sdk';
-export default function mapDefaultPrimaryValue(
+export default function mapDefaultDisplayValue(
columnsArr: Array
): void | T {
if (!columnsArr.some((column) => column.pv)) {
diff --git a/packages/nocodb/src/lib/models/Model.ts b/packages/nocodb/src/lib/models/Model.ts
index 3708b2e38f..c22c115d02 100644
--- a/packages/nocodb/src/lib/models/Model.ts
+++ b/packages/nocodb/src/lib/models/Model.ts
@@ -84,7 +84,7 @@ export default class Model implements TableType {
return this.columns?.filter((c) => c.pk);
}
- public get primaryValue(): Column {
+ public get displayValue(): Column {
if (!this.columns) return null;
const pCol = this.columns?.find((c) => c.pv);
if (pCol) return pCol;
@@ -561,7 +561,7 @@ export default class Model implements TableType {
ncMeta = Noco.ncMeta
) {
const model = await this.getWithInfo({ id: tableId });
- const currentPvCol = model.primaryValue;
+ const currentPvCol = model.displayValue;
const newPvCol = model.columns.find((c) => c.id === columnId);
if (!newPvCol) NcError.badRequest('Column not found');
diff --git a/packages/nocodb/src/lib/models/View.ts b/packages/nocodb/src/lib/models/View.ts
index 875be37e27..64a2df528c 100644
--- a/packages/nocodb/src/lib/models/View.ts
+++ b/packages/nocodb/src/lib/models/View.ts
@@ -375,10 +375,10 @@ export default class View implements ViewType {
let kanbanShowLimit = 0;
if (view.type === ViewTypes.KANBAN && !copyFromView) {
- // sort by primary value & attachment first, then by singleLineText & Number
+ // sort by display value & attachment first, then by singleLineText & Number
// so that later we can handle control `show` easily
columns.sort((a, b) => {
- const primaryValueOrder = b.pv - a.pv;
+ const displayValueOrder = b.pv - a.pv;
const attachmentOrder =
+(b.uidt === UITypes.Attachment) - +(a.uidt === UITypes.Attachment);
const singleLineTextOrder =
@@ -388,7 +388,7 @@ export default class View implements ViewType {
+(b.uidt === UITypes.Number) - +(a.uidt === UITypes.Number);
const defaultOrder = b.order - a.order;
return (
- primaryValueOrder ||
+ displayValueOrder ||
attachmentOrder ||
singleLineTextOrder ||
numberOrder ||
diff --git a/packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts b/packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts
index 5af521950e..210eb61a32 100644
--- a/packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts
+++ b/packages/nocodb/src/lib/utils/common/BaseApiBuilder.ts
@@ -2511,11 +2511,11 @@ export default abstract class BaseApiBuilder
ctx,
filename: '',
}).getVitualColumns();
- // set default primary values
+ // set default display values
ModelXcMetaFactory.create(
this.connectionConfig,
{}
- ).mapDefaultPrimaryValue(meta.columns);
+ ).mapDefaultDisplayValue(meta.columns);
// update meta
await this.xcMeta.metaUpdate(
this.projectId,
diff --git a/packages/nocodb/src/lib/version-upgrader/ncStickyColumnUpgrader.ts b/packages/nocodb/src/lib/version-upgrader/ncStickyColumnUpgrader.ts
index 60ebe6647e..67b02ce842 100644
--- a/packages/nocodb/src/lib/version-upgrader/ncStickyColumnUpgrader.ts
+++ b/packages/nocodb/src/lib/version-upgrader/ncStickyColumnUpgrader.ts
@@ -1,9 +1,9 @@
import { NcUpgraderCtx } from './NcUpgrader';
import { MetaTable } from '../utils/globals';
-// before 0.104.3, primary value column can be in any position in table
+// before 0.104.3, display value column can be in any position in table
// with this upgrade we introduced sticky primary column feature
-// this upgrader will make primary value column first column in grid views
+// this upgrader will make display value column first column in grid views
export default async function ({ ncMeta }: NcUpgraderCtx) {
const grid_columns = await ncMeta.metaList2(
diff --git a/tests/playwright/pages/Dashboard/Grid/Column/index.ts b/tests/playwright/pages/Dashboard/Grid/Column/index.ts
index 3e2948c1bc..21af2677bc 100644
--- a/tests/playwright/pages/Dashboard/Grid/Column/index.ts
+++ b/tests/playwright/pages/Dashboard/Grid/Column/index.ts
@@ -44,7 +44,7 @@ export class ColumnPageObject extends BasePage {
timeFormat = '',
insertAfterColumnTitle,
insertBeforeColumnTitle,
- isPrimaryValue = false,
+ isDisplayValue = false,
}: {
title: string;
type?: string;
@@ -61,12 +61,12 @@ export class ColumnPageObject extends BasePage {
timeFormat?: string;
insertBeforeColumnTitle?: string;
insertAfterColumnTitle?: string;
- isPrimaryValue?: boolean;
+ isDisplayValue?: boolean;
}) {
if (insertBeforeColumnTitle) {
await this.grid.get().locator(`th[data-title="${insertBeforeColumnTitle}"] .nc-ui-dt-dropdown`).click();
- if (isPrimaryValue) {
+ if (isDisplayValue) {
await expect(this.rootPage.locator('li[role="menuitem"]:has-text("Insert Before")')).toHaveCount(0);
return;
}
@@ -321,10 +321,10 @@ export class ColumnPageObject extends BasePage {
await this.grid.get().locator(`th[data-title="${expectedTitle}"]`).isVisible();
}
- async hideColumn({ title, isPrimaryValue = false }: { title: string; isPrimaryValue?: boolean }) {
+ async hideColumn({ title, isDisplayValue = false }: { title: string; isDisplayValue?: boolean }) {
await this.grid.get().locator(`th[data-title="${title}"] .nc-ui-dt-dropdown`).click();
- if (isPrimaryValue) {
+ if (isDisplayValue) {
await expect(this.rootPage.locator('li[role="menuitem"]:has-text("Hide Field")')).toHaveCount(0);
return;
}
diff --git a/tests/playwright/tests/columnMenuOperations.spec.ts b/tests/playwright/tests/columnMenuOperations.spec.ts
index e2c78eb9af..01a4e016bf 100644
--- a/tests/playwright/tests/columnMenuOperations.spec.ts
+++ b/tests/playwright/tests/columnMenuOperations.spec.ts
@@ -91,7 +91,7 @@ test.describe('Column menu operations', () => {
title: 'InsertBeforeColumn',
type: 'SingleLineText',
insertBeforeColumnTitle: 'Title',
- isPrimaryValue: true,
+ isDisplayValue: true,
});
await dashboard.grid.column.create({
@@ -108,7 +108,7 @@ test.describe('Column menu operations', () => {
await dashboard.grid.column.hideColumn({
title: 'Title',
- isPrimaryValue: true,
+ isDisplayValue: true,
});
await dashboard.grid.column.hideColumn({