From 3d9003b11d2c3af2bdd449d07c85bbe9734a7241 Mon Sep 17 00:00:00 2001 From: ArtemDzhereleiko Date: Thu, 30 Sep 2021 12:39:16 +0300 Subject: [PATCH 1/3] Fixed imposible to save new boolean attribute --- ui-ngx/src/app/shared/components/value-input.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/shared/components/value-input.component.ts b/ui-ngx/src/app/shared/components/value-input.component.ts index 06bf9ab283..ae36d57da5 100644 --- a/ui-ngx/src/app/shared/components/value-input.component.ts +++ b/ui-ngx/src/app/shared/components/value-input.component.ts @@ -17,7 +17,7 @@ import { Component, forwardRef, Input, OnInit, ViewChild } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR, NgForm } from '@angular/forms'; import { ValueType, valueTypesMap } from '@shared/models/constants'; -import { isObject } from '@core/utils'; +import { isObject, isDefinedAndNotNull } from '@core/utils'; import { MatDialog } from '@angular/material/dialog'; import { JsonObjectEditDialogComponent, @@ -114,7 +114,7 @@ export class ValueInputComponent implements OnInit, ControlValueAccessor { } updateView() { - if (this.inputForm.valid || this.valueType === ValueType.BOOLEAN) { + if (this.inputForm.valid || this.valueType === ValueType.BOOLEAN || this.valueType === ValueType.JSON) { this.propagateChange(this.modelValue); } else { this.propagateChange(null); @@ -124,7 +124,7 @@ export class ValueInputComponent implements OnInit, ControlValueAccessor { onValueTypeChanged() { if (this.valueType === ValueType.BOOLEAN) { this.modelValue = false; - } if (this.valueType === ValueType.JSON) { + } else if (this.valueType === ValueType.JSON) { this.modelValue = {}; } else { this.modelValue = null; From c893d5d2214321035a140867b0b4d53b1ad03825 Mon Sep 17 00:00:00 2001 From: ArtemDzhereleiko Date: Thu, 30 Sep 2021 12:44:04 +0300 Subject: [PATCH 2/3] Remove not used import --- ui-ngx/src/app/shared/components/value-input.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/components/value-input.component.ts b/ui-ngx/src/app/shared/components/value-input.component.ts index ae36d57da5..41333096e9 100644 --- a/ui-ngx/src/app/shared/components/value-input.component.ts +++ b/ui-ngx/src/app/shared/components/value-input.component.ts @@ -17,7 +17,7 @@ import { Component, forwardRef, Input, OnInit, ViewChild } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR, NgForm } from '@angular/forms'; import { ValueType, valueTypesMap } from '@shared/models/constants'; -import { isObject, isDefinedAndNotNull } from '@core/utils'; +import { isObject } from '@core/utils'; import { MatDialog } from '@angular/material/dialog'; import { JsonObjectEditDialogComponent, From 571d4f0dbdf7537f37d34de97b561ea3c5e5c838 Mon Sep 17 00:00:00 2001 From: ArtemDzhereleiko Date: Thu, 30 Sep 2021 15:27:57 +0300 Subject: [PATCH 3/3] Update json value for correct working --- ui-ngx/src/app/shared/components/value-input.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/components/value-input.component.ts b/ui-ngx/src/app/shared/components/value-input.component.ts index 41333096e9..d4422bfbbb 100644 --- a/ui-ngx/src/app/shared/components/value-input.component.ts +++ b/ui-ngx/src/app/shared/components/value-input.component.ts @@ -114,7 +114,7 @@ export class ValueInputComponent implements OnInit, ControlValueAccessor { } updateView() { - if (this.inputForm.valid || this.valueType === ValueType.BOOLEAN || this.valueType === ValueType.JSON) { + if (this.inputForm.valid || this.valueType === ValueType.BOOLEAN) { this.propagateChange(this.modelValue); } else { this.propagateChange(null); @@ -126,6 +126,7 @@ export class ValueInputComponent implements OnInit, ControlValueAccessor { this.modelValue = false; } else if (this.valueType === ValueType.JSON) { this.modelValue = {}; + this.inputForm.form.get('value').patchValue({}); } else { this.modelValue = null; }