UI: Fixed stepper for device and device profile dialog

This commit is contained in:
Artem Dzhereleiko 2023-03-16 11:05:23 +02:00
parent da4d0f93a3
commit e96e355a31
4 changed files with 301 additions and 283 deletions

View File

@ -15,124 +15,124 @@
limitations under the License. limitations under the License.
--> -->
<div> <mat-toolbar color="primary">
<mat-toolbar color="primary"> <h2 translate>device-profile.add</h2>
<h2 translate>device-profile.add</h2> <span fxFlex></span>
<span fxFlex></span> <div [tb-help]="'deviceProfiles'"></div>
<div [tb-help]="'deviceProfiles'"></div> <button mat-icon-button
<button mat-icon-button (click)="cancel()"
(click)="cancel()" type="button">
type="button"> <mat-icon class="material-icons">close</mat-icon>
<mat-icon class="material-icons">close</mat-icon> </button>
</button> </mat-toolbar>
</mat-toolbar> <mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async">
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async"> </mat-progress-bar>
</mat-progress-bar> <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> <div mat-dialog-content>
<div mat-dialog-content> <mat-horizontal-stepper [linear]="true" #addDeviceProfileStepper (selectionChange)="changeStep($event)">
<mat-horizontal-stepper [linear]="true" #addDeviceProfileStepper (selectionChange)="changeStep($event)"> <mat-step [stepControl]="deviceProfileDetailsFormGroup">
<mat-step [stepControl]="deviceProfileDetailsFormGroup"> <form [formGroup]="deviceProfileDetailsFormGroup" style="padding-bottom: 16px;">
<form [formGroup]="deviceProfileDetailsFormGroup" style="padding-bottom: 16px;"> <ng-template matStepLabel>{{ 'device-profile.device-profile-details' | translate }}</ng-template>
<ng-template matStepLabel>{{ 'device-profile.device-profile-details' | translate }}</ng-template> <fieldset [disabled]="isLoading$ | async">
<fieldset [disabled]="isLoading$ | async">
<mat-form-field class="mat-block">
<mat-label translate>device-profile.name</mat-label>
<input matInput formControlName="name" required/>
<mat-error *ngIf="deviceProfileDetailsFormGroup.get('name').hasError('required')">
{{ 'device-profile.name-required' | translate }}
</mat-error>
<mat-error *ngIf="deviceProfileDetailsFormGroup.get('name').hasError('maxlength')">
{{ 'device-profile.name-max-length' | translate }}
</mat-error>
</mat-form-field>
<tb-rule-chain-autocomplete
labelText="device-profile.default-rule-chain"
formControlName="defaultRuleChainId">
</tb-rule-chain-autocomplete>
<tb-dashboard-autocomplete
label="{{'device-profile.mobile-dashboard' | translate}}"
formControlName="defaultDashboardId">
<span tb-hint>{{'device-profile.mobile-dashboard-hint' | translate}}</span>
</tb-dashboard-autocomplete>
<tb-queue-autocomplete
[queueType]="serviceType"
formControlName="defaultQueueName">
</tb-queue-autocomplete>
<tb-rule-chain-autocomplete
labelText="device-profile.default-edge-rule-chain"
formControlName="defaultEdgeRuleChainId"
[ruleChainType]="edgeRuleChainType">
<span tb-hint>{{'device-profile.default-edge-rule-chain-hint' | translate}}</span>
</tb-rule-chain-autocomplete>
<mat-form-field fxHide class="mat-block">
<mat-label translate>device-profile.type</mat-label>
<mat-select formControlName="type" required>
<mat-option *ngFor="let type of deviceProfileTypes" [value]="type">
{{deviceProfileTypeTranslations.get(type) | translate}}
</mat-option>
</mat-select>
<mat-error *ngIf="deviceProfileDetailsFormGroup.get('type').hasError('required')">
{{ 'device-profile.type-required' | translate }}
</mat-error>
</mat-form-field>
<tb-image-input fxFlex
label="{{'device-profile.image' | translate}}"
maxSizeByte="524288"
formControlName="image">
</tb-image-input>
<mat-form-field class="mat-block">
<mat-label translate>device-profile.description</mat-label>
<textarea matInput formControlName="description" rows="2"></textarea>
</mat-form-field>
</fieldset>
</form>
</mat-step>
<mat-step [stepControl]="transportConfigFormGroup" [optional]="true">
<form [formGroup]="transportConfigFormGroup" style="padding-bottom: 16px;">
<ng-template matStepLabel>{{ 'device-profile.transport-configuration' | translate }}</ng-template>
<mat-form-field class="mat-block"> <mat-form-field class="mat-block">
<mat-label translate>device-profile.transport-type</mat-label> <mat-label translate>device-profile.name</mat-label>
<mat-select formControlName="transportType" required> <input matInput formControlName="name" required/>
<mat-option *ngFor="let type of deviceTransportTypes" [value]="type"> <mat-error *ngIf="deviceProfileDetailsFormGroup.get('name').hasError('required')">
{{deviceTransportTypeTranslations.get(type) | translate}} {{ 'device-profile.name-required' | translate }}
</mat-option> </mat-error>
</mat-select> <mat-error *ngIf="deviceProfileDetailsFormGroup.get('name').hasError('maxlength')">
<mat-hint *ngIf="transportConfigFormGroup.get('transportType').value"> {{ 'device-profile.name-max-length' | translate }}
{{deviceTransportTypeHints.get(transportConfigFormGroup.get('transportType').value) | translate}}
</mat-hint>
<mat-error *ngIf="transportConfigFormGroup.get('transportType').hasError('required')">
{{ 'device-profile.transport-type-required' | translate }}
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<tb-device-profile-transport-configuration <tb-rule-chain-autocomplete
formControlName="transportConfiguration" labelText="device-profile.default-rule-chain"
isAdd="true" formControlName="defaultRuleChainId">
required> </tb-rule-chain-autocomplete>
</tb-device-profile-transport-configuration> <tb-dashboard-autocomplete
</form> label="{{'device-profile.mobile-dashboard' | translate}}"
</mat-step> formControlName="defaultDashboardId">
<mat-step [stepControl]="alarmRulesFormGroup" [optional]="true"> <span tb-hint>{{'device-profile.mobile-dashboard-hint' | translate}}</span>
<form [formGroup]="alarmRulesFormGroup" style="padding-bottom: 16px;"> </tb-dashboard-autocomplete>
<ng-template matStepLabel>{{'device-profile.alarm-rules-with-count' | translate: <tb-queue-autocomplete
{count: alarmRulesFormGroup.get('alarms').value ? [queueType]="serviceType"
alarmRulesFormGroup.get('alarms').value.length : 0} }}</ng-template> formControlName="defaultQueueName">
<tb-device-profile-alarms </tb-queue-autocomplete>
formControlName="alarms" <tb-rule-chain-autocomplete
[deviceProfileId]="null"> labelText="device-profile.default-edge-rule-chain"
</tb-device-profile-alarms> formControlName="defaultEdgeRuleChainId"
</form> [ruleChainType]="edgeRuleChainType">
</mat-step> <span tb-hint>{{'device-profile.default-edge-rule-chain-hint' | translate}}</span>
<mat-step [stepControl]="provisionConfigFormGroup" [optional]="true"> </tb-rule-chain-autocomplete>
<form [formGroup]="provisionConfigFormGroup" style="padding-bottom: 16px;"> <mat-form-field fxHide class="mat-block">
<ng-template matStepLabel>{{ 'device-profile.device-provisioning' | translate }}</ng-template> <mat-label translate>device-profile.type</mat-label>
<tb-device-profile-provision-configuration <mat-select formControlName="type" required>
formControlName="provisionConfiguration"> <mat-option *ngFor="let type of deviceProfileTypes" [value]="type">
</tb-device-profile-provision-configuration> {{deviceProfileTypeTranslations.get(type) | translate}}
</form> </mat-option>
</mat-step> </mat-select>
</mat-horizontal-stepper> <mat-error *ngIf="deviceProfileDetailsFormGroup.get('type').hasError('required')">
</div> {{ 'device-profile.type-required' | translate }}
<div mat-dialog-actions fxLayout="row"> </mat-error>
</mat-form-field>
<tb-image-input fxFlex
label="{{'device-profile.image' | translate}}"
maxSizeByte="524288"
formControlName="image">
</tb-image-input>
<mat-form-field class="mat-block">
<mat-label translate>device-profile.description</mat-label>
<textarea matInput formControlName="description" rows="2"></textarea>
</mat-form-field>
</fieldset>
</form>
</mat-step>
<mat-step [stepControl]="transportConfigFormGroup" [optional]="true">
<form [formGroup]="transportConfigFormGroup" style="padding-bottom: 16px;">
<ng-template matStepLabel>{{ 'device-profile.transport-configuration' | translate }}</ng-template>
<mat-form-field class="mat-block">
<mat-label translate>device-profile.transport-type</mat-label>
<mat-select formControlName="transportType" required>
<mat-option *ngFor="let type of deviceTransportTypes" [value]="type">
{{deviceTransportTypeTranslations.get(type) | translate}}
</mat-option>
</mat-select>
<mat-hint *ngIf="transportConfigFormGroup.get('transportType').value">
{{deviceTransportTypeHints.get(transportConfigFormGroup.get('transportType').value) | translate}}
</mat-hint>
<mat-error *ngIf="transportConfigFormGroup.get('transportType').hasError('required')">
{{ 'device-profile.transport-type-required' | translate }}
</mat-error>
</mat-form-field>
<tb-device-profile-transport-configuration
formControlName="transportConfiguration"
isAdd="true"
required>
</tb-device-profile-transport-configuration>
</form>
</mat-step>
<mat-step [stepControl]="alarmRulesFormGroup" [optional]="true">
<form [formGroup]="alarmRulesFormGroup" style="padding-bottom: 16px;">
<ng-template matStepLabel>{{'device-profile.alarm-rules-with-count' | translate:
{count: alarmRulesFormGroup.get('alarms').value ?
alarmRulesFormGroup.get('alarms').value.length : 0} }}</ng-template>
<tb-device-profile-alarms
formControlName="alarms"
[deviceProfileId]="null">
</tb-device-profile-alarms>
</form>
</mat-step>
<mat-step [stepControl]="provisionConfigFormGroup" [optional]="true">
<form [formGroup]="provisionConfigFormGroup" style="padding-bottom: 16px;">
<ng-template matStepLabel>{{ 'device-profile.device-provisioning' | translate }}</ng-template>
<tb-device-profile-provision-configuration
formControlName="provisionConfiguration">
</tb-device-profile-provision-configuration>
</form>
</mat-step>
</mat-horizontal-stepper>
</div>
<div mat-dialog-actions style="padding: 0">
<div class="dialog-actions-row" fxFlex fxLayout="row" fxLayoutAlign="end center">
<button mat-stroked-button *ngIf="selectedIndex > 0" <button mat-stroked-button *ngIf="selectedIndex > 0"
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="previousStep()">{{ 'action.back' | translate }}</button> (click)="previousStep()">{{ 'action.back' | translate }}</button>
@ -143,8 +143,8 @@
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="nextStep()">{{ 'action.next-with-label' | translate:{label: (getFormLabel(this.selectedIndex+1) | translate)} }}</button> (click)="nextStep()">{{ 'action.next-with-label' | translate:{label: (getFormLabel(this.selectedIndex+1) | translate)} }}</button>
</div> </div>
<mat-divider></mat-divider> <mat-divider style="width: 100%"></mat-divider>
<div mat-dialog-actions fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="end"> <div class="dialog-actions-row" fxFlex fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="end center">
<button mat-button <button mat-button
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="cancel()">{{ 'action.cancel' | translate }}</button> (click)="cancel()">{{ 'action.cancel' | translate }}</button>

View File

@ -15,6 +15,15 @@
*/ */
@import "../../../../../scss/constants"; @import "../../../../../scss/constants";
:host {
height: 100%;
display: grid;
.dialog-actions-row {
padding: 8px;
}
}
:host-context(.tb-fullscreen-dialog .mat-mdc-dialog-container) { :host-context(.tb-fullscreen-dialog .mat-mdc-dialog-container) {
@media #{$mat-lt-sm} { @media #{$mat-lt-sm} {
.mat-mdc-dialog-content { .mat-mdc-dialog-content {

View File

@ -15,172 +15,172 @@
limitations under the License. limitations under the License.
--> -->
<div> <mat-toolbar color="primary">
<mat-toolbar color="primary"> <h2 translate>device.add-device-text</h2>
<h2 translate>device.add-device-text</h2> <span fxFlex></span>
<span fxFlex></span> <div [tb-help]="'devices'"></div>
<div [tb-help]="'devices'"></div> <button mat-icon-button
<button mat-icon-button (click)="cancel()"
(click)="cancel()" type="button">
type="button"> <mat-icon class="material-icons">close</mat-icon>
<mat-icon class="material-icons">close</mat-icon> </button>
</button> </mat-toolbar>
</mat-toolbar> <mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async">
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async"> </mat-progress-bar>
</mat-progress-bar> <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> <div mat-dialog-content>
<div mat-dialog-content> <mat-horizontal-stepper [linear]="true" [labelPosition]="labelPosition" #addDeviceWizardStepper (selectionChange)="changeStep($event)">
<mat-horizontal-stepper [linear]="true" [labelPosition]="labelPosition" #addDeviceWizardStepper (selectionChange)="changeStep($event)"> <ng-template matStepperIcon="edit">
<ng-template matStepperIcon="edit"> <mat-icon>check</mat-icon>
<mat-icon>check</mat-icon> </ng-template>
</ng-template> <mat-step [stepControl]="deviceWizardFormGroup">
<mat-step [stepControl]="deviceWizardFormGroup"> <form [formGroup]="deviceWizardFormGroup" style="padding-bottom: 16px;">
<form [formGroup]="deviceWizardFormGroup" style="padding-bottom: 16px;"> <ng-template matStepLabel>{{ 'device.wizard.device-details' | translate}}</ng-template>
<ng-template matStepLabel>{{ 'device.wizard.device-details' | translate}}</ng-template> <fieldset [disabled]="isLoading$ | async">
<fieldset [disabled]="isLoading$ | async"> <mat-form-field class="mat-block">
<mat-form-field class="mat-block"> <mat-label translate>device.name</mat-label>
<mat-label translate>device.name</mat-label> <input matInput formControlName="name" required>
<input matInput formControlName="name" required> <mat-error *ngIf="deviceWizardFormGroup.get('name').hasError('required')">
<mat-error *ngIf="deviceWizardFormGroup.get('name').hasError('required')"> {{ 'device.name-required' | translate }}
{{ 'device.name-required' | translate }} </mat-error>
</mat-error> <mat-error *ngIf="deviceWizardFormGroup.get('name').hasError('maxlength')">
<mat-error *ngIf="deviceWizardFormGroup.get('name').hasError('maxlength')"> {{ 'device.name-max-length' | translate }}
{{ 'device.name-max-length' | translate }} </mat-error>
</mat-error> </mat-form-field>
</mat-form-field> <mat-form-field class="mat-block">
<mat-form-field class="mat-block"> <mat-label translate>device.label</mat-label>
<mat-label translate>device.label</mat-label> <input matInput formControlName="label">
<input matInput formControlName="label"> <mat-error *ngIf="deviceWizardFormGroup.get('label').hasError('maxlength')">
<mat-error *ngIf="deviceWizardFormGroup.get('label').hasError('maxlength')"> {{ 'device.label-max-length' | translate }}
{{ 'device.label-max-length' | translate }} </mat-error>
</mat-error> </mat-form-field>
</mat-form-field> <div fxLayout="row" fxLayoutGap="16px">
<div fxLayout="row" fxLayoutGap="16px"> <mat-radio-group fxLayout="column" formControlName="addProfileType" fxLayoutAlign="space-around">
<mat-radio-group fxLayout="column" formControlName="addProfileType" fxLayoutAlign="space-around"> <mat-radio-button [value]="0" color="primary">
<mat-radio-button [value]="0" color="primary"> <span translate>device.wizard.existing-device-profile</span>
<span translate>device.wizard.existing-device-profile</span> </mat-radio-button>
</mat-radio-button> <mat-radio-button [value]="1" color="primary">
<mat-radio-button [value]="1" color="primary"> <span translate>device.wizard.new-device-profile</span>
<span translate>device.wizard.new-device-profile</span> </mat-radio-button>
</mat-radio-button> </mat-radio-group>
</mat-radio-group> <div fxLayout="column">
<div fxLayout="column"> <tb-device-profile-autocomplete
<tb-device-profile-autocomplete [required]="!createProfile"
[required]="!createProfile" formControlName="deviceProfileId"
formControlName="deviceProfileId" [ngClass]="{invisible: deviceWizardFormGroup.get('addProfileType').value !== 0}"
[ngClass]="{invisible: deviceWizardFormGroup.get('addProfileType').value !== 0}" [addNewProfile]="false"
[addNewProfile]="false" [selectDefaultProfile]="true"
[selectDefaultProfile]="true" [editProfileEnabled]="false"
[editProfileEnabled]="false" (deviceProfileChanged)="deviceProfileChanged($event)">
(deviceProfileChanged)="deviceProfileChanged($event)"> </tb-device-profile-autocomplete>
</tb-device-profile-autocomplete> <mat-form-field fxFlex class="mat-block"
<mat-form-field fxFlex class="mat-block" [ngClass]="{invisible: deviceWizardFormGroup.get('addProfileType').value !== 1}">
[ngClass]="{invisible: deviceWizardFormGroup.get('addProfileType').value !== 1}"> <mat-label translate>device-profile.new-device-profile-name</mat-label>
<mat-label translate>device-profile.new-device-profile-name</mat-label> <input matInput formControlName="newDeviceProfileTitle"
<input matInput formControlName="newDeviceProfileTitle" [required]="createProfile">
[required]="createProfile"> <mat-error *ngIf="deviceWizardFormGroup.get('newDeviceProfileTitle').hasError('required')">
<mat-error *ngIf="deviceWizardFormGroup.get('newDeviceProfileTitle').hasError('required')"> {{ 'device-profile.new-device-profile-name-required' | translate }}
{{ 'device-profile.new-device-profile-name-required' | translate }} </mat-error>
</mat-error> </mat-form-field>
</mat-form-field>
</div>
<div fxLayout="column" fxLayoutAlign="flex-end start">
<tb-rule-chain-autocomplete
[ngClass]="{invisible: deviceWizardFormGroup.get('addProfileType').value !== 1}"
labelText="device-profile.default-rule-chain"
formControlName="defaultRuleChainId">
</tb-rule-chain-autocomplete>
</div>
<div fxLayout="column" fxLayoutAlign="flex-end start">
<tb-queue-autocomplete
[ngClass]="{invisible: deviceWizardFormGroup.get('addProfileType').value !== 1}"
[queueType]="serviceType"
formControlName="defaultQueueName">
</tb-queue-autocomplete>
</div>
</div> </div>
<div fxLayout="row" fxLayoutGap="16px" style="padding-bottom: 16px;"> <div fxLayout="column" fxLayoutAlign="flex-end start">
<mat-checkbox formControlName="gateway"> <tb-rule-chain-autocomplete
{{ 'device.is-gateway' | translate }} [ngClass]="{invisible: deviceWizardFormGroup.get('addProfileType').value !== 1}"
</mat-checkbox> labelText="device-profile.default-rule-chain"
<mat-checkbox *ngIf="deviceWizardFormGroup.get('gateway').value" formControlName="defaultRuleChainId">
formControlName="overwriteActivityTime"> </tb-rule-chain-autocomplete>
{{ 'device.overwrite-activity-time' | translate }}
</mat-checkbox>
</div> </div>
<mat-form-field class="mat-block"> <div fxLayout="column" fxLayoutAlign="flex-end start">
<mat-label translate>device.description</mat-label> <tb-queue-autocomplete
<textarea matInput formControlName="description" rows="2"></textarea> [ngClass]="{invisible: deviceWizardFormGroup.get('addProfileType').value !== 1}"
</mat-form-field> [queueType]="serviceType"
</fieldset> formControlName="defaultQueueName">
</form> </tb-queue-autocomplete>
</mat-step> </div>
<mat-step [stepControl]="transportConfigFormGroup" [optional]="true" *ngIf="createProfile"> </div>
<form [formGroup]="transportConfigFormGroup" style="padding-bottom: 16px;"> <div fxLayout="row" fxLayoutGap="16px" style="padding-bottom: 16px;">
<ng-template matStepLabel>{{ 'device-profile.transport-configuration' | translate }}</ng-template><mat-form-field class="mat-block" style="padding-bottom: 14px;"> <mat-checkbox formControlName="gateway">
<mat-label translate>device-profile.transport-type</mat-label> {{ 'device.is-gateway' | translate }}
<mat-select formControlName="transportType" required> </mat-checkbox>
<mat-option *ngFor="let type of deviceTransportTypes" [value]="type"> <mat-checkbox *ngIf="deviceWizardFormGroup.get('gateway').value"
{{deviceTransportTypeTranslations.get(type) | translate}} formControlName="overwriteActivityTime">
</mat-option> {{ 'device.overwrite-activity-time' | translate }}
</mat-select> </mat-checkbox>
<mat-hint *ngIf="transportConfigFormGroup.get('transportType').value"> </div>
{{deviceTransportTypeHints.get(transportConfigFormGroup.get('transportType').value) | translate}} <mat-form-field class="mat-block">
</mat-hint> <mat-label translate>device.description</mat-label>
<mat-error *ngIf="transportConfigFormGroup.get('transportType').hasError('required')"> <textarea matInput formControlName="description" rows="2"></textarea>
{{ 'device-profile.transport-type-required' | translate }} </mat-form-field>
</mat-error> </fieldset>
</mat-form-field> </form>
<tb-device-profile-transport-configuration </mat-step>
formControlName="transportConfiguration" <mat-step [stepControl]="transportConfigFormGroup" [optional]="true" *ngIf="createProfile">
isAdd="true" <form [formGroup]="transportConfigFormGroup" style="padding-bottom: 16px;">
required> <ng-template matStepLabel>{{ 'device-profile.transport-configuration' | translate }}</ng-template><mat-form-field class="mat-block" style="padding-bottom: 14px;">
</tb-device-profile-transport-configuration> <mat-label translate>device-profile.transport-type</mat-label>
</form> <mat-select formControlName="transportType" required>
</mat-step> <mat-option *ngFor="let type of deviceTransportTypes" [value]="type">
<mat-step [stepControl]="alarmRulesFormGroup" [optional]="true" *ngIf="createProfile"> {{deviceTransportTypeTranslations.get(type) | translate}}
<form [formGroup]="alarmRulesFormGroup" style="padding-bottom: 16px;"> </mat-option>
<ng-template matStepLabel>{{'device-profile.alarm-rules-with-count' | translate: </mat-select>
{count: alarmRulesFormGroup.get('alarms').value ? <mat-hint *ngIf="transportConfigFormGroup.get('transportType').value">
alarmRulesFormGroup.get('alarms').value.length : 0} }}</ng-template> {{deviceTransportTypeHints.get(transportConfigFormGroup.get('transportType').value) | translate}}
<tb-device-profile-alarms </mat-hint>
formControlName="alarms" <mat-error *ngIf="transportConfigFormGroup.get('transportType').hasError('required')">
[deviceProfileId]="null"> {{ 'device-profile.transport-type-required' | translate }}
</tb-device-profile-alarms> </mat-error>
</form> </mat-form-field>
</mat-step> <tb-device-profile-transport-configuration
<mat-step [stepControl]="provisionConfigFormGroup" [optional]="true" *ngIf="createProfile"> formControlName="transportConfiguration"
<form [formGroup]="provisionConfigFormGroup" style="padding-bottom: 16px;"> isAdd="true"
<ng-template matStepLabel>{{ 'device-profile.device-provisioning' | translate }}</ng-template> required>
<tb-device-profile-provision-configuration </tb-device-profile-transport-configuration>
formControlName="provisionConfiguration"> </form>
</tb-device-profile-provision-configuration> </mat-step>
</form> <mat-step [stepControl]="alarmRulesFormGroup" [optional]="true" *ngIf="createProfile">
</mat-step> <form [formGroup]="alarmRulesFormGroup" style="padding-bottom: 16px;">
<mat-step [stepControl]="credentialsFormGroup" [optional]="true"> <ng-template matStepLabel>{{'device-profile.alarm-rules-with-count' | translate:
<ng-template matStepLabel>{{ 'device.credentials' | translate }}</ng-template> {count: alarmRulesFormGroup.get('alarms').value ?
<form [formGroup]="credentialsFormGroup" style="padding-bottom: 16px;"> alarmRulesFormGroup.get('alarms').value.length : 0} }}</ng-template>
<mat-checkbox style="padding-bottom: 16px;" formControlName="setCredential">{{ 'device.wizard.add-credentials' | translate }}</mat-checkbox> <tb-device-profile-alarms
<tb-device-credentials formControlName="alarms"
[fxShow]="credentialsFormGroup.get('setCredential').value" [deviceProfileId]="null">
[deviceTransportType]="deviceTransportType" </tb-device-profile-alarms>
formControlName="credential"> </form>
</tb-device-credentials> </mat-step>
</form> <mat-step [stepControl]="provisionConfigFormGroup" [optional]="true" *ngIf="createProfile">
</mat-step> <form [formGroup]="provisionConfigFormGroup" style="padding-bottom: 16px;">
<mat-step [stepControl]="customerFormGroup" [optional]="true"> <ng-template matStepLabel>{{ 'device-profile.device-provisioning' | translate }}</ng-template>
<ng-template matStepLabel>{{ 'customer.customer' | translate }}</ng-template> <tb-device-profile-provision-configuration
<form [formGroup]="customerFormGroup" style="padding-bottom: 16px;"> formControlName="provisionConfiguration">
<tb-entity-autocomplete </tb-device-profile-provision-configuration>
formControlName="customerId" </form>
labelText="device.wizard.customer-to-assign-device" </mat-step>
[entityType]="entityType.CUSTOMER"> <mat-step [stepControl]="credentialsFormGroup" [optional]="true">
</tb-entity-autocomplete> <ng-template matStepLabel>{{ 'device.credentials' | translate }}</ng-template>
</form> <form [formGroup]="credentialsFormGroup" style="padding-bottom: 16px;">
</mat-step> <mat-checkbox style="padding-bottom: 16px;" formControlName="setCredential">{{ 'device.wizard.add-credentials' | translate }}</mat-checkbox>
</mat-horizontal-stepper> <tb-device-credentials
</div> [fxShow]="credentialsFormGroup.get('setCredential').value"
<div mat-dialog-actions fxLayout="row"> [deviceTransportType]="deviceTransportType"
formControlName="credential">
</tb-device-credentials>
</form>
</mat-step>
<mat-step [stepControl]="customerFormGroup" [optional]="true">
<ng-template matStepLabel>{{ 'customer.customer' | translate }}</ng-template>
<form [formGroup]="customerFormGroup" style="padding-bottom: 16px;">
<tb-entity-autocomplete
formControlName="customerId"
labelText="device.wizard.customer-to-assign-device"
[entityType]="entityType.CUSTOMER">
</tb-entity-autocomplete>
</form>
</mat-step>
</mat-horizontal-stepper>
</div>
<div mat-dialog-actions style="padding: 0">
<div class="dialog-actions-row" fxFlex fxLayout="row" fxLayoutAlign="end center">
<button mat-stroked-button *ngIf="selectedIndex > 0" <button mat-stroked-button *ngIf="selectedIndex > 0"
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="previousStep()">{{ 'action.back' | translate }}</button> (click)="previousStep()">{{ 'action.back' | translate }}</button>
@ -191,8 +191,8 @@
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="nextStep()">{{ 'action.next-with-label' | translate:{label: (getFormLabel(this.selectedIndex+1) | translate)} }}</button> (click)="nextStep()">{{ 'action.next-with-label' | translate:{label: (getFormLabel(this.selectedIndex+1) | translate)} }}</button>
</div> </div>
<mat-divider></mat-divider> <mat-divider style="width: 100%"></mat-divider>
<div mat-dialog-actions fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="end"> <div class="dialog-actions-row" fxFlex fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="end center">
<button mat-button <button mat-button
[disabled]="(isLoading$ | async)" [disabled]="(isLoading$ | async)"
(click)="cancel()">{{ 'action.cancel' | translate }}</button> (click)="cancel()">{{ 'action.cancel' | translate }}</button>

View File

@ -15,6 +15,15 @@
*/ */
@import "../../../../../scss/constants"; @import "../../../../../scss/constants";
:host {
height: 100%;
display: grid;
.dialog-actions-row {
padding: 8px;
}
}
:host-context(.tb-fullscreen-dialog .mat-mdc-dialog-container) { :host-context(.tb-fullscreen-dialog .mat-mdc-dialog-container) {
@media #{$mat-lt-sm} { @media #{$mat-lt-sm} {
.mat-mdc-dialog-content { .mat-mdc-dialog-content {