Merge pull request #8341 from vvlladd28/bugs/angular/after-updated

Fixed bug after update Angular version
This commit is contained in:
Igor Kulikov 2023-04-13 18:03:58 +03:00 committed by GitHub
commit 079f49845f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 78 additions and 76 deletions

View File

@ -120,32 +120,34 @@ export class ComplexVersionCreateComponent extends PageComponent implements OnIn
this.popoverComponent.updatePosition(); this.popoverComponent.updatePosition();
} }
this.versionCreateResultSubscription = this.versionCreateResult$.subscribe((result) => { this.versionCreateResultSubscription = this.versionCreateResult$.subscribe({
let message: string; next: (result) => {
if (!result.error) { let message: string;
if (result.done && !result.added && !result.modified && !result.removed) { if (!result.error) {
message = this.translate.instant('version-control.nothing-to-commit'); if (result.done && !result.added && !result.modified && !result.removed) {
message = this.translate.instant('version-control.nothing-to-commit');
} else {
message = this.translate.instant('version-control.version-create-result',
{added: result.added, modified: result.modified, removed: result.removed});
}
} else { } else {
message = this.translate.instant('version-control.version-create-result',
{added: result.added, modified: result.modified, removed: result.removed});
}
} else {
message = result.error; message = result.error;
} }
this.resultMessage = this.sanitizer.bypassSecurityTrustHtml(message); this.resultMessage = this.sanitizer.bypassSecurityTrustHtml(message);
this.versionCreateResult = result; this.versionCreateResult = result;
this.versionCreateBranch = request.branch; this.versionCreateBranch = request.branch;
this.cd.detectChanges(); this.cd.detectChanges();
if (this.popoverComponent) { if (this.popoverComponent) {
this.popoverComponent.updatePosition(); this.popoverComponent.updatePosition();
} }
}, },
(error) => { error: (error) => {
this.hasError = true; this.hasError = true;
this.resultMessage = this.sanitizer.bypassSecurityTrustHtml(parseHttpErrorMessage(error, this.translate).message); this.resultMessage = this.sanitizer.bypassSecurityTrustHtml(parseHttpErrorMessage(error, this.translate).message);
this.cd.detectChanges(); this.cd.detectChanges();
if (this.popoverComponent) { if (this.popoverComponent) {
this.popoverComponent.updatePosition(); this.popoverComponent.updatePosition();
}
} }
}); });
} }

View File

@ -18,12 +18,12 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core';
import { import {
AbstractControl, AbstractControl,
ControlValueAccessor, ControlValueAccessor,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
UntypedFormArray, UntypedFormArray,
UntypedFormBuilder, UntypedFormBuilder,
UntypedFormControl, UntypedFormControl,
UntypedFormGroup, UntypedFormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
Validator, Validator,
Validators Validators
} from '@angular/forms'; } from '@angular/forms';
@ -104,6 +104,9 @@ export class EntityTypesVersionCreateComponent extends PageComponent implements
this.entityTypesVersionCreateFormGroup.disable({emitEvent: false}); this.entityTypesVersionCreateFormGroup.disable({emitEvent: false});
} else { } else {
this.entityTypesVersionCreateFormGroup.enable({emitEvent: false}); this.entityTypesVersionCreateFormGroup.enable({emitEvent: false});
(this.entityTypesVersionCreateFormGroup.get('entityTypes') as UntypedFormArray).controls.forEach(
control => this.updateEntityTypeValidators(control)
);
} }
} }
@ -147,7 +150,7 @@ export class EntityTypesVersionCreateComponent extends PageComponent implements
} }
); );
this.updateEntityTypeValidators(entityTypeControl); this.updateEntityTypeValidators(entityTypeControl);
entityTypeControl.get('config').get('allEntities').valueChanges.subscribe(() => { entityTypeControl.get('config.allEntities').valueChanges.subscribe(() => {
this.updateEntityTypeValidators(entityTypeControl); this.updateEntityTypeValidators(entityTypeControl);
}); });
return entityTypeControl; return entityTypeControl;
@ -229,7 +232,7 @@ export class EntityTypesVersionCreateComponent extends PageComponent implements
allowedEntityTypes(entityTypeControl?: AbstractControl): Array<EntityType> { allowedEntityTypes(entityTypeControl?: AbstractControl): Array<EntityType> {
let res = [...exportableEntityTypes]; let res = [...exportableEntityTypes];
const currentEntityType: EntityType = entityTypeControl?.get('entityType')?.value; const currentEntityType: EntityType = entityTypeControl?.get('entityType')?.value;
const value: [{entityType: string, config: EntityTypeVersionCreateConfig}] = const value: [{entityType: string; config: EntityTypeVersionCreateConfig}] =
this.entityTypesVersionCreateFormGroup.get('entityTypes').value || []; this.entityTypesVersionCreateFormGroup.get('entityTypes').value || [];
const usedEntityTypes = value.map(val => val.entityType).filter(val => val); const usedEntityTypes = value.map(val => val.entityType).filter(val => val);
res = res.filter(entityType => !usedEntityTypes.includes(entityType) || entityType === currentEntityType); res = res.filter(entityType => !usedEntityTypes.includes(entityType) || entityType === currentEntityType);
@ -237,7 +240,7 @@ export class EntityTypesVersionCreateComponent extends PageComponent implements
} }
private updateModel() { private updateModel() {
const value: [{entityType: string, config: EntityTypeVersionCreateConfig}] = const value: [{entityType: string; config: EntityTypeVersionCreateConfig}] =
this.entityTypesVersionCreateFormGroup.get('entityTypes').value || []; this.entityTypesVersionCreateFormGroup.get('entityTypes').value || [];
let modelValue: {[entityType: string]: EntityTypeVersionCreateConfig} = null; let modelValue: {[entityType: string]: EntityTypeVersionCreateConfig} = null;
if (value && value.length) { if (value && value.length) {

View File

@ -271,7 +271,7 @@
{{ 'widget-config.alarm-source' | translate }} {{ 'widget-config.alarm-source' | translate }}
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<div [formGroup]="alarmSourceSettings" style="padding: 0 5px;"> <div class="tb-datasource-params" [formGroup]="alarmSourceSettings">
<section class="tb-datasource-section"> <section class="tb-datasource-section">
<mat-form-field class="tb-datasource-type"> <mat-form-field class="tb-datasource-type">
<mat-select formControlName="type"> <mat-select formControlName="type">

View File

@ -40,49 +40,48 @@
[fxShow]="!isEdit && (edgeScope === 'customer' || edgeScope === 'tenant') && isAssignedToCustomer(entity)"> [fxShow]="!isEdit && (edgeScope === 'customer' || edgeScope === 'tenant') && isAssignedToCustomer(entity)">
{{ (entity?.customerIsPublic ? 'edge.make-private' : 'edge.unassign-from-customer') | translate }} {{ (entity?.customerIsPublic ? 'edge.make-private' : 'edge.unassign-from-customer') | translate }}
</button> </button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'openEdgeAssets')"
[fxShow]="!isEdit && edgeScope !== 'customer'">
{{'edge.manage-assets' | translate }}
</button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'openEdgeDevices')"
[fxShow]="!isEdit && edgeScope !== 'customer'">
{{'edge.manage-devices' | translate }}
</button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'openEdgeEntityViews')"
[fxShow]="!isEdit && edgeScope !== 'customer'">
{{'edge.manage-entity-views' | translate }}
</button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'openEdgeDashboards')"
[fxShow]="!isEdit && edgeScope !== 'customer'">
{{'edge.manage-dashboards' | translate }}
</button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'openEdgeRuleChains')"
[fxShow]="!isEdit && edgeScope === 'tenant'">
{{'edge.manage-rulechains' | translate }}
</button>
<button mat-raised-button color="primary" fxFlex.xs <button mat-raised-button color="primary" fxFlex.xs
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'delete')" (click)="onEntityAction($event, 'delete')"
[fxShow]="!hideDelete() && !isEdit"> [fxShow]="!hideDelete() && !isEdit">
{{'edge.delete' | translate }} {{'edge.delete' | translate }}
</button> </button>
<div fxLayout="row" fxLayout.xs="column"> <div fxLayout="row wrap" fxLayout.xs="column">
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'openEdgeAssets')"
[fxShow]="!isEdit && edgeScope !== 'customer'">
{{'edge.edge-assets' | translate }}
</button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'openEdgeDevices')"
[fxShow]="!isEdit && edgeScope !== 'customer'">
{{'edge.edge-devices' | translate }}
</button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'openEdgeEntityViews')"
[fxShow]="!isEdit && edgeScope !== 'customer'">
{{'edge.edge-entity-views' | translate }}
</button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'openEdgeDashboards')"
[fxShow]="!isEdit && edgeScope !== 'customer'">
{{'edge.edge-dashboards' | translate }}
</button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'openEdgeRuleChains')"
[fxShow]="!isEdit && edgeScope === 'tenant'">
{{'edge.edge-rulechains' | translate }}
</button>
</div>
<div fxLayout="row" fxLayout.xs="column">
<button mat-raised-button <button mat-raised-button
ngxClipboard ngxClipboard
(cbOnSuccess)="onEdgeIdCopied($event)" (cbOnSuccess)="onEdgeIdCopied($event)"
[cbContent]="entity?.id?.id" [cbContent]="entity?.id?.id"
[disabled]="(isLoading$ | async)"
[fxShow]="!isEdit"> [fxShow]="!isEdit">
<mat-icon svgIcon="mdi:clipboard-arrow-left"></mat-icon> <mat-icon svgIcon="mdi:clipboard-arrow-left"></mat-icon>
<span translate>edge.copy-id</span> <span translate>edge.copy-id</span>
@ -91,6 +90,7 @@
ngxClipboard ngxClipboard
(cbOnSuccess)="onEdgeInfoCopied('key')" (cbOnSuccess)="onEdgeInfoCopied('key')"
[cbContent]="entity?.routingKey" [cbContent]="entity?.routingKey"
[disabled]="(isLoading$ | async)"
[fxShow]="!isEdit && edgeScope !== 'customer_user'"> [fxShow]="!isEdit && edgeScope !== 'customer_user'">
<mat-icon svgIcon="mdi:clipboard-arrow-left"></mat-icon> <mat-icon svgIcon="mdi:clipboard-arrow-left"></mat-icon>
<span translate>edge.copy-edge-key</span> <span translate>edge.copy-edge-key</span>
@ -99,6 +99,7 @@
ngxClipboard ngxClipboard
(cbOnSuccess)="onEdgeInfoCopied('secret')" (cbOnSuccess)="onEdgeInfoCopied('secret')"
[cbContent]="entity?.secret" [cbContent]="entity?.secret"
[disabled]="(isLoading$ | async)"
[fxShow]="!isEdit && edgeScope !== 'customer_user'"> [fxShow]="!isEdit && edgeScope !== 'customer_user'">
<mat-icon svgIcon="mdi:clipboard-arrow-left"></mat-icon> <mat-icon svgIcon="mdi:clipboard-arrow-left"></mat-icon>
<span translate>edge.copy-edge-secret</span> <span translate>edge.copy-edge-secret</span>

View File

@ -142,14 +142,10 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
); );
} else if (ruleChainScope === 'edges') { } else if (ruleChainScope === 'edges') {
columns.push( columns.push(
new EntityTableColumn<RuleChain>('root', 'rulechain.edge-template-root', '70px', new EntityTableColumn<RuleChain>('root', 'rulechain.edge-template-root', '100px',
entity => { entity => checkBoxCell(entity.root)),
return checkBoxCell(entity.root); new EntityTableColumn<RuleChain>('assignToEdge', 'rulechain.assign-to-edge', '100px',
}), entity => checkBoxCell(this.isAutoAssignToEdgeRuleChain(entity)), () => ({}), false)
new EntityTableColumn<RuleChain>('assignToEdge', 'rulechain.assign-to-edge', '70px',
entity => {
return checkBoxCell(this.isAutoAssignToEdgeRuleChain(entity));
})
); );
} }
return columns; return columns;

View File

@ -1821,11 +1821,11 @@
"edge-secret": "Edge secret", "edge-secret": "Edge secret",
"copy-edge-secret": "Copy Edge secret", "copy-edge-secret": "Copy Edge secret",
"edge-secret-copied-message": "Edge secret has been copied to clipboard", "edge-secret-copied-message": "Edge secret has been copied to clipboard",
"edge-assets": "Edge assets", "manage-assets": "Manage assets",
"edge-devices": "Edge devices", "manage-devices": "Manage devices",
"edge-entity-views": "Edge entity views", "manage-entity-views": "Manage entity views",
"edge-dashboards": "Edge dashboards", "manage-dashboards": "Manage dashboards",
"edge-rulechains": "Edge rule chains", "manage-rulechains": "Manage rule chains",
"assets": "Edge assets", "assets": "Edge assets",
"devices": "Edge devices", "devices": "Edge devices",
"entity-views": "Edge entity views", "entity-views": "Edge entity views",