RED-5741: Fixed ui sending empty string when technical name is _.
This commit is contained in:
parent
484704683c
commit
1b3676cc93
@ -201,9 +201,12 @@ export class AddEditEntityComponent extends BaseFormComponent implements OnInit
|
||||
const existingTechnicalNames = this._dictionariesMapService.get(this.dossierTemplateId).map(dict => dict.type);
|
||||
const baseTechnicalName = toSnakeCase(value.trim());
|
||||
let technicalName = baseTechnicalName.replaceAll(/[^A-Za-z0-9_-]/g, '');
|
||||
if (!technicalName.length && baseTechnicalName.length) {
|
||||
technicalName = '_';
|
||||
}
|
||||
let suffix = 1;
|
||||
while (existingTechnicalNames.includes(technicalName)) {
|
||||
technicalName = [technicalName, suffix++].join('_');
|
||||
technicalName = technicalName === '_' ? `${technicalName}${suffix++}` : [technicalName, suffix++].join('_');
|
||||
}
|
||||
return technicalName;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user