From d089521afd17890e7c45349b832611575b5ac3a2 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 23 Jul 2024 12:00:00 +0200 Subject: [PATCH] Query Builder: Set alias automatically based on name --- .../aql-builder-select-item.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/modules/aqls/components/aql-builder-select-item/aql-builder-select-item.component.ts b/src/app/modules/aqls/components/aql-builder-select-item/aql-builder-select-item.component.ts index 4c9bbd76b..c835ae747 100644 --- a/src/app/modules/aqls/components/aql-builder-select-item/aql-builder-select-item.component.ts +++ b/src/app/modules/aqls/components/aql-builder-select-item/aql-builder-select-item.component.ts @@ -22,9 +22,12 @@ export class AqlBuilderSelectItemComponent implements OnInit, OnDestroy { ngOnInit(): void { this.aliasForm = new UntypedFormGroup({ - value: new UntypedFormControl(this.item.givenName), + value: new UntypedFormControl( + this.item.givenName || this.item.name.replace(/(^[^a-zA-Z]+)|[^0-9a-zA-Z_]+/g, '_') + ), }) + this.handleAliasChange(this.aliasForm.get('value').value) this.subscriptions.add( this.aliasForm.get('value').valueChanges.subscribe((value) => this.handleAliasChange(value)) )