Skip to content

Commit

Permalink
fix: policy dry run bugs[3141]
Browse files Browse the repository at this point in the history
  • Loading branch information
Ihar committed Dec 21, 2024
1 parent 090e75e commit 5105666
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div
[class.hidden-logotype]="collapsed"
class="span-icon"
(click)="compareMenu.toggle($event); onMenuOpened($event)">
(click)="compareMenu.toggle($event); onMenuOpened($event)"
>
<span>Documents</span>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class WipeRequestsDialogComponent implements OnInit {
private dialogRef: DynamicDialogRef,
private config: DynamicDialogConfig,
) {
this.contract = this.config.data.contract;
this.contract = this.config.data ?? {};

this.contractId = this.contract.contractId;
this.version = this.contract.version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
[options]="options"
optionLabel="name"
(onChange)="onDropdown()"
placeholder="Выберите значение">
placeholder="Select"
[appendTo]="'body'"
>
</p-dropdown>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ export class ActionBlockComponent implements OnInit {
if (this.type == 'dropdown') {
this.field = data.field;
this.options = data.options || [];
this.currentValue = this.getObjectValue(this.data, this.field);
const currentValue = this.getObjectValue(this.data, this.field);
this.currentValue = this.options.find((option: {name: string, value: string}) =>
option.value === currentValue);
}
} else {
this.data = null;
Expand Down Expand Up @@ -200,14 +202,15 @@ export class ActionBlockComponent implements OnInit {
}

onDropdown() {
if (this.getObjectValue(this.data, this.field) == this.currentValue) {
if (this.getObjectValue(this.data, this.field) == this.currentValue.value) {
return;
}
this.setObjectValue(this.data, this.field, this.currentValue);

this.setObjectValue(this.data, this.field, this.currentValue.value);

this.policyEngineService
.setBlockData(this.id, this.policyId, this.data)
.subscribe(() => {

}, (e) => {
console.error(e.error);
this.loading = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
[options]="documents"
optionLabel="name"
(onChange)="onDropdown($event.value)"
placeholder="Выберите значение">
placeholder="Select"
>
</p-dropdown>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
[options]="options"
optionLabel="name"
(onChange)="onFilters()"
placeholder="Выберите значение">
placeholder="Select"
>
</p-dropdown>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,28 @@
.content {
box-shadow: 0px 3px 6px #00000020;
background: #e5e5e5;
display: inline-block;
display: grid;
grid-template-columns: 1fr auto;
align-content: center;
margin: 7px;
padding: 10px 10px 6px 10px;
padding: 6px 10px 6px 10px;
height: 48px;
width: 270px
}

.content-name {
display: inline-block;
display: grid;
margin-right: 10px;
align-content: center;
}

.content-select {
display: inline-block;
display: grid;
width: 190px;
}
align-content: center;

::ng-deep .p-dropdown {
height: 36px;
width: 190px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export class FiltersAddonBlockComponent implements OnInit {
this.target = data.targetBlock;
this.content = data.uiMetaData.content;
this.filters = data.filters;
this.currentValue = data.filterValue;

if (this.type == 'unelected') {
}
Expand All @@ -113,6 +112,8 @@ export class FiltersAddonBlockComponent implements OnInit {
}
}
}
this.currentValue = this.options.find((option: {value: string, name: string}) =>
option.value === data.filterValue)
} else {
this.data = null;
}
Expand All @@ -121,7 +122,7 @@ export class FiltersAddonBlockComponent implements OnInit {
onFilters() {
this.loading = true;
this.policyEngineService
.setBlockData(this.id, this.policyId, { filterValue: this.currentValue })
.setBlockData(this.id, this.policyId, { filterValue: this.currentValue.value })
.subscribe(() => {
this.loading = false;
}, (e) => {
Expand Down

0 comments on commit 5105666

Please sign in to comment.