From 02257fb5529c0176d2e426c4a1d62c5b3e63a3fc Mon Sep 17 00:00:00 2001 From: Diogo Bastos <50139916+DiogoABastos@users.noreply.github.com> Date: Fri, 26 Jul 2024 16:37:39 +0100 Subject: [PATCH] Revert "AAE-22847 Fill out input fields with default values (#9930)" (#10000) This reverts commit d91fba72599ad6013df5a6e536182dd24294cd38. --- .../dropdown/dropdown-cloud.widget.spec.ts | 18 ------------------ .../widgets/dropdown/dropdown-cloud.widget.ts | 16 ---------------- 2 files changed, 34 deletions(-) diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.spec.ts index 86ccd2db72..170e36a45a 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.spec.ts @@ -808,14 +808,6 @@ describe('DropdownCloudWidgetComponent', () => { } }); - const getVariableDropdownWidgetWithoutConfig = () => - new FormFieldModel(new FormModel({ taskId: 'fake-task-id', readOnly: 'false' }), { - id: 'variable-dropdown-id', - name: 'variable-options-dropdown', - type: 'dropdown', - optionType: 'variable' - }); - const checkDropdownVariableOptionsFailed = () => { const failedErrorMsgElement = fixture.debugElement.query(By.css('.adf-dropdown-failed-message')); expect(failedErrorMsgElement.nativeElement.textContent.trim()).toBe(errorIcon.concat('FORM.FIELD.VARIABLE_DROPDOWN_OPTIONS_FAILED')); @@ -823,16 +815,6 @@ describe('DropdownCloudWidgetComponent', () => { expect(widget.field.options.length).toEqual(0); }; - it('should add default variable config when variable config property is not provided', () => { - widget.field = getVariableDropdownWidgetWithoutConfig(); - fixture.detectChanges(); - - expect(widget.field.json.variableConfig.variableName).toBe(''); - expect(widget.field.json.variableConfig.optionsPath).toBe('data'); - expect(widget.field.json.variableConfig.optionsId).toBe('id'); - expect(widget.field.json.variableConfig.optionsLabel).toBe('name'); - }); - it('should display options persisted from process variable', async () => { widget.field = getVariableDropdownWidget( 'variables.json-variable', diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.ts b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.ts index 26371400b6..3b852b85ad 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.ts @@ -24,7 +24,6 @@ import { FormFieldTypes, FormService, RuleEntry, - VariableConfig, WidgetComponent } from '@alfresco/adf-core'; import { FormCloudService } from '../../../services/form-cloud.service'; @@ -67,7 +66,6 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI list$: Observable; filter$ = new BehaviorSubject(''); - private readonly defaultVariableName = ''; private readonly defaultVariableOptionId = 'id'; private readonly defaultVariableOptionLabel = 'name'; private readonly defaultVariableOptionPath = 'data'; @@ -82,7 +80,6 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI this.setPreviewState(); this.checkFieldOptionsSource(); this.updateOptions(); - this.setDefaultVariableConfig(); } private checkFieldOptionsSource(): void { @@ -106,19 +103,6 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI } } - private setDefaultVariableConfig(): void { - if (!this.field.json) { - return; - } - - this.field.json.variableConfig = { - variableName: this.field.json?.variableConfig?.variableName || this.defaultVariableName, - optionsPath: this.field.json?.variableConfig?.optionsPath || this.defaultVariableOptionPath, - optionsId: this.field.json?.variableConfig?.optionsId || this.defaultVariableOptionId, - optionsLabel: this.field.json?.variableConfig?.optionsLabel || this.defaultVariableOptionLabel - } as VariableConfig; - } - private persistFieldOptionsFromVariable(): void { const optionsPath = this.field?.variableConfig?.optionsPath ?? this.defaultVariableOptionPath; const variableName = this.field?.variableConfig?.variableName;