[ACS-9386] Fix wrong dialog title & button text on edit rule dialog (#4445)

This commit is contained in:
Mykyta Maliarchuk 2025-03-19 08:55:20 +01:00 committed by GitHub
parent 801d671f98
commit 73d4743b62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View File

@ -87,6 +87,11 @@ describe('EditRuleDialogSmartComponent', () => {
expect(titleElement.innerText.trim()).toBe('ACA_FOLDER_RULES.EDIT_RULE_DIALOG.CREATE');
});
it('should set correct title and submitLabel for create mode', () => {
expect(fixture.componentInstance.title).toBe('ACA_FOLDER_RULES.EDIT_RULE_DIALOG.CREATE_TITLE');
expect(fixture.componentInstance.submitLabel).toBe('ACA_FOLDER_RULES.EDIT_RULE_DIALOG.CREATE');
});
});
describe('With dialog options passed', () => {
@ -113,5 +118,10 @@ describe('EditRuleDialogSmartComponent', () => {
expect(titleElement.innerText.trim()).toBe('ACA_FOLDER_RULES.EDIT_RULE_DIALOG.UPDATE');
});
it('should set correct title and submitLabel for update mode', () => {
expect(fixture.componentInstance.title).toBe('ACA_FOLDER_RULES.EDIT_RULE_DIALOG.UPDATE_TITLE');
expect(fixture.componentInstance.submitLabel).toBe('ACA_FOLDER_RULES.EDIT_RULE_DIALOG.UPDATE');
});
});
});

View File

@ -54,19 +54,21 @@ export class EditRuleDialogUiComponent {
formValid = false;
model: Partial<Rule>;
nodeId = '';
title = '';
submitLabel = '';
actionDefinitions$;
parameterConstraints$;
formValue: Partial<Rule>;
@Output() submitted = new EventEmitter<Partial<Rule>>();
title = 'ACA_FOLDER_RULES.EDIT_RULE_DIALOG.' + (this.isUpdateMode ? 'UPDATE_TITLE' : 'CREATE_TITLE');
submitLabel = 'ACA_FOLDER_RULES.EDIT_RULE_DIALOG.' + (this.isUpdateMode ? 'UPDATE' : 'CREATE');
constructor(@Inject(MAT_DIALOG_DATA) public data: EditRuleDialogOptions) {
this.model = this.data?.model || {};
this.nodeId = this.data?.nodeId;
this.actionDefinitions$ = this.data?.actionDefinitions$;
this.parameterConstraints$ = this.data?.parameterConstraints$;
this.title = 'ACA_FOLDER_RULES.EDIT_RULE_DIALOG.' + (this.isUpdateMode ? 'UPDATE_TITLE' : 'CREATE_TITLE');
this.submitLabel = 'ACA_FOLDER_RULES.EDIT_RULE_DIALOG.' + (this.isUpdateMode ? 'UPDATE' : 'CREATE');
}
get isUpdateMode(): boolean {