UI: Refactoring
This commit is contained in:
parent
45b6a738ca
commit
4a53707124
@ -26,18 +26,19 @@
|
|||||||
matTooltip="{{ 'device.generate-client-id' | translate }}"
|
matTooltip="{{ 'device.generate-client-id' | translate }}"
|
||||||
matTooltipPosition="above"
|
matTooltipPosition="above"
|
||||||
(click)="generate('clientId')"
|
(click)="generate('clientId')"
|
||||||
*ngIf="!deviceCredentialsMqttFormGroup.get('clientId').value">
|
*ngIf="!deviceCredentialsMqttFormGroup.get('clientId').value; else copyClientId">
|
||||||
<mat-icon>autorenew</mat-icon>
|
<mat-icon>autorenew</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
<ng-template #copyClientId>
|
||||||
<tb-copy-button
|
<tb-copy-button
|
||||||
matSuffix
|
matSuffix
|
||||||
inputAction
|
[miniButton]="false"
|
||||||
*ngIf="deviceCredentialsMqttFormGroup.get('clientId').value"
|
|
||||||
[copyText]="deviceCredentialsMqttFormGroup.get('clientId').value"
|
[copyText]="deviceCredentialsMqttFormGroup.get('clientId').value"
|
||||||
tooltipText="{{ 'device.copy-client-id' | translate }}"
|
tooltipText="{{ 'device.copy-client-id' | translate }}"
|
||||||
tooltipPosition="above"
|
tooltipPosition="above"
|
||||||
icon="content_copy">
|
icon="content_copy">
|
||||||
</tb-copy-button>
|
</tb-copy-button>
|
||||||
|
</ng-template>
|
||||||
<mat-error *ngIf="deviceCredentialsMqttFormGroup.get('clientId').hasError('pattern')">
|
<mat-error *ngIf="deviceCredentialsMqttFormGroup.get('clientId').hasError('pattern')">
|
||||||
{{ 'device.client-id-pattern' | translate }}
|
{{ 'device.client-id-pattern' | translate }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
@ -52,18 +53,20 @@
|
|||||||
matTooltip="{{ 'device.generate-user-name' | translate }}"
|
matTooltip="{{ 'device.generate-user-name' | translate }}"
|
||||||
matTooltipPosition="above"
|
matTooltipPosition="above"
|
||||||
(click)="generate('userName')"
|
(click)="generate('userName')"
|
||||||
*ngIf="!deviceCredentialsMqttFormGroup.get('userName').value">
|
*ngIf="!deviceCredentialsMqttFormGroup.get('userName').value; else copyUserName">
|
||||||
<mat-icon>autorenew</mat-icon>
|
<mat-icon>autorenew</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
<ng-template #copyUserName>
|
||||||
<tb-copy-button
|
<tb-copy-button
|
||||||
matSuffix
|
matSuffix
|
||||||
inputAction
|
[miniButton]="false"
|
||||||
*ngIf="deviceCredentialsMqttFormGroup.get('userName').value"
|
*ngIf="deviceCredentialsMqttFormGroup.get('userName').value"
|
||||||
[copyText]="deviceCredentialsMqttFormGroup.get('userName').value"
|
[copyText]="deviceCredentialsMqttFormGroup.get('userName').value"
|
||||||
tooltipText="{{ 'device.copy-user-name' | translate }}"
|
tooltipText="{{ 'device.copy-user-name' | translate }}"
|
||||||
tooltipPosition="above"
|
tooltipPosition="above"
|
||||||
icon="content_copy">
|
icon="content_copy">
|
||||||
</tb-copy-button>
|
</tb-copy-button>
|
||||||
|
</ng-template>
|
||||||
<mat-error *ngIf="deviceCredentialsMqttFormGroup.get('userName').hasError('required')">
|
<mat-error *ngIf="deviceCredentialsMqttFormGroup.get('userName').hasError('required')">
|
||||||
{{ 'device.user-name-required' | translate }}
|
{{ 'device.user-name-required' | translate }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
@ -82,18 +85,20 @@
|
|||||||
matTooltip="{{ 'device.generate-password' | translate }}"
|
matTooltip="{{ 'device.generate-password' | translate }}"
|
||||||
matTooltipPosition="above"
|
matTooltipPosition="above"
|
||||||
(click)="generate('password')"
|
(click)="generate('password')"
|
||||||
*ngIf="!deviceCredentialsMqttFormGroup.get('password').value">
|
*ngIf="!deviceCredentialsMqttFormGroup.get('password').value; else copyPassword">
|
||||||
<mat-icon>autorenew</mat-icon>
|
<mat-icon>autorenew</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
<ng-template #copyPassword>
|
||||||
<tb-copy-button
|
<tb-copy-button
|
||||||
matSuffix
|
matSuffix
|
||||||
inputAction
|
[miniButton]="false"
|
||||||
*ngIf="deviceCredentialsMqttFormGroup.get('password').value"
|
*ngIf="deviceCredentialsMqttFormGroup.get('password').value"
|
||||||
[copyText]="deviceCredentialsMqttFormGroup.get('password').value"
|
[copyText]="deviceCredentialsMqttFormGroup.get('password').value"
|
||||||
tooltipText="{{ 'device.copy-password' | translate }}"
|
tooltipText="{{ 'device.copy-password' | translate }}"
|
||||||
tooltipPosition="above"
|
tooltipPosition="above"
|
||||||
icon="content_copy">
|
icon="content_copy">
|
||||||
</tb-copy-button>
|
</tb-copy-button>
|
||||||
|
</ng-template>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<tb-error style="margin-top: -12px; display: block;"
|
<tb-error style="margin-top: -12px; display: block;"
|
||||||
[error]="deviceCredentialsMqttFormGroup.hasError('atLeastOne') ?
|
[error]="deviceCredentialsMqttFormGroup.hasError('atLeastOne') ?
|
||||||
|
|||||||
@ -130,6 +130,6 @@ export class DeviceCredentialsMqttBasicComponent implements ControlValueAccessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
public generate(formControlName: string) {
|
public generate(formControlName: string) {
|
||||||
this.deviceCredentialsMqttFormGroup.get(formControlName).patchValue(generateSecret(12));
|
this.deviceCredentialsMqttFormGroup.get(formControlName).patchValue(generateSecret(20));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,18 +36,19 @@
|
|||||||
matTooltip="{{ 'device.generate-access-token' | translate }}"
|
matTooltip="{{ 'device.generate-access-token' | translate }}"
|
||||||
matTooltipPosition="above"
|
matTooltipPosition="above"
|
||||||
(click)="generate('credentialsId')"
|
(click)="generate('credentialsId')"
|
||||||
*ngIf="!deviceCredentialsFormGroup.get('credentialsId').value">
|
*ngIf="!deviceCredentialsFormGroup.get('credentialsId').value; else copyAccessToken">
|
||||||
<mat-icon>autorenew</mat-icon>
|
<mat-icon>autorenew</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
<ng-template #copyAccessToken>
|
||||||
<tb-copy-button
|
<tb-copy-button
|
||||||
matSuffix
|
matSuffix
|
||||||
inputAction
|
[miniButton]="false"
|
||||||
*ngIf="deviceCredentialsFormGroup.get('credentialsId').value"
|
|
||||||
[copyText]="deviceCredentialsFormGroup.get('credentialsId').value"
|
[copyText]="deviceCredentialsFormGroup.get('credentialsId').value"
|
||||||
tooltipText="{{ 'device.copy-access-token' | translate }}"
|
tooltipText="{{ 'device.copy-access-token' | translate }}"
|
||||||
tooltipPosition="above"
|
tooltipPosition="above"
|
||||||
icon="content_copy">
|
icon="content_copy">
|
||||||
</tb-copy-button>
|
</tb-copy-button>
|
||||||
|
</ng-template>
|
||||||
<mat-error *ngIf="deviceCredentialsFormGroup.get('credentialsId').hasError('required')">
|
<mat-error *ngIf="deviceCredentialsFormGroup.get('credentialsId').hasError('required')">
|
||||||
{{ 'device.access-token-required' | translate }}
|
{{ 'device.access-token-required' | translate }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
@ -62,7 +63,7 @@
|
|||||||
<textarea matInput formControlName="credentialsValue" cols="15" rows="5" required></textarea>
|
<textarea matInput formControlName="credentialsValue" cols="15" rows="5" required></textarea>
|
||||||
<tb-copy-button
|
<tb-copy-button
|
||||||
matSuffix
|
matSuffix
|
||||||
inputAction
|
[miniButton]="false"
|
||||||
*ngIf="deviceCredentialsFormGroup.get('credentialsValue').value"
|
*ngIf="deviceCredentialsFormGroup.get('credentialsValue').value"
|
||||||
[copyText]="deviceCredentialsFormGroup.get('credentialsValue').value"
|
[copyText]="deviceCredentialsFormGroup.get('credentialsValue').value"
|
||||||
tooltipText="{{ 'device.copy-certificate' | translate }}"
|
tooltipText="{{ 'device.copy-certificate' | translate }}"
|
||||||
|
|||||||
@ -183,6 +183,6 @@ export class DeviceCredentialsComponent implements ControlValueAccessor, OnInit,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public generate(formControlName: string) {
|
public generate(formControlName: string) {
|
||||||
this.deviceCredentialsFormGroup.get(formControlName).patchValue(generateSecret(12));
|
this.deviceCredentialsFormGroup.get(formControlName).patchValue(generateSecret(20));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,7 @@
|
|||||||
<input matInput [value]="redirectURI(domainInfo)" readonly>
|
<input matInput [value]="redirectURI(domainInfo)" readonly>
|
||||||
<tb-copy-button
|
<tb-copy-button
|
||||||
matSuffix
|
matSuffix
|
||||||
inputAction
|
[miniButton]="false"
|
||||||
color="primary"
|
color="primary"
|
||||||
[copyText]="redirectURI(domainInfo)"
|
[copyText]="redirectURI(domainInfo)"
|
||||||
tooltipText="{{ 'admin.oauth2.copy-redirect-uri' | translate }}"
|
tooltipText="{{ 'admin.oauth2.copy-redirect-uri' | translate }}"
|
||||||
@ -107,7 +107,7 @@
|
|||||||
<input matInput [value]="redirectURIMixed(domainInfo)" readonly>
|
<input matInput [value]="redirectURIMixed(domainInfo)" readonly>
|
||||||
<tb-copy-button
|
<tb-copy-button
|
||||||
matSuffix
|
matSuffix
|
||||||
inputAction
|
[miniButton]="false"
|
||||||
color="primary"
|
color="primary"
|
||||||
[copyText]="redirectURIMixed(domainInfo)"
|
[copyText]="redirectURIMixed(domainInfo)"
|
||||||
tooltipText="{{ 'admin.oauth2.copy-redirect-uri' | translate }}"
|
tooltipText="{{ 'admin.oauth2.copy-redirect-uri' | translate }}"
|
||||||
@ -166,7 +166,7 @@
|
|||||||
<textarea matInput formControlName="appSecret" rows="1" required></textarea>
|
<textarea matInput formControlName="appSecret" rows="1" required></textarea>
|
||||||
<tb-copy-button
|
<tb-copy-button
|
||||||
matSuffix
|
matSuffix
|
||||||
inputAction
|
[miniButton]="false"
|
||||||
color="primary"
|
color="primary"
|
||||||
[copyText]="mobileInfo.get('appSecret').value"
|
[copyText]="mobileInfo.get('appSecret').value"
|
||||||
tooltipText="{{ 'admin.oauth2.copy-mobile-app-secret' | translate }}"
|
tooltipText="{{ 'admin.oauth2.copy-mobile-app-secret' | translate }}"
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
-->
|
-->
|
||||||
<button mat-icon-button
|
<button mat-icon-button
|
||||||
type="button"
|
type="button"
|
||||||
[ngClass]="{'table-cell-action': !inputAction}"
|
[ngClass]="{'mini-button': miniButton}"
|
||||||
[color]="color"
|
[color]="color"
|
||||||
[disabled]="disabled"
|
[disabled]="disabled"
|
||||||
[matTooltip]="matTooltipText"
|
[matTooltip]="matTooltipText"
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
@import "../../../../theme";
|
@import "../../../../theme";
|
||||||
|
|
||||||
:host {
|
:host {
|
||||||
.table-cell-action {
|
.mini-button {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
width: 32px;
|
width: 32px;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
|
|||||||
@ -36,6 +36,7 @@ export class CopyButtonComponent {
|
|||||||
copyText: string;
|
copyText: string;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
|
@coerceBoolean()
|
||||||
disabled = false;
|
disabled = false;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
@ -58,7 +59,7 @@ export class CopyButtonComponent {
|
|||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
@coerceBoolean()
|
@coerceBoolean()
|
||||||
inputAction = false;
|
miniButton = true;
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
successCopied = new EventEmitter<string>();
|
successCopied = new EventEmitter<string>();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user