Skip to content

Commit

Permalink
[ACS-6211] Resolved UI alignment issue in create rule dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
swapnil-verma-gl committed Nov 27, 2023
1 parent 7c95b53 commit a1c20cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<form class="aca-rule-action__form" [formGroup]="form">

<mat-form-field>
<mat-form-field class="aca-rule-action-full-width">
<mat-select
formControlName="actionDefinitionId"
data-automation-id="rule-action-select"
Expand All @@ -14,9 +14,10 @@
</mat-form-field>

<adf-card-view
*ngIf="cardViewItems?.length > 0"
data-automation-id="rule-action-card-view"
[properties]="cardViewItems"
[ngClass]="{ 'aca-rule-action-full-width': isFullWidth }"
class="aca-rule-action-full-width"
[editable]="!readOnly">
</adf-card-view>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
}

&-full-width {
width: 100%;
flex: 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
get parameterConstraints(): ActionParameterConstraint[] {
return this._parameterConstraints;
}

set parameterConstraints(value) {
this._parameterConstraints = value.map((obj) => ({ ...obj, constraints: this.parseConstraintsToSelectOptions(obj.constraints) }));
this._parameterConstraints = value.map((obj) => ({
...obj,
constraints: this.parseConstraintsToSelectOptions(obj.constraints)
}));
}

isFullWidth = false;

form = new FormGroup({
actionDefinitionId: new FormControl('', Validators.required)
});
Expand All @@ -100,10 +102,6 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
return this.actionDefinitions.find((actionDefinition: ActionDefinitionTransformed) => actionDefinition.id === this.selectedActionDefinitionId);
}

get cardViewStyle() {
return this.isFullWidth ? { width: '100%' } : {};
}

onChange: (action: RuleAction) => void = () => undefined;
onTouch: () => void = () => undefined;

Expand Down Expand Up @@ -171,7 +169,6 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh

setCardViewProperties() {
this.cardViewItems = (this.selectedActionDefinition?.parameterDefinitions ?? []).map((paramDef) => {
this.isFullWidth = false;
const constraintsForDropdownBox = this._parameterConstraints.find((obj) => obj.name === paramDef.name);
const cardViewPropertiesModel = {
label: paramDef.displayLabel + (paramDef.mandatory ? ' *' : ''),
Expand Down Expand Up @@ -208,7 +205,6 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
// falls through
default:
if (constraintsForDropdownBox && !this.readOnly) {
this.isFullWidth = true;
return new CardViewSelectItemModel({
...cardViewPropertiesModel,
value: (this.parameters[paramDef.name] as string) ?? '',
Expand Down

0 comments on commit a1c20cd

Please sign in to comment.