Merge pull request #8341 from vvlladd28/bugs/angular/after-updated
Fixed bug after update Angular version
This commit is contained in:
		
						commit
						079f49845f
					
				@ -120,32 +120,34 @@ export class ComplexVersionCreateComponent extends PageComponent implements OnIn
 | 
			
		||||
      this.popoverComponent.updatePosition();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.versionCreateResultSubscription = this.versionCreateResult$.subscribe((result) => {
 | 
			
		||||
      let message: string;
 | 
			
		||||
      if (!result.error) {
 | 
			
		||||
        if (result.done && !result.added && !result.modified && !result.removed) {
 | 
			
		||||
          message = this.translate.instant('version-control.nothing-to-commit');
 | 
			
		||||
    this.versionCreateResultSubscription = this.versionCreateResult$.subscribe({
 | 
			
		||||
      next: (result) => {
 | 
			
		||||
        let message: string;
 | 
			
		||||
        if (!result.error) {
 | 
			
		||||
          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 {
 | 
			
		||||
          message = this.translate.instant('version-control.version-create-result',
 | 
			
		||||
            {added: result.added, modified: result.modified, removed: result.removed});
 | 
			
		||||
        }
 | 
			
		||||
      } else {
 | 
			
		||||
          message = result.error;
 | 
			
		||||
      }
 | 
			
		||||
      this.resultMessage = this.sanitizer.bypassSecurityTrustHtml(message);
 | 
			
		||||
      this.versionCreateResult = result;
 | 
			
		||||
      this.versionCreateBranch = request.branch;
 | 
			
		||||
      this.cd.detectChanges();
 | 
			
		||||
      if (this.popoverComponent) {
 | 
			
		||||
        this.popoverComponent.updatePosition();
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    (error) => {
 | 
			
		||||
      this.hasError = true;
 | 
			
		||||
      this.resultMessage = this.sanitizer.bypassSecurityTrustHtml(parseHttpErrorMessage(error, this.translate).message);
 | 
			
		||||
      this.cd.detectChanges();
 | 
			
		||||
      if (this.popoverComponent) {
 | 
			
		||||
        this.popoverComponent.updatePosition();
 | 
			
		||||
        }
 | 
			
		||||
        this.resultMessage = this.sanitizer.bypassSecurityTrustHtml(message);
 | 
			
		||||
        this.versionCreateResult = result;
 | 
			
		||||
        this.versionCreateBranch = request.branch;
 | 
			
		||||
        this.cd.detectChanges();
 | 
			
		||||
        if (this.popoverComponent) {
 | 
			
		||||
          this.popoverComponent.updatePosition();
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      error: (error) => {
 | 
			
		||||
        this.hasError = true;
 | 
			
		||||
        this.resultMessage = this.sanitizer.bypassSecurityTrustHtml(parseHttpErrorMessage(error, this.translate).message);
 | 
			
		||||
        this.cd.detectChanges();
 | 
			
		||||
        if (this.popoverComponent) {
 | 
			
		||||
          this.popoverComponent.updatePosition();
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -18,12 +18,12 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core';
 | 
			
		||||
import {
 | 
			
		||||
  AbstractControl,
 | 
			
		||||
  ControlValueAccessor,
 | 
			
		||||
  NG_VALIDATORS,
 | 
			
		||||
  NG_VALUE_ACCESSOR,
 | 
			
		||||
  UntypedFormArray,
 | 
			
		||||
  UntypedFormBuilder,
 | 
			
		||||
  UntypedFormControl,
 | 
			
		||||
  UntypedFormGroup,
 | 
			
		||||
  NG_VALIDATORS,
 | 
			
		||||
  NG_VALUE_ACCESSOR,
 | 
			
		||||
  Validator,
 | 
			
		||||
  Validators
 | 
			
		||||
} from '@angular/forms';
 | 
			
		||||
@ -104,6 +104,9 @@ export class EntityTypesVersionCreateComponent extends PageComponent implements
 | 
			
		||||
      this.entityTypesVersionCreateFormGroup.disable({emitEvent: false});
 | 
			
		||||
    } else {
 | 
			
		||||
      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);
 | 
			
		||||
    entityTypeControl.get('config').get('allEntities').valueChanges.subscribe(() => {
 | 
			
		||||
    entityTypeControl.get('config.allEntities').valueChanges.subscribe(() => {
 | 
			
		||||
      this.updateEntityTypeValidators(entityTypeControl);
 | 
			
		||||
    });
 | 
			
		||||
    return entityTypeControl;
 | 
			
		||||
@ -229,7 +232,7 @@ export class EntityTypesVersionCreateComponent extends PageComponent implements
 | 
			
		||||
  allowedEntityTypes(entityTypeControl?: AbstractControl): Array<EntityType> {
 | 
			
		||||
    let res = [...exportableEntityTypes];
 | 
			
		||||
    const currentEntityType: EntityType = entityTypeControl?.get('entityType')?.value;
 | 
			
		||||
    const value: [{entityType: string, config: EntityTypeVersionCreateConfig}] =
 | 
			
		||||
    const value: [{entityType: string; config: EntityTypeVersionCreateConfig}] =
 | 
			
		||||
      this.entityTypesVersionCreateFormGroup.get('entityTypes').value || [];
 | 
			
		||||
    const usedEntityTypes = value.map(val => val.entityType).filter(val => val);
 | 
			
		||||
    res = res.filter(entityType => !usedEntityTypes.includes(entityType) || entityType === currentEntityType);
 | 
			
		||||
@ -237,7 +240,7 @@ export class EntityTypesVersionCreateComponent extends PageComponent implements
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private updateModel() {
 | 
			
		||||
    const value: [{entityType: string, config: EntityTypeVersionCreateConfig}] =
 | 
			
		||||
    const value: [{entityType: string; config: EntityTypeVersionCreateConfig}] =
 | 
			
		||||
      this.entityTypesVersionCreateFormGroup.get('entityTypes').value || [];
 | 
			
		||||
    let modelValue: {[entityType: string]: EntityTypeVersionCreateConfig} = null;
 | 
			
		||||
    if (value && value.length) {
 | 
			
		||||
 | 
			
		||||
@ -271,7 +271,7 @@
 | 
			
		||||
              {{ 'widget-config.alarm-source' | translate }}
 | 
			
		||||
            </mat-panel-title>
 | 
			
		||||
          </mat-expansion-panel-header>
 | 
			
		||||
          <div [formGroup]="alarmSourceSettings" style="padding: 0 5px;">
 | 
			
		||||
          <div class="tb-datasource-params" [formGroup]="alarmSourceSettings">
 | 
			
		||||
            <section class="tb-datasource-section">
 | 
			
		||||
              <mat-form-field class="tb-datasource-type">
 | 
			
		||||
                <mat-select formControlName="type">
 | 
			
		||||
 | 
			
		||||
@ -40,49 +40,48 @@
 | 
			
		||||
          [fxShow]="!isEdit && (edgeScope === 'customer' || edgeScope === 'tenant') && isAssignedToCustomer(entity)">
 | 
			
		||||
    {{ (entity?.customerIsPublic ? 'edge.make-private' : 'edge.unassign-from-customer') | translate }}
 | 
			
		||||
  </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
 | 
			
		||||
          [disabled]="(isLoading$ | async)"
 | 
			
		||||
          (click)="onEntityAction($event, 'delete')"
 | 
			
		||||
          [fxShow]="!hideDelete() && !isEdit">
 | 
			
		||||
    {{'edge.delete' | translate }}
 | 
			
		||||
  </button>
 | 
			
		||||
  <div fxLayout="row" 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">
 | 
			
		||||
  <div fxLayout="row wrap" fxLayout.xs="column">
 | 
			
		||||
    <button mat-raised-button
 | 
			
		||||
            ngxClipboard
 | 
			
		||||
            (cbOnSuccess)="onEdgeIdCopied($event)"
 | 
			
		||||
            [cbContent]="entity?.id?.id"
 | 
			
		||||
            [disabled]="(isLoading$ | async)"
 | 
			
		||||
            [fxShow]="!isEdit">
 | 
			
		||||
      <mat-icon svgIcon="mdi:clipboard-arrow-left"></mat-icon>
 | 
			
		||||
      <span translate>edge.copy-id</span>
 | 
			
		||||
@ -91,6 +90,7 @@
 | 
			
		||||
            ngxClipboard
 | 
			
		||||
            (cbOnSuccess)="onEdgeInfoCopied('key')"
 | 
			
		||||
            [cbContent]="entity?.routingKey"
 | 
			
		||||
            [disabled]="(isLoading$ | async)"
 | 
			
		||||
            [fxShow]="!isEdit && edgeScope !== 'customer_user'">
 | 
			
		||||
      <mat-icon svgIcon="mdi:clipboard-arrow-left"></mat-icon>
 | 
			
		||||
      <span translate>edge.copy-edge-key</span>
 | 
			
		||||
@ -99,6 +99,7 @@
 | 
			
		||||
            ngxClipboard
 | 
			
		||||
            (cbOnSuccess)="onEdgeInfoCopied('secret')"
 | 
			
		||||
            [cbContent]="entity?.secret"
 | 
			
		||||
            [disabled]="(isLoading$ | async)"
 | 
			
		||||
            [fxShow]="!isEdit && edgeScope !== 'customer_user'">
 | 
			
		||||
      <mat-icon svgIcon="mdi:clipboard-arrow-left"></mat-icon>
 | 
			
		||||
      <span translate>edge.copy-edge-secret</span>
 | 
			
		||||
 | 
			
		||||
@ -142,14 +142,10 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
 | 
			
		||||
      );
 | 
			
		||||
    } else if (ruleChainScope === 'edges') {
 | 
			
		||||
      columns.push(
 | 
			
		||||
        new EntityTableColumn<RuleChain>('root', 'rulechain.edge-template-root', '70px',
 | 
			
		||||
          entity => {
 | 
			
		||||
            return checkBoxCell(entity.root);
 | 
			
		||||
          }),
 | 
			
		||||
        new EntityTableColumn<RuleChain>('assignToEdge', 'rulechain.assign-to-edge', '70px',
 | 
			
		||||
          entity => {
 | 
			
		||||
            return checkBoxCell(this.isAutoAssignToEdgeRuleChain(entity));
 | 
			
		||||
          })
 | 
			
		||||
        new EntityTableColumn<RuleChain>('root', 'rulechain.edge-template-root', '100px',
 | 
			
		||||
          entity => checkBoxCell(entity.root)),
 | 
			
		||||
        new EntityTableColumn<RuleChain>('assignToEdge', 'rulechain.assign-to-edge', '100px',
 | 
			
		||||
          entity => checkBoxCell(this.isAutoAssignToEdgeRuleChain(entity)), () => ({}), false)
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
    return columns;
 | 
			
		||||
 | 
			
		||||
@ -1821,11 +1821,11 @@
 | 
			
		||||
        "edge-secret": "Edge secret",
 | 
			
		||||
        "copy-edge-secret": "Copy Edge secret",
 | 
			
		||||
        "edge-secret-copied-message": "Edge secret has been copied to clipboard",
 | 
			
		||||
        "edge-assets": "Edge assets",
 | 
			
		||||
        "edge-devices": "Edge devices",
 | 
			
		||||
        "edge-entity-views": "Edge entity views",
 | 
			
		||||
        "edge-dashboards": "Edge dashboards",
 | 
			
		||||
        "edge-rulechains": "Edge rule chains",
 | 
			
		||||
        "manage-assets": "Manage assets",
 | 
			
		||||
        "manage-devices": "Manage devices",
 | 
			
		||||
        "manage-entity-views": "Manage entity views",
 | 
			
		||||
        "manage-dashboards": "Manage dashboards",
 | 
			
		||||
        "manage-rulechains": "Manage rule chains",
 | 
			
		||||
        "assets": "Edge assets",
 | 
			
		||||
        "devices": "Edge devices",
 | 
			
		||||
        "entity-views": "Edge entity views",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user