Browse Source

refactor: system field name usage error message

pull/7304/head
Pranav C 11 months ago
parent
commit
58cdaf5e7b
  1. 12
      packages/nc-gui/composables/useColumnCreateStore.ts
  2. 1
      packages/nc-gui/lang/en.json

12
packages/nc-gui/composables/useColumnCreateStore.ts

@ -113,6 +113,18 @@ const [useProvideColumnCreateStore, useColumnCreateStore] = createInjectionState
{ {
validator: (rule: any, value: any) => { validator: (rule: any, value: any) => {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
if (
(tableExplorerColumns?.value || meta.value?.columns)?.some(
(c) =>
c.id !== formState.value.id && // ignore current column
// compare against column_name and title
((value || '').toLowerCase() === (c.column_name || '').toLowerCase() ||
(value || '').toLowerCase() === (c.title || '').toLowerCase()) &&
c.system,
)
) {
return reject(new Error(t('msg.error.duplicateSystemColumnName')))
}
if ( if (
(tableExplorerColumns?.value || meta.value?.columns)?.some( (tableExplorerColumns?.value || meta.value?.columns)?.some(
(c) => (c) =>

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

@ -1274,6 +1274,7 @@
"followingCharactersAreNotAllowed": "Following characters are not allowed", "followingCharactersAreNotAllowed": "Following characters are not allowed",
"columnNameRequired": "Field name is required", "columnNameRequired": "Field name is required",
"duplicateColumnName": "Duplicate field name", "duplicateColumnName": "Duplicate field name",
"duplicateSystemColumnName": "Name already used for system field",
"uiDataTypeRequired": "UI data type is required", "uiDataTypeRequired": "UI data type is required",
"columnNameExceedsCharacters": "The length of field name exceeds the max {value} characters", "columnNameExceedsCharacters": "The length of field name exceeds the max {value} characters",
"projectNameExceeds50Characters": "Base name exceeds 50 characters", "projectNameExceeds50Characters": "Base name exceeds 50 characters",

Loading…
Cancel
Save