Browse Source

fixes

pull/8337/head
Maksym Dudnik 3 years ago
parent
commit
475e7525ca
  1. 1
      ui-ngx/src/app/modules/home/components/widget/lib/action-buttons.component.scss
  2. 2
      ui-ngx/src/app/shared/components/device/device-gateway-command.component.ts
  3. 108
      ui-ngx/src/app/shared/components/device/gateway-configuration.component.html
  4. 10
      ui-ngx/src/app/shared/components/device/gateway-configuration.component.scss
  5. 16
      ui-ngx/src/app/shared/components/device/gateway-configuration.component.ts
  6. 10
      ui-ngx/src/app/shared/components/device/gateway-connectors.component.html
  7. 82
      ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts
  8. 34
      ui-ngx/src/app/shared/components/device/gateway-logs.component.ts
  9. 4
      ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts
  10. 10
      ui-ngx/src/assets/locale/locale.constant-en_US.json

1
ui-ngx/src/app/modules/home/components/widget/lib/action-buttons.component.scss

@ -28,6 +28,7 @@
flex-grow: 1;
margin: 10px;
min-width: 150px;
height: auto;
}
}
}

2
ui-ngx/src/app/shared/components/device/device-gateway-command.component.ts

@ -71,7 +71,7 @@ export class DeviceGatewayCommandComponent implements OnInit {
macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'],
windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
if (macosPlatforms.indexOf(platform) !== -1) {
this.selectedOSCControl.setValue(OsType.macos);
this.selectedOSCControl.setValue(OsType.linux);
} else if (windowsPlatforms.indexOf(platform) !== -1) {
this.selectedOSCControl.setValue(OsType.windows);
} else if (/Linux/.test(platform)) {

108
ui-ngx/src/app/shared/components/device/gateway-configuration.component.html

@ -35,14 +35,14 @@
<mat-slide-toggle color="primary" fxFlex="100" formControlName="remoteConfiguration">
{{ 'gateway.remote-configuration' | translate }}
<mat-icon class="material-icons-outlined" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.remote-configuration' | translate }}">info
</mat-icon>
</mat-slide-toggle>
<mat-slide-toggle color="primary" fxFlex="100" formControlName="remoteShell">
{{ 'gateway.remote-shell' | translate }}
<mat-icon class="material-icons-outlined" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.remote-shell' | translate }}">info
</mat-icon>
</mat-slide-toggle>
@ -50,7 +50,7 @@
<mat-label translate>gateway.thingsboard-host</mat-label>
<input matInput formControlName="host"/>
<mat-icon class="mat-form-field-infix pe"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.host' | translate }}">info_outlined
</mat-icon>
<mat-error *ngIf="gatewayConfigGroup.get('thingsboard.host').hasError('required')">
@ -59,7 +59,7 @@
</mat-form-field>
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.thingsboard-port</mat-label>
<input matInput formControlName="port" type="number"/>
<input matInput formControlName="port" type="number" min="0" />
<mat-error *ngIf="gatewayConfigGroup.get('thingsboard.port').hasError('required')">
{{'gateway.thingsboard-port-required' | translate }}
</mat-error>
@ -73,7 +73,7 @@
{{'gateway.thingsboard-port-pattern' | translate }}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.port' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -99,7 +99,7 @@
{{'security.access-token-required' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.token' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -111,7 +111,7 @@
{{'security.clientId-required' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.client-id' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -123,7 +123,7 @@
{{'security.username-required' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.username' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -135,7 +135,7 @@
{{'security.password-required' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.password' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -186,7 +186,7 @@
{{'gateway.logs.date-format-required' | translate }}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.date-form' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -197,7 +197,7 @@
{{'gateway.logs.log-format-required' | translate }}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.log-format' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -213,7 +213,7 @@
<mat-slide-toggle color="primary" formControlName="enabled">
{{ 'gateway.logs.remote-logs' | translate }}
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.remote-log' | translate }}">info
</mat-icon>
</mat-slide-toggle>
@ -249,7 +249,7 @@
</mat-form-field>
<mat-form-field class="mat-block tb-value-type" fxFlex="calc(35%-30px)">
<mat-label translate>gateway.logs.saving-period</mat-label>
<input matInput formControlName="savingTime" type="number"/>
<input matInput formControlName="savingTime" type="number" min="0" />
<mat-error
*ngIf="gatewayConfigGroup.get('logs.local.' + logSelector.value + '.savingTime').hasError('required')">
{{'gateway.logs.saving-period-required' | translate }}
@ -269,7 +269,7 @@
</mat-form-field>
<mat-form-field class="mat-block tb-value-type" fxFlex="calc(50%-30px)">
<mat-label translate>gateway.logs.backup-count</mat-label>
<input matInput formControlName="backupCount" type="number"/>
<input matInput formControlName="backupCount" type="number" min="0" />
<mat-error
*ngIf="gatewayConfigGroup.get('logs.local.' + logSelector.value + '.backupCount').hasError('required')">
{{'gateway.logs.backup-count-required' | translate }}
@ -279,7 +279,7 @@
{{'gateway.logs.backup-count-min' | translate }}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.backup-count' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -296,7 +296,7 @@
<mat-expansion-panel expanded="true" disabled>
<mat-expansion-panel-header>
<mat-panel-title translate class="expansion-panel-header">gateway.storage
<span class="tb-hint" matTooltip="{{'gateway.hints.storage' | translate}}">Hint about storage</span>
<span class="tb-hint">{{'gateway.hints.storage' | translate}}</span>
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="row wrap">
@ -306,9 +306,8 @@
{{ storageType.value | translate }}
</mat-button-toggle>
<div class="line-break "></div>
<span class="tb-hint" style="padding-left: 0"
matTooltip="{{'gateway.hints.'+gatewayConfigGroup.get('storage.type').value | translate}}">
Hint about {{ gatewayConfigGroup.get('storage.type').value | translate }} storage</span>
<span class="tb-hint" style="padding-left: 0">
{{'gateway.hints.'+gatewayConfigGroup.get('storage.type').value | translate}}</span>
</mat-button-toggle-group>
<mat-form-field *ngIf="gatewayConfigGroup.get('storage.type').value === 'memory'"
fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
@ -324,7 +323,7 @@
{{'gateway.storage-read-record-count-pattern' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.read-record-count' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -342,7 +341,7 @@
{{'gateway.storage-max-records-pattern' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.max-records-count' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -354,7 +353,7 @@
{{'gateway.storage-data-folder-path-required' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.data-folder' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -372,7 +371,7 @@
{{'gateway.storage-max-files-pattern' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.max-file-count' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -390,7 +389,7 @@
{{'gateway.storage-max-read-record-count-pattern' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.max-read-count' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -408,7 +407,7 @@
{{'gateway.storage-max-records-pattern' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.max-records' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -420,7 +419,7 @@
{{'gateway.storage-path-required' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.data-folder' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -438,7 +437,7 @@
{{'gateway.messages-ttl-check-in-hours-pattern' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.ttl-check-hour' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -456,7 +455,7 @@
{{'gateway.messages-ttl-in-days-pattern' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.ttl-messages-day' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -478,7 +477,7 @@
</mat-slide-toggle>
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.server-port</mat-label>
<input matInput formControlName="serverPort" type="number"/>
<input matInput formControlName="serverPort" type="number" min="0" />
<mat-error *ngIf="gatewayConfigGroup.get('grpc.serverPort').hasError('required')">
{{'gateway.thingsboard-port-required' | translate }}
</mat-error>
@ -494,7 +493,7 @@
</mat-form-field>
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.grpc-keep-alive-timeout</mat-label>
<input matInput formControlName="keepAliveTimeoutMs" type="number"/>
<input matInput formControlName="keepAliveTimeoutMs" type="number" min="0" />
<mat-error *ngIf="gatewayConfigGroup.get('grpc.keepAliveTimeoutMs').hasError('required')">
{{'gateway.grpc-keep-alive-timeout-required' | translate }}
</mat-error>
@ -507,7 +506,7 @@
</mat-form-field>
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.grpc-keep-alive</mat-label>
<input matInput formControlName="keepAliveTimeMs" type="number"/>
<input matInput formControlName="keepAliveTimeMs" type="number" min="0" />
<mat-error *ngIf="gatewayConfigGroup.get('grpc.keepAliveTimeMs').hasError('required')">
{{'gateway.grpc-keep-alive-required' | translate }}
</mat-error>
@ -520,7 +519,7 @@
</mat-form-field>
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.grpc-min-time-between-pings</mat-label>
<input matInput formControlName="minTimeBetweenPingsMs" type="number"/>
<input matInput formControlName="minTimeBetweenPingsMs" type="number" min="0" />
<mat-error *ngIf="gatewayConfigGroup.get('grpc.minTimeBetweenPingsMs').hasError('required')">
{{'gateway.grpc-min-time-between-pings-required' | translate }}
</mat-error>
@ -533,7 +532,7 @@
</mat-form-field>
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.grpc-max-pings-without-data</mat-label>
<input matInput formControlName="maxPingsWithoutData" type="number"/>
<input matInput formControlName="maxPingsWithoutData" type="number" min="0" />
<mat-error *ngIf="gatewayConfigGroup.get('grpc.maxPingsWithoutData').hasError('required')">
{{'gateway.grpc-max-pings-without-data-required' | translate }}
</mat-error>
@ -546,7 +545,7 @@
</mat-form-field>
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.grpc-min-ping-interval-without-data</mat-label>
<input matInput formControlName="minPingIntervalWithoutDataMs" type="number"/>
<input matInput formControlName="minPingIntervalWithoutDataMs" type="number" min="0" />
<mat-error *ngIf="gatewayConfigGroup.get('grpc.minPingIntervalWithoutDataMs').hasError('required')">
{{'gateway.grpc-min-ping-interval-without-data-required' | translate }}
</mat-error>
@ -572,7 +571,7 @@
</mat-slide-toggle>
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.statistics.send-period</mat-label>
<input matInput formControlName="statsSendPeriodInSeconds" type="number"/>
<input matInput formControlName="statsSendPeriodInSeconds" type="number" min="0" />
<mat-error
*ngIf="gatewayConfigGroup.get('thingsboard.statistics.statsSendPeriodInSeconds').hasError('required')">
{{'gateway.statistics.send-period-required' | translate }}
@ -591,9 +590,8 @@
<mat-expansion-panel expanded="true" disabled>
<mat-expansion-panel-header>
<mat-panel-title class="expansion-panel-header">{{"gateway.statistics.commands" |translate}}
<span class="tb-hint"
matTooltip="{{'gateway.hints.commands' | translate}}"
>Hint about commands</span></mat-panel-title>
<span class="tb-hint">
{{'gateway.hints.commands' | translate}}</span></mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="column" formGroupName="statistics">
<div fxLayout="row" formArrayName="commands"
@ -602,19 +600,19 @@
<mat-card fxLayout="row wrap" [formGroupName]="$index" class="statistics-block">
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.statistics.attribute-name</mat-label>
<input matInput formControlName="attributeName"/>
<input matInput formControlName="attributeOnGateway"/>
<mat-error
*ngIf="commandControl.get('attributeName').hasError('required')">
*ngIf="commandControl.get('attributeOnGateway').hasError('required')">
{{'gateway.statistics.attribute-name-required' | translate }}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.attribute' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.statistics.timeout</mat-label>
<input matInput formControlName="timeout" type="number"/>
<input matInput formControlName="timeout" type="number" min="0" />
<mat-error
*ngIf="commandControl.get('timeout').hasError('required')">
{{'gateway.statistics.timeout-required' | translate }}
@ -628,7 +626,7 @@
{{'gateway.statistics.timeout-pattern' | translate }}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.timeout' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -640,7 +638,7 @@
{{'gateway.statistics.command-required' | translate }}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.command' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -674,9 +672,7 @@
<mat-slide-toggle color="primary" fxFlex="100" formControlName="checkDeviceInactivity">
{{ 'gateway.checking-device-activity' | translate }}
</mat-slide-toggle>
<span class="tb-hint" style="padding-left: 40px; margin-top: -15px;"
matTooltip="{{'gateway.hints.check-device-activity' | translate}}"
>Hint about checking activity</span>
<span class="tb-hint" style="padding-left: 40px; margin-top: -15px;">{{'gateway.hints.check-device-activity' | translate}}</span>
</mat-panel-title>
</mat-expansion-panel-header>
<div fxLayout="row wrap">
@ -684,7 +680,7 @@
*ngIf="gatewayConfigGroup.get('thingsboard.checkingDeviceActivity.checkDeviceInactivity').value"
fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.inactivity-timeout-seconds</mat-label>
<input matInput formControlName="inactivityTimeoutSeconds" type="number"/>
<input matInput formControlName="inactivityTimeoutSeconds" type="number" min="0" />
<mat-error
*ngIf="gatewayConfigGroup.get('thingsboard.checkingDeviceActivity.inactivityTimeoutSeconds').hasError('required')">
{{'gateway.inactivity-timeout-seconds-required' | translate }}
@ -694,7 +690,7 @@
{{'gateway.inactivity-timeout-seconds-min' | translate }}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.inactivity-timeout' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -712,7 +708,7 @@
{{'gateway.inactivity-check-period-seconds-min' | translate }}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.inactivity-period' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
@ -725,7 +721,7 @@
<div fxLayout="row wrap">
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.min-pack-send-delay</mat-label>
<input matInput formControlName="minPackSendDelayMS" type="number" min="0"/>
<input matInput formControlName="minPackSendDelayMS" type="number" min="0" />
<mat-error *ngIf="gatewayConfigGroup.get('thingsboard.minPackSendDelayMS').hasError('required')">
{{ 'gateway.min-pack-send-delay-required' | translate }}
</mat-error>
@ -733,13 +729,13 @@
{{ 'gateway.min-pack-send-delay-min' | translate }}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.minimal-pack-delay' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.mqtt-qos</mat-label>
<input matInput formControlName="qos" type="number" min="0" max="2"/>
<input matInput formControlName="qos" type="number" min="0" min="0" max="2"/>
<mat-error *ngIf="gatewayConfigGroup.get('thingsboard.qos').hasError('required')">
{{ 'gateway.mqtt-qos-required' | translate}}
</mat-error>
@ -750,13 +746,13 @@
{{ 'gateway.mqtt-qos-range' | translate}}
</mat-error>
<mat-icon class="mat-form-field-infix pe" aria-hidden="false" aria-label="help-icon"
matSuffix style="cursor:pointer;"
matSuffix class='suffix-icon' style="cursor:pointer;"
matTooltip="{{'gateway.hints.qos' | translate }}">info_outlined
</mat-icon>
</mat-form-field>
<mat-form-field fxFlex="calc(50%-15px)" class="mat-block tb-value-type">
<mat-label translate>gateway.statistics.check-connectors-configuration</mat-label>
<input matInput formControlName="checkConnectorsConfigurationInSeconds" type="number"/>
<input matInput formControlName="checkConnectorsConfigurationInSeconds" type="number" min="0" />
<mat-error
*ngIf="gatewayConfigGroup.get('thingsboard.checkConnectorsConfigurationInSeconds').hasError('required')">
{{'gateway.statistics.check-connectors-configuration-required' | translate }}
@ -778,7 +774,7 @@
</mat-tab>
</mat-tab-group>
<div fxFlex></div>
<div mat-dialog-actions fxLayoutAlign="end center">
<div mat-dialog-actions fxLayoutAlign="start center">
<button mat-button color="primary"
type="button"
cdkFocusInitial

10
ui-ngx/src/app/shared/components/device/gateway-configuration.component.scss

@ -166,6 +166,11 @@
z-index: 100;
}
.suffix-icon {
position: relative;
transform: translateY(5px);
}
mat-panel-title {
display: block;
padding-top: 20px;
@ -188,5 +193,10 @@
.line-break {
width: 100%;
}
//
//::ng-deep.mat-mdc-slide-toggle .mdc-switch {
// position: relative;
// transform: translateY(4px);
//}
}

16
ui-ngx/src/app/shared/components/device/gateway-configuration.component.ts

@ -100,7 +100,7 @@ export const securityTypesTranslationsMap = new Map<SecurityTypes, string>(
[
[SecurityTypes.ACCESS_TOKEN, 'gateway.security-types.access-token'],
[SecurityTypes.USERNAME_PASSWORD, 'gateway.security-types.username-password'],
[SecurityTypes.TLS_ACCESS_TOKEN, 'gateway.security-types.tls-access-token'],
// [SecurityTypes.TLS_ACCESS_TOKEN, 'gateway.security-types.tls-access-token'],
[SecurityTypes.TLS_PRIVATE_KEY, 'gateway.security-types.tls-private-key'],
]
);
@ -174,7 +174,7 @@ export class GatewayConfigurationComponent implements OnInit {
cert: [null, []],
privateKey: [null, []],
}),
qos: [1, [Validators.min(0), Validators.max(2), Validators.required]]
qos: [1, [Validators.min(0), Validators.max(1), Validators.required]]
}),
storage: this.fb.group({
type: [StorageTypes.MEMORY, [Validators.required]],
@ -356,16 +356,17 @@ export class GatewayConfigurationComponent implements OnInit {
}
checkAndFetchCredentials(security): void {
if ((security.type == SecurityTypes.ACCESS_TOKEN && !security.accessToken) ||
(security.type === SecurityTypes.USERNAME_PASSWORD && !(security.username && security.password)) || !security.type) {
if (security.type !== SecurityTypes.TLS_PRIVATE_KEY) {
this.deviceService.getDeviceCredentials(this.device.id).subscribe(credentials => {
if (credentials.credentialsType === DeviceCredentialsType.ACCESS_TOKEN) {
this.gatewayConfigGroup.get('thingsboard.security.accessToken').setValue(credentials.credentialsValue);
if (credentials.credentialsType === DeviceCredentialsType.ACCESS_TOKEN || security.type !== SecurityTypes.TLS_ACCESS_TOKEN) {
this.gatewayConfigGroup.get('thingsboard.security.accessToken').setValue(credentials.credentialsId);
} else if (credentials.credentialsType === DeviceCredentialsType.MQTT_BASIC) {
const parsedValue = JSON.parse(credentials.credentialsValue);
this.gatewayConfigGroup.get('thingsboard.security.clientId').setValue(parsedValue.clientId);
this.gatewayConfigGroup.get('thingsboard.security.username').setValue(parsedValue.userName);
this.gatewayConfigGroup.get('thingsboard.security.password').setValue(parsedValue.password);
} else if (credentials.credentialsType === DeviceCredentialsType.X509_CERTIFICATE ) {
//if sertificate is present set sertificate as present
}
});
}
@ -396,7 +397,7 @@ export class GatewayConfigurationComponent implements OnInit {
const data = command || {};
const commandsFormArray = this.commandFormArray();
const commandFormGroup = this.fb.group({
attributeName: [data.attributeName || null, [Validators.required]],
attributeOnGateway: [data.attributeOnGateway || null, [Validators.required]],
command: [data.command || null, [Validators.required]],
timeout: [data.timeout || null, [Validators.required, Validators.min(1), Validators.pattern(/^-?[0-9]+$/)]],
});
@ -425,6 +426,7 @@ export class GatewayConfigurationComponent implements OnInit {
removeCommandControl(index: number): void {
this.commandFormArray().removeAt(index);
this.gatewayConfigGroup.markAsDirty();
}
removeAllSecurityValidators(): void {

10
ui-ngx/src/app/shared/components/device/gateway-connectors.component.html

@ -50,7 +50,7 @@
<ng-container matColumnDef="type">
<mat-header-cell *matHeaderCellDef mat-sort-header style="width: 30%"> Type</mat-header-cell>
<mat-cell *matCellDef="let attribute" style="text-transform: uppercase">
{{ attribute.value.type }}
{{ gatewayConnectorDefaultTypes.get(attribute.value.type) }}
</mat-cell>
</ng-container>
<ng-container matColumnDef="actions" stickyEnd>
@ -126,13 +126,17 @@
<mat-label>Type</mat-label>
<mat-select formControlName="type">
<mat-option style="text-transform: uppercase"
*ngFor="let type of gatewayConnectorDefaultTypes" [value]="type">{{type}}</mat-option>
*ngFor="let type of gatewayConnectorDefaultTypes | keyvalue" [value]="type.key">{{type.value}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="mat-block tb-value-type" *ngIf="connectorForm.get('type').value === 'grpc'">
<mat-label>Key</mat-label>
<input matInput formControlName="key"/>
</mat-form-field>
<mat-form-field class="mat-block tb-value-type" *ngIf="connectorForm.get('type').value === 'custom'">
<mat-label>Class</mat-label>
<input matInput formControlName="class"/>
</mat-form-field>
<mat-form-field class="mat-block tb-value-type">
<mat-label translate>gateway.remote-logging-level</mat-label>
<mat-select formControlName="log_level">
@ -148,7 +152,7 @@
label="{{ 'gateway.connector-json' | translate }}"
formControlName="configurationJson">
</tb-json-object-edit>
<div fxLayoutAlign="end center">
<div fxLayoutAlign="start center">
<button mat-raised-button color="primary"
class="action-btns"
type="button"

82
ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts

@ -26,19 +26,19 @@ import { DeviceService } from '@core/http/device.service';
import { TranslateService } from '@ngx-translate/core';
import { forkJoin, merge } from 'rxjs';
import { AttributeData, AttributeScope } from '@shared/models/telemetry/telemetry.models';
import { PageComponent } from "@shared/components/page.component";
import { PageLink } from "@shared/models/page/page-link";
import { AttributeDatasource } from "@home/models/datasource/attribute-datasource";
import { Direction, SortOrder } from "@shared/models/page/sort-order";
import { MatSort } from "@angular/material/sort";
import { tap } from "rxjs/operators";
import { TelemetryWebsocketService } from "@core/ws/telemetry-websocket.service";
import { MatTableDataSource } from "@angular/material/table";
import { GatewayLogLevel } from "@shared/components/device/gateway-configuration.component";
import { ActionNotificationShow } from "@core/notification/notification.actions";
import { PageComponent } from '@shared/components/page.component';
import { PageLink } from '@shared/models/page/page-link';
import { AttributeDatasource } from '@home/models/datasource/attribute-datasource';
import { Direction, SortOrder } from '@shared/models/page/sort-order';
import { MatSort } from '@angular/material/sort';
import { tap } from 'rxjs/operators';
import { TelemetryWebsocketService } from '@core/ws/telemetry-websocket.service';
import { MatTableDataSource } from '@angular/material/table';
import { GatewayLogLevel } from '@shared/components/device/gateway-configuration.component';
import { ActionNotificationShow } from '@core/notification/notification.actions';
import { DialogService } from '@app/core/services/dialog.service';
import { updateEntityParams, WidgetContext } from "@home/models/widget-component.models";
import { deepClone } from "@core/utils";
import { WidgetContext } from '@home/models/widget-component.models';
import { deepClone } from '@core/utils';
export interface gatewayConnector {
@ -50,6 +50,27 @@ export interface gatewayConnector {
key?: string;
}
export const GatewayConnectorDefaultTypesTranslates= new Map<string, string> ([
['mqtt', 'MQTT'],
['modbus', 'MODBUS'],
['grpc', 'GRPC'],
['opcua', 'OPCUA'],
['opcua_asyncio', 'OPCUA ASYNCIO'],
['ble', 'BLE'],
['request', 'REQUEST'],
['can', 'CAN'],
['bacnet', 'BACNET'],
['odbc', 'ODBC'],
['rest', 'REST'],
['snmp', 'SNMP'],
['ftp', 'FTP'],
['socket', 'SOCKET'],
['xmpp', 'XMPP'],
['ocpp', 'OCCP'],
['custom', 'CUSTOM']
]);
@Component({
selector: 'tb-gateway-connector',
templateUrl: './gateway-connectors.component.html',
@ -65,25 +86,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
displayedColumns = ['enabled', 'key', 'type', 'actions'];
gatewayConnectorDefaultTypes: Array<string> =
['mqtt',
'modbus',
'grpc',
'opcua',
'opcua_asyncio',
'ble',
'request',
'can',
'bacnet',
'odbc',
'rest',
'snmp',
'ftp',
'socket',
'xmpp',
'ocpp',
'custom'
];
gatewayConnectorDefaultTypes = GatewayConnectorDefaultTypesTranslates;
@Input()
ctx: WidgetContext;
@ -131,6 +134,10 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
key: ['auto'],
configurationJson: [{}, [Validators.required]]
})
this.connectorForm.valueChanges.subscribe(_=>{
this.cd.detectChanges();
})
this.connectorForm.disable();
}
@ -167,7 +174,6 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
if (value.type !== 'grpc') {
delete value.key;
}
value.configuration = `${value.type}.json`
const attributesToSave = [{
key: value.name,
value: value
@ -239,9 +245,10 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
clearOutConnectorForm(): void {
this.connectorForm.setValue({
name: '',
type: this.gatewayConnectorDefaultTypes[0],
type: 'mqtt',
log_level: GatewayLogLevel.info,
key: 'auto',
class: '',
configurationJson: {}
})
this.initialConnector = null;
@ -253,14 +260,15 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
this.connectorForm.enable();
}
const connector = attribute.value;
if (!connector.key) {
connector.key = 'auto';
}
if (connector.configuration) {
delete connector.configuration;
}
if (!connector.key) {
connector.key = 'auto';
}
this.initialConnector = connector;
this.connectorForm.setValue(connector);
this.connectorForm.markAsPristine();
}
showToast(message: string) {
@ -312,7 +320,6 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
if ($event) {
$event.stopPropagation();
}
console.log(attribute);
const params = deepClone(this.ctx.stateController.getStateParams());
params.connector_logs = attribute;
params.targetEntityParamName = "connector_logs";
@ -323,7 +330,6 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
if ($event) {
$event.stopPropagation();
}
console.log(attribute);
const params = deepClone(this.ctx.stateController.getStateParams());
params.connector_logs = attribute;
params.targetEntityParamName = "connector_rpc";

34
ui-ngx/src/app/shared/components/device/gateway-logs.component.ts

@ -65,26 +65,6 @@ export class GatewayLogsComponent extends PageComponent implements AfterViewInit
displayedColumns = ['ts', 'status', 'message'];
gatewayConnectorDefaultTypes: Array<string> =
['mqtt',
'modbus',
'grpc',
'opcua',
'opcua_asyncio',
'ble',
'request',
'can',
'bacnet',
'odbc',
'rest',
'snmp',
'ftp',
'socket',
'xmpp',
'ocpp',
'custom'
];
@Input()
ctx: WidgetContext;
@ -128,6 +108,10 @@ export class GatewayLogsComponent extends PageComponent implements AfterViewInit
}, {
name: "Storage",
key: "STORAGE_LOGS"
},
{
key: 'EXTENSIONS_LOGS',
name: "Extension"
}]
@ -168,15 +152,11 @@ export class GatewayLogsComponent extends PageComponent implements AfterViewInit
}
},{
key: `${connector.key}_LOGS`,
name: "Convector",
name: "Converter",
filterFn: (attrData)=>{
return attrData.message.includes(`${connector.key}_converter`)
}
},
{
key: `${connector.key}_EXTENSION_LOGS`,
name: "Extension"
}]
}]
} else {
this.logLinks = this.gatewayLogLinks;
}
@ -191,7 +171,7 @@ export class GatewayLogsComponent extends PageComponent implements AfterViewInit
return {
ts: data[0],
key: this.activeLink.key,
status: data[1].match(/\|(\w+)\|/)[1],
status: data[1].match(/\|(\w+)\|/)? data[1].match(/\|(\w+)\|/)[1] : "",
message: /\[(.*)/.exec(data[1])[0]
};
});

4
ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts

@ -70,7 +70,7 @@ export class GatewayStatisticsComponent extends PageComponent implements AfterVi
this.statisticForm.get('statisticKey').valueChanges.subscribe(value=>{
this.commandObj = null;
if (this.commands.length) {
this.commandObj = this.commands.find(command=>command.attributeName === value);
this.commandObj = this.commands.find(command=>command.attributeOnGateway === value);
}
this.changeSubscription(true);
})
@ -84,7 +84,7 @@ export class GatewayStatisticsComponent extends PageComponent implements AfterVi
if (resp && resp.length) {
this.commands = resp[0].value.thingsboard.thingsboard.statistics.commands;
if (!this.statisticForm.get('statisticKey').value ) {
this.statisticForm.get('statisticKey').setValue(this.commands[0].attributeName);
this.statisticForm.get('statisticKey').setValue(this.commands[0].attributeOnGateway);
this.changeSubscription(true);
}
}

10
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -2574,10 +2574,10 @@
"file-path": "File path",
"file-path-required": "File path required",
"saving-period": "Log saving period",
"saving-period-min": "Log saving period can not be less then 0",
"saving-period-min": "Log saving period can not be less then 1",
"saving-period-required": "Log saving period required",
"backup-count": "Backup count",
"backup-count-min": "Backup count can not be less then 0",
"backup-count-min": "Backup count can not be less then 1",
"backup-count-required": "Backup count required"
},
"min-pack-send-delay": "Min pack send delay (in ms)",
@ -2612,16 +2612,16 @@
"commands": "Commands",
"send-period": "Statistic send period (in ms)",
"send-period-required": "Statistic send period is required",
"send-period-min": "Statistic send period can not be less then 0",
"send-period-min": "Statistic send period can not be less then 1",
"send-period-pattern": "Statistic send period is not valid",
"check-connectors-configuration": "Check connectors configuration (in ms)",
"check-connectors-configuration-required": "Check connectors configuration is required",
"check-connectors-configuration-min": "Check connectors configuration can not be less then 0",
"check-connectors-configuration-min": "Check connectors configuration can not be less then 1",
"check-connectors-configuration-pattern": "Check connectors configuration is not valid",
"add": "Add command",
"timeout": "Timeout",
"timeout-required": "Timeout is required",
"timeout-min": "Timeout can not be less then 0",
"timeout-min": "Timeout can not be less then 1",
"timeout-pattern": "Timeout is not valid",
"attribute-name": "Attribute name",
"attribute-name-required": "Attribute name is required",

Loading…
Cancel
Save