Merge pull request #3889 from vvlladd28/improvement/show-many/alarm0rules

UI: Improvement time rendering profiles seated too many parameters
This commit is contained in:
Igor Kulikov 2020-12-23 17:42:35 +02:00 committed by GitHub
commit 0117330be1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 113 additions and 99 deletions

View File

@ -33,87 +33,91 @@
</button> </button>
</div> </div>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<div fxLayout="column" fxLayoutGap="0.5em"> <ng-template matExpansionPanelContent>
<mat-divider></mat-divider> <div fxLayout="column" fxLayoutGap="0.5em">
<mat-form-field fxFlex floatLabel="always"> <mat-divider></mat-divider>
<mat-label>{{'device-profile.alarm-type' | translate}}</mat-label> <mat-form-field fxFlex floatLabel="always">
<input required matInput formControlName="alarmType" placeholder="Enter alarm type"> <mat-label>{{'device-profile.alarm-type' | translate}}</mat-label>
<mat-error *ngIf="alarmFormGroup.get('alarmType').hasError('required')"> <input required matInput formControlName="alarmType" placeholder="Enter alarm type">
{{ 'device-profile.alarm-type-required' | translate }} <mat-error *ngIf="alarmFormGroup.get('alarmType').hasError('required')">
</mat-error> {{ 'device-profile.alarm-type-required' | translate }}
<mat-error *ngIf="alarmFormGroup.get('alarmType').hasError('unique')"> </mat-error>
{{ 'device-profile.alarm-type-unique' | translate }} <mat-error *ngIf="alarmFormGroup.get('alarmType').hasError('unique')">
</mat-error> {{ 'device-profile.alarm-type-unique' | translate }}
</mat-form-field> </mat-error>
</div>
<mat-expansion-panel class="advanced-settings" [expanded]="false">
<mat-expansion-panel-header>
<mat-panel-title>
<div fxFlex fxLayout="row" fxLayoutAlign="end center">
<div class="tb-small" translate>device-profile.advanced-settings</div>
</div>
</mat-panel-title>
</mat-expansion-panel-header>
<mat-checkbox formControlName="propagate" style="display: block; padding-bottom: 16px;">
{{ 'device-profile.propagate-alarm' | translate }}
</mat-checkbox>
<section *ngIf="alarmFormGroup.get('propagate').value === true" style="padding-bottom: 1em;">
<mat-form-field floatLabel="always" class="mat-block">
<mat-label translate>device-profile.alarm-rule-relation-types-list</mat-label>
<mat-chip-list #relationTypesChipList [disabled]="disabled">
<mat-chip
*ngFor="let key of alarmFormGroup.get('propagateRelationTypes').value;"
(removed)="removeRelationType(key)">
{{key}}
<mat-icon matChipRemove>close</mat-icon>
</mat-chip>
<input matInput type="text" placeholder="{{'device-profile.alarm-rule-relation-types-list' | translate}}"
style="max-width: 200px;"
[matChipInputFor]="relationTypesChipList"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
(matChipInputTokenEnd)="addRelationType($event)"
[matChipInputAddOnBlur]="true">
</mat-chip-list>
<mat-hint innerHTML="{{ 'device-profile.alarm-rule-relation-types-list-hint' | translate }}"></mat-hint>
</mat-form-field> </mat-form-field>
</section> </div>
</mat-expansion-panel> <mat-expansion-panel class="advanced-settings" [expanded]="false">
<div fxFlex fxLayout="column"> <mat-expansion-panel-header>
<div translate class="tb-small" style="padding-bottom: 8px;">device-profile.create-alarm-rules</div> <mat-panel-title>
<tb-create-alarm-rules formControlName="createRules" <div fxFlex fxLayout="row" fxLayoutAlign="end center">
style="padding-bottom: 16px;" <div class="tb-small" translate>device-profile.advanced-settings</div>
[deviceProfileId]="deviceProfileId"> </div>
</tb-create-alarm-rules> </mat-panel-title>
<div translate class="tb-small" style="padding-bottom: 8px;">device-profile.clear-alarm-rule</div> </mat-expansion-panel-header>
<div fxLayout="row" fxLayoutGap="8px;" fxLayoutAlign="start center" <ng-template matExpansionPanelContent>
[fxShow]="alarmFormGroup.get('clearRule').value" <mat-checkbox formControlName="propagate" style="display: block; padding-bottom: 16px;">
style="padding-bottom: 8px;"> {{ 'device-profile.propagate-alarm' | translate }}
<div class="clear-alarm-rule" fxFlex fxLayout="row"> </mat-checkbox>
<tb-alarm-rule formControlName="clearRule" fxFlex [deviceProfileId]="deviceProfileId"> <section *ngIf="alarmFormGroup.get('propagate').value === true" style="padding-bottom: 1em;">
</tb-alarm-rule> <mat-form-field floatLabel="always" class="mat-block">
<mat-label translate>device-profile.alarm-rule-relation-types-list</mat-label>
<mat-chip-list #relationTypesChipList [disabled]="disabled">
<mat-chip
*ngFor="let key of alarmFormGroup.get('propagateRelationTypes').value;"
(removed)="removeRelationType(key)">
{{key}}
<mat-icon matChipRemove>close</mat-icon>
</mat-chip>
<input matInput type="text" placeholder="{{'device-profile.alarm-rule-relation-types-list' | translate}}"
style="max-width: 200px;"
[matChipInputFor]="relationTypesChipList"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
(matChipInputTokenEnd)="addRelationType($event)"
[matChipInputAddOnBlur]="true">
</mat-chip-list>
<mat-hint innerHTML="{{ 'device-profile.alarm-rule-relation-types-list-hint' | translate }}"></mat-hint>
</mat-form-field>
</section>
</ng-template>
</mat-expansion-panel>
<div fxFlex fxLayout="column">
<div translate class="tb-small" style="padding-bottom: 8px;">device-profile.create-alarm-rules</div>
<tb-create-alarm-rules formControlName="createRules"
style="padding-bottom: 16px;"
[deviceProfileId]="deviceProfileId">
</tb-create-alarm-rules>
<div translate class="tb-small" style="padding-bottom: 8px;">device-profile.clear-alarm-rule</div>
<div fxLayout="row" fxLayoutGap="8px;" fxLayoutAlign="start center"
[fxShow]="alarmFormGroup.get('clearRule').value"
style="padding-bottom: 8px;">
<div class="clear-alarm-rule" fxFlex fxLayout="row">
<tb-alarm-rule formControlName="clearRule" fxFlex [deviceProfileId]="deviceProfileId">
</tb-alarm-rule>
</div>
<button *ngIf="!disabled"
mat-icon-button color="primary" style="min-width: 40px;"
type="button"
(click)="removeClearAlarmRule()"
matTooltip="{{ 'action.remove' | translate }}"
matTooltipPosition="above">
<mat-icon>remove_circle_outline</mat-icon>
</button>
</div>
<div *ngIf="disabled && !alarmFormGroup.get('clearRule').value">
<span translate fxLayoutAlign="center center" style="margin: 16px 0"
class="tb-prompt">device-profile.no-clear-alarm-rule</span>
</div>
<div *ngIf="!disabled" [fxShow]="!alarmFormGroup.get('clearRule').value">
<button mat-stroked-button color="primary"
type="button"
(click)="addClearAlarmRule()"
matTooltip="{{ 'device-profile.add-clear-alarm-rule' | translate }}"
matTooltipPosition="above">
<mat-icon class="button-icon">add_circle_outline</mat-icon>
{{ 'device-profile.add-clear-alarm-rule' | translate }}
</button>
</div> </div>
<button *ngIf="!disabled"
mat-icon-button color="primary" style="min-width: 40px;"
type="button"
(click)="removeClearAlarmRule()"
matTooltip="{{ 'action.remove' | translate }}"
matTooltipPosition="above">
<mat-icon>remove_circle_outline</mat-icon>
</button>
</div> </div>
<div *ngIf="disabled && !alarmFormGroup.get('clearRule').value"> </ng-template>
<span translate fxLayoutAlign="center center" style="margin: 16px 0"
class="tb-prompt">device-profile.no-clear-alarm-rule</span>
</div>
<div *ngIf="!disabled" [fxShow]="!alarmFormGroup.get('clearRule').value">
<button mat-stroked-button color="primary"
type="button"
(click)="addClearAlarmRule()"
matTooltip="{{ 'device-profile.add-clear-alarm-rule' | translate }}"
matTooltipPosition="above">
<mat-icon class="button-icon">add_circle_outline</mat-icon>
{{ 'device-profile.add-clear-alarm-rule' | translate }}
</button>
</div>
</div>
</mat-expansion-panel> </mat-expansion-panel>

View File

@ -91,10 +91,12 @@
<div translate>device-profile.profile-configuration</div> <div translate>device-profile.profile-configuration</div>
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<tb-device-profile-configuration <ng-template matExpansionPanelContent>
formControlName="configuration" <tb-device-profile-configuration
required> formControlName="configuration"
</tb-device-profile-configuration> required>
</tb-device-profile-configuration>
</ng-template>
</mat-expansion-panel> </mat-expansion-panel>
<mat-expansion-panel *ngIf="displayTransportConfiguration" [expanded]="true"> <mat-expansion-panel *ngIf="displayTransportConfiguration" [expanded]="true">
<mat-expansion-panel-header> <mat-expansion-panel-header>
@ -102,10 +104,12 @@
<div translate>device-profile.transport-configuration</div> <div translate>device-profile.transport-configuration</div>
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<tb-device-profile-transport-configuration <ng-template matExpansionPanelContent>
formControlName="transportConfiguration" <tb-device-profile-transport-configuration
required> formControlName="transportConfiguration"
</tb-device-profile-transport-configuration> required>
</tb-device-profile-transport-configuration>
</ng-template>
</mat-expansion-panel> </mat-expansion-panel>
<mat-expansion-panel [expanded]="false"> <mat-expansion-panel [expanded]="false">
<mat-expansion-panel-header> <mat-expansion-panel-header>
@ -115,10 +119,12 @@
entityForm.get('profileData.alarms').value.length : 0} }}</div> entityForm.get('profileData.alarms').value.length : 0} }}</div>
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<tb-device-profile-alarms <ng-template matExpansionPanelContent>
formControlName="alarms" <tb-device-profile-alarms
[deviceProfileId]="deviceProfileId"> formControlName="alarms"
</tb-device-profile-alarms> [deviceProfileId]="deviceProfileId">
</tb-device-profile-alarms>
</ng-template>
</mat-expansion-panel> </mat-expansion-panel>
<mat-expansion-panel [expanded]="true"> <mat-expansion-panel [expanded]="true">
<mat-expansion-panel-header> <mat-expansion-panel-header>
@ -126,9 +132,11 @@
<div translate>device-profile.device-provisioning</div> <div translate>device-profile.device-provisioning</div>
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<tb-device-profile-provision-configuration <ng-template matExpansionPanelContent>
formControlName="provisionConfiguration"> <tb-device-profile-provision-configuration
</tb-device-profile-provision-configuration> formControlName="provisionConfiguration">
</tb-device-profile-provision-configuration>
</ng-template>
</mat-expansion-panel> </mat-expansion-panel>
</mat-accordion> </mat-accordion>
</div> </div>

View File

@ -22,9 +22,11 @@
<div translate>tenant-profile.profile-configuration</div> <div translate>tenant-profile.profile-configuration</div>
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<tb-tenant-profile-configuration <ng-template matExpansionPanelContent>
formControlName="configuration" <tb-tenant-profile-configuration
required> formControlName="configuration"
</tb-tenant-profile-configuration> required>
</tb-tenant-profile-configuration>
</ng-template>
</mat-expansion-panel> </mat-expansion-panel>
</form> </form>