diff --git a/application/src/main/data/json/demo/dashboards/gateway_list.json b/application/src/main/data/json/demo/dashboards/gateway_list.json index 5f6c9b4cc8..cae7d54bb9 100644 --- a/application/src/main/data/json/demo/dashboards/gateway_list.json +++ b/application/src/main/data/json/demo/dashboards/gateway_list.json @@ -1907,7 +1907,7 @@ "dialogTitle": "Launch command", "dialogHideDashboardToolbar": true, "dialogWidth": null, - "dialogHeight": 35, + "dialogHeight": 40, "openInSeparateDialog": true, "openInPopover": false, "id": "337c767b-3217-d3d3-b955-7b0bd0858a1d" @@ -5087,14 +5087,14 @@ "useMarkdownTextFunction": true, "markdownTextFunction": "return `
\n\n
`;", "applyDefaultMarkdownStyle": false, - "markdownCss": ".action-container {\r\n display: flex;\r\n flex-wrap: wrap;\r\n flex-direction: row;\r\n height: 100%;\r\n width: 100%;\r\n align-content: center;\r\n}\r\n\r\nbutton {\r\n flex-grow: 1;\r\n margin: 10px;\r\n min-width: 150px;\r\n height: auto;\r\n}" + "markdownCss": ".action-container {\r\n display: flex;\r\n flex-wrap: wrap;\r\n flex-direction: row;\r\n height: 100%;\r\n width: 100%;\r\n}\r\n\r\nbutton {\r\n flex-grow: 1;\r\n margin: 10px;\r\n min-width: 150px;\r\n height: auto;\r\n}" }, "title": "New Markdown/HTML Card", "showTitleIcon": false, "iconColor": "rgba(0, 0, 0, 0.87)", "iconSize": "24px", "titleTooltip": "", - "dropShadow": true, + "dropShadow": false, "enableFullscreen": false, "widgetStyle": {}, "titleStyle": { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/device-gateway-command.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/device-gateway-command.component.html index a5cc2bcf37..7a58c51852 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/device-gateway-command.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/device-gateway-command.component.html @@ -17,39 +17,57 @@ -->
{{ 'gateway.docker-label' | translate }} -
- - gateway.windows - gateway.linux-macos - +
+ + Windows + Linux/MacOS +
-
-
-
{{ linuxCode }}
- -
-
-
-
-
{{ windowsCode }}
- -
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/device-gateway-command.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/device-gateway-command.component.scss new file mode 100644 index 0000000000..023744b827 --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/device-gateway-command.component.scss @@ -0,0 +1,95 @@ +/** + * Copyright © 2016-2023 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +:host { + width: 100%; + height: 100%; + display: block; + + ::ng-deep.tb-markdown-view { + .start-code { + .code-wrapper { + padding: 0; + + pre[class*=language-] { + margin: 0; + padding: 9px 38px 9px 16px; + background: rgba(0, 0, 0, 0.03); + border-radius: 6px; + border: none; + } + + code[class*="language-"], pre[class*="language-"] { + font-family: 'Roboto'; + font-style: normal; + font-weight: 400; + font-size: 12px; + line-height: 16px; + letter-spacing: 0.25px; + color: rgba(0, 0, 0, 0.38); + overflow: hidden; + white-space: break-spaces; + word-break: break-all; + + & * { + color: rgba(0, 0, 0, 0.38); + cursor: inherit; + background: transparent; + } + } + + button.clipboard-btn { + right: 0; + height: 34px; + + p, div { + background: transparent; + } + + p { + margin: 0; + padding: 7px; + color: #305680; + } + + div { + top: 0; + padding: 8px; + height: 34px; + width: 34px; + + img { + display: none; + } + + &:after { + content: ""; + position: initial; + display: block; + width: 18px; + height: 18px; + background: #305680; + -webkit-mask-image: url(/assets/copy-code-icon.svg); + -webkit-mask-repeat: no-repeat; + mask-image: url(/assets/copy-code-icon.svg); + mask-repeat: no-repeat; + } + } + } + } + } + } +} + diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/device-gateway-command.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/device-gateway-command.component.ts index 8e65324720..33d6e7ef24 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/device-gateway-command.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/device-gateway-command.component.ts @@ -33,7 +33,7 @@ enum OsType { @Component({ selector: 'tb-gateway-command', templateUrl: './device-gateway-command.component.html', - styleUrls: [] + styleUrls: ['./device-gateway-command.component.scss'] }) export class DeviceGatewayCommandComponent implements OnInit { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.html index f497dd4f0e..4fd39528ae 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.html @@ -26,27 +26,26 @@ close - +
- - +
{{ 'gateway.remote-configuration' | translate }} - info {{ 'gateway.remote-shell' | translate }} - info - + gateway.thingsboard-host - + gateway.thingsboard-port - + {{'gateway.thingsboard-port-required' | translate }} @@ -72,399 +71,410 @@ {{'gateway.thingsboard-port-pattern' | translate }} - info_outlined
- - - - security.security - -
- - - {{ securityType.value | translate }} - - - - security.access-token - - - {{'security.access-token-required' | translate}} - - info_outlined - - - - security.clientId - - - {{'security.clientId-required' | translate}} - - info_outlined - - - - security.username - - - {{'security.username-required' | translate}} - - info_outlined - - - - security.password - - info_outlined - - - - - - - - +
+
+
security.security
+
+ + {{ securityType.value | translate }} + +
+ + security.access-token + + + {{'security.access-token-required' | translate}} + + info_outlined + + + + security.clientId + + + {{'security.clientId-required' | translate}} + + info_outlined + + + + security.username + + + {{'security.username-required' | translate}} + + info_outlined + + + + security.password + + info_outlined + + + + + + + + +
- - +
- - +
- + gateway.logs.date-format {{'gateway.logs.date-format-required' | translate }} - info_outlined - + gateway.logs.log-format {{'gateway.logs.log-format-required' | translate }} - info_outlined
- - - - gateway.logs.remote - +
+
+
gateway.logs.remote
{{ 'gateway.logs.remote-logs' | translate }} - info - + gateway.logs.level {{logLevel}} - - - - gateway.logs.local - - - - {{ logConfig.value }} - - -
- - gateway.logs.level - - {{logLevel}} - - - - gateway.logs.file-path - - - {{'gateway.logs.file-path-required' | translate }} - - -
- - gateway.logs.saving-period - - - {{'gateway.logs.saving-period-required' | translate }} - - - {{'gateway.logs.saving-period-min' | translate }} - - - - - - - {{period.value | translate}} - +
+
+
gateway.logs.local
+
+ + {{ logConfig.value }} + +
+ + gateway.logs.level + + {{logLevel}} + + gateway.logs.file-path + + + {{'gateway.logs.file-path-required' | translate }} + + +
+ + gateway.logs.saving-period + + + {{'gateway.logs.saving-period-required' | translate }} + + + {{'gateway.logs.saving-period-min' | translate }} + + + + + + + {{period.value | translate}} + + + +
+ + gateway.logs.backup-count + + + {{'gateway.logs.backup-count-required' | translate }} + + + {{'gateway.logs.backup-count-min' | translate }} + + info_outlined + +
- - gateway.logs.backup-count - - - {{'gateway.logs.backup-count-required' | translate }} - - - {{'gateway.logs.backup-count-min' | translate }} - - info_outlined - -
- - +
- - - - gateway.storage +
+
gateway.storage {{'gateway.hints.storage' | translate}} - - -
- - - {{ storageType.value | translate }} - -
- - {{'gateway.hints.'+gatewayConfigGroup.get('storage.type').value | translate}} -
- - gateway.storage-read-record-count - - - {{'gateway.storage-read-record-count-required' | translate}} - - - {{'gateway.storage-read-record-count-min' | translate}} - - - {{'gateway.storage-read-record-count-pattern' | translate}} - - info_outlined - - - - gateway.storage-max-records - - - {{'gateway.storage-max-records-required' | translate}} - - - {{'gateway.storage-max-records-min' | translate}} - - - {{'gateway.storage-max-records-pattern' | translate}} - - info_outlined - - - - gateway.storage-data-folder-path - - - {{'gateway.storage-data-folder-path-required' | translate}} - - info_outlined - - - - gateway.storage-max-files - - - {{'gateway.storage-max-files-required' | translate}} - - - {{'gateway.storage-max-files-min' | translate}} - - - {{'gateway.storage-max-files-pattern' | translate}} - - info_outlined - - - - gateway.storage-max-read-record-count - - - {{'gateway.storage-max-read-record-count-required' | translate}} - - - {{'gateway.storage-max-read-record-count-min' | translate}} - - - {{'gateway.storage-max-read-record-count-pattern' | translate}} - - info_outlined - - - - gateway.storage-max-file-records - - - {{'gateway.storage-max-records-required' | translate}} - - - {{'gateway.storage-max-records-min' | translate}} - - - {{'gateway.storage-max-records-pattern' | translate}} - - info_outlined - - - - gateway.storage-path - - - {{'gateway.storage-path-required' | translate}} - - info_outlined - - - - gateway.messages-ttl-check-in-hours - - - {{'gateway.messages-ttl-check-in-hours-required' | translate}} - - - {{'gateway.messages-ttl-check-in-hours-min' | translate}} - - - {{'gateway.messages-ttl-check-in-hours-pattern' | translate}} - - info_outlined - - - - gateway.messages-ttl-in-days - - - {{'gateway.messages-ttl-in-days-required' | translate}} - - - {{'gateway.messages-ttl-in-days-min' | translate}} - - - {{'gateway.messages-ttl-in-days-pattern' | translate}} - - info_outlined - - +
+
+ + + {{ storageType.value | translate }} + + +
+ + {{'gateway.hints.' + gatewayConfigGroup.get('storage.type').value | translate}} +
+ + gateway.storage-read-record-count + + + {{'gateway.storage-read-record-count-required' | translate}} + + + {{'gateway.storage-read-record-count-min' | translate}} + + + {{'gateway.storage-read-record-count-pattern' | translate}} + + info_outlined + + + + gateway.storage-max-records + + + {{'gateway.storage-max-records-required' | translate}} + + + {{'gateway.storage-max-records-min' | translate}} + + + {{'gateway.storage-max-records-pattern' | translate}} + + info_outlined + + + + gateway.storage-data-folder-path + + + {{'gateway.storage-data-folder-path-required' | translate}} + + info_outlined + + + + gateway.storage-max-files + + + {{'gateway.storage-max-files-required' | translate}} + + + {{'gateway.storage-max-files-min' | translate}} + + + {{'gateway.storage-max-files-pattern' | translate}} + + info_outlined + + + + gateway.storage-max-read-record-count + + + {{'gateway.storage-max-read-record-count-required' | translate}} + + + {{'gateway.storage-max-read-record-count-min' | translate}} + + + {{'gateway.storage-max-read-record-count-pattern' | translate}} + + info_outlined + + + + gateway.storage-max-file-records + + + {{'gateway.storage-max-records-required' | translate}} + + + {{'gateway.storage-max-records-min' | translate}} + + + {{'gateway.storage-max-records-pattern' | translate}} + + info_outlined + + + + gateway.storage-path + + + {{'gateway.storage-path-required' | translate}} + + info_outlined + + + + gateway.messages-ttl-check-in-hours + + + {{'gateway.messages-ttl-check-in-hours-required' | translate}} + + + {{'gateway.messages-ttl-check-in-hours-min' | translate}} + + + {{'gateway.messages-ttl-check-in-hours-pattern' | translate}} + + info_outlined + + + + gateway.messages-ttl-in-days + + + {{'gateway.messages-ttl-in-days-required' | translate}} + + + {{'gateway.messages-ttl-in-days-min' | translate}} + + + {{'gateway.messages-ttl-in-days-pattern' | translate}} + + info_outlined + + +
- - +
- - +
{{ 'gateway.grpc' | translate }} @@ -472,9 +482,9 @@ {{ 'gateway.permit-without-calls' | translate }} - + gateway.server-port - + {{'gateway.thingsboard-port-required' | translate }} @@ -488,9 +498,9 @@ {{'gateway.thingsboard-port-pattern' | translate }} - + gateway.grpc-keep-alive-timeout - + {{'gateway.grpc-keep-alive-timeout-required' | translate }} @@ -501,9 +511,9 @@ {{'gateway.grpc-keep-alive-timeout-pattern' | translate }} - + gateway.grpc-keep-alive - + {{'gateway.grpc-keep-alive-required' | translate }} @@ -514,9 +524,9 @@ {{'gateway.grpc-keep-alive-pattern' | translate }} - + gateway.grpc-min-time-between-pings - + {{'gateway.grpc-min-time-between-pings-required' | translate }} @@ -527,9 +537,9 @@ {{'gateway.grpc-min-time-between-pings-pattern' | translate }} - + gateway.grpc-max-pings-without-data - + {{'gateway.grpc-max-pings-without-data-required' | translate }} @@ -540,9 +550,9 @@ {{'gateway.grpc-max-pings-without-data-pattern' | translate }} - + gateway.grpc-min-ping-interval-without-data - + {{'gateway.grpc-min-ping-interval-without-data-required' | translate }} @@ -554,21 +564,19 @@
- - +
- - +
{{ 'gateway.statistics.statistics' | translate }} - + gateway.statistics.send-period - + {{'gateway.statistics.send-period-required' | translate }} @@ -583,33 +591,33 @@
- - - - {{"gateway.statistics.commands" |translate}} +
+
+
{{"gateway.statistics.commands" |translate}} - {{'gateway.hints.commands' | translate}} - + {{'gateway.hints.commands' | translate}}
-
- - + + gateway.statistics.attribute-name {{'gateway.statistics.attribute-name-required' | translate }} - info_outlined - + gateway.statistics.timeout - + {{'gateway.statistics.timeout-required' | translate }} @@ -622,19 +630,22 @@ *ngIf="commandControl.get('timeout').hasError('pattern')"> {{'gateway.statistics.timeout-pattern' | translate }} - info_outlined - + gateway.statistics.command {{'gateway.statistics.command-required' | translate }} - info_outlined @@ -655,28 +666,26 @@ {{ 'gateway.statistics.add' | translate }}
- - +
- - - - +
+
{{ 'gateway.checking-device-activity' | translate }} - {{'gateway.hints.check-device-activity' | translate}} - - + {{'gateway.hints.check-device-activity' | translate}} +
gateway.inactivity-timeout-seconds - + {{'gateway.inactivity-timeout-seconds-required' | translate }} @@ -685,12 +694,14 @@ *ngIf="gatewayConfigGroup.get('thingsboard.checkingDeviceActivity.inactivityTimeoutSeconds').hasError('min')"> {{'gateway.inactivity-timeout-seconds-min' | translate }} - info_outlined gateway.inactivity-check-period-seconds @@ -703,33 +714,33 @@ *ngIf="gatewayConfigGroup.get('thingsboard.checkingDeviceActivity.inactivityCheckPeriodSeconds').hasError('min')"> {{'gateway.inactivity-check-period-seconds-min' | translate }} - info_outlined
- - - - gateway.advanced - +
+
+
gateway.advanced
- + gateway.min-pack-send-delay - + {{ 'gateway.min-pack-send-delay-required' | translate }} {{ 'gateway.min-pack-send-delay-min' | translate }} - info_outlined - + gateway.mqtt-qos @@ -741,14 +752,15 @@ {{ 'gateway.mqtt-qos-range' | translate}} - info_outlined - + gateway.statistics.check-connectors-configuration - + {{'gateway.statistics.check-connectors-configuration-required' | translate }} @@ -763,9 +775,8 @@
- +
-
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.scss b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.scss index ee546ff9a7..3460d28745 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.scss @@ -22,6 +22,10 @@ color: rgba(0, 0, 0, .12); } + .tb-form-panel { + margin-bottom: 20px; + } + .mat-toolbar { background: transparent; color: rgba(0, 0, 0, .87) !important; @@ -41,6 +45,11 @@ margin-right: 15px; } + .slider-icon { + position: absolute; + transform: translateY(-3px); + } + .block-title { font-size: 20px; font-weight: 400; @@ -53,41 +62,11 @@ } .security-toggle-group { - padding-bottom: 0; - background: transparent !important; margin-bottom: 15px; - border: none; - overflow: auto; - - .mat-button-toggle { - border-radius: 15px; - border: 1px solid rgba(0, 0, 0, 0); - background: rgba(0, 0, 0, .05); - margin: 5px; - color: rgba(0, 0, 0, .2); - font-weight: 500; - } - - .mat-button-toggle-checked { - border-radius: 15px; - border: 1px solid #305680; - background: white; - color: #305680; - } + margin-right: auto; ::ng-deep span { - text-transform: capitalize; - line-height: 20px; - font-size: 13px; - padding: 5px 25px; - } - - ::ng-deep .mat-button-toggle-ripple { - border-radius: 15px; - } - - ::ng-deep .mat-button-toggle-appearance-standard:not(.mat-button-toggle-disabled):hover .mat-button-toggle-focus-overlay { - opacity: 0 !important; + padding: 0 25px; } } @@ -96,41 +75,6 @@ margin-bottom: 10px; } - .logs-toggle-group { - border: none; - border-radius: 15px; - background: rgba(0, 0, 0, .05); - color: rgba(0, 0, 0, .2); - font-weight: 500; - - .mat-button-toggle { - border: none; - background: rgba(0, 0, 0, .0); - color: rgba(0, 0, 0, .2); - font-weight: 500; - } - - .mat-button-toggle-checked { - border-radius: 15px; - color: white; - background: #305680; - } - - ::ng-deep span { - line-height: 20px; - font-size: 13px; - padding: 5px 25px; - } - - ::ng-deep .mat-button-toggle-ripple { - border-radius: 15px; - } - - ::ng-deep .mat-button-toggle-appearance-standard:not(.mat-button-toggle-disabled):hover .mat-button-toggle-focus-overlay { - opacity: 0 !important; - } - } - .statistics-block { margin-bottom: 15px; padding-left: 15px; @@ -167,10 +111,6 @@ z-index: 100; } - .suffix-icon { - position: absolute; - transform: translateY(-3px); - } mat-panel-title { display: block; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.ts index 47a975ee25..6966fa7f52 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/gateway/gateway-configuration.component.ts @@ -133,6 +133,8 @@ export class GatewayConfigurationComponent implements OnInit { logSelector: FormControl; + securityType: SecurityTypes; + constructor(protected router: Router, protected store: Store, @@ -259,6 +261,7 @@ export class GatewayConfigurationComponent implements OnInit { const securityGroup = this.gatewayConfigGroup.get('thingsboard.security') as FormGroup; securityGroup.get('type').valueChanges.subscribe(type => { this.removeAllSecurityValidators(); + console.log(type); if (type === SecurityTypes.ACCESS_TOKEN) { securityGroup.get('accessToken').addValidators([Validators.required]); securityGroup.get('accessToken').updateValueAndValidity(); @@ -317,6 +320,18 @@ export class GatewayConfigurationComponent implements OnInit { this.fetchConfigAttribute(this.device); } + updateSecurityValidators(value: SecurityTypes) { + this.gatewayConfigGroup.get('thingsboard.security.type').setValue(value, {emitEvent: true}); + } + + updateLogType(value: LocalLogsConfigs) { + this.logSelector.setValue(value); + } + + updateStorageType(value: StorageTypes) { + this.gatewayConfigGroup.get('storage.type').setValue(value, {emitEvent: true}) + } + fetchConfigAttribute(entityId: EntityId) { if (entityId.id === NULL_UUID) return; this.attributeService.getEntityAttributes(entityId, AttributeScope.CLIENT_SCOPE,