|
|
|
@ -15,39 +15,206 @@ |
|
|
|
limitations under the License. |
|
|
|
|
|
|
|
--> |
|
|
|
<div> |
|
|
|
<mat-card appearance="outlined" class="settings-card"> |
|
|
|
<mat-card-header> |
|
|
|
<mat-card-title> |
|
|
|
<div fxLayout="row"> |
|
|
|
<span class="mat-headline-5" translate>admin.general-settings</span> |
|
|
|
</div> |
|
|
|
</mat-card-title> |
|
|
|
</mat-card-header> |
|
|
|
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async"> |
|
|
|
</mat-progress-bar> |
|
|
|
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> |
|
|
|
<mat-card-content> |
|
|
|
<form [formGroup]="generalSettings" (ngSubmit)="save()"> |
|
|
|
<fieldset [disabled]="isLoading$ | async"> |
|
|
|
<mat-form-field class="mat-block"> |
|
|
|
<mat-label translate>admin.base-url</mat-label> |
|
|
|
<input matInput formControlName="baseUrl" required/> |
|
|
|
<mat-error *ngIf="generalSettings.get('baseUrl').hasError('required')"> |
|
|
|
{{ 'admin.base-url-required' | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
<tb-checkbox formControlName="prohibitDifferentUrl" style="display: block;"> |
|
|
|
<mat-card appearance="outlined" class="settings-card"> |
|
|
|
<mat-card-header> |
|
|
|
<mat-card-title> |
|
|
|
<div fxLayout="row"> |
|
|
|
<span class="mat-headline-5" translate>admin.general-settings</span> |
|
|
|
</div> |
|
|
|
</mat-card-title> |
|
|
|
</mat-card-header> |
|
|
|
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async"> |
|
|
|
</mat-progress-bar> |
|
|
|
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> |
|
|
|
<mat-card-content> |
|
|
|
<form [formGroup]="generalSettings" (ngSubmit)="save()"> |
|
|
|
<fieldset [disabled]="isLoading$ | async" style="margin-bottom: 10px"> |
|
|
|
<mat-form-field class="mat-block"> |
|
|
|
<mat-label translate>admin.base-url</mat-label> |
|
|
|
<input matInput formControlName="baseUrl" required/> |
|
|
|
<mat-error *ngIf="generalSettings.get('baseUrl').hasError('required')"> |
|
|
|
{{ 'admin.base-url-required' | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
<div class="tb-form-row" tb-hint-tooltip-icon="{{ 'admin.prohibit-different-url-hint' | translate }}"> |
|
|
|
<mat-slide-toggle class="mat-slide" formControlName="prohibitDifferentUrl"> |
|
|
|
{{ 'admin.prohibit-different-url' | translate }} |
|
|
|
</tb-checkbox> |
|
|
|
<div class="tb-hint" style="padding-left: 10px;" translate>admin.prohibit-different-url-hint</div> |
|
|
|
<div fxLayout="row" fxLayoutAlign="end center" style="width: 100%;" class="layout-wrap"> |
|
|
|
<button mat-button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || generalSettings.invalid || !generalSettings.dirty" |
|
|
|
type="submit">{{'action.save' | translate}} |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</fieldset> |
|
|
|
</form> |
|
|
|
</mat-card-content> |
|
|
|
</mat-card> |
|
|
|
</div> |
|
|
|
</mat-slide-toggle> |
|
|
|
</div> |
|
|
|
</fieldset> |
|
|
|
<div fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px" class="layout-wrap"> |
|
|
|
<button mat-button color="primary" |
|
|
|
[disabled]="generalSettings.pristine" |
|
|
|
(click)="discardGeneralSettings()" |
|
|
|
type="button">{{'action.undo' | translate}} |
|
|
|
</button> |
|
|
|
<button mat-button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || generalSettings.invalid || !generalSettings.dirty" |
|
|
|
type="submit">{{'action.save' | translate}} |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</form> |
|
|
|
</mat-card-content> |
|
|
|
</mat-card> |
|
|
|
<mat-card appearance="outlined" class="settings-card"> |
|
|
|
<mat-card-header> |
|
|
|
<mat-card-title> |
|
|
|
<span class="mat-headline-5" translate>admin.device-connectivity.device-connectivity</span> |
|
|
|
</mat-card-title> |
|
|
|
</mat-card-header> |
|
|
|
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async"> |
|
|
|
</mat-progress-bar> |
|
|
|
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> |
|
|
|
<mat-card-content style="padding-top: 16px"> |
|
|
|
<tb-toggle-select class="toggle-group" appearance="fill" selectMediaBreakpoint="xs" [(ngModel)]="protocol"> |
|
|
|
<tb-toggle-option value="http">{{ "admin.device-connectivity.http-https" | translate }}</tb-toggle-option> |
|
|
|
<tb-toggle-option value="mqtt">{{ 'admin.device-connectivity.mqtt-mqtts' | translate }}</tb-toggle-option> |
|
|
|
<tb-toggle-option value="coap">{{ 'admin.device-connectivity.coap-coaps' | translate }}</tb-toggle-option> |
|
|
|
</tb-toggle-select> |
|
|
|
<mat-hint class="tb-form-hint tb-primary-fill hint">{{ 'admin.device-connectivity.hint' | translate }}</mat-hint> |
|
|
|
<form [formGroup]="deviceConnectivitySettingsForm" (ngSubmit)="saveDeviceConnectivitySettings()"> |
|
|
|
<fieldset *ngIf="protocol === 'http'" [disabled]="isLoading$ | async" formGroupName="http" class="fields-group"> |
|
|
|
<mat-slide-toggle class="slide" formControlName="enabled"> |
|
|
|
{{ 'admin.device-connectivity.http' | translate }} |
|
|
|
</mat-slide-toggle> |
|
|
|
<div class="fields-row"> |
|
|
|
<mat-form-field class="mat-block" fxFlex> |
|
|
|
<mat-label translate>admin.device-connectivity.host</mat-label> |
|
|
|
<input matInput formControlName="host"/> |
|
|
|
</mat-form-field> |
|
|
|
<mat-form-field class="mat-block" fxFlex> |
|
|
|
<mat-label translate>admin.device-connectivity.port</mat-label> |
|
|
|
<input matInput type="number" min="0" max="65535" formControlName="port"/> |
|
|
|
<mat-error *ngIf="deviceConnectivitySettingsForm.get('http.port').hasError('pattern')"> |
|
|
|
{{ 'admin.device-connectivity.port-pattern' | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="deviceConnectivitySettingsForm.get('http.port').hasError('min') || |
|
|
|
deviceConnectivitySettingsForm.get('http.port').hasError('max')"> |
|
|
|
{{ 'admin.device-connectivity.port-range' | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
|
</fieldset> |
|
|
|
<fieldset *ngIf="protocol === 'http'" [disabled]="isLoading$ | async" formGroupName="https" class="fields-group"> |
|
|
|
<mat-slide-toggle class="slide" formControlName="enabled"> |
|
|
|
{{ 'admin.device-connectivity.https' | translate }} |
|
|
|
</mat-slide-toggle> |
|
|
|
<div class="fields-row"> |
|
|
|
<mat-form-field class="mat-block" fxFlex> |
|
|
|
<mat-label translate>admin.device-connectivity.host</mat-label> |
|
|
|
<input matInput formControlName="host"/> |
|
|
|
</mat-form-field> |
|
|
|
<mat-form-field class="mat-block" fxFlex> |
|
|
|
<mat-label translate>admin.device-connectivity.port</mat-label> |
|
|
|
<input matInput type="number" min="0" max="65535" formControlName="port"/> |
|
|
|
<mat-error *ngIf="deviceConnectivitySettingsForm.get('https.port').hasError('pattern')"> |
|
|
|
{{ 'admin.device-connectivity.port-pattern' | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="deviceConnectivitySettingsForm.get('https.port').hasError('min') || |
|
|
|
deviceConnectivitySettingsForm.get('https.port').hasError('max')"> |
|
|
|
{{ 'admin.device-connectivity.port-range' | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
|
</fieldset> |
|
|
|
<fieldset *ngIf="protocol === 'mqtt'" [disabled]="isLoading$ | async" formGroupName="mqtt" class="fields-group"> |
|
|
|
<mat-slide-toggle class="slide" formControlName="enabled"> |
|
|
|
{{ 'admin.device-connectivity.mqtt' | translate }} |
|
|
|
</mat-slide-toggle> |
|
|
|
<div class="fields-row"> |
|
|
|
<mat-form-field class="mat-block" fxFlex> |
|
|
|
<mat-label translate>admin.device-connectivity.host</mat-label> |
|
|
|
<input matInput formControlName="host"/> |
|
|
|
</mat-form-field> |
|
|
|
<mat-form-field class="mat-block" fxFlex> |
|
|
|
<mat-label translate>admin.device-connectivity.port</mat-label> |
|
|
|
<input matInput type="number" min="0" max="65535" formControlName="port"/> |
|
|
|
<mat-error *ngIf="deviceConnectivitySettingsForm.get('mqtt.port').hasError('pattern')"> |
|
|
|
{{ 'admin.device-connectivity.port-pattern' | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="deviceConnectivitySettingsForm.get('mqtt.port').hasError('min') || |
|
|
|
deviceConnectivitySettingsForm.get('mqtt.port').hasError('max')"> |
|
|
|
{{ 'admin.device-connectivity.port-range' | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
|
</fieldset> |
|
|
|
<fieldset *ngIf="protocol === 'mqtt'" [disabled]="isLoading$ | async" formGroupName="mqtts" class="fields-group"> |
|
|
|
<mat-slide-toggle class="slide" formControlName="enabled"> |
|
|
|
{{ 'admin.device-connectivity.mqtts' | translate }} |
|
|
|
</mat-slide-toggle> |
|
|
|
<div class="fields-row"> |
|
|
|
<mat-form-field class="mat-block" fxFlex> |
|
|
|
<mat-label translate>admin.device-connectivity.host</mat-label> |
|
|
|
<input matInput formControlName="host"/> |
|
|
|
</mat-form-field> |
|
|
|
<mat-form-field class="mat-block" fxFlex> |
|
|
|
<mat-label translate>admin.device-connectivity.port</mat-label> |
|
|
|
<input matInput type="number" min="0" max="65535" formControlName="port"/> |
|
|
|
<mat-error *ngIf="deviceConnectivitySettingsForm.get('mqtts.port').hasError('pattern')"> |
|
|
|
{{ 'admin.device-connectivity.port-pattern' | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="deviceConnectivitySettingsForm.get('mqtts.port').hasError('min') || |
|
|
|
deviceConnectivitySettingsForm.get('mqtts.port').hasError('max')"> |
|
|
|
{{ 'admin.device-connectivity.port-range' | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
|
</fieldset> |
|
|
|
<fieldset *ngIf="protocol === 'coap'" [disabled]="isLoading$ | async" formGroupName="coap" class="fields-group"> |
|
|
|
<mat-slide-toggle class="slide" formControlName="enabled"> |
|
|
|
{{ 'admin.device-connectivity.coap' | translate }} |
|
|
|
</mat-slide-toggle> |
|
|
|
<div class="fields-row"> |
|
|
|
<mat-form-field class="mat-block" fxFlex> |
|
|
|
<mat-label translate>admin.device-connectivity.host</mat-label> |
|
|
|
<input matInput formControlName="host"/> |
|
|
|
</mat-form-field> |
|
|
|
<mat-form-field class="mat-block" fxFlex> |
|
|
|
<mat-label translate>admin.device-connectivity.port</mat-label> |
|
|
|
<input matInput type="number" min="0" max="65535" formControlName="port"/> |
|
|
|
<mat-error *ngIf="deviceConnectivitySettingsForm.get('coap.port').hasError('pattern')"> |
|
|
|
{{ 'admin.device-connectivity.port-pattern' | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="deviceConnectivitySettingsForm.get('coap.port').hasError('min') || |
|
|
|
deviceConnectivitySettingsForm.get('coap.port').hasError('max')"> |
|
|
|
{{ 'admin.device-connectivity.port-range' | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
|
</fieldset> |
|
|
|
<fieldset *ngIf="protocol === 'coap'" [disabled]="isLoading$ | async" formGroupName="coaps" class="fields-group"> |
|
|
|
<mat-slide-toggle class="slide" formControlName="enabled"> |
|
|
|
{{ 'admin.device-connectivity.coaps' | translate }} |
|
|
|
</mat-slide-toggle> |
|
|
|
<div class="fields-row"> |
|
|
|
<mat-form-field class="mat-block" fxFlex> |
|
|
|
<mat-label translate>admin.device-connectivity.host</mat-label> |
|
|
|
<input matInput formControlName="host"/> |
|
|
|
</mat-form-field> |
|
|
|
<mat-form-field class="mat-block" fxFlex> |
|
|
|
<mat-label translate>admin.device-connectivity.port</mat-label> |
|
|
|
<input matInput type="number" min="0" max="65535" formControlName="port"/> |
|
|
|
<mat-error *ngIf="deviceConnectivitySettingsForm.get('coaps.port').hasError('pattern')"> |
|
|
|
{{ 'admin.device-connectivity.port-pattern' | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="deviceConnectivitySettingsForm.get('coaps.port').hasError('min') || |
|
|
|
deviceConnectivitySettingsForm.get('coaps.port').hasError('max')"> |
|
|
|
{{ 'admin.device-connectivity.port-range' | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
|
</fieldset> |
|
|
|
<div fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px" class="layout-wrap"> |
|
|
|
<button mat-button color="primary" |
|
|
|
[disabled]="deviceConnectivitySettingsForm.pristine" |
|
|
|
(click)="discardDeviceConnectivitySettings()" |
|
|
|
type="button">{{'action.undo' | translate}} |
|
|
|
</button> |
|
|
|
<button mat-raised-button color="primary" |
|
|
|
[disabled]="(isLoading$ | async) || deviceConnectivitySettingsForm.invalid || !deviceConnectivitySettingsForm.dirty" |
|
|
|
type="submit">{{'action.save' | translate}} |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</form> |
|
|
|
</mat-card-content> |
|
|
|
</mat-card> |
|
|
|
|