From 3c9ab8c91f99a2b2a894c7048ba7b15007a40118 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 15 Jun 2023 13:02:06 +0300 Subject: [PATCH 01/11] UI: Fixed table row style --- .../widget/lib/alarms-table-widget.component.html | 4 ++-- .../lib/entities-table-widget.component.html | 2 +- .../components/widget/lib/table-widget.models.ts | 2 +- .../lib/timeseries-table-widget.component.html | 12 ++++++------ ui-ngx/src/styles.scss | 15 +++++++++++++++ 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.html index 9a23e86bf8..8cba9e8e8c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.html @@ -70,7 +70,7 @@ [indeterminate]="alarmsDatasource.selection.hasValue() && !(alarmsDatasource.isAllSelected() | async)"> - + @@ -122,7 +122,7 @@ maxWidth: (alarmsDatasource.countCellButtonAction * 48) + 'px', width: (alarmsDatasource.countCellButtonAction * 48) + 'px' }"> -
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/entities-table-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/entities-table-widget.component.html index d89eaeda27..eac3f8710c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/entities-table-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/entities-table-widget.component.html @@ -52,7 +52,7 @@ maxWidth: (entityDatasource.countCellButtonAction * 48) + 'px', width: (entityDatasource.countCellButtonAction * 48) + 'px' }"> -
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts index 2a29776e7e..62236f01b0 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts @@ -451,7 +451,7 @@ export function constructTableCssString(widgetConfig: WidgetConfig): string { '.mat-mdc-table .mat-mdc-row .mat-mdc-cell.mat-mdc-table-sticky, .mat-mdc-table .mat-mdc-header-cell.mat-mdc-table-sticky {\n' + 'background-color: ' + origBackgroundColor + ';\n' + '}\n' + - '.mat-mdc-table .mat-mdc-cell {\n' + + '.mat-mdc-table .mat-mdc-row {\n' + 'color: ' + mdDark + ';\n' + 'background-color: rgba(0, 0, 0, 0);\n' + '}\n' + diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html index d0ca2f23d1..65f873b586 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html @@ -64,32 +64,32 @@ maxWidth: (source.timeseriesDatasource.countCellButtonAction * 48) + 'px', width: (source.timeseriesDatasource.countCellButtonAction * 48) + 'px' }"> -
- +
-
+
- + diff --git a/ui-ngx/src/styles.scss b/ui-ngx/src/styles.scss index 760ffe88c6..b9ad237eac 100644 --- a/ui-ngx/src/styles.scss +++ b/ui-ngx/src/styles.scss @@ -664,6 +664,21 @@ mat-label { table-layout: auto; border-collapse: separate; margin: 0; + + .mat-mdc-row { + font-size: 13px; + } + + .mat-mdc-cell { + background: inherit; + color: inherit; + font-size: inherit; + font-family: inherit; + font-weight: inherit; + line-height: inherit; + letter-spacing: inherit; + text-transform: inherit; + } } .mat-mdc-footer-row::after, .mat-mdc-header-row::after, .mat-mdc-row::after { From efaaf9e7915b8b6a56d152da849924fa328840f4 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 13 Jul 2023 12:56:51 +0300 Subject: [PATCH 02/11] UI: Improvement Add asset dialog --- .../asset-profile-autocomplete.component.html | 5 +++++ .../asset-profile-autocomplete.component.ts | 10 +++------ ...device-profile-autocomplete.component.html | 2 +- .../device-profile-autocomplete.component.ts | 4 ---- .../device-wizard-dialog.component.html | 2 +- .../wizard/device-wizard-dialog.component.ts | 5 +---- .../home/pages/asset/asset.component.html | 21 ++++++++++++------- .../home/pages/asset/asset.component.ts | 2 ++ .../assets/locale/locale.constant-en_US.json | 3 ++- 9 files changed, 29 insertions(+), 25 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.html b/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.html index 87ee2a7fa1..ec41d7db09 100644 --- a/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.html @@ -43,6 +43,11 @@ (click)="editAssetProfile($event)"> edit + @@ -76,6 +75,7 @@
diff --git a/ui-ngx/src/app/modules/home/components/wizard/device-wizard-dialog.component.ts b/ui-ngx/src/app/modules/home/components/wizard/device-wizard-dialog.component.ts index 65e7df1e90..69c18b42c5 100644 --- a/ui-ngx/src/app/modules/home/components/wizard/device-wizard-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/wizard/device-wizard-dialog.component.ts @@ -147,11 +147,8 @@ export class DeviceWizardDialogComponent extends DialogComponent 0) { return this.deviceService.saveDeviceWithCredentials(deepTrim(device), deepTrim(this.credentialsFormGroup.value.credential)).pipe( catchError((e: HttpErrorResponse) => { diff --git a/ui-ngx/src/app/modules/home/pages/asset/asset.component.html b/ui-ngx/src/app/modules/home/pages/asset/asset.component.html index 16229a7af6..62b45b7542 100644 --- a/ui-ngx/src/app/modules/home/pages/asset/asset.component.html +++ b/ui-ngx/src/app/modules/home/pages/asset/asset.component.html @@ -86,13 +86,6 @@ {{ 'asset.name-max-length' | translate }} - - asset.label @@ -100,6 +93,20 @@ {{ 'asset.label-max-length' | translate }} + + + +
asset.description diff --git a/ui-ngx/src/app/modules/home/pages/asset/asset.component.ts b/ui-ngx/src/app/modules/home/pages/asset/asset.component.ts index 8c53cbba38..a96b65e249 100644 --- a/ui-ngx/src/app/modules/home/pages/asset/asset.component.ts +++ b/ui-ngx/src/app/modules/home/pages/asset/asset.component.ts @@ -69,6 +69,7 @@ export class AssetComponent extends EntityComponent { name: [entity ? entity.name : '', [Validators.required, Validators.maxLength(255)]], assetProfileId: [entity ? entity.assetProfileId : null, [Validators.required]], label: [entity ? entity.label : '', Validators.maxLength(255)], + customerId: [entity ? entity.customerId : ''], additionalInfo: this.fb.group( { description: [entity && entity.additionalInfo ? entity.additionalInfo.description : ''], @@ -82,6 +83,7 @@ export class AssetComponent extends EntityComponent { this.entityForm.patchValue({name: entity.name}); this.entityForm.patchValue({assetProfileId: entity.assetProfileId}); this.entityForm.patchValue({label: entity.label}); + this.entityForm.patchValue({customerId: entity.customerId}); this.entityForm.patchValue({additionalInfo: {description: entity.additionalInfo ? entity.additionalInfo.description : ''}}); } diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index c5ec1fca40..7257ebb730 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -685,7 +685,8 @@ "unassign-asset-from-edge-text": "After the confirmation the asset will be unassigned and won't be accessible by the edge.", "unassign-assets-from-edge-title": "Are you sure you want to unassign { count, plural, =1 {1 asset} other {# assets} }?", "unassign-assets-from-edge-text": "After the confirmation all selected assets will be unassigned and won't be accessible by the edge.", - "selected-assets": "{ count, plural, =1 {1 asset} other {# assets} } selected" + "selected-assets": "{ count, plural, =1 {1 asset} other {# assets} } selected", + "customer-to-assign-asset": "Customer to assign the asset" }, "attribute": { "attributes": "Attributes", From a5aa605b8548459e48889e99477069562a363f1d Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Thu, 20 Jul 2023 16:31:42 +0300 Subject: [PATCH 03/11] UI: Change label to assign customer --- ui-ngx/src/app/modules/home/pages/asset/asset.component.html | 2 +- ui-ngx/src/assets/locale/locale.constant-en_US.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/asset/asset.component.html b/ui-ngx/src/app/modules/home/pages/asset/asset.component.html index 62b45b7542..fbef65a4d6 100644 --- a/ui-ngx/src/app/modules/home/pages/asset/asset.component.html +++ b/ui-ngx/src/app/modules/home/pages/asset/asset.component.html @@ -104,7 +104,7 @@ *ngIf="isAdd" useFullEntityId formControlName="customerId" - labelText="asset.customer-to-assign-asset" + labelText="customer.assign-customer" [entityType]="entityType.CUSTOMER">
diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 33067d403d..cd379fa4dc 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -686,8 +686,7 @@ "unassign-asset-from-edge-text": "After the confirmation the asset will be unassigned and won't be accessible by the edge.", "unassign-assets-from-edge-title": "Are you sure you want to unassign { count, plural, =1 {1 asset} other {# assets} }?", "unassign-assets-from-edge-text": "After the confirmation all selected assets will be unassigned and won't be accessible by the edge.", - "selected-assets": "{ count, plural, =1 {1 asset} other {# assets} } selected", - "customer-to-assign-asset": "Customer to assign the asset" + "selected-assets": "{ count, plural, =1 {1 asset} other {# assets} } selected" }, "attribute": { "attributes": "Attributes", From 4f8b1e42fc0a82c767b0006c851cbfb174868b51 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 28 Jul 2023 12:11:07 +0300 Subject: [PATCH 04/11] UI: Refactoring --- ui-ngx/src/app/modules/home/pages/asset/asset.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/pages/asset/asset.component.html b/ui-ngx/src/app/modules/home/pages/asset/asset.component.html index fbef65a4d6..b2c4b5a10a 100644 --- a/ui-ngx/src/app/modules/home/pages/asset/asset.component.html +++ b/ui-ngx/src/app/modules/home/pages/asset/asset.component.html @@ -104,7 +104,7 @@ *ngIf="isAdd" useFullEntityId formControlName="customerId" - labelText="customer.assign-customer" + labelText="asset.assign-to-customer" [entityType]="entityType.CUSTOMER">
From a88730207f62506cd4962f534831c5140381ebff Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Mon, 7 Aug 2023 14:48:23 +0300 Subject: [PATCH 05/11] UI: Fixed buttons for mobile --- .../profile/asset-profile-autocomplete.component.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.scss b/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.scss index d9ffef2925..892c3648bb 100644 --- a/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.scss +++ b/ui-ngx/src/app/modules/home/components/profile/asset-profile-autocomplete.component.scss @@ -19,3 +19,9 @@ color: inherit; } } + +:host ::ng-deep { + .mat-mdc-form-field-icon-suffix { + display: flex; + } +} From 62da933c2e89dba6a30263732e6758e46f2a7ee1 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Wed, 16 Aug 2023 15:23:05 +0300 Subject: [PATCH 06/11] UI: Add style only for table widget --- ui-ngx/src/styles.scss | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/ui-ngx/src/styles.scss b/ui-ngx/src/styles.scss index 4879f1894e..a584985924 100644 --- a/ui-ngx/src/styles.scss +++ b/ui-ngx/src/styles.scss @@ -690,20 +690,24 @@ mat-label { table-layout: auto; border-collapse: separate; margin: 0; + } - .mat-mdc-row { - font-size: 13px; - } + .tb-table-widget { + .mat-mdc-table { + .mat-mdc-row { + font-size: 13px; + } - .mat-mdc-cell { - background: inherit; - color: inherit; - font-size: inherit; - font-family: inherit; - font-weight: inherit; - line-height: inherit; - letter-spacing: inherit; - text-transform: inherit; + .mat-mdc-cell { + background: inherit; + color: inherit; + font-size: inherit; + font-family: inherit; + font-weight: inherit; + line-height: inherit; + letter-spacing: inherit; + text-transform: inherit; + } } } From 638916b7cdc0d7b2bfadb4943bb97e2b9615141d Mon Sep 17 00:00:00 2001 From: kalytka Date: Wed, 23 Aug 2023 14:26:55 +0300 Subject: [PATCH 07/11] Fix rule node disable --- .../pages/rulechain/rule-node-config.component.ts | 4 ++++ .../rulechain/rule-node-details.component.html | 2 +- .../pages/rulechain/rule-node-details.component.ts | 13 ++++++++++++- ui-ngx/src/app/shared/models/rule-node.models.ts | 9 +++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-config.component.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-config.component.ts index 3f3071221e..90f29f555f 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-config.component.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-config.component.ts @@ -165,6 +165,9 @@ export class RuleNodeConfigComponent implements ControlValueAccessor, OnInit, On } else { this.ruleNodeConfigFormGroup.enable({emitEvent: false}); } + if (this.definedConfigComponent) { + this.definedConfigComponent.disabled = this.disabled; + } } writeValue(value: RuleNodeConfiguration): void { @@ -222,6 +225,7 @@ export class RuleNodeConfigComponent implements ControlValueAccessor, OnInit, On this.definedConfigComponent.ruleChainId = this.ruleChainId; this.definedConfigComponent.ruleChainType = this.ruleChainType; this.definedConfigComponent.configuration = this.configuration; + this.definedConfigComponent.disabled = this.disabled; this.changeSubscription = this.definedConfigComponent.configurationChanged.subscribe((configuration) => { this.updateModel(configuration); }); diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html index 34aa8167e3..e92e2a61ef 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html @@ -22,7 +22,7 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts index f1d6001c88..b0ec810083 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChange, SimpleChanges, ViewChild } from '@angular/core'; import { PageComponent } from '@shared/components/page.component'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; @@ -119,6 +119,17 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O } } } + this.disableControl(changes.isEdit, changes.isReadOnly); + } + + private disableControl(isEdit: SimpleChange, isReadOnly: SimpleChange) { + if (isEdit.currentValue !== isEdit.previousValue || isReadOnly.currentValue !== isReadOnly.previousValue) { + if (!isEdit.currentValue || isReadOnly.currentValue) { + this.ruleNodeFormGroup.disable({emitEvent: false}); + } else { + this.ruleNodeFormGroup.enable({emitEvent: false}); + } + } } validate() { diff --git a/ui-ngx/src/app/shared/models/rule-node.models.ts b/ui-ngx/src/app/shared/models/rule-node.models.ts index 2a7dedabec..d38d027607 100644 --- a/ui-ngx/src/app/shared/models/rule-node.models.ts +++ b/ui-ngx/src/app/shared/models/rule-node.models.ts @@ -74,6 +74,7 @@ export interface IRuleNodeConfigurationComponent { ruleNodeId: string; ruleChainId: string; hasScript: boolean; + disabled: boolean; testScriptLabel?: string; changeScript?: EventEmitter; ruleChainType: RuleChainType; @@ -101,6 +102,14 @@ export abstract class RuleNodeConfigurationComponent extends PageComponent imple private configurationSet = false; + set disabled(value: boolean) { + if (value) { + this.configForm().disable({emitEvent: false}); + } else { + this.configForm().enable({emitEvent: false}); + } + }; + set configuration(value: RuleNodeConfiguration) { this.configurationValue = value; if (!this.configurationSet) { From 7f5b74d34c8257a6e7b49c7964e4410bb5db2149 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 25 Aug 2023 15:43:58 +0300 Subject: [PATCH 08/11] UI: Fixed show exit dialog twice --- .../components/dashboard-page/dashboard-page.component.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts index 868b1544c3..f3e57a9dcb 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts @@ -161,12 +161,14 @@ import { HasDirtyFlag } from '@core/guards/confirm-on-exit.guard'; }) export class DashboardPageComponent extends PageComponent implements IDashboardController, HasDirtyFlag, OnInit, AfterViewInit, OnDestroy { + private forcePristine = true; + get isDirty(): boolean { - return this.isEdit; + return this.isEdit && this.forcePristine; } set isDirty(value: boolean) { - + this.forcePristine = value; } authState: AuthState = getCurrentAuthState(this.store); From ba6abea10519ae85e400d78f26e556acd57edcb4 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 25 Aug 2023 15:59:58 +0300 Subject: [PATCH 09/11] UI: Fixed infinity loaded in latest widget when aggregation data --- ui-ngx/src/app/core/api/entity-data-subscription.ts | 3 ++- ui-ngx/src/app/core/api/widget-subscription.ts | 3 ++- ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/core/api/entity-data-subscription.ts b/ui-ngx/src/app/core/api/entity-data-subscription.ts index 25cb47ca0a..1e0f31c4d0 100644 --- a/ui-ngx/src/app/core/api/entity-data-subscription.ts +++ b/ui-ngx/src/app/core/api/entity-data-subscription.ts @@ -42,6 +42,7 @@ import { EntityCountCmd, EntityDataCmd, IndexedSubscriptionData, + NOT_SUPPORTED, SubscriptionData, TelemetrySubscriber } from '@shared/models/telemetry/telemetry.models'; @@ -786,7 +787,7 @@ export class EntityDataSubscription { private reportNotSupported(keys: AggKey[], isUpdate: boolean) { const indexedData: IndexedSubscriptionData = []; for (const key of keys) { - indexedData[key.id] = [[0, 'Not supported!']]; + indexedData[key.id] = [[0, NOT_SUPPORTED]]; } for (let dataIndex = 0; dataIndex < this.pageData.data.length; dataIndex++) { this.onIndexedData(indexedData, dataIndex, true, diff --git a/ui-ngx/src/app/core/api/widget-subscription.ts b/ui-ngx/src/app/core/api/widget-subscription.ts index f9a79d8f76..374775bdd0 100644 --- a/ui-ngx/src/app/core/api/widget-subscription.ts +++ b/ui-ngx/src/app/core/api/widget-subscription.ts @@ -81,6 +81,7 @@ import { distinct, filter, map, switchMap, takeUntil } from 'rxjs/operators'; import { AlarmDataListener } from '@core/api/alarm-data.service'; import { RpcStatus } from '@shared/models/rpc.models'; import { EventEmitter } from '@angular/core'; +import { NOT_SUPPORTED } from '@shared/models/telemetry/telemetry.models'; const moment = moment_; @@ -1541,7 +1542,7 @@ export class WidgetSubscription implements IWidgetSubscription { } else if (prevData && prevData[0] && prevData[0].length > 1 && data.data.length > 0) { const prevTs = prevData[0][0]; const prevValue = prevData[0][1]; - if (prevTs === data.data[0][0] && prevValue === data.data[0][1]) { + if (prevTs === data.data[0][0] && prevValue === data.data[0][1] && data.data[0][1] !== NOT_SUPPORTED) { update = false; } } diff --git a/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts b/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts index d93dde4530..66f39d080a 100644 --- a/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts +++ b/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts @@ -37,6 +37,8 @@ import { isUndefined } from '@core/utils'; import { CmdWrapper, WsSubscriber } from '@shared/models/websocket/websocket.models'; import { TelemetryWebsocketService } from '@core/ws/telemetry-websocket.service'; +export const NOT_SUPPORTED = 'Not supported!'; + export enum DataKeyType { timeseries = 'timeseries', attribute = 'attribute', From b493f1a1b7feec5c2efd97f6d4088d34fa9e7df5 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 25 Aug 2023 16:29:51 +0300 Subject: [PATCH 10/11] UI: Improved disabled rulenode config --- .../add-rule-node-dialog.component.html | 16 ++--- .../rulechain/rule-node-config.component.scss | 2 +- .../rule-node-details.component.html | 72 +++++++++---------- .../rulechain/rule-node-details.component.ts | 29 +++----- .../rulechain/rulechain-page.component.html | 2 - 5 files changed, 52 insertions(+), 69 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-dialog.component.html b/ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-dialog.component.html index bc72cd90c0..0da62e48bc 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-dialog.component.html @@ -29,16 +29,12 @@
-
- - -
+ +
-
-
-
- - rulenode.name - - + + rulenode.name + + - {{ 'rulenode.name-required' | translate }} - - - {{ 'rulenode.name-max-length' | translate }} - - -
- - {{ 'rulenode.debug-mode' | translate }} - - - {{ 'rulenode.singleton-mode' | translate }} - -
-
- - -
- - rulenode.rule-node-description - - -
+ {{ 'rulenode.name-required' | translate }} + + + {{ 'rulenode.name-max-length' | translate }} + + +
+ + {{ 'rulenode.debug-mode' | translate }} + + + {{ 'rulenode.singleton-mode' | translate }} +
-
+
+ + +
+ + rulenode.rule-node-description + + +
diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts index b0ec810083..5fce7f8e0b 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChange, SimpleChanges, ViewChild } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; import { PageComponent } from '@shared/components/page.component'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; @@ -22,11 +22,11 @@ import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms import { FcRuleNode, RuleNodeType } from '@shared/models/rule-node.models'; import { EntityType } from '@shared/models/entity-type.models'; import { Subscription } from 'rxjs'; -import { RuleChainService } from '@core/http/rule-chain.service'; import { RuleNodeConfigComponent } from './rule-node-config.component'; import { Router } from '@angular/router'; import { RuleChainType } from '@app/shared/models/rule-chain.models'; import { ComponentClusteringMode } from '@shared/models/component-descriptor.models'; +import { coerceBoolean } from '@shared/decorators/coercion'; @Component({ selector: 'tb-rule-node', @@ -47,12 +47,11 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O ruleChainType: RuleChainType; @Input() - isEdit: boolean; - - @Input() - isReadOnly: boolean; + @coerceBoolean() + disabled = false; @Input() + @coerceBoolean() isAdd = false; @Output() @@ -70,7 +69,6 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O constructor(protected store: Store, private fb: UntypedFormBuilder, - private ruleChainService: RuleChainService, private router: Router) { super(store); this.ruleNodeFormGroup = this.fb.group({}); @@ -99,6 +97,9 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O } else { this.ruleNodeFormGroup = this.fb.group({}); } + if (this.disabled) { + this.ruleNodeFormGroup.disable({emitEvent: false}); + } } private updateRuleNode() { @@ -108,6 +109,9 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O } ngOnInit(): void { + if (this.disabled) { + this.ruleNodeFormGroup.disable({emitEvent: false}); + } } ngOnChanges(changes: SimpleChanges): void { @@ -119,17 +123,6 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O } } } - this.disableControl(changes.isEdit, changes.isReadOnly); - } - - private disableControl(isEdit: SimpleChange, isReadOnly: SimpleChange) { - if (isEdit.currentValue !== isEdit.previousValue || isReadOnly.currentValue !== isReadOnly.previousValue) { - if (!isEdit.currentValue || isReadOnly.currentValue) { - this.ruleNodeFormGroup.disable({emitEvent: false}); - } else { - this.ruleNodeFormGroup.enable({emitEvent: false}); - } - } } validate() { diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.html b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.html index c37db14a18..6911558ad4 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.html +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.html @@ -110,8 +110,6 @@ [ruleNode]="editingRuleNode" [ruleChainId]="ruleChain.id?.id" [ruleChainType]="ruleChainType" - [isEdit]="true" - [isReadOnly]="false" (initRuleNode)="onRuleNodeInit()" (changeScript)="switchToFirstTab()"> From 00f21ea9a063608f8a0a5f33110f7351e94879d8 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Fri, 25 Aug 2023 18:33:45 +0300 Subject: [PATCH 11/11] Update dashboard-page.component.ts --- .../components/dashboard-page/dashboard-page.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts index f3e57a9dcb..e24f1cad07 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts @@ -161,14 +161,14 @@ import { HasDirtyFlag } from '@core/guards/confirm-on-exit.guard'; }) export class DashboardPageComponent extends PageComponent implements IDashboardController, HasDirtyFlag, OnInit, AfterViewInit, OnDestroy { - private forcePristine = true; + private forcePristine = false; get isDirty(): boolean { - return this.isEdit && this.forcePristine; + return this.isEdit && !this.forcePristine; } set isDirty(value: boolean) { - this.forcePristine = value; + this.forcePristine = !value; } authState: AuthState = getCurrentAuthState(this.store);