UI: Improved view gateway dashboard and updated gateway widget types

This commit is contained in:
Vladyslav_Prykhodko 2023-09-12 19:08:40 +03:00
parent 0b9df293cd
commit 65145284ca
14 changed files with 452 additions and 605 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -17,8 +17,6 @@
import { Inject, Injectable, Type } from '@angular/core'; import { Inject, Injectable, Type } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
import { TranslateService } from '@ngx-translate/core';
import { AuthService } from '@core/auth/auth.service';
import { DynamicComponentFactoryService } from '@core/services/dynamic-component-factory.service'; import { DynamicComponentFactoryService } from '@core/services/dynamic-component-factory.service';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { mergeMap, tap } from 'rxjs/operators'; import { mergeMap, tap } from 'rxjs/operators';
@ -28,7 +26,11 @@ import {
CustomDialogContainerData CustomDialogContainerData
} from '@home/components/widget/dialog/custom-dialog-container.component'; } from '@home/components/widget/dialog/custom-dialog-container.component';
import { SHARED_MODULE_TOKEN } from '@shared/components/tokens'; import { SHARED_MODULE_TOKEN } from '@shared/components/tokens';
import { HOME_COMPONENTS_MODULE_TOKEN, SHARED_HOME_COMPONENTS_MODULE_TOKEN } from '@home/components/tokens'; import {
HOME_COMPONENTS_MODULE_TOKEN,
SHARED_HOME_COMPONENTS_MODULE_TOKEN,
WIDGET_COMPONENTS_MODULE_TOKEN
} from '@home/components/tokens';
@Injectable() @Injectable()
export class CustomDialogService { export class CustomDialogService {
@ -36,12 +38,11 @@ export class CustomDialogService {
private customModules: Array<Type<any>>; private customModules: Array<Type<any>>;
constructor( constructor(
private translate: TranslateService,
private authService: AuthService,
private dynamicComponentFactoryService: DynamicComponentFactoryService, private dynamicComponentFactoryService: DynamicComponentFactoryService,
@Inject(SHARED_MODULE_TOKEN) private sharedModule: Type<any>, @Inject(SHARED_MODULE_TOKEN) private sharedModule: Type<any>,
@Inject(SHARED_HOME_COMPONENTS_MODULE_TOKEN) private sharedHomeComponentsModule: Type<any>, @Inject(SHARED_HOME_COMPONENTS_MODULE_TOKEN) private sharedHomeComponentsModule: Type<any>,
@Inject(HOME_COMPONENTS_MODULE_TOKEN) private homeComponentsModule: Type<any>, @Inject(HOME_COMPONENTS_MODULE_TOKEN) private homeComponentsModule: Type<any>,
@Inject(WIDGET_COMPONENTS_MODULE_TOKEN) private widgetComponentsModule: Type<any>,
public dialog: MatDialog public dialog: MatDialog
) { ) {
} }
@ -52,7 +53,8 @@ export class CustomDialogService {
customDialog(template: string, controller: (instance: CustomDialogComponent) => void, data?: any, customDialog(template: string, controller: (instance: CustomDialogComponent) => void, data?: any,
config?: MatDialogConfig): Observable<any> { config?: MatDialogConfig): Observable<any> {
const modules = [this.sharedModule, CommonModule, this.sharedHomeComponentsModule, this.homeComponentsModule]; const modules = [this.sharedModule, CommonModule, this.sharedHomeComponentsModule, this.homeComponentsModule,
this.widgetComponentsModule];
if (Array.isArray(this.customModules)) { if (Array.isArray(this.customModules)) {
modules.push(...this.customModules); modules.push(...this.customModules);
} }

View File

@ -15,7 +15,7 @@
limitations under the License. limitations under the License.
--> -->
<div mat-dialog-content fxLayout="column" style="padding: 0"> <div mat-dialog-content fxLayout="column" style="padding: 0 8px 8px">
<div fxLayout="row" fxLayoutAlign="space-between center"> <div fxLayout="row" fxLayoutAlign="space-between center">
<span class="tb-no-data-text">{{ 'gateway.docker-label' | translate }}</span> <span class="tb-no-data-text">{{ 'gateway.docker-label' | translate }}</span>
<div fxFlexAlign="end" class="tb-help" [tb-help]="helpLink"></div> <div fxFlexAlign="end" class="tb-help" [tb-help]="helpLink"></div>
@ -60,7 +60,8 @@
</div> </div>
<ng-template #commandsExample let-command="command"> <ng-template #commandsExample let-command="command">
<div class="tb-form-panel no-padding no-border tb-tab-body"> <div class="tb-form-panel stroked tb-tab-body">
<div class="tb-form-panel-title" translate>device.connectivity.execute-following-command</div>
<tb-markdown usePlainMarkdown containerClass="start-code" <tb-markdown usePlainMarkdown containerClass="start-code"
data=" data="
```bash ```bash

View File

@ -26,12 +26,44 @@
overflow: hidden; overflow: hidden;
white-space: break-spaces; white-space: break-spaces;
word-break: break-all; word-break: break-all;
background: #F3F6FA;
border-color: #305680;
} }
.code-wrapper { .code-wrapper {
padding: 0; padding: 0;
} }
button.clipboard-btn {
right: 0;
p {
color: #305680;
}
p, div {
background-color: #F3F6FA;
}
div {
img {
display: none;
}
&:after {
content: "";
position: initial;
display: block;
width: 18px;
height: 18px;
background: #305680;
mask-image: url(/assets/copy-code-icon.svg);
mask-repeat: no-repeat;
}
}
} }
} }
} }
.tb-form-panel.tb-tab-body {
margin-top: 16px;
}
}

View File

@ -15,17 +15,10 @@
limitations under the License. limitations under the License.
--> -->
<mat-toolbar color="primary"> <mat-toolbar color="primary" *ngIf="!dialogRef">
<h2 translate>gateway.gateway-configuration</h2> <h2 translate>gateway.gateway-configuration</h2>
<span fxFlex></span>
<button mat-icon-button
type="button"
(click)="cancel()"
*ngIf="dialogRef">
<mat-icon class="material-icons" style="color:#000;">close</mat-icon>
</button>
</mat-toolbar> </mat-toolbar>
<mat-tab-group style="max-height: calc(100% - 117px); height: 100%;" [formGroup]="gatewayConfigGroup"> <mat-tab-group class="tab-group-block" [formGroup]="gatewayConfigGroup">
<mat-tab label="{{ 'gateway.thingsboard-general' | translate }}"> <mat-tab label="{{ 'gateway.thingsboard-general' | translate }}">
<div formGroupName="thingsboard" class="mat-content mat-padding configuration-block"> <div formGroupName="thingsboard" class="mat-content mat-padding configuration-block">
<div class="tb-form-panel no-padding-bottom"> <div class="tb-form-panel no-padding-bottom">
@ -713,7 +706,7 @@
</div> </div>
</mat-tab> </mat-tab>
</mat-tab-group> </mat-tab-group>
<div mat-dialog-actions fxLayoutAlign="start center"> <div class="actions">
<button mat-button color="primary" <button mat-button color="primary"
type="button" type="button"
*ngIf="dialogRef" *ngIf="dialogRef"

View File

@ -16,8 +16,8 @@
:host { :host {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: grid;
flex-direction: column; grid-template-rows: min-content minmax(auto, 1fr) min-content;
.configuration-block { .configuration-block {
display: flex; display: flex;
@ -26,10 +26,18 @@
} }
.mat-toolbar { .mat-toolbar {
grid-row: 1;
background: transparent; background: transparent;
color: rgba(0, 0, 0, .87) !important; color: rgba(0, 0, 0, .87) !important;
} }
.tab-group-block {
min-width: 0;
height: 100%;
min-height: 0;
grid-row: 2;
}
.toggle-group { .toggle-group {
margin-right: auto; margin-right: auto;
} }
@ -45,6 +53,15 @@
.saving-period { .saving-period {
flex: 1; flex: 1;
} }
.actions {
grid-row: 3;
padding: 8px;
display: flex;
gap: 8px;
justify-content: flex-end;
flex: 1;
}
} }
:host ::ng-deep { :host ::ng-deep {

View File

@ -16,7 +16,7 @@
--> -->
<div class="connector-container tb-form-panel no-border"> <div class="connector-container tb-form-panel no-border">
<section class="table-container tb-form-panel stroked no-padding flex"> <section class="table-section tb-form-panel no-padding flex section-container">
<mat-toolbar class="mat-mdc-table-toolbar"> <mat-toolbar class="mat-mdc-table-toolbar">
<h2>{{ 'gateway.connectors' | translate }}</h2> <h2>{{ 'gateway.connectors' | translate }}</h2>
<span fxFlex></span> <span fxFlex></span>
@ -28,6 +28,7 @@
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
<div class="table-container">
<table mat-table [dataSource]="dataSource" <table mat-table [dataSource]="dataSource"
matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="pageLink.sortDirection()" matSort [matSortActive]="pageLink.sortOrder.property" [matSortDirection]="pageLink.sortDirection()"
matSortDisableClear> matSortDisableClear>
@ -138,9 +139,11 @@
<mat-row class="mat-row-select" [class]="{'tb-current-entity': isSameConnector(attribute)}" <mat-row class="mat-row-select" [class]="{'tb-current-entity': isSameConnector(attribute)}"
*matRowDef="let attribute; columns: displayedColumns;" (click)="selectConnector(attribute)"></mat-row> *matRowDef="let attribute; columns: displayedColumns;" (click)="selectConnector(attribute)"></mat-row>
</table> </table>
</div>
</section> </section>
<section [formGroup]="connectorForm" class="tb-form-panel no-border no-padding flex"> <section [formGroup]="connectorForm" class="tb-form-panel no-border no-padding flex">
<section class="tb-form-row tb-not-inline-field same-padding input-container"> <section class="tb-form-panel input-container section-container">
<section class="tb-form-row tb-not-inline-field no-padding no-border column-lt-md input-container">
<mat-form-field class="flex" subscriptSizing="dynamic"> <mat-form-field class="flex" subscriptSizing="dynamic">
<mat-label>{{ 'gateway.connectors-table-name' | translate }}</mat-label> <mat-label>{{ 'gateway.connectors-table-name' | translate }}</mat-label>
<input matInput formControlName="name" #nameInput/> <input matInput formControlName="name" #nameInput/>
@ -167,17 +170,18 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</section> </section>
<section class="tb-form-panel stroked flex"> </section>
<section class="tb-form-panel flex section-container">
<tb-json-object-edit <tb-json-object-edit
fillHeight="true"
class="flex" class="flex"
fxLayout="column" fxLayout="column"
required required
label="{{ 'gateway.configuration' | translate }}" label="{{ 'gateway.configuration' | translate }}"
formControlName="configurationJson"> formControlName="configurationJson">
</tb-json-object-edit> </tb-json-object-edit>
<div fxLayoutAlign="start center"> <div fxLayoutAlign="end center">
<button mat-raised-button color="primary" <button mat-raised-button color="primary"
class="action-button"
type="button" type="button"
[disabled]="!connectorForm.dirty || connectorForm.invalid" [disabled]="!connectorForm.dirty || connectorForm.invalid"
(click)="saveConnector()"> (click)="saveConnector()">

View File

@ -30,9 +30,13 @@
flex-direction: column; flex-direction: column;
} }
.table-section {
min-height: 35vh;
overflow: hidden;
.table-container { .table-container {
overflow: auto; overflow: auto;
min-height: 35vh; }
} }
.flex { .flex {
@ -42,6 +46,10 @@
.input-container { .input-container {
height: auto; height: auto;
} }
.section-container {
background-color: #fff;
}
} }
.mat-toolbar { .mat-toolbar {
@ -69,10 +77,6 @@
} }
} }
.action-button {
margin: 0 15px;
}
mat-row { mat-row {
cursor: pointer; cursor: pointer;
} }