Browse Source

Merge branch 'rc'

pull/16395/head
Viacheslav Klimov 2 months ago
parent
commit
f221a8f32e
  1. 10
      application/src/main/data/json/demo/dashboards/firmware.json
  2. 10
      application/src/main/data/json/demo/dashboards/software.json
  3. 4
      application/src/main/data/json/demo/dashboards/thermostats.json
  4. 2
      application/src/main/data/json/system/widget_types/asset_admin_table.json
  5. 2
      application/src/main/data/json/system/widget_types/device_admin_table.json
  6. 12
      application/src/main/java/org/thingsboard/server/service/edge/rpc/service/EdgeGrpcService.java
  7. 4
      application/src/main/java/org/thingsboard/server/service/edge/rpc/session/DefaultZombieSessionCleanupService.java
  8. 34
      application/src/main/java/org/thingsboard/server/service/edge/rpc/session/EdgeSessionsHolder.java
  9. 5
      application/src/main/java/org/thingsboard/server/service/edge/rpc/session/manager/AbstractEdgeGrpcSessionManager.java
  10. 4
      application/src/main/java/org/thingsboard/server/service/edge/rpc/session/manager/KafkaBasedEdgeGrpcSessionManager.java
  11. 9
      application/src/main/java/org/thingsboard/server/service/edge/rpc/session/manager/PostgresBasedEdgeGrpcSessionManager.java
  12. 36
      application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/CookieUtils.java
  13. 98
      application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/HttpCookieOAuth2AuthorizationRequestRepository.java
  14. 118
      application/src/test/java/org/thingsboard/server/service/edge/rpc/session/DefaultZombieSessionCleanupServiceTest.java
  15. 92
      application/src/test/java/org/thingsboard/server/service/edge/rpc/session/EdgeSessionsHolderTest.java
  16. 14
      application/src/test/java/org/thingsboard/server/service/script/TbelInvokeServiceTest.java
  17. 45
      application/src/test/java/org/thingsboard/server/service/security/auth/oauth2/CookieUtilsTest.java
  18. 151
      application/src/test/java/org/thingsboard/server/service/security/auth/oauth2/HttpCookieOAuth2AuthorizationRequestRepositoryTest.java
  19. 2
      pom.xml
  20. 18
      tools/src/main/python/license-headers/curations.json
  21. 5
      ui-ngx/src/app/core/services/dashboard-utils.service.ts
  22. 8
      ui-ngx/src/app/modules/home/components/attribute/delete-timeseries-panel.component.scss
  23. 10
      ui-ngx/src/app/modules/home/components/attribute/delete-timeseries-panel.component.ts
  24. 8
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-image-dialog.component.html
  25. 1
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html
  26. 16
      ui-ngx/src/app/modules/home/components/dashboard-page/edit-widget.component.ts
  27. 2
      ui-ngx/src/app/modules/home/components/dashboard/select-target-state-dialog.component.html
  28. 4
      ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule-condition-dialog.component.html
  29. 2
      ui-ngx/src/app/modules/home/components/profile/alarm/edit-alarm-details-dialog.component.html
  30. 2
      ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-bootstrap-add-config-server-dialog.component.html
  31. 2
      ui-ngx/src/app/modules/home/components/rule-node/external/lambda-config.component.html
  32. 2
      ui-ngx/src/app/modules/home/components/rule-node/external/sns-config.component.html
  33. 2
      ui-ngx/src/app/modules/home/components/rule-node/external/sqs-config.component.html
  34. 2
      ui-ngx/src/app/modules/home/components/scheduler/scheduler-event-config.models.ts
  35. 6
      ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/digital-simple-gauge-basic-config.component.ts
  36. 2
      ui-ngx/src/app/modules/home/components/widget/lib/maps-legacy/dialogs/select-entity-dialog.component.html
  37. 7
      ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html
  38. 2
      ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.html
  39. 47
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-sample-html.raw
  40. 9
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-range-list.component.ts
  41. 12
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings.component.ts
  42. 2
      ui-ngx/src/app/modules/home/components/widget/lib/settings/common/count-widget-settings.component.ts
  43. 7
      ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-widget-settings.component.html
  44. 4
      ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/digital-gauge-widget-settings.component.ts
  45. 9
      ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-link-dialog.component.scss
  46. 6
      ui-ngx/src/app/modules/home/pages/rulechain/link-labels.component.html
  47. 1
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts
  48. 1
      ui-ngx/src/app/modules/home/pages/widget/widgets-bundle-widgets.component.html
  49. 40
      ui-ngx/src/app/shared/models/widget-settings.models.ts
  50. 21
      ui-ngx/src/assets/help/en_US/widget/action/examples/custom_pretty_create_dialog_html.md
  51. 26
      ui-ngx/src/assets/help/en_US/widget/action/examples/custom_pretty_edit_dialog_html.md
  52. 2
      ui-ngx/src/assets/help/en_US/widget/action/examples_custom_pretty/custom_pretty_clone_device_html.md
  53. 21
      ui-ngx/src/assets/help/en_US/widget/action/examples_custom_pretty/custom_pretty_create_dialog_html.md
  54. 8
      ui-ngx/src/assets/help/en_US/widget/action/examples_custom_pretty/custom_pretty_create_user_html.md
  55. 26
      ui-ngx/src/assets/help/en_US/widget/action/examples_custom_pretty/custom_pretty_edit_dialog_html.md
  56. 4
      ui-ngx/src/assets/help/en_US/widget/editor/examples/rpc_widget.md
  57. 4026
      ui-ngx/src/assets/locale/locale.constant-es_ES.json
  58. 10
      ui-ngx/src/assets/locale/locale.constant-uk_UA.json
  59. 8
      ui-ngx/structure.md

10
application/src/main/data/json/demo/dashboards/firmware.json

@ -279,7 +279,7 @@
"name": "Edit firmware",
"icon": "edit",
"type": "customPretty",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit firmware {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [useFullEntityId]=\"true\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"firmwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit firmware {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [appearance]=\"'outline'\"\n [useFullEntityId]=\"true\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"firmwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customCss": "form {\n min-width: 300px !important;\n}",
"customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet entityService = $injector.get(widgetContext.servicesMap.get('entityService'));\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\n\nopenEditEntityDialog();\n\nfunction openEditEntityDialog() {\n customDialog.customDialog(htmlTemplate, EditEntityDialogController).subscribe();\n}\n\nfunction EditEntityDialogController(instance) {\n let vm = instance;\n\n vm.entityName = entityName;\n vm.entity = {};\n\n vm.editEntityFormGroup = vm.fb.group({\n firmwareId: [null]\n });\n\n getEntityInfo();\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n\n vm.save = function() {\n vm.editEntityFormGroup.markAsPristine();\n saveEntity().subscribe(\n function () {\n // widgetContext.updateAliases();\n vm.dialogRef.close(null);\n }\n );\n };\n\n\n function getEntityInfo() {\n entityService.getEntity(entityId.entityType, entityId.id).subscribe(\n function (data) {\n vm.entity = data;\n vm.editEntityFormGroup.patchValue({\n firmwareId: vm.entity.firmwareId\n }, {emitEvent: false});\n }\n );\n }\n\n function saveEntity() {\n const formValues = vm.editEntityFormGroup.value;\n vm.entity.firmwareId = formValues.firmwareId;\n return deviceService.saveDevice(vm.entity);\n }\n}",
"customResources": [],
@ -1142,7 +1142,7 @@
"name": "Edit firmware",
"icon": "edit",
"type": "customPretty",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit firmware {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [useFullEntityId]=\"true\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"firmwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit firmware {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [appearance]=\"'outline'\"\n [useFullEntityId]=\"true\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"firmwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customCss": "form {\n min-width: 300px !important;\n}",
"customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet entityService = $injector.get(widgetContext.servicesMap.get('entityService'));\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\n\nopenEditEntityDialog();\n\nfunction openEditEntityDialog() {\n customDialog.customDialog(htmlTemplate, EditEntityDialogController).subscribe();\n}\n\nfunction EditEntityDialogController(instance) {\n let vm = instance;\n\n vm.entityName = entityName;\n vm.entity = {};\n\n vm.editEntityFormGroup = vm.fb.group({\n firmwareId: [null]\n });\n\n getEntityInfo();\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n\n vm.save = function() {\n vm.editEntityFormGroup.markAsPristine();\n saveEntity().subscribe(\n function () {\n // widgetContext.updateAliases();\n vm.dialogRef.close(null);\n }\n );\n };\n\n\n function getEntityInfo() {\n entityService.getEntity(entityId.entityType, entityId.id).subscribe(\n function (data) {\n vm.entity = data;\n vm.editEntityFormGroup.patchValue({\n firmwareId: vm.entity.firmwareId\n }, {emitEvent: false});\n }\n );\n }\n\n function saveEntity() {\n const formValues = vm.editEntityFormGroup.value;\n vm.entity.firmwareId = formValues.firmwareId;\n return deviceService.saveDevice(vm.entity);\n }\n}",
"customResources": [],
@ -1448,7 +1448,7 @@
"name": "Edit firmware",
"icon": "edit",
"type": "customPretty",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit firmware {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [useFullEntityId]=\"true\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"firmwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit firmware {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [appearance]=\"'outline'\"\n [useFullEntityId]=\"true\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"firmwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customCss": "form {\n min-width: 300px !important;\n}",
"customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet entityService = $injector.get(widgetContext.servicesMap.get('entityService'));\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\n\nopenEditEntityDialog();\n\nfunction openEditEntityDialog() {\n customDialog.customDialog(htmlTemplate, EditEntityDialogController).subscribe();\n}\n\nfunction EditEntityDialogController(instance) {\n let vm = instance;\n\n vm.entityName = entityName;\n vm.entity = {};\n\n vm.editEntityFormGroup = vm.fb.group({\n firmwareId: [null]\n });\n\n getEntityInfo();\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n\n vm.save = function() {\n vm.editEntityFormGroup.markAsPristine();\n saveEntity().subscribe(\n function () {\n // widgetContext.updateAliases();\n vm.dialogRef.close(null);\n }\n );\n };\n\n\n function getEntityInfo() {\n entityService.getEntity(entityId.entityType, entityId.id).subscribe(\n function (data) {\n vm.entity = data;\n vm.editEntityFormGroup.patchValue({\n firmwareId: vm.entity.firmwareId\n }, {emitEvent: false});\n }\n );\n }\n\n function saveEntity() {\n const formValues = vm.editEntityFormGroup.value;\n vm.entity.firmwareId = formValues.firmwareId;\n return deviceService.saveDevice(vm.entity);\n }\n}",
"customResources": [],
@ -1754,7 +1754,7 @@
"name": "Edit firmware",
"icon": "edit",
"type": "customPretty",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit firmware {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [useFullEntityId]=\"true\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"firmwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit firmware {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [appearance]=\"'outline'\"\n [useFullEntityId]=\"true\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"firmwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customCss": "form {\n min-width: 300px !important;\n}",
"customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet entityService = $injector.get(widgetContext.servicesMap.get('entityService'));\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\n\nopenEditEntityDialog();\n\nfunction openEditEntityDialog() {\n customDialog.customDialog(htmlTemplate, EditEntityDialogController).subscribe();\n}\n\nfunction EditEntityDialogController(instance) {\n let vm = instance;\n\n vm.entityName = entityName;\n vm.entity = {};\n\n vm.editEntityFormGroup = vm.fb.group({\n firmwareId: [null]\n });\n\n getEntityInfo();\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n\n vm.save = function() {\n vm.editEntityFormGroup.markAsPristine();\n saveEntity().subscribe(\n function () {\n // widgetContext.updateAliases();\n vm.dialogRef.close(null);\n }\n );\n };\n\n\n function getEntityInfo() {\n entityService.getEntity(entityId.entityType, entityId.id).subscribe(\n function (data) {\n vm.entity = data;\n vm.editEntityFormGroup.patchValue({\n firmwareId: vm.entity.firmwareId\n }, {emitEvent: false});\n }\n );\n }\n\n function saveEntity() {\n const formValues = vm.editEntityFormGroup.value;\n vm.entity.firmwareId = formValues.firmwareId;\n return deviceService.saveDevice(vm.entity);\n }\n}",
"customResources": [],
@ -2060,7 +2060,7 @@
"name": "Edit firmware",
"icon": "edit",
"type": "customPretty",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit firmware {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [useFullEntityId]=\"true\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"firmwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit firmware {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [appearance]=\"'outline'\"\n [useFullEntityId]=\"true\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"firmwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customCss": "form {\n min-width: 300px !important;\n}",
"customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet entityService = $injector.get(widgetContext.servicesMap.get('entityService'));\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\n\nopenEditEntityDialog();\n\nfunction openEditEntityDialog() {\n customDialog.customDialog(htmlTemplate, EditEntityDialogController).subscribe();\n}\n\nfunction EditEntityDialogController(instance) {\n let vm = instance;\n\n vm.entityName = entityName;\n vm.entity = {};\n\n vm.editEntityFormGroup = vm.fb.group({\n firmwareId: [null]\n });\n\n getEntityInfo();\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n\n vm.save = function() {\n vm.editEntityFormGroup.markAsPristine();\n saveEntity().subscribe(\n function () {\n // widgetContext.updateAliases();\n vm.dialogRef.close(null);\n }\n );\n };\n\n\n function getEntityInfo() {\n entityService.getEntity(entityId.entityType, entityId.id).subscribe(\n function (data) {\n vm.entity = data;\n vm.editEntityFormGroup.patchValue({\n firmwareId: vm.entity.firmwareId\n }, {emitEvent: false});\n }\n );\n }\n\n function saveEntity() {\n const formValues = vm.editEntityFormGroup.value;\n vm.entity.firmwareId = formValues.firmwareId;\n return deviceService.saveDevice(vm.entity);\n }\n}",
"customResources": [],

10
application/src/main/data/json/demo/dashboards/software.json

@ -279,7 +279,7 @@
"name": "Edit software",
"icon": "edit",
"type": "customPretty",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit software {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [useFullEntityId]=\"true\"\n type=\"SOFTWARE\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"softwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit software {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [appearance]=\"'outline'\"\n [useFullEntityId]=\"true\"\n type=\"SOFTWARE\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"softwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customCss": "form {\n min-width: 300px !important;\n}",
"customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet entityService = $injector.get(widgetContext.servicesMap.get('entityService'));\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\n\nopenEditEntityDialog();\n\nfunction openEditEntityDialog() {\n customDialog.customDialog(htmlTemplate, EditEntityDialogController).subscribe();\n}\n\nfunction EditEntityDialogController(instance) {\n let vm = instance;\n\n vm.entityName = entityName;\n vm.entity = {};\n\n vm.editEntityFormGroup = vm.fb.group({\n softwareId: [null]\n });\n\n getEntityInfo();\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n\n vm.save = function() {\n vm.editEntityFormGroup.markAsPristine();\n saveEntity().subscribe(\n function () {\n // widgetContext.updateAliases();\n vm.dialogRef.close(null);\n }\n );\n };\n\n\n function getEntityInfo() {\n entityService.getEntity(entityId.entityType, entityId.id).subscribe(\n function (data) {\n vm.entity = data;\n vm.editEntityFormGroup.patchValue({\n softwareId: vm.entity.softwareId\n }, {emitEvent: false});\n }\n );\n }\n\n function saveEntity() {\n const formValues = vm.editEntityFormGroup.value;\n vm.entity.softwareId = formValues.softwareId;\n return deviceService.saveDevice(vm.entity);\n }\n}",
"customResources": [],
@ -1142,7 +1142,7 @@
"name": "Edit software",
"icon": "edit",
"type": "customPretty",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit software {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [useFullEntityId]=\"true\"\n type=\"SOFTWARE\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"softwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit software {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [appearance]=\"'outline'\"\n [useFullEntityId]=\"true\"\n type=\"SOFTWARE\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"softwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customCss": "form {\n min-width: 300px !important;\n}",
"customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet entityService = $injector.get(widgetContext.servicesMap.get('entityService'));\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\n\nopenEditEntityDialog();\n\nfunction openEditEntityDialog() {\n customDialog.customDialog(htmlTemplate, EditEntityDialogController).subscribe();\n}\n\nfunction EditEntityDialogController(instance) {\n let vm = instance;\n\n vm.entityName = entityName;\n vm.entity = {};\n\n vm.editEntityFormGroup = vm.fb.group({\n softwareId: [null]\n });\n\n getEntityInfo();\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n\n vm.save = function() {\n vm.editEntityFormGroup.markAsPristine();\n saveEntity().subscribe(\n function () {\n // widgetContext.updateAliases();\n vm.dialogRef.close(null);\n }\n );\n };\n\n\n function getEntityInfo() {\n entityService.getEntity(entityId.entityType, entityId.id).subscribe(\n function (data) {\n vm.entity = data;\n vm.editEntityFormGroup.patchValue({\n softwareId: vm.entity.softwareId\n }, {emitEvent: false});\n }\n );\n }\n\n function saveEntity() {\n const formValues = vm.editEntityFormGroup.value;\n vm.entity.softwareId = formValues.softwareId;\n return deviceService.saveDevice(vm.entity);\n }\n}",
"customResources": [],
@ -1448,7 +1448,7 @@
"name": "Edit software",
"icon": "edit",
"type": "customPretty",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit software {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [useFullEntityId]=\"true\"\n type=\"SOFTWARE\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"softwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit software {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [appearance]=\"'outline'\"\n [useFullEntityId]=\"true\"\n type=\"SOFTWARE\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"softwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customCss": "form {\n min-width: 300px !important;\n}",
"customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet entityService = $injector.get(widgetContext.servicesMap.get('entityService'));\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\n\nopenEditEntityDialog();\n\nfunction openEditEntityDialog() {\n customDialog.customDialog(htmlTemplate, EditEntityDialogController).subscribe();\n}\n\nfunction EditEntityDialogController(instance) {\n let vm = instance;\n\n vm.entityName = entityName;\n vm.entity = {};\n\n vm.editEntityFormGroup = vm.fb.group({\n softwareId: [null]\n });\n\n getEntityInfo();\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n\n vm.save = function() {\n vm.editEntityFormGroup.markAsPristine();\n saveEntity().subscribe(\n function () {\n // widgetContext.updateAliases();\n vm.dialogRef.close(null);\n }\n );\n };\n\n\n function getEntityInfo() {\n entityService.getEntity(entityId.entityType, entityId.id).subscribe(\n function (data) {\n vm.entity = data;\n vm.editEntityFormGroup.patchValue({\n softwareId: vm.entity.softwareId\n }, {emitEvent: false});\n }\n );\n }\n\n function saveEntity() {\n const formValues = vm.editEntityFormGroup.value;\n vm.entity.softwareId = formValues.softwareId;\n return deviceService.saveDevice(vm.entity);\n }\n}",
"customResources": [],
@ -1754,7 +1754,7 @@
"name": "Edit software",
"icon": "edit",
"type": "customPretty",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit software {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [useFullEntityId]=\"true\"\n type=\"SOFTWARE\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"softwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit software {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [appearance]=\"'outline'\"\n [useFullEntityId]=\"true\"\n type=\"SOFTWARE\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"softwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customCss": "form {\n min-width: 300px !important;\n}",
"customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet entityService = $injector.get(widgetContext.servicesMap.get('entityService'));\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\n\nopenEditEntityDialog();\n\nfunction openEditEntityDialog() {\n customDialog.customDialog(htmlTemplate, EditEntityDialogController).subscribe();\n}\n\nfunction EditEntityDialogController(instance) {\n let vm = instance;\n\n vm.entityName = entityName;\n vm.entity = {};\n\n vm.editEntityFormGroup = vm.fb.group({\n softwareId: [null]\n });\n\n getEntityInfo();\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n\n vm.save = function() {\n vm.editEntityFormGroup.markAsPristine();\n saveEntity().subscribe(\n function () {\n // widgetContext.updateAliases();\n vm.dialogRef.close(null);\n }\n );\n };\n\n\n function getEntityInfo() {\n entityService.getEntity(entityId.entityType, entityId.id).subscribe(\n function (data) {\n vm.entity = data;\n vm.editEntityFormGroup.patchValue({\n softwareId: vm.entity.softwareId\n }, {emitEvent: false});\n }\n );\n }\n\n function saveEntity() {\n const formValues = vm.editEntityFormGroup.value;\n vm.entity.softwareId = formValues.softwareId;\n return deviceService.saveDevice(vm.entity);\n }\n}",
"customResources": [],
@ -2060,7 +2060,7 @@
"name": "Edit software",
"icon": "edit",
"type": "customPretty",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit software {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [useFullEntityId]=\"true\"\n type=\"SOFTWARE\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"softwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit software {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div *ngIf=\"entity.deviceProfileId\" mat-dialog-content class=\"flex flex-col\">\n <tb-ota-package-autocomplete\n [appearance]=\"'outline'\"\n [useFullEntityId]=\"true\"\n type=\"SOFTWARE\"\n [deviceProfileId]=\"entity.deviceProfileId.id\"\n formControlName=\"softwareId\">\n </tb-ota-package-autocomplete>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customCss": "form {\n min-width: 300px !important;\n}",
"customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet entityService = $injector.get(widgetContext.servicesMap.get('entityService'));\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\n\nopenEditEntityDialog();\n\nfunction openEditEntityDialog() {\n customDialog.customDialog(htmlTemplate, EditEntityDialogController).subscribe();\n}\n\nfunction EditEntityDialogController(instance) {\n let vm = instance;\n\n vm.entityName = entityName;\n vm.entity = {};\n\n vm.editEntityFormGroup = vm.fb.group({\n softwareId: [null]\n });\n\n getEntityInfo();\n\n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n\n vm.save = function() {\n vm.editEntityFormGroup.markAsPristine();\n saveEntity().subscribe(\n function () {\n // widgetContext.updateAliases();\n vm.dialogRef.close(null);\n }\n );\n };\n\n\n function getEntityInfo() {\n entityService.getEntity(entityId.entityType, entityId.id).subscribe(\n function (data) {\n vm.entity = data;\n vm.editEntityFormGroup.patchValue({\n softwareId: vm.entity.softwareId\n }, {emitEvent: false});\n }\n );\n }\n\n function saveEntity() {\n const formValues = vm.editEntityFormGroup.value;\n vm.entity.softwareId = formValues.softwareId;\n return deviceService.saveDevice(vm.entity);\n }\n}",
"customResources": [],

4
application/src/main/data/json/demo/dashboards/thermostats.json

@ -167,7 +167,7 @@
"name": "Add",
"icon": "add",
"type": "customPretty",
"customHtml": "<form #addEntityForm=\"ngForm\" [formGroup]=\"addEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"add-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Add thermostat</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div mat-dialog-content class=\"flex flex-col\">\n <mat-form-field class=\"mat-block flex-1\">\n <mat-label>Thermostat name</mat-label>\n <input matInput formControlName=\"entityName\" required>\n <mat-error *ngIf=\"addEntityFormGroup.get('entityName').hasError('required')\">\n Thermostat name is required.\n </mat-error>\n </mat-form-field>\n <div formGroupName=\"attributes\" class=\"flex flex-col\">\n <mat-slide-toggle formControlName=\"temperatureAlarmFlag\">\n High temperature alarm\n </mat-slide-toggle>\n <mat-form-field class=\"mat-block flex-1\">\n <mat-label>High temperature threshold, °C</mat-label>\n <input type=\"number\" step=\"any\" matInput\n [required] = \"addEntityFormGroup.get('attributes').get('temperatureAlarmFlag').value\"\n formControlName=\"temperatureAlarmThreshold\">\n <mat-error *ngIf=\"addEntityFormGroup.get('attributes').get('temperatureAlarmThreshold').hasError('required')\">\n High temperature threshold is required.\n </mat-error>\n </mat-form-field>\n\n <mat-slide-toggle formControlName=\"humidityAlarmFlag\">\n Low humidity alarm\n </mat-slide-toggle>\n\n <mat-form-field class=\"mat-block flex-1\">\n <mat-label>Low humidity threshold, %</mat-label>\n <input type=\"number\" step=\"any\" matInput\n [required] = \"addEntityFormGroup.get('attributes').get('humidityAlarmFlag').value\"\n formControlName=\"humidityAlarmThreshold\">\n <mat-error *ngIf=\"addEntityFormGroup.get('attributes').get('humidityAlarmThreshold').hasError('required')\">\n Low humidity threshold is required.\n </mat-error>\n </mat-form-field>\n </div>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || addEntityForm.invalid || !addEntityForm.dirty\">\n Create\n </button>\n </div>\n</form>",
"customHtml": "<form #addEntityForm=\"ngForm\" [formGroup]=\"addEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"add-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Add thermostat</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div mat-dialog-content class=\"flex flex-col\">\n <mat-form-field class=\"mat-block flex-1\" appearance=\"outline\">\n <mat-label>Thermostat name</mat-label>\n <input matInput formControlName=\"entityName\" required>\n <mat-error *ngIf=\"addEntityFormGroup.get('entityName').hasError('required')\">\n Thermostat name is required.\n </mat-error>\n </mat-form-field>\n <div formGroupName=\"attributes\" class=\"flex flex-col\">\n <mat-slide-toggle formControlName=\"temperatureAlarmFlag\">\n High temperature alarm\n </mat-slide-toggle>\n <mat-form-field class=\"mat-block flex-1\" appearance=\"outline\">\n <mat-label>High temperature threshold, °C</mat-label>\n <input type=\"number\" step=\"any\" matInput\n [required] = \"addEntityFormGroup.get('attributes').get('temperatureAlarmFlag').value\"\n formControlName=\"temperatureAlarmThreshold\">\n <mat-error *ngIf=\"addEntityFormGroup.get('attributes').get('temperatureAlarmThreshold').hasError('required')\">\n High temperature threshold is required.\n </mat-error>\n </mat-form-field>\n\n <mat-slide-toggle formControlName=\"humidityAlarmFlag\">\n Low humidity alarm\n </mat-slide-toggle>\n\n <mat-form-field class=\"mat-block flex-1\" appearance=\"outline\">\n <mat-label>Low humidity threshold, %</mat-label>\n <input type=\"number\" step=\"any\" matInput\n [required] = \"addEntityFormGroup.get('attributes').get('humidityAlarmFlag').value\"\n formControlName=\"humidityAlarmThreshold\">\n <mat-error *ngIf=\"addEntityFormGroup.get('attributes').get('humidityAlarmThreshold').hasError('required')\">\n Low humidity threshold is required.\n </mat-error>\n </mat-form-field>\n </div>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || addEntityForm.invalid || !addEntityForm.dirty\">\n Create\n </button>\n </div>\n</form>",
"customCss": ".add-entity-form{\n width: 300px;\n}\n",
"customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));\nlet attributeService = $injector.get(widgetContext.servicesMap.get('attributeService'));\n\nopenAddEntityDialog();\n\nfunction openAddEntityDialog() {\n customDialog.customDialog(htmlTemplate, AddEntityDialogController).subscribe();\n}\n\nfunction AddEntityDialogController(instance) {\n let vm = instance;\n \n vm.addEntityFormGroup = vm.fb.group({\n entityName: ['', [vm.validators.required]],\n attributes: vm.fb.group({\n temperatureAlarmFlag: [false],\n temperatureAlarmThreshold: [{value: null, disabled: true}],\n humidityAlarmFlag: [false],\n humidityAlarmThreshold: [{value: null, disabled: true}]\n })\n });\n \n vm.addEntityFormGroup.get('attributes').get('temperatureAlarmFlag').valueChanges\n .subscribe(activate => {\n if (activate) {\n vm.addEntityFormGroup.get('attributes').get('temperatureAlarmThreshold').enable();\n } else {\n vm.addEntityFormGroup.get('attributes').get('temperatureAlarmThreshold').disable();\n }\n });\n \n vm.addEntityFormGroup.get('attributes').get('humidityAlarmFlag').valueChanges\n .subscribe(activate => {\n if (activate) {\n vm.addEntityFormGroup.get('attributes').get('humidityAlarmThreshold').enable();\n } else {\n vm.addEntityFormGroup.get('attributes').get('humidityAlarmThreshold').disable();\n }\n });\n\n vm.save = function() {\n vm.addEntityFormGroup.markAsPristine();\n saveEntityObservable().subscribe(\n function (entity) {\n saveAttributes(entity.id).subscribe(\n function () {\n widgetContext.updateAliases();\n vm.dialogRef.close(null);\n }\n );\n }\n );\n };\n \n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n \n function saveEntityObservable() {\n const formValues = vm.addEntityFormGroup.value;\n let entity = {\n name: formValues.entityName,\n type: \"thermostat\"\n };\n return deviceService.saveDevice(entity);\n }\n \n function saveAttributes(entityId) {\n let attributes = vm.addEntityFormGroup.get('attributes').value;\n let attributesArray = [];\n for (let key in attributes) {\n if(attributes[key] !== null) {\n attributesArray.push({key: key, value: attributes[key]});\n }\n }\n if (attributesArray.length > 0) {\n return attributeService.saveEntityAttributes(entityId, \"SERVER_SCOPE\", attributesArray);\n } else {\n return widgetContext.rxjs.of([]);\n }\n }\n}",
"customResources": [],
@ -187,7 +187,7 @@
"name": "Edit",
"icon": "edit",
"type": "customPretty",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit thermostat {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div mat-dialog-content class=\"flex flex-col\">\n <mat-form-field class=\"mat-block flex-1\">\n <mat-label>Thermostat name</mat-label>\n <input matInput formControlName=\"entityName\" readonly>\n </mat-form-field>\n <div formGroupName=\"attributes\" class=\"flex flex-col\">\n <mat-slide-toggle formControlName=\"temperatureAlarmFlag\">\n High temperature alarm\n </mat-slide-toggle>\n <mat-form-field class=\"mat-block flex-1\">\n <mat-label>High temperature threshold, °C</mat-label>\n <input type=\"number\" step=\"any\" matInput\n [required] = \"editEntityFormGroup.get('attributes').get('temperatureAlarmFlag').value\"\n formControlName=\"temperatureAlarmThreshold\">\n <mat-error *ngIf=\"editEntityFormGroup.get('attributes').get('temperatureAlarmThreshold').hasError('required')\">\n High temperature threshold is required.\n </mat-error>\n </mat-form-field>\n\n <mat-slide-toggle formControlName=\"humidityAlarmFlag\">\n Low humidity alarm\n </mat-slide-toggle>\n\n <mat-form-field class=\"mat-block flex-1\">\n <mat-label>Low humidity threshold, %</mat-label>\n <input type=\"number\" step=\"any\" matInput\n [required] = \"editEntityFormGroup.get('attributes').get('humidityAlarmFlag').value\"\n formControlName=\"humidityAlarmThreshold\">\n <mat-error *ngIf=\"editEntityFormGroup.get('attributes').get('humidityAlarmThreshold').hasError('required')\">\n Low humidity threshold is required.\n </mat-error>\n </mat-form-field>\n </div>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customHtml": "<form #editEntityForm=\"ngForm\" [formGroup]=\"editEntityFormGroup\"\n (ngSubmit)=\"save()\" class=\"edit-entity-form\">\n <mat-toolbar color=\"tb-primary\" class=\"tb-bottom-border flex flex-row\">\n <h2>Edit thermostat {{entityName}}</h2>\n <span class=\"flex-1\"></span>\n <button mat-icon-button (click)=\"cancel()\" type=\"button\">\n <mat-icon class=\"material-icons\">close</mat-icon>\n </button>\n </mat-toolbar>\n <mat-progress-bar color=\"warn\" mode=\"indeterminate\" *ngIf=\"isLoading$ | async\">\n </mat-progress-bar>\n <div style=\"height: 4px;\" *ngIf=\"!(isLoading$ | async)\"></div>\n <div mat-dialog-content class=\"flex flex-col\">\n <mat-form-field class=\"mat-block flex-1\" appearance=\"outline\">\n <mat-label>Thermostat name</mat-label>\n <input matInput formControlName=\"entityName\" readonly>\n </mat-form-field>\n <div formGroupName=\"attributes\" class=\"flex flex-col\">\n <mat-slide-toggle formControlName=\"temperatureAlarmFlag\">\n High temperature alarm\n </mat-slide-toggle>\n <mat-form-field class=\"mat-block flex-1\" appearance=\"outline\">\n <mat-label>High temperature threshold, °C</mat-label>\n <input type=\"number\" step=\"any\" matInput\n [required] = \"editEntityFormGroup.get('attributes').get('temperatureAlarmFlag').value\"\n formControlName=\"temperatureAlarmThreshold\">\n <mat-error *ngIf=\"editEntityFormGroup.get('attributes').get('temperatureAlarmThreshold').hasError('required')\">\n High temperature threshold is required.\n </mat-error>\n </mat-form-field>\n\n <mat-slide-toggle formControlName=\"humidityAlarmFlag\">\n Low humidity alarm\n </mat-slide-toggle>\n\n <mat-form-field class=\"mat-block flex-1\" appearance=\"outline\">\n <mat-label>Low humidity threshold, %</mat-label>\n <input type=\"number\" step=\"any\" matInput\n [required] = \"editEntityFormGroup.get('attributes').get('humidityAlarmFlag').value\"\n formControlName=\"humidityAlarmThreshold\">\n <mat-error *ngIf=\"editEntityFormGroup.get('attributes').get('humidityAlarmThreshold').hasError('required')\">\n Low humidity threshold is required.\n </mat-error>\n </mat-form-field>\n </div>\n </div>\n <div mat-dialog-actions class=\"flex flex-row items-center justify-end\">\n <button mat-button color=\"primary\"\n type=\"button\"\n [disabled]=\"(isLoading$ | async)\"\n (click)=\"cancel()\" cdkFocusInitial>\n Cancel\n </button>\n <button mat-button mat-raised-button color=\"primary\"\n type=\"submit\"\n [disabled]=\"(isLoading$ | async) || editEntityForm.invalid || !editEntityForm.dirty\">\n Save\n </button>\n </div>\n</form>",
"customCss": ".edit-entity-form{\n width: 300px;\n}",
"customFunction": "let $injector = widgetContext.$scope.$injector;\nlet customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));\nlet attributeService = $injector.get(widgetContext.servicesMap.get('attributeService'));\n\nopenEditEntityDialog();\n\nfunction openEditEntityDialog() {\n customDialog.customDialog(htmlTemplate, EditEntityDialogController).subscribe();\n}\n\nfunction EditEntityDialogController(instance) {\n let vm = instance;\n \n vm.entityId = entityId;\n vm.entityName = entityName;\n vm.attributes = {};\n \n vm.editEntityFormGroup = vm.fb.group({\n entityName: [''],\n attributes: vm.fb.group({\n temperatureAlarmFlag: [false],\n temperatureAlarmThreshold: [{value: null, disabled: true}],\n humidityAlarmFlag: [false],\n humidityAlarmThreshold: [{value: null, disabled: true}]\n })\n });\n \n vm.editEntityFormGroup.get('attributes').get('temperatureAlarmFlag').valueChanges\n .subscribe(activate => {\n if (activate) {\n vm.editEntityFormGroup.get('attributes').get('temperatureAlarmThreshold').enable();\n } else {\n vm.editEntityFormGroup.get('attributes').get('temperatureAlarmThreshold').disable();\n }\n });\n \n vm.editEntityFormGroup.get('attributes').get('humidityAlarmFlag').valueChanges\n .subscribe(activate => {\n if (activate) {\n vm.editEntityFormGroup.get('attributes').get('humidityAlarmThreshold').enable();\n } else {\n vm.editEntityFormGroup.get('attributes').get('humidityAlarmThreshold').disable();\n }\n });\n \n \n getEntityInfo();\n \n \n vm.save = function() {\n vm.editEntityFormGroup.markAsPristine();\n saveAttributes(entityId).subscribe(\n function () {\n vm.dialogRef.close(null);\n }\n );\n };\n \n vm.cancel = function() {\n vm.dialogRef.close(null);\n };\n \n function getEntityAttributes(attributes) {\n for (var i = 0; i < attributes.length; i++) {\n vm.attributes[attributes[i].key] = attributes[i].value;\n }\n }\n \n function getEntityInfo() {\n attributeService.getEntityAttributes(entityId, 'SERVER_SCOPE').subscribe(\n function (attributes) {\n getEntityAttributes(attributes);\n vm.editEntityFormGroup.patchValue({\n entityName: vm.entityName,\n attributes: vm.attributes\n });\n // if(vm.attributes.temperatureAlarmFlag) {\n // vm.editEntityFormGroup.get('attributes').get('temperatureAlarmThreshold').enable();\n // }\n // if(vm.attributes.humidityAlarmFlag) {\n // vm.editEntityFormGroup.get('attributes').get('humidityAlarmThreshold').enable();\n // }\n }\n );\n }\n \n function saveAttributes(entityId) {\n let attributes = vm.editEntityFormGroup.get('attributes').value;\n let attributesArray = [];\n for (let key in attributes) {\n if (attributes[key] !== vm.attributes[key]) {\n attributesArray.push({key: key, value: attributes[key]});\n }\n }\n if (attributesArray.length > 0) {\n return attributeService.saveEntityAttributes(entityId, \"SERVER_SCOPE\", attributesArray);\n } else {\n return widgetContext.rxjs.of([]);\n }\n }\n}",
"customResources": [],

2
application/src/main/data/json/system/widget_types/asset_admin_table.json

File diff suppressed because one or more lines are too long

2
application/src/main/data/json/system/widget_types/device_admin_table.json

File diff suppressed because one or more lines are too long

12
application/src/main/java/org/thingsboard/server/service/edge/rpc/service/EdgeGrpcService.java

@ -225,19 +225,17 @@ public class EdgeGrpcService extends EdgeRpcServiceGrpc.EdgeRpcServiceImplBase i
TenantId tenantId = edge.getTenantId();
EdgeId edgeId = edge.getId();
log.info("[{}][{}] edge disconnected!", edgeId, sessionId);
EdgeGrpcSessionManager current = sessions.getByEdgeId(edgeId);
if (current != null && current.getState().getSessionId().equals(sessionId)) {
EdgeGrpcSessionManager toRemove = sessions.removeByEdgeId(edgeId);
if (toRemove != null) {
toRemove.onEdgeDisconnect();
toRemove.destroyAndMarkAsZombieIfFailed();
}
EdgeGrpcSessionManager toRemove = sessions.removeByEdgeIdIfCurrent(edgeId, sessionId);
if (toRemove != null) {
sessions.removeBySessionId(sessionId);
save(tenantId, edgeId, ACTIVITY_STATE, false);
long lastDisconnectTs = System.currentTimeMillis();
save(tenantId, edgeId, LAST_DISCONNECT_TIME, lastDisconnectTs);
pushRuleEngineMessage(tenantId, edge, lastDisconnectTs, TbMsgType.DISCONNECT_EVENT);
scheduleDisconnectNotification(edge);
toRemove.onEdgeDisconnect();
// keep the slow teardown last, after the state transition is fully recorded
toRemove.destroyAndMarkAsZombieIfFailed();
} else {
log.info("[{}] edge session [{}] is not current anymore. Attempting to destroy it by sessionId.", edgeId, sessionId);
EdgeGrpcSessionManager stale = sessions.removeBySessionId(sessionId);

4
application/src/main/java/org/thingsboard/server/service/edge/rpc/session/DefaultZombieSessionCleanupService.java

@ -59,8 +59,10 @@ public class DefaultZombieSessionCleanupService implements ZombieSessionCleanupS
private void cleanupZombieSessions() {
try {
// remove by identity: the edge may have reconnected since the zombie scan, and that newer
// session must not be evicted by the cleanup of the one it replaced
tryToDestroyZombieSessions(getZombieSessions(edgeSessionsHolder.getSessions().values()),
s -> edgeSessionsHolder.removeByEdgeId(s.getState().getEdge().getId()));
s -> edgeSessionsHolder.removeByEdgeIdIfCurrent(s.getState().getEdgeId(), s.getState().getSessionId()));
tryToDestroyZombieSessions(getZombieSessions(edgeSessionsHolder.getSessionsById().values()),
s -> edgeSessionsHolder.removeBySessionId(s.getState().getSessionId()));

34
application/src/main/java/org/thingsboard/server/service/edge/rpc/session/EdgeSessionsHolder.java

@ -16,6 +16,7 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
@Data
@ -54,6 +55,39 @@ public class EdgeSessionsHolder {
return sessions.remove(id);
}
/**
* Whether the given session is still the one registered for its edge. A session that has been
* superseded must not arm or run work on the edge's behalf - the session that replaced it owns
* that now - and a plain "some session exists for this edge" check does not catch that.
*/
public boolean isCurrent(EdgeGrpcSessionManager session) {
EdgeSessionState state = session.getState();
return state != null && sessions.get(state.getEdgeId()) == session;
}
/**
* Removes the edge's registered session and returns it, but only if it is still the given session.
* Returns null when another session has taken the edge over in the meantime, so that a teardown
* racing with a reconnect cannot act on behalf of a session it no longer owns. The check and the
* removal are one atomic step.
* <p>
* Only cheap non-blocking work may run inside the remapping function: it holds the bin lock of
* {@link #sessions} for this edge, so a slow teardown such as
* {@link EdgeGrpcSessionManager#destroyAndMarkAsZombieIfFailed()} has to be done by the caller
* once compute has returned.
*/
public EdgeGrpcSessionManager removeByEdgeIdIfCurrent(EdgeId id, UUID sessionId) {
AtomicReference<EdgeGrpcSessionManager> removed = new AtomicReference<>();
sessions.compute(id, (edgeId, current) -> {
if (current == null || !sessionId.equals(current.getState().getSessionId())) {
return current;
}
removed.set(current);
return null;
});
return removed.get();
}
public EdgeGrpcSessionManager removeBySessionId(UUID sessionId) {
return sessionsById.remove(sessionId);
}

5
application/src/main/java/org/thingsboard/server/service/edge/rpc/session/manager/AbstractEdgeGrpcSessionManager.java

@ -110,6 +110,11 @@ public abstract class AbstractEdgeGrpcSessionManager extends EdgeGrpcSessionDele
session.sendDownlinkMsg(edgeConfigMsg);
}
/**
* Stops the session and hands it to the zombie cleanup service if that fails. This can block for
* seconds - the Kafka session gives its consumer executor up to 5s to terminate - so it must never
* be called from inside an {@code EdgeSessionsHolder} remapping function.
*/
@Override
public void destroyAndMarkAsZombieIfFailed() {
EdgeSessionState state = getState();

4
application/src/main/java/org/thingsboard/server/service/edge/rpc/session/manager/KafkaBasedEdgeGrpcSessionManager.java

@ -114,8 +114,8 @@ public class KafkaBasedEdgeGrpcSessionManager extends AbstractEdgeGrpcSessionMan
TenantId tenantId = state.getTenantId();
EdgeId edgeId = state.getEdgeId();
if (!sessions.hasByEdgeId(edgeId)) {
log.debug("[{}] Session was removed and edge event consumer must not be started [{}]",
if (!sessions.isCurrent(this)) {
log.debug("[{}] Session is not current anymore and edge event consumer must not be started [{}]",
tenantId, edgeId.getId());
return;
}

9
application/src/main/java/org/thingsboard/server/service/edge/rpc/session/manager/PostgresBasedEdgeGrpcSessionManager.java

@ -79,8 +79,8 @@ public class PostgresBasedEdgeGrpcSessionManager extends AbstractEdgeGrpcSession
EdgeId edgeId = getState().getEdgeId();
TenantId tenantId = getState().getTenantId();
if (!edgeSessions.hasByEdgeId(edgeId)) {
log.debug("[{}] Session was removed and edge event check schedule must not be started [{}]",
if (!edgeSessions.isCurrent(this)) {
log.debug("[{}] Session is not current anymore and edge event check schedule must not be started [{}]",
tenantId, edgeId.getId());
return;
}
@ -88,6 +88,11 @@ public class PostgresBasedEdgeGrpcSessionManager extends AbstractEdgeGrpcSession
try {
newEventsLock.lock();
try {
if (!edgeSessions.isCurrent(this)) {
log.debug("[{}] Session is not current anymore, edge event check must not run for edge [{}]",
tenantId, edgeId.getId());
return;
}
if (!hasNewEvents) {
scheduleEdgeEventsCheck();
return;

36
application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/CookieUtils.java

@ -2,30 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
package org.thingsboard.server.service.security.auth.oauth2;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.jackson2.SecurityJackson2Modules;
import java.io.IOException;
import java.util.Arrays;
import java.util.Base64;
import java.util.Optional;
@Slf4j
public class CookieUtils {
private static final ObjectMapper OBJECT_MAPPER;
static {
ClassLoader loader = CookieUtils.class.getClassLoader();
OBJECT_MAPPER = new ObjectMapper();
OBJECT_MAPPER.registerModules(SecurityJackson2Modules.getModules(loader));
}
public static Optional<Cookie> getCookie(HttpServletRequest request, String name) {
Cookie[] cookies = request.getCookies();
@ -61,24 +45,4 @@ public class CookieUtils {
}
}
}
public static String serialize(Object object) {
try {
return Base64.getUrlEncoder()
.encodeToString(OBJECT_MAPPER.writeValueAsBytes(object));
} catch (JsonProcessingException e) {
throw new IllegalArgumentException("The given Json object value: "
+ object + " cannot be transformed to a String", e);
}
}
public static <T> T deserialize(Cookie cookie, Class<T> cls) {
byte[] decodedBytes = Base64.getUrlDecoder().decode(cookie.getValue());
try {
return OBJECT_MAPPER.readValue(decodedBytes, cls);
} catch (IOException e) {
throw new IllegalArgumentException("The given string value: "
+ Arrays.toString(decodedBytes) + " cannot be transformed to Json object", e);
}
}
}

98
application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/HttpCookieOAuth2AuthorizationRequestRepository.java

@ -2,13 +2,34 @@
// SPDX-License-Identifier: Apache-2.0
package org.thingsboard.server.service.security.auth.oauth2;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.generators.HKDFBytesGenerator;
import org.bouncycastle.crypto.params.HKDFParameters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.jackson2.SecurityJackson2Modules;
import org.springframework.security.oauth2.client.web.AuthorizationRequestRepository;
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest;
import org.springframework.stereotype.Component;
import org.thingsboard.server.queue.util.TbCoreComponent;
import org.thingsboard.server.service.security.auth.jwt.settings.JwtSettingsService;
import javax.crypto.Cipher;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.time.Clock;
import java.util.Arrays;
import java.util.Base64;
@Slf4j
@Component
@TbCoreComponent
public class HttpCookieOAuth2AuthorizationRequestRepository implements AuthorizationRequestRepository<OAuth2AuthorizationRequest> {
@ -17,10 +38,31 @@ public class HttpCookieOAuth2AuthorizationRequestRepository implements Authoriza
public static final String PREV_URI_COOKIE_NAME = "prev_uri";
private static final int cookieExpireSeconds = 180;
private static final byte[] KEY_DERIVATION_INFO = "thingsboard-oauth2-authorization-request-cookie".getBytes(StandardCharsets.UTF_8);
private static final int KEY_LENGTH = 32;
private static final int NONCE_LENGTH = 12;
private static final int TAG_LENGTH_BITS = 128;
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
.registerModules(SecurityJackson2Modules.getModules(HttpCookieOAuth2AuthorizationRequestRepository.class.getClassLoader()));
private final JwtSettingsService jwtSettingsService;
private final Clock clock;
private final SecureRandom secureRandom = new SecureRandom();
@Autowired
public HttpCookieOAuth2AuthorizationRequestRepository(JwtSettingsService jwtSettingsService) {
this(jwtSettingsService, Clock.systemUTC());
}
HttpCookieOAuth2AuthorizationRequestRepository(JwtSettingsService jwtSettingsService, Clock clock) {
this.jwtSettingsService = jwtSettingsService;
this.clock = clock;
}
@Override
public OAuth2AuthorizationRequest loadAuthorizationRequest(HttpServletRequest request) {
return CookieUtils.getCookie(request, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME)
.map(cookie -> CookieUtils.deserialize(cookie, OAuth2AuthorizationRequest.class))
.map(this::decrypt)
.orElse(null);
}
@ -34,7 +76,7 @@ public class HttpCookieOAuth2AuthorizationRequestRepository implements Authoriza
if (PrevUriValidator.isValid(prevUri)) {
CookieUtils.addCookie(response, PREV_URI_COOKIE_NAME, prevUri, cookieExpireSeconds);
}
CookieUtils.addCookie(response, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME, CookieUtils.serialize(authorizationRequest), cookieExpireSeconds);
CookieUtils.addCookie(response, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME, encrypt(authorizationRequest), cookieExpireSeconds);
}
@Override
@ -45,4 +87,56 @@ public class HttpCookieOAuth2AuthorizationRequestRepository implements Authoriza
public void removeAuthorizationRequestCookies(HttpServletRequest request, HttpServletResponse response) {
CookieUtils.deleteCookie(request, response, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME);
}
private String encrypt(OAuth2AuthorizationRequest authorizationRequest) {
try {
byte[] json = OBJECT_MAPPER.writeValueAsBytes(authorizationRequest);
byte[] plaintext = ByteBuffer.allocate(Long.BYTES + json.length).putLong(clock.millis()).put(json).array();
byte[] nonce = new byte[NONCE_LENGTH];
secureRandom.nextBytes(nonce);
byte[] ciphertext = initCipher(Cipher.ENCRYPT_MODE, nonce).doFinal(plaintext);
byte[] envelope = ByteBuffer.allocate(NONCE_LENGTH + ciphertext.length).put(nonce).put(ciphertext).array();
return Base64.getUrlEncoder().withoutPadding().encodeToString(envelope);
} catch (Exception e) {
throw new IllegalStateException("Failed to encrypt OAuth2 authorization request", e);
}
}
private OAuth2AuthorizationRequest decrypt(Cookie cookie) {
try {
byte[] envelope = Base64.getUrlDecoder().decode(cookie.getValue());
if (envelope.length < NONCE_LENGTH + TAG_LENGTH_BITS / Byte.SIZE + Long.BYTES) {
log.debug("Ignoring OAuth2 authorization request cookie: too short");
return null;
}
byte[] nonce = Arrays.copyOf(envelope, NONCE_LENGTH);
byte[] plaintext = initCipher(Cipher.DECRYPT_MODE, nonce).doFinal(envelope, NONCE_LENGTH, envelope.length - NONCE_LENGTH);
ByteBuffer buffer = ByteBuffer.wrap(plaintext);
long issuedAt = buffer.getLong();
if (clock.millis() - issuedAt > cookieExpireSeconds * 1000L) {
log.debug("Ignoring OAuth2 authorization request cookie: expired");
return null;
}
return OBJECT_MAPPER.readValue(plaintext, Long.BYTES, plaintext.length - Long.BYTES, OAuth2AuthorizationRequest.class);
} catch (Exception e) {
log.debug("Ignoring invalid OAuth2 authorization request cookie: {}", e.getClass().getSimpleName());
return null;
}
}
private Cipher initCipher(int mode, byte[] nonce) throws GeneralSecurityException {
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
cipher.init(mode, new SecretKeySpec(deriveKey(), "AES"), new GCMParameterSpec(TAG_LENGTH_BITS, nonce));
return cipher;
}
private byte[] deriveKey() {
byte[] signingKey = Base64.getDecoder().decode(jwtSettingsService.getJwtSettings().getTokenSigningKey());
HKDFBytesGenerator hkdf = new HKDFBytesGenerator(new SHA256Digest());
hkdf.init(new HKDFParameters(signingKey, null, KEY_DERIVATION_INFO));
byte[] key = new byte[KEY_LENGTH];
hkdf.generateBytes(key, 0, KEY_LENGTH);
return key;
}
}

118
application/src/test/java/org/thingsboard/server/service/edge/rpc/session/DefaultZombieSessionCleanupServiceTest.java

@ -0,0 +1,118 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
package org.thingsboard.server.service.edge.rpc.session;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.test.util.ReflectionTestUtils;
import org.thingsboard.server.common.data.edge.Edge;
import org.thingsboard.server.common.data.id.EdgeId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.gen.transport.TransportProtos.ToEdgeEventNotificationMsg;
import org.thingsboard.server.queue.TbQueueConsumer;
import org.thingsboard.server.queue.common.TbProtoQueueMsg;
import org.thingsboard.server.queue.common.consumer.QueueConsumerManager;
import org.thingsboard.server.service.edge.rpc.EdgeSessionState;
import org.thingsboard.server.service.edge.rpc.session.manager.EdgeGrpcSessionManager;
import org.thingsboard.server.service.edge.rpc.session.manager.KafkaBasedEdgeGrpcSessionManager;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* The zombie sweep destroys a session and then removes it from the holder. If the edge reconnects in
* between, the removal must not take the live session with it.
*/
class DefaultZombieSessionCleanupServiceTest {
private DefaultZombieSessionCleanupService service;
private EdgeSessionsHolder holder;
private Edge edge;
private EdgeId edgeId;
@BeforeEach
void setUp() {
edgeId = new EdgeId(UUID.randomUUID());
edge = new Edge(edgeId);
edge.setTenantId(TenantId.fromUUID(UUID.randomUUID()));
edge.setName("test-edge");
holder = new EdgeSessionsHolder();
service = new DefaultZombieSessionCleanupService();
ReflectionTestUtils.setField(service, "edgeSessionsHolder", holder);
}
@AfterEach
void tearDown() {
service.destroy();
}
@Test
void cleanupRemovesTheZombieWhenItStillOwnsTheEdge() {
KafkaBasedEdgeGrpcSessionManager zombie = newZombieSession();
when(zombie.destroy()).thenReturn(true);
holder.put(zombie);
cleanupZombieSessions();
assertThat(holder.getByEdgeId(edgeId)).isNull();
}
@Test
void cleanupKeepsASessionThatReconnectedDuringTheSweep() {
KafkaBasedEdgeGrpcSessionManager zombie = newZombieSession();
EdgeGrpcSessionManager reconnected = newSession();
holder.put(zombie);
// the edge reconnects while the zombie is being destroyed, i.e. after the scan picked it up.
// The sweep also passes over sessionsById, so only the first destroy stands in for the reconnect
AtomicBoolean reconnectPending = new AtomicBoolean(true);
when(zombie.destroy()).thenAnswer(invocation -> {
if (reconnectPending.compareAndSet(true, false)) {
holder.put(reconnected);
}
return true;
});
cleanupZombieSessions();
assertThat(holder.getByEdgeId(edgeId))
.as("removing by edge id alone would evict the live session here")
.isSameAs(reconnected);
}
private void cleanupZombieSessions() {
ReflectionTestUtils.invokeMethod(service, "cleanupZombieSessions");
}
private EdgeGrpcSessionManager newSession() {
EdgeGrpcSessionManager session = mock(EdgeGrpcSessionManager.class);
when(session.getState()).thenReturn(newState());
return session;
}
private KafkaBasedEdgeGrpcSessionManager newZombieSession() {
KafkaBasedEdgeGrpcSessionManager session = mock(KafkaBasedEdgeGrpcSessionManager.class);
when(session.getState()).thenReturn(newState());
@SuppressWarnings("unchecked")
QueueConsumerManager<TbProtoQueueMsg<ToEdgeEventNotificationMsg>> consumerManager = mock(QueueConsumerManager.class);
@SuppressWarnings("unchecked")
TbQueueConsumer<TbProtoQueueMsg<ToEdgeEventNotificationMsg>> consumer = mock(TbQueueConsumer.class);
when(consumerManager.getConsumer()).thenReturn(consumer);
when(consumer.isStopped()).thenReturn(false);
when(session.getConsumer()).thenReturn(consumerManager);
return session;
}
private EdgeSessionState newState() {
EdgeSessionState state = new EdgeSessionState();
state.setEdge(edge);
state.setConnected(false);
return state;
}
}

92
application/src/test/java/org/thingsboard/server/service/edge/rpc/session/EdgeSessionsHolderTest.java

@ -0,0 +1,92 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
package org.thingsboard.server.service.edge.rpc.session;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.thingsboard.server.common.data.edge.Edge;
import org.thingsboard.server.common.data.id.EdgeId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.service.edge.rpc.EdgeSessionState;
import org.thingsboard.server.service.edge.rpc.session.manager.EdgeGrpcSessionManager;
import java.util.UUID;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* A teardown that races with a reconnect must not act on behalf of the session that has taken the
* edge over: neither by removing it from the holder nor by treating it as current.
*/
class EdgeSessionsHolderTest {
private EdgeSessionsHolder holder;
private Edge edge;
private EdgeId edgeId;
@BeforeEach
void setUp() {
holder = new EdgeSessionsHolder();
edgeId = new EdgeId(UUID.randomUUID());
edge = new Edge(edgeId);
edge.setTenantId(TenantId.fromUUID(UUID.randomUUID()));
edge.setName("test-edge");
}
@Test
void removeByEdgeIdIfCurrentRemovesTheRegisteredSession() {
EdgeGrpcSessionManager session = newSession();
holder.put(session);
EdgeGrpcSessionManager removed = holder.removeByEdgeIdIfCurrent(edgeId, session.getState().getSessionId());
assertThat(removed).isSameAs(session);
assertThat(holder.getByEdgeId(edgeId)).isNull();
}
@Test
void removeByEdgeIdIfCurrentKeepsTheSessionThatTookTheEdgeOver() {
EdgeGrpcSessionManager first = newSession();
EdgeGrpcSessionManager second = newSession();
holder.put(first);
holder.put(second);
EdgeGrpcSessionManager removed = holder.removeByEdgeIdIfCurrent(edgeId, first.getState().getSessionId());
assertThat(removed).as("the superseded session owns nothing to remove").isNull();
assertThat(holder.getByEdgeId(edgeId))
.as("the reconnected session stays registered")
.isSameAs(second);
}
@Test
void isCurrentOnlyForTheSessionRegisteredForTheEdge() {
EdgeGrpcSessionManager first = newSession();
EdgeGrpcSessionManager second = newSession();
holder.put(first);
assertThat(holder.isCurrent(first)).isTrue();
holder.put(second);
assertThat(holder.isCurrent(second)).isTrue();
assertThat(holder.isCurrent(first))
.as("a presence check would still say true here, which is the bug this guards")
.isFalse();
}
@Test
void isCurrentIsFalseWhenTheEdgeHasNoRegisteredSession() {
assertThat(holder.isCurrent(newSession())).isFalse();
}
private EdgeGrpcSessionManager newSession() {
EdgeSessionState state = new EdgeSessionState();
state.setEdge(edge);
EdgeGrpcSessionManager session = mock(EdgeGrpcSessionManager.class);
when(session.getState()).thenReturn(state);
return session;
}
}

14
application/src/test/java/org/thingsboard/server/service/script/TbelInvokeServiceTest.java

@ -288,6 +288,20 @@ class TbelInvokeServiceTest extends AbstractTbelInvokeTest {
});
}
@Test
void givenForbiddenFormatter_whenInvoking_thenThrowsRuntimeError() throws ExecutionException, InterruptedException {
UUID scriptId = evalScript("new java.util.Formatter(\"/tmp/test.txt\")");
assertThatThrownBy(() -> invokeScript(scriptId, "{\"temperature\":25}"))
.isInstanceOf(ExecutionException.class)
.cause()
.isInstanceOf(TbScriptException.class)
.asInstanceOf(type(TbScriptException.class))
.satisfies(ex -> {
assertThat(ex.getErrorCode()).isEqualTo(TbScriptException.ErrorCode.RUNTIME);
assertThat(ex.getCause().getMessage()).contains("could not resolve class: java.util.Formatter");
});
}
private void assertThatScriptIsBlocked(UUID scriptId) {
assertThatThrownBy(() -> {
invokeScriptResultString(scriptId, "{}");

45
application/src/test/java/org/thingsboard/server/service/security/auth/oauth2/CookieUtilsTest.java

@ -1,45 +0,0 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
package org.thingsboard.server.service.security.auth.oauth2;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest;
import java.util.LinkedHashMap;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.thingsboard.server.service.security.auth.oauth2.HttpCookieOAuth2AuthorizationRequestRepository.OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME;
public class CookieUtilsTest {
@Test
public void serializeDeserializeOAuth2AuthorizationRequestTest() {
HttpCookieOAuth2AuthorizationRequestRepository cookieRequestRepo = new HttpCookieOAuth2AuthorizationRequestRepository();
HttpServletRequest servletRequest = Mockito.mock(HttpServletRequest.class);
Map<String, Object> additionalParameters = new LinkedHashMap<>();
additionalParameters.put("param1", "value1");
additionalParameters.put("param2", "value2");
var request = OAuth2AuthorizationRequest.authorizationCode()
.authorizationUri("testUri").clientId("testId")
.scope("read", "write")
.additionalParameters(additionalParameters).build();
Cookie cookie = new Cookie(OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME, CookieUtils.serialize(request));
Mockito.when(servletRequest.getCookies()).thenReturn(new Cookie[]{cookie});
OAuth2AuthorizationRequest deserializedRequest = cookieRequestRepo.loadAuthorizationRequest(servletRequest);
assertNotNull(deserializedRequest);
assertEquals(request.getGrantType(), deserializedRequest.getGrantType());
assertEquals(request.getAuthorizationUri(), deserializedRequest.getAuthorizationUri());
assertEquals(request.getClientId(), deserializedRequest.getClientId());
}
}

151
application/src/test/java/org/thingsboard/server/service/security/auth/oauth2/HttpCookieOAuth2AuthorizationRequestRepositoryTest.java

@ -2,27 +2,50 @@
// SPDX-License-Identifier: Apache-2.0
package org.thingsboard.server.service.security.auth.oauth2;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.NullAndEmptySource;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
import org.springframework.security.jackson2.SecurityJackson2Modules;
import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest;
import org.thingsboard.server.common.data.security.model.JwtSettings;
import org.thingsboard.server.service.security.auth.jwt.settings.JwtSettingsService;
import java.security.SecureRandom;
import java.time.Clock;
import java.util.Base64;
import java.util.LinkedHashMap;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.thingsboard.server.service.security.auth.oauth2.HttpCookieOAuth2AuthorizationRequestRepository.OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME;
import static org.thingsboard.server.service.security.auth.oauth2.HttpCookieOAuth2AuthorizationRequestRepository.PREV_URI_COOKIE_NAME;
import static org.thingsboard.server.service.security.auth.oauth2.HttpCookieOAuth2AuthorizationRequestRepository.PREV_URI_PARAMETER;
public class HttpCookieOAuth2AuthorizationRequestRepositoryTest {
private final HttpCookieOAuth2AuthorizationRequestRepository repository = new HttpCookieOAuth2AuthorizationRequestRepository();
private static final long NOW = 1_700_000_000_000L;
private final JwtSettingsService jwtSettingsService = mock(JwtSettingsService.class);
private final Clock clock = mock(Clock.class);
private final HttpCookieOAuth2AuthorizationRequestRepository repository =
new HttpCookieOAuth2AuthorizationRequestRepository(jwtSettingsService, clock);
@BeforeEach
public void before() {
givenSigningKey(randomSigningKey());
when(clock.millis()).thenReturn(NOW);
}
@Test
public void testPrevUriSavedForInAppPath() {
@ -37,20 +60,140 @@ public class HttpCookieOAuth2AuthorizationRequestRepositoryTest {
assertThat(savePrevUri(prevUri)).isNull();
}
@Test
public void testAuthorizationRequestRoundTrip() {
Map<String, Object> additionalParameters = new LinkedHashMap<>();
additionalParameters.put("param1", "value1");
additionalParameters.put("param2", "value2");
OAuth2AuthorizationRequest authorizationRequest = OAuth2AuthorizationRequest.authorizationCode()
.authorizationUri("testUri").clientId("testId")
.scope("read", "write")
.state("testState")
.additionalParameters(additionalParameters)
.attributes(attributes -> attributes.put(TbOAuth2ParameterNames.CALLBACK_URL_SCHEME, "tbmobile"))
.build();
OAuth2AuthorizationRequest loaded = load(save(authorizationRequest));
assertThat(loaded).isNotNull();
assertThat(loaded.getGrantType()).isEqualTo(authorizationRequest.getGrantType());
assertThat(loaded.getAuthorizationUri()).isEqualTo(authorizationRequest.getAuthorizationUri());
assertThat(loaded.getClientId()).isEqualTo(authorizationRequest.getClientId());
assertThat(loaded.getScopes()).isEqualTo(authorizationRequest.getScopes());
assertThat(loaded.getState()).isEqualTo(authorizationRequest.getState());
assertThat(loaded.getAdditionalParameters()).isEqualTo(additionalParameters);
assertThat(CallbackUrlSchemeValidator.getCallbackUrlScheme(loaded)).isEqualTo("tbmobile");
}
@Test
public void testCookieIsNotPlainJson() {
String cookieValue = save(authorizationRequest());
assertThat(new String(Base64.getUrlDecoder().decode(cookieValue))).doesNotContain("testId");
}
@Test
public void testEachCookieUsesFreshNonce() {
assertThat(save(authorizationRequest())).isNotEqualTo(save(authorizationRequest()));
}
@Test
public void testTamperedCookieIsRejected() {
byte[] envelope = Base64.getUrlDecoder().decode(save(authorizationRequest()));
for (int i = 0; i < envelope.length; i++) {
byte[] tampered = envelope.clone();
tampered[i] ^= 0x01;
assertThat(load(Base64.getUrlEncoder().withoutPadding().encodeToString(tampered))).as("bit flipped at byte %s", i).isNull();
}
}
@Test
public void testTruncatedCookieIsRejected() {
String cookieValue = save(authorizationRequest());
assertThat(load(cookieValue.substring(0, cookieValue.length() - 4))).isNull();
}
@Test
public void testCookieEncryptedWithDifferentKeyIsRejected() {
String cookieValue = save(authorizationRequest());
givenSigningKey(randomSigningKey());
assertThat(load(cookieValue)).isNull();
}
@Test
public void testNewCookieIsAcceptedAfterKeyRotation() {
givenSigningKey(randomSigningKey());
String cookieValue = save(authorizationRequest());
assertThat(load(cookieValue)).isNotNull();
}
@Test
public void testUnencryptedCookieIsRejected() throws Exception {
ObjectMapper mapper = new ObjectMapper().registerModules(SecurityJackson2Modules.getModules(getClass().getClassLoader()));
String plainCookieValue = Base64.getUrlEncoder().encodeToString(mapper.writeValueAsBytes(authorizationRequest()));
assertThat(load(plainCookieValue)).isNull();
}
@ParameterizedTest
@ValueSource(strings = {"", "a", "AAAA", "not base64 !", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"})
public void testMalformedCookieIsRejected(String cookieValue) {
assertThat(load(cookieValue)).isNull();
}
@Test
public void testExpiredCookieIsRejected() {
String cookieValue = save(authorizationRequest());
when(clock.millis()).thenReturn(NOW + 180_000);
assertThat(load(cookieValue)).isNotNull();
when(clock.millis()).thenReturn(NOW + 180_001);
assertThat(load(cookieValue)).isNull();
}
private OAuth2AuthorizationRequest authorizationRequest() {
return OAuth2AuthorizationRequest.authorizationCode().authorizationUri("testUri").clientId("testId").build();
}
private String save(OAuth2AuthorizationRequest authorizationRequest) {
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
repository.saveAuthorizationRequest(authorizationRequest, request, response);
return findCookie(response, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME);
}
private OAuth2AuthorizationRequest load(String cookieValue) {
HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getCookies()).thenReturn(new Cookie[]{new Cookie(OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME, cookieValue)});
return repository.loadAuthorizationRequest(request);
}
private String savePrevUri(String prevUri) {
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
when(request.getParameter(PREV_URI_PARAMETER)).thenReturn(prevUri);
repository.saveAuthorizationRequest(OAuth2AuthorizationRequest.authorizationCode()
.authorizationUri("testUri").clientId("testId").build(), request, response);
repository.saveAuthorizationRequest(authorizationRequest(), request, response);
return findCookie(response, PREV_URI_COOKIE_NAME);
}
private String findCookie(HttpServletResponse response, String name) {
ArgumentCaptor<Cookie> cookieCaptor = ArgumentCaptor.forClass(Cookie.class);
verify(response, atLeastOnce()).addCookie(cookieCaptor.capture());
return cookieCaptor.getAllValues().stream()
.filter(cookie -> PREV_URI_COOKIE_NAME.equals(cookie.getName()))
.filter(cookie -> name.equals(cookie.getName()))
.map(Cookie::getValue)
.findAny().orElse(null);
}
private void givenSigningKey(String signingKey) {
JwtSettings jwtSettings = new JwtSettings();
jwtSettings.setTokenSigningKey(signingKey);
when(jwtSettingsService.getJwtSettings()).thenReturn(jwtSettings);
}
private static String randomSigningKey() {
byte[] key = new byte[64];
new SecureRandom().nextBytes(key);
return Base64.getEncoder().encodeToString(key);
}
}

2
pom.xml

@ -111,7 +111,7 @@
<zookeeper.version>3.9.6</zookeeper.version> <!-- to fix CVE-2026-24281, CVE-2026-24308, CVE-2026-59969 and CVE-2026-84439. TODO: remove override when fixed in curator-client -->
<protobuf.version>3.25.5</protobuf.version> <!-- Protobuf v4 is not yet supported by the pubsub -->
<grpc.version>1.76.0</grpc.version>
<tbel.version>1.2.10</tbel.version>
<tbel.version>1.2.12</tbel.version>
<lombok.version>1.18.46</lombok.version> <!-- must be in sync with spring-boot-dependencies; needed for maven-compiler-plugin annotationProcessorPaths -->
<paho.client.version>1.2.5</paho.client.version>
<paho.mqttv5.client.version>1.2.5</paho.mqttv5.client.version>

18
tools/src/main/python/license-headers/curations.json

@ -475,6 +475,18 @@
"reason": "PE-specific data/configuration type IntegrationLifecycleEventTrigger.java. Reviewed fields, type discriminators and serialization hooks describe PE entities or PE behavior; matching CE types supply only the common DTO/interface pattern. Resolved as PE-authored consistently with the maintainer decision for PE entity wrappers. Reviewed candidate common/data/src/main/java/org/thingsboard/server/common/data/notification/rule/trigger/RuleEngineComponentLifecycleEventTrigger.java at 0d3b41e002f958887a317ca8366fdc4efa549058 (blob e4c967c19792ecf5fa6409973459efe5ce73cb8d).",
"contentHash": "sha256:c5da9a11ed196635c09972733cf511bee2bd111242c0d084d115d37e2e7524c5"
},
{
"path": "common/data/src/main/java/org/thingsboard/server/common/data/notification/targets/platform/UserGroupListFilter.java",
"header": "busl",
"reason": "PE user group notification target filter UserGroupListFilter.java; the path has never existed in CE history. Similarity to the CE candidate is the shared filter shape, not a relocation of the CE implementation. Reviewed candidate common/data/src/main/java/org/thingsboard/server/common/data/notification/targets/platform/UserListFilter.java at aeaf9d1e299 (blob 07cd0280ba84ab71b6823242e18c7c7285296b84).",
"contentHash": "sha256:64563fbc6ee416025b555c14cf3c517c5027bfc112a883078cc717ed471c5b52"
},
{
"path": "common/data/src/main/java/org/thingsboard/server/common/data/notification/targets/platform/UserRoleFilter.java",
"header": "busl",
"reason": "PE role-based notification target filter UserRoleFilter.java; the path has never existed in CE history. Similarity to the CE candidate is the shared filter shape, not a relocation of the CE implementation. Reviewed candidate common/data/src/main/java/org/thingsboard/server/common/data/notification/targets/platform/UserListFilter.java at aeaf9d1e299 (blob 07cd0280ba84ab71b6823242e18c7c7285296b84).",
"contentHash": "sha256:007e94e798f25a9d0ccd1716b8a68eada4fe3ced71e531bd0538c2c56e24ecb7"
},
{
"path": "common/data/src/main/java/org/thingsboard/server/common/data/permission/Operation.java",
"header": "ce-modified",
@ -493,6 +505,12 @@
"reason": "PE-specific data/configuration type EntityGroupNameFilter.java. Reviewed fields, type discriminators and serialization hooks describe PE entities or PE behavior; matching CE types supply only the common DTO/interface pattern. Resolved as PE-authored consistently with the maintainer decision for PE entity wrappers. Reviewed candidate common/data/src/main/java/org/thingsboard/server/common/data/query/EntityNameFilter.java at 0d3b41e002f958887a317ca8366fdc4efa549058 (blob a3889bc7c07de44917eac165a9c4e8578bbbcd62).",
"contentHash": "sha256:46cc0073210fb81fb1a71f44604042da6056f78f62468cf45bdc78cdaf8cdd09"
},
{
"path": "common/data/src/main/java/org/thingsboard/server/common/data/query/StateEntityFilter.java",
"header": "busl",
"reason": "PE entity filter StateEntityFilter.java; the path has never existed in CE history. Similarity to the CE candidate is the shared filter shape, not a relocation of the CE implementation. Reviewed candidate common/data/src/main/java/org/thingsboard/server/common/data/query/SingleEntityFilter.java at aeaf9d1e299 (blob dacd7de6eae6cd80cfd63047dad8951d76aeb455).",
"contentHash": "sha256:46835b82b0320007209a5d53528f9fdb534af41c2fcb5a528754c316c530394a"
},
{
"path": "common/data/src/main/java/org/thingsboard/server/common/data/query/StateEntityOwnerFilter.java",
"header": "busl",

5
ui-ngx/src/app/core/services/dashboard-utils.service.ts

@ -45,6 +45,7 @@ import {
TargetDevice,
TargetDeviceType,
Widget,
widgetActionSources,
WidgetConfig,
WidgetConfigMode,
WidgetSize,
@ -690,11 +691,13 @@ export class DashboardUtilsService {
};
// Stable per state: an unchanged page keeps its rendered instance, a changed one is re-rendered.
const widgetId = htmlPageWidgetId(stateId);
const actions = {...layout.gridSettings?.htmlPageConfig?.actions};
delete actions[widgetActionSources.headerButton.value];
const config = mergeDeep({},
htmlPageDefaultConfig,
{
settings: layout.gridSettings?.htmlPageConfig?.settings || mergeDeep({} as HtmlContainerWidgetSettings, htmlContainerDefaultSettings),
actions: layout.gridSettings?.htmlPageConfig?.actions
actions
}
);
result.widget = {

8
ui-ngx/src/app/modules/home/components/attribute/delete-timeseries-panel.component.scss

@ -1,9 +1,13 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
@import '../../../../../scss/constants';
:host {
width: 100%;
max-height: 90vh;
display: flex;
flex-direction: column;
.mat-toolbar {
background: none;
@ -14,6 +18,8 @@
flex-direction: column;
gap: 16px;
padding-top: 4px;
overflow: auto;
flex: 1;
}
.tb-select-interval {

10
ui-ngx/src/app/modules/home/components/attribute/delete-timeseries-panel.component.ts

@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
import { Component, InjectionToken, OnDestroy, OnInit } from '@angular/core';
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
import { Component, ElementRef, InjectionToken, OnDestroy, OnInit } from '@angular/core';
import { OverlayRef } from '@angular/cdk/overlay';
import {
TimeseriesDeleteStrategy,
@ -37,10 +38,14 @@ export class DeleteTimeseriesPanelComponent implements OnInit, OnDestroy {
private destroy$ = new Subject<void>();
private resizeObserver = new ResizeObserver(() => this.overlayRef.updatePosition());
constructor(private overlayRef: OverlayRef,
private elementRef: ElementRef<HTMLElement>,
private fb: FormBuilder) { }
ngOnInit(): void {
this.resizeObserver.observe(this.elementRef.nativeElement);
const today = new Date();
this.deleteTimeseriesFormGroup = this.fb.group({
strategy: [TimeseriesDeleteStrategy.DELETE_ALL_DATA],
@ -72,6 +77,7 @@ export class DeleteTimeseriesPanelComponent implements OnInit, OnDestroy {
}
ngOnDestroy(): void {
this.resizeObserver.disconnect();
this.destroy$.next();
this.destroy$.complete();
}

8
ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-image-dialog.component.html

@ -22,12 +22,12 @@
<div mat-dialog-content style="position: relative;">
<fieldset [disabled]="(isLoading$ | async) || (takingScreenshot$ | async)" class="flex flex-col items-stretch justify-center gap-2">
<div [formGroup]="dashboardRectFormGroup" class="flex flex-col items-center justify-center gap-2">
<mat-form-field class="rect-field">
<mat-form-field class="rect-field" appearance="outline">
<mat-label>Top %</mat-label>
<input matInput formControlName="top" type="number" step="1" min="0" max="100">
</mat-form-field>
<div class="flex flex-row items-center justify-center gap-2">
<mat-form-field class="rect-field">
<mat-form-field class="rect-field" appearance="outline">
<mat-label>Left %</mat-label>
<input matInput formControlName="left" type="number" step="1" min="0" max="100">
</mat-form-field>
@ -38,12 +38,12 @@
<img class="tb-image-preview" [src]="imageUrl | image | async" />
}
</div>
<mat-form-field class="rect-field">
<mat-form-field class="rect-field" appearance="outline">
<mat-label>Right %</mat-label>
<input matInput formControlName="right" type="number" step="1" min="0" max="100">
</mat-form-field>
</div>
<mat-form-field class="rect-field">
<mat-form-field class="rect-field" appearance="outline">
<mat-label>Bottom %</mat-label>
<input matInput formControlName="bottom" type="number" step="1" min="0" max="100">
</mat-form-field>

1
ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.html

@ -511,6 +511,7 @@
[widgetLayout]="editingWidgetLayout"
[showLayoutConfig]="showLayoutConfigInEdit(editingLayoutCtx)"
[isDefaultBreakpoint]="editingLayoutCtx?.breakpoint === 'default'"
[isHtmlPage]="isHtml"
(revertWidgetConfig)="onRevertWidgetEdit()"
(applyWidgetConfig)="saveWidget()">
</tb-edit-widget>

16
ui-ngx/src/app/modules/home/components/dashboard-page/edit-widget.component.ts

@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';
import { PageComponent } from '@shared/components/page.component';
import { Store } from '@ngrx/store';
@ -7,7 +8,7 @@ import { AppState } from '@core/core.state';
import { MatDialog } from '@angular/material/dialog';
import { Dashboard, WidgetLayout } from '@shared/models/dashboard.models';
import { IAliasController, IStateController } from '@core/api/widget-api.models';
import { Widget, WidgetConfigMode } from '@shared/models/widget.models';
import { Widget, widgetActionSources, WidgetConfigMode } from '@shared/models/widget.models';
import { WidgetComponentService } from '@home/components/widget/widget-component.service';
import { WidgetConfigComponentData } from '../../models/widget-component.models';
import { isDefined, isDefinedAndNotNull } from '@core/utils';
@ -53,6 +54,10 @@ export class EditWidgetComponent extends PageComponent implements OnInit, OnChan
@coerceBoolean()
isDefaultBreakpoint= true;
@Input()
@coerceBoolean()
isHtmlPage = false;
@Output()
applyWidgetConfig = new EventEmitter<void>();
@ -94,7 +99,7 @@ export class EditWidgetComponent extends PageComponent implements OnInit, OnChan
for (const propName of Object.keys(changes)) {
const change = changes[propName];
if (!change.firstChange && change.currentValue !== change.previousValue) {
if (['widget', 'widgetLayout'].includes(propName)) {
if (['widget', 'widgetLayout', 'isHtmlPage'].includes(propName)) {
reloadConfig = true;
}
}
@ -135,7 +140,10 @@ export class EditWidgetComponent extends PageComponent implements OnInit, OnChan
widgetInfo.typeLatestDataKeySettingsForm : (widgetInfo.latestDataKeySettingsForm || []);
const typeParameters = widgetInfo.typeParameters;
const dataKeySettingsFunction: DataKeySettingsFunction = typeParameters?.dataKeySettingsFunction;
const actionSources = widgetInfo.actionSources;
const actionSources = {...widgetInfo.actionSources};
if (this.isHtmlPage) {
delete actionSources[widgetActionSources.headerButton.value];
}
const isDataEnabled = isDefined(widgetInfo.typeParameters) ? !widgetInfo.typeParameters.useCustomDatasources : true;
this.widgetConfig = {

2
ui-ngx/src/app/modules/home/components/dashboard/select-target-state-dialog.component.html

@ -21,7 +21,7 @@
}
<div mat-dialog-content>
<fieldset [disabled]="isLoading$ | async" class="flex flex-col">
<mat-form-field class="mat-block">
<mat-form-field class="mat-block" appearance="outline">
<mat-label translate>dashboard.state</mat-label>
<mat-select required formControlName="stateId">
@for (stateItem of states | keyvalue; track stateItem) {

4
ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule-condition-dialog.component.html

@ -30,7 +30,7 @@
formControlName="keyFilters">
</tb-key-filter-list>
<section formGroupName="spec" style="margin-top: 1em">
<mat-form-field class="mat-block" hideRequiredMarker>
<mat-form-field class="mat-block" appearance="outline" hideRequiredMarker>
<mat-label translate>device-profile.condition-type</mat-label>
<mat-select formControlName="type" required>
@for (alarmConditionType of alarmConditionTypes; track alarmConditionType) {
@ -55,7 +55,7 @@
</tb-alarm-duration-predicate-value>
@if (conditionFormGroup.get('spec.type').value == AlarmConditionType.DURATION) {
<div class="max-w-23% flex-full">
<mat-form-field class="mat-block" subscriptSizing="dynamic">
<mat-form-field class="mat-block" appearance="outline" subscriptSizing="dynamic">
<mat-select formControlName="unit" required
placeholder="{{ 'device-profile.condition-duration-time-unit' | translate }}">
@for (timeUnit of timeUnits; track timeUnit) {

2
ui-ngx/src/app/modules/home/components/profile/alarm/edit-alarm-details-dialog.component.html

@ -22,7 +22,7 @@
<div mat-dialog-content>
<fieldset [disabled]="isLoading$ | async">
<div class="flex flex-1 flex-col">
<mat-form-field class="mat-block">
<mat-form-field class="mat-block" appearance="outline">
<textarea matInput formControlName="alarmDetails" rows="5"
placeholder="{{ 'device-profile.alarm-rule-additional-info-placeholder' | translate }}"></textarea>
<mat-hint [innerHTML]="'device-profile.alarm-rule-additional-info-hint' | translate | safe: 'html'"></mat-hint>

2
ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-bootstrap-add-config-server-dialog.component.html

@ -21,7 +21,7 @@
<div style="height: 4px;"></div>
}
<div mat-dialog-content class="flex flex-col">
<mat-form-field>
<mat-form-field appearance="outline">
<mat-label>{{ 'device-profile.lwm2m.server-type' | translate }}</mat-label>
<mat-select formControlName="serverType">
@for (serverType of serverTypes; track serverType) {

2
ui-ngx/src/app/modules/home/components/rule-node/external/lambda-config.component.html

@ -53,7 +53,7 @@
label="{{ 'rule-node-config.aws-secret-access-key' | translate }}"
requiredText="{{ 'rule-node-config.aws-secret-access-key-required' | translate }}">
</tb-secret-key-input>
<mat-form-field class="mat-block">
<mat-form-field class="mat-block" appearance="outline">
<mat-label translate>rule-node-config.aws-region</mat-label>
<input required matInput formControlName="region">
@if (lambdaConfigForm.get('region').hasError('required')) {

2
ui-ngx/src/app/modules/home/components/rule-node/external/sns-config.component.html

@ -32,7 +32,7 @@
label="{{ 'rule-node-config.aws-secret-access-key' | translate }}"
requiredText="{{ 'rule-node-config.aws-secret-access-key-required' | translate }}">
</tb-secret-key-input>
<mat-form-field class="mat-block">
<mat-form-field class="mat-block" appearance="outline">
<mat-label translate>rule-node-config.aws-region</mat-label>
<input required matInput formControlName="region">
@if (snsConfigForm.get('region').hasError('required')) {

2
ui-ngx/src/app/modules/home/components/rule-node/external/sqs-config.component.html

@ -69,7 +69,7 @@
label="{{ 'rule-node-config.aws-secret-access-key' | translate }}"
requiredText="{{ 'rule-node-config.aws-secret-access-key-required' | translate }}">
</tb-secret-key-input>
<mat-form-field class="mat-block">
<mat-form-field class="mat-block" appearance="outline">
<mat-label translate>rule-node-config.aws-region</mat-label>
<input required matInput formControlName="region">
@if (sqsConfigForm.get('region').hasError('required')) {

2
ui-ngx/src/app/modules/home/components/scheduler/scheduler-event-config.models.ts

@ -28,7 +28,7 @@ test = {
originator: true,
msgType: true,
template: '<form #myCustomConfigForm="ngForm">' +
'<mat-form-field class="mat-block">' +
'<mat-form-field class="mat-block" appearance="outline">' +
'<mat-label>My custom field</mat-label>' +
'<input name="myField" #myField="ngModel" matInput [(ngModel)]="configuration.msgBody.myField" required>' +
'<mat-error *ngIf="myField.hasError(\'required\')">' +

6
ui-ngx/src/app/modules/home/components/widget/config/basic/gauge/digital-simple-gauge-basic-config.component.ts

@ -28,7 +28,7 @@ import {
DigitalGaugeSettings,
DigitalGaugeType
} from '@home/components/widget/lib/digital-gauge.models';
import { ColorSettings, ColorType } from '@shared/models/widget-settings.models';
import { ColorSettings, ColorType, normalizeColorRangeSettings } from '@shared/models/widget-settings.models';
import { getSourceTbUnitSymbol } from '@shared/models/unit.models';
@Component({
@ -162,8 +162,8 @@ export class DigitalSimpleGaugeBasicConfigComponent extends BasicWidgetConfigCom
if (barColor.type === ColorType.range) {
this.widgetConfig.config.settings.useFixedLevelColor = true;
this.widgetConfig.config.settings.fixedLevelColors =
barColor.rangeList.advancedMode ? barColor.rangeList.rangeAdvanced : barColor.rangeList.range;
const rangeList = normalizeColorRangeSettings(barColor.rangeList);
this.widgetConfig.config.settings.fixedLevelColors = rangeList?.advancedMode ? rangeList.rangeAdvanced : rangeList?.range;
} else {
this.widgetConfig.config.settings.useFixedLevelColor = false;
}

2
ui-ngx/src/app/modules/home/components/widget/lib/maps-legacy/dialogs/select-entity-dialog.component.html

@ -20,7 +20,7 @@
<div style="height: 4px;"></div>
}
<div mat-dialog-content>
<mat-form-field class="mat-block" style="min-width: 280px">
<mat-form-field class="mat-block" appearance="outline" style="min-width: 280px">
<mat-label translate>entity.entity</mat-label>
<mat-select formControlName="entity">
@for (entity of data.entities; track entity) {

7
ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-widget-settings.component.html

@ -1,7 +1,8 @@
<!--
SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
<ng-container [formGroup]="alarmsTableWidgetSettingsForm">
@ -62,7 +63,7 @@
{{ 'widgets.table.allow-alarms-clear' | translate }}
</mat-slide-toggle>
</div>
<mat-form-field class="flex-1" subscriptSizing="dynamic">
<mat-form-field class="flex-1" subscriptSizing="dynamic" appearance="outline">
<mat-label translate>widgets.table.hidden-cell-button-display-mode</mat-label>
<mat-select formControlName="reserveSpaceForHiddenAction">
<mat-option [value]="'true'">
@ -73,7 +74,7 @@
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="flex-1" subscriptSizing="dynamic">
<mat-form-field class="flex-1" subscriptSizing="dynamic" appearance="outline">
<mat-label translate>widgets.table.default-sort-order</mat-label>
<input matInput formControlName="defaultSortOrder">
</mat-form-field>

2
ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-widget-settings.component.html

@ -52,7 +52,7 @@
<mat-slide-toggle class="mat-slide" formControlName="showCellActionsMenu">
{{ 'widgets.table.show-cell-actions-menu-mobile' | translate }}
</mat-slide-toggle>
<mat-form-field class="flex-1" subscriptSizing="dynamic">
<mat-form-field class="flex-1" appearance="outline" subscriptSizing="dynamic">
<mat-label translate>widgets.table.hidden-cell-button-display-mode</mat-label>
<mat-select formControlName="reserveSpaceForHiddenAction">
<mat-option [value]="'true'">

47
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/action/custom-sample-html.raw

@ -18,48 +18,48 @@
<!-- <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>-->
<!-- <div mat-dialog-content class="flex flex-col">-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Entity Name</mat-label>-->
<!-- <input matInput formControlName="entityName" required readonly="">-->
<!-- </mat-form-field>-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Entity Label</mat-label>-->
<!-- <input matInput formControlName="entityLabel">-->
<!-- </mat-form-field>-->
<!-- </div>-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Entity Type</mat-label>-->
<!-- <input matInput formControlName="entityType" readonly>-->
<!-- </mat-form-field>-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Type</mat-label>-->
<!-- <input matInput formControlName="type" readonly>-->
<!-- </mat-form-field>-->
<!-- </div>-->
<!-- <div formGroupName="attributes" class="flex flex-col">-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Latitude</mat-label>-->
<!-- <input type="number" step="any" matInput formControlName="latitude">-->
<!-- </mat-form-field>-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Longitude</mat-label>-->
<!-- <input type="number" step="any" matInput formControlName="longitude">-->
<!-- </mat-form-field>-->
<!-- </div>-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Address</mat-label>-->
<!-- <input matInput formControlName="address">-->
<!-- </mat-form-field>-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Owner</mat-label>-->
<!-- <input matInput formControlName="owner">-->
<!-- </mat-form-field>-->
<!-- </div>-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Integer Value</mat-label>-->
<!-- <input type="number" step="1" matInput formControlName="number">-->
<!-- <mat-error *ngIf="editEntityFormGroup.get('attributes.number').hasError('pattern')">-->
@ -82,7 +82,7 @@
<!-- <div [formGroupName]="i" class="mat-elevation-z2 flex flex-1 flex-row" style="padding: 5px 0 5px 5px;">-->
<!-- <div class="flex flex-1 flex-col">-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <mat-form-field class="mat-block" style="min-width: 100px;">-->
<!-- <mat-form-field class="mat-block" style="min-width: 100px;" appearance="outline">-->
<!-- <mat-label>Direction</mat-label>-->
<!-- <mat-select formControlName="direction" name="direction">-->
<!-- <mat-option *ngFor="let direction of entitySearchDirection | keyvalue" [value]="direction.value">-->
@ -94,6 +94,7 @@
<!-- </mat-error>-->
<!-- </mat-form-field>-->
<!-- <tb-relation-type-autocomplete-->
<!-- [appearance]="'outline'"-->
<!-- class="mat-block flex-1"-->
<!-- formControlName="relationType"-->
<!-- required="true">-->
@ -101,6 +102,7 @@
<!-- </div>-->
<!-- <div class="flex flex-row xs:flex-col">-->
<!-- <tb-entity-select-->
<!-- [appearance]="'outline'"-->
<!-- class="mat-block flex-1"-->
<!-- required="true"-->
<!-- formControlName="relatedEntity">-->
@ -128,7 +130,7 @@
<!-- <div [formGroupName]="i" class="mat-elevation-z2 flex flex-1 flex-row" style="padding: 5px 0 5px 5px;">-->
<!-- <div class="flex flex-1 flex-col">-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <mat-form-field class="mat-block" style="min-width: 100px;">-->
<!-- <mat-form-field class="mat-block" style="min-width: 100px;" appearance="outline">-->
<!-- <mat-label>Direction</mat-label>-->
<!-- <mat-select formControlName="direction" name="direction">-->
<!-- <mat-option *ngFor="let direction of entitySearchDirection | keyvalue" [value]="direction.value">-->
@ -140,6 +142,7 @@
<!-- </mat-error>-->
<!-- </mat-form-field>-->
<!-- <tb-relation-type-autocomplete-->
<!-- [appearance]="'outline'"-->
<!-- class="mat-block flex-1"-->
<!-- formControlName="relationType"-->
<!-- [required]="true">-->
@ -147,6 +150,7 @@
<!-- </div>-->
<!-- <div class="flex flex-row xs:flex-col">-->
<!-- <tb-entity-select-->
<!-- [appearance]="'outline'"-->
<!-- class="mat-block flex-1"-->
<!-- [required]="true"-->
<!-- formControlName="relatedEntity">-->
@ -210,26 +214,28 @@
<!-- <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>-->
<!-- <div mat-dialog-content class="flex flex-col">-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Entity Name</mat-label>-->
<!-- <input matInput formControlName="entityName" required>-->
<!-- <mat-error *ngIf="addEntityFormGroup.get('entityName').hasError('required')">-->
<!-- Entity name is required.-->
<!-- </mat-error>-->
<!-- </mat-form-field>-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Entity Label</mat-label>-->
<!-- <input matInput formControlName="entityLabel" >-->
<!-- </mat-form-field>-->
<!-- </div>-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <tb-entity-type-select-->
<!-- [appearance]="'outline'"-->
<!-- class="mat-block"-->
<!-- formControlName="entityType"-->
<!-- [showLabel]="true"-->
<!-- [allowedEntityTypes]="allowedEntityTypes"-->
<!-- ></tb-entity-type-select>-->
<!-- <tb-entity-subtype-autocomplete-->
<!-- [appearance]="'outline'"-->
<!-- *ngIf="addEntityFormGroup.get('entityType').value == 'ASSET'"-->
<!-- class="mat-block flex-1"-->
<!-- formControlName="type"-->
@ -237,6 +243,7 @@
<!-- [entityType]="'ASSET'"-->
<!-- ></tb-entity-subtype-autocomplete>-->
<!-- <tb-entity-subtype-autocomplete-->
<!-- [appearance]="'outline'"-->
<!-- *ngIf="addEntityFormGroup.get('entityType').value != 'ASSET'"-->
<!-- class="mat-block flex-1"-->
<!-- formControlName="type"-->
@ -246,27 +253,27 @@
<!-- </div>-->
<!-- <div formGroupName="attributes" class="flex flex-col">-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Latitude</mat-label>-->
<!-- <input type="number" step="any" matInput formControlName="latitude">-->
<!-- </mat-form-field>-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Longitude</mat-label>-->
<!-- <input type="number" step="any" matInput formControlName="longitude">-->
<!-- </mat-form-field>-->
<!-- </div>-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Address</mat-label>-->
<!-- <input matInput formControlName="address">-->
<!-- </mat-form-field>-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Owner</mat-label>-->
<!-- <input matInput formControlName="owner">-->
<!-- </mat-form-field>-->
<!-- </div>-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <mat-form-field class="mat-block flex-1">-->
<!-- <mat-form-field class="mat-block flex-1" appearance="outline">-->
<!-- <mat-label>Integer Value</mat-label>-->
<!-- <input type="number" step="1" matInput formControlName="number">-->
<!-- <mat-error *ngIf="addEntityFormGroup.get('attributes.number').hasError('pattern')">-->
@ -288,7 +295,7 @@
<!-- <div [formGroupName]="i" class="mat-elevation-z2 flex flex-1 flex-row" style="padding: 5px 0 5px 5px;">-->
<!-- <div class="flex flex-1 flex-col">-->
<!-- <div class="flex flex-row gap-2 xs:flex-col xs:gap-0">-->
<!-- <mat-form-field class="mat-block" style="min-width: 100px;">-->
<!-- <mat-form-field class="mat-block" style="min-width: 100px;" appearance="outline">-->
<!-- <mat-label>Direction</mat-label>-->
<!-- <mat-select formControlName="direction" name="direction">-->
<!-- <mat-option *ngFor="let direction of entitySearchDirection | keyvalue" [value]="direction.value">-->
@ -300,6 +307,7 @@
<!-- </mat-error>-->
<!-- </mat-form-field>-->
<!-- <tb-relation-type-autocomplete-->
<!-- [appearance]="'outline'"-->
<!-- class="mat-block flex-1"-->
<!-- formControlName="relationType"-->
<!-- [required]="true">-->
@ -307,6 +315,7 @@
<!-- </div>-->
<!-- <div class="flex flex-row xs:flex-col">-->
<!-- <tb-entity-select-->
<!-- [appearance]="'outline'"-->
<!-- class="mat-block flex-1"-->
<!-- [required]="true"-->
<!-- formControlName="relatedEntity">-->

9
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-range-list.component.ts

@ -17,12 +17,13 @@ import {
AdvancedColorRange,
ColorRange,
ColorRangeSettings,
normalizeColorRangeSettings,
ValueSourceType
} from '@shared/models/widget-settings.models';
import { TbPopoverComponent } from '@shared/components/popover.component';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { deepClone, isDefinedAndNotNull, isUndefined } from '@core/utils';
import { isDefinedAndNotNull } from '@core/utils';
import { CdkDragDrop } from '@angular/cdk/drag-drop';
import { IAliasController } from '@core/api/widget-api.models';
import { coerceBoolean } from '@shared/decorators/coercion';
@ -126,11 +127,11 @@ export class ColorRangeListComponent implements OnInit, ControlValueAccessor, On
writeValue(value: any): void {
if (value) {
let rangeList: ColorRangeSettings = {};
if (this.simpleRange || (isUndefined(value?.advancedMode) && value?.length)) {
if (this.simpleRange) {
rangeList.advancedMode = false;
rangeList.range = value;
rangeList.range = normalizeColorRangeSettings(value).range;
} else {
rangeList = deepClone(value);
rangeList = normalizeColorRangeSettings(value);
}
this.colorRangeListFormGroup.get('advancedMode').patchValue(rangeList.advancedMode || false, {emitEvent: false});
if (isDefinedAndNotNull(rangeList?.range)) {

12
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/color-settings.component.ts

@ -11,14 +11,14 @@ import {
ViewContainerRef
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { ColorRange, ColorSettings, ColorType, ComponentStyle } from '@shared/models/widget-settings.models';
import { ColorSettings, ColorType, ComponentStyle, normalizeColorRangeSettings } from '@shared/models/widget-settings.models';
import { MatButton } from '@angular/material/button';
import { TbPopoverService } from '@shared/components/popover.service';
import {
ColorSettingsPanelComponent
} from '@home/components/widget/lib/settings/common/color-settings-panel.component';
import { IAliasController } from '@core/api/widget-api.models';
import { deepClone, isDefinedAndNotNull } from '@core/utils';
import { isDefinedAndNotNull } from '@core/utils';
import { coerceBoolean } from '@shared/decorators/coercion';
import { DataKeysCallbacks } from '@home/components/widget/lib/settings/common/key/data-keys.component.models';
import { Datasource } from '@shared/models/widget.models';
@ -129,11 +129,9 @@ export class ColorSettingsComponent implements OnInit, ControlValueAccessor, OnD
writeValue(value: ColorSettings): void {
if (value) {
this.modelValue = value;
if (isDefinedAndNotNull(this.modelValue.rangeList) && !isDefinedAndNotNull(this.modelValue.rangeList?.advancedMode)) {
const range = deepClone(this.modelValue.rangeList) as ColorRange[];
this.modelValue.rangeList = deepClone({advancedMode: false, range});
}
this.modelValue = isDefinedAndNotNull(value.rangeList)
? {...value, rangeList: normalizeColorRangeSettings(value.rangeList)}
: value;
this.updateColorStyle();
}
}

2
ui-ngx/src/app/modules/home/components/widget/lib/settings/common/count-widget-settings.component.ts

@ -140,7 +140,7 @@ export class CountWidgetSettingsComponent extends PageComponent implements OnIni
}
private updateModel() {
const value: CountWidgetSettings = this.countWidgetConfigForm.value;
const value: CountWidgetSettings = this.countWidgetConfigForm.getRawValue();
this.propagateChange(value);
}

7
ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-widget-settings.component.html

@ -1,7 +1,8 @@
<!--
SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
<ng-container [formGroup]="entitiesTableWidgetSettingsForm">
@ -65,7 +66,7 @@
{{ 'widgets.table.show-cell-actions-menu-mobile' | translate }}
</mat-slide-toggle>
</div>
<mat-form-field class="flex-1" subscriptSizing="dynamic">
<mat-form-field class="flex-1" subscriptSizing="dynamic" appearance="outline">
<mat-label translate>widgets.table.hidden-cell-button-display-mode</mat-label>
<mat-select formControlName="reserveSpaceForHiddenAction">
<mat-option [value]="'true'">
@ -76,7 +77,7 @@
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="flex-1" subscriptSizing="dynamic">
<mat-form-field class="flex-1" subscriptSizing="dynamic" appearance="outline">
<mat-label translate>widgets.table.default-sort-order</mat-label>
<input matInput formControlName="defaultSortOrder">
</mat-form-field>

4
ui-ngx/src/app/modules/home/components/widget/lib/settings/gauge/digital-gauge-widget-settings.component.ts

@ -28,6 +28,7 @@ import {
ColorSettings,
ColorType,
constantColor,
normalizeColorRangeSettings,
simpleDateFormat,
ValueSourceConfig,
ValueSourceType
@ -219,7 +220,8 @@ export class DigitalGaugeWidgetSettingsComponent extends WidgetSettingsComponent
if (barColor.type === ColorType.range) {
settings.useFixedLevelColor = true;
settings.fixedLevelColors = barColor.rangeList.advancedMode ? barColor.rangeList.rangeAdvanced : barColor.rangeList.range;
const rangeList = normalizeColorRangeSettings(barColor.rangeList);
settings.fixedLevelColors = rangeList?.advancedMode ? rangeList.rangeAdvanced : rangeList?.range;
} else {
settings.useFixedLevelColor = false;
}

9
ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-link-dialog.component.scss

@ -1,9 +0,0 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
:host ::ng-deep {
tb-rule-node-link {
form {
overflow: hidden !important;
}
}
}

6
ui-ngx/src/app/modules/home/pages/rulechain/link-labels.component.html

@ -1,7 +1,8 @@
<!--
SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
-->
<mat-form-field [formGroup]="linksFormGroup" style="width: 100%;" appearance="outline">
@ -22,9 +23,6 @@
#labelInput
(focusin)="onFocus()"
formControlName="label"
matAutocompleteOrigin
#origin="matAutocompleteOrigin"
[matAutocompleteConnectedTo]="origin"
[matAutocomplete]="labelAutocomplete"
[matChipInputFor]="chipList"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"

1
ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts

@ -1989,7 +1989,6 @@ export interface AddRuleNodeLinkDialogData {
selector: 'tb-add-rule-node-link-dialog',
templateUrl: './add-rule-node-link-dialog.component.html',
providers: [{ provide: ErrorStateMatcher, useExisting: AddRuleNodeLinkDialogComponent }],
styleUrls: ['./add-rule-node-link-dialog.component.scss'],
standalone: false
})
export class AddRuleNodeLinkDialogComponent extends DialogComponent<AddRuleNodeLinkDialogComponent, FcRuleEdge>

1
ui-ngx/src/app/modules/home/pages/widget/widgets-bundle-widgets.component.html

@ -130,6 +130,7 @@
<div class="tb-add-bundle-widget-form">
<tb-widget-type-autocomplete
required
appearance="outline"
placeholder="{{ 'widget.select-widget' | translate }}"
[excludeWidgetTypeIds]="excludeWidgetTypeIds"
[formControl]="addWidgetFormControl">

40
ui-ngx/src/app/shared/models/widget-settings.models.ts

@ -2,6 +2,7 @@
// SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1
import {
deepClone,
isDefinedAndNotNull,
isNotEmptyStr,
isNumber,
@ -189,6 +190,28 @@ export interface ColorRangeSettings extends AdvancedColorMode {
rangeAdvanced?: AdvancedColorRange[];
}
/**
* Converts any stored rangeList shape to ColorRangeSettings. Always returns a new deep copy (null/undefined pass through),
* so callers may mutate the result freely.
*/
export const normalizeColorRangeSettings = (rangeList: ColorRangeSettings | ColorRange[]): ColorRangeSettings => {
if (!isDefinedAndNotNull(rangeList)) {
return rangeList as ColorRangeSettings;
}
if (Array.isArray(rangeList)) {
return {advancedMode: false, range: deepClone(rangeList)};
}
const result: ColorRangeSettings = deepClone(rangeList);
result.advancedMode = result.advancedMode ?? false;
// Unwraps the legacy corrupted shape {range: {advancedMode, range: [...]}} (possibly nested several levels deep)
let range: any = result.range;
while (isDefinedAndNotNull(range) && !Array.isArray(range)) {
range = range.range;
}
result.range = range;
return result;
};
export interface ColorGradientSettings extends AdvancedColorMode {
gradient?: string[];
gradientAdvanced?: AdvancedGradient[];
@ -515,9 +538,9 @@ export abstract class AdvancedModeColorProcessor extends ColorProcessor {
class RangeColorProcessor extends AdvancedModeColorProcessor {
constructor(protected settings: ColorSettings,
protected ctx: WidgetContext) {
super(settings, ctx);
constructor(settings: ColorSettings,
ctx: WidgetContext) {
super({...settings, rangeList: normalizeColorRangeSettings(settings.rangeList)}, ctx);
}
update(value: any): void {
@ -561,15 +584,8 @@ class RangeColorProcessor extends AdvancedModeColorProcessor {
}
private computeFromRange(value: any): string {
let rangeList: any = this.settings.rangeList as Array<ColorRange>;
let advancedMode = false;
if (isDefinedAndNotNull(this.settings.rangeList?.advancedMode)) {
advancedMode = this.settings.rangeList.advancedMode;
rangeList = advancedMode ?
this.settings.rangeList.rangeAdvanced as Array<AdvancedColorRange> :
this.settings.rangeList.range as Array<ColorRange>;
}
const advancedMode = this.settings.rangeList?.advancedMode ?? false;
const rangeList: any = advancedMode ? this.settings.rangeList?.rangeAdvanced : this.settings.rangeList?.range;
if (rangeList?.length && isDefinedAndNotNull(value) && isNumeric(value)) {
const num = Number(value);

21
ui-ngx/src/assets/help/en_US/widget/action/examples/custom_pretty_create_dialog_html.md

@ -16,26 +16,28 @@
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
<div mat-dialog-content class="flex flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Entity Name</mat-label>
<input matInput formControlName="entityName" required>
<mat-error *ngIf="addEntityFormGroup.get('entityName').hasError('required')">
Entity name is required.
</mat-error>
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Entity Label</mat-label>
<input matInput formControlName="entityLabel" >
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<tb-entity-type-select
[appearance]="'outline'"
class="mat-block"
formControlName="entityType"
[showLabel]="true"
[allowedEntityTypes]="allowedEntityTypes"
></tb-entity-type-select>
<tb-entity-subtype-autocomplete
[appearance]="'outline'"
*ngIf="addEntityFormGroup.get('entityType').value == 'ASSET'"
class="mat-block flex-1"
formControlName="type"
@ -43,6 +45,7 @@
[entityType]="'ASSET'"
></tb-entity-subtype-autocomplete>
<tb-entity-subtype-autocomplete
[appearance]="'outline'"
*ngIf="addEntityFormGroup.get('entityType').value != 'ASSET'"
class="mat-block flex-1"
formControlName="type"
@ -52,27 +55,27 @@
</div>
<div formGroupName="attributes" class="flex flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Latitude</mat-label>
<input type="number" step="any" matInput formControlName="latitude">
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Longitude</mat-label>
<input type="number" step="any" matInput formControlName="longitude">
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Address</mat-label>
<input matInput formControlName="address">
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Owner</mat-label>
<input matInput formControlName="owner">
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Integer Value</mat-label>
<input type="number" step="1" matInput formControlName="number">
<mat-error *ngIf="addEntityFormGroup.get('attributes.number').hasError('pattern')">
@ -94,7 +97,7 @@
<div [formGroupName]="i" class="mat-elevation-z2 flex flex-1 flex-row" style="padding: 5px 0 5px 5px;">
<div class="flex flex-1 flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block" style="min-width: 100px;">
<mat-form-field class="mat-block" style="min-width: 100px;" appearance="outline">
<mat-label>Direction</mat-label>
<mat-select formControlName="direction" name="direction">
<mat-option *ngFor="let direction of entitySearchDirection | keyvalue" [value]="direction.value">
@ -106,6 +109,7 @@
</mat-error>
</mat-form-field>
<tb-relation-type-autocomplete
[appearance]="'outline'"
class="mat-block flex-1"
formControlName="relationType"
[required]="true">
@ -113,6 +117,7 @@
</div>
<div class="flex flex-row xs:flex-col">
<tb-entity-select
[appearance]="'outline'"
class="mat-block flex-1"
[required]="true"
formControlName="relatedEntity">

26
ui-ngx/src/assets/help/en_US/widget/action/examples/custom_pretty_edit_dialog_html.md

@ -16,48 +16,48 @@
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
<div mat-dialog-content class="flex flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Entity Name</mat-label>
<input matInput formControlName="entityName" required readonly="">
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Entity Label</mat-label>
<input matInput formControlName="entityLabel">
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Entity Type</mat-label>
<input matInput formControlName="entityType" readonly>
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Type</mat-label>
<input matInput formControlName="type" readonly>
</mat-form-field>
</div>
<div formGroupName="attributes" class="flex flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Latitude</mat-label>
<input type="number" step="any" matInput formControlName="latitude">
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Longitude</mat-label>
<input type="number" step="any" matInput formControlName="longitude">
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Address</mat-label>
<input matInput formControlName="address">
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Owner</mat-label>
<input matInput formControlName="owner">
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Integer Value</mat-label>
<input type="number" step="1" matInput formControlName="number">
<mat-error *ngIf="editEntityFormGroup.get('attributes.number').hasError('pattern')">
@ -80,7 +80,7 @@
<div [formGroupName]="i" class="mat-elevation-z2 flex flex-1 flex-row" style="padding: 5px 0 5px 5px;">
<div class="flex flex-1 flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block" style="min-width: 100px;">
<mat-form-field class="mat-block" style="min-width: 100px;" appearance="outline">
<mat-label>Direction</mat-label>
<mat-select formControlName="direction" name="direction">
<mat-option *ngFor="let direction of entitySearchDirection | keyvalue" [value]="direction.value">
@ -92,6 +92,7 @@
</mat-error>
</mat-form-field>
<tb-relation-type-autocomplete
[appearance]="'outline'"
class="mat-block flex-1"
formControlName="relationType"
required="true">
@ -99,6 +100,7 @@
</div>
<div class="flex flex-row xs:flex-col">
<tb-entity-select
[appearance]="'outline'"
class="mat-block flex-1"
required="true"
formControlName="relatedEntity">
@ -126,7 +128,7 @@
<div [formGroupName]="i" class="mat-elevation-z2 flex flex-1 flex-row" style="padding: 5px 0 5px 5px;">
<div class="flex flex-1 flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block" style="min-width: 100px;">
<mat-form-field class="mat-block" style="min-width: 100px;" appearance="outline">
<mat-label>Direction</mat-label>
<mat-select formControlName="direction" name="direction">
<mat-option *ngFor="let direction of entitySearchDirection | keyvalue" [value]="direction.value">
@ -138,6 +140,7 @@
</mat-error>
</mat-form-field>
<tb-relation-type-autocomplete
[appearance]="'outline'"
class="mat-block flex-1"
formControlName="relationType"
[required]="true">
@ -145,6 +148,7 @@
</div>
<div class="flex flex-row xs:flex-col">
<tb-entity-select
[appearance]="'outline'"
class="mat-block flex-1"
[required]="true"
formControlName="relatedEntity">

2
ui-ngx/src/assets/help/en_US/widget/action/examples_custom_pretty/custom_pretty_clone_device_html.md

@ -17,7 +17,7 @@
</mat-progress-bar>
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
<div mat-dialog-content class="flex flex-col">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Clone device name</mat-label>
<input matInput formControlName="cloneName" required>
<mat-error *ngIf="cloneDeviceFormGroup.get('cloneName').hasError('required')">

21
ui-ngx/src/assets/help/en_US/widget/action/examples_custom_pretty/custom_pretty_create_dialog_html.md

@ -16,26 +16,28 @@
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
<div mat-dialog-content class="flex flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Entity Name</mat-label>
<input matInput formControlName="entityName" required>
<mat-error *ngIf="addEntityFormGroup.get('entityName').hasError('required')">
Entity name is required.
</mat-error>
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Entity Label</mat-label>
<input matInput formControlName="entityLabel" >
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<tb-entity-type-select
[appearance]="'outline'"
class="mat-block"
formControlName="entityType"
[showLabel]="true"
[allowedEntityTypes]="allowedEntityTypes"
></tb-entity-type-select>
<tb-entity-subtype-autocomplete
[appearance]="'outline'"
*ngIf="addEntityFormGroup.get('entityType').value == 'ASSET'"
class="mat-block flex-1"
formControlName="type"
@ -43,6 +45,7 @@
[entityType]="'ASSET'"
></tb-entity-subtype-autocomplete>
<tb-entity-subtype-autocomplete
[appearance]="'outline'"
*ngIf="addEntityFormGroup.get('entityType').value != 'ASSET'"
class="mat-block flex-1"
formControlName="type"
@ -52,27 +55,27 @@
</div>
<div formGroupName="attributes" class="flex flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Latitude</mat-label>
<input type="number" step="any" matInput formControlName="latitude">
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Longitude</mat-label>
<input type="number" step="any" matInput formControlName="longitude">
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Address</mat-label>
<input matInput formControlName="address">
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Owner</mat-label>
<input matInput formControlName="owner">
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Integer Value</mat-label>
<input type="number" step="1" matInput formControlName="number">
<mat-error *ngIf="addEntityFormGroup.get('attributes.number').hasError('pattern')">
@ -94,7 +97,7 @@
<div [formGroupName]="i" class="mat-elevation-z2 flex flex-1 flex-row" style="padding: 5px 0 5px 5px;">
<div class="flex flex-1 flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block" style="min-width: 100px;">
<mat-form-field class="mat-block" style="min-width: 100px;" appearance="outline">
<mat-label>Direction</mat-label>
<mat-select formControlName="direction" name="direction">
<mat-option *ngFor="let direction of entitySearchDirection | keyvalue" [value]="direction.value">
@ -106,6 +109,7 @@
</mat-error>
</mat-form-field>
<tb-relation-type-autocomplete
[appearance]="'outline'"
class="mat-block flex-1"
formControlName="relationType"
[required]="true">
@ -113,6 +117,7 @@
</div>
<div class="flex flex-row xs:flex-col">
<tb-entity-select
[appearance]="'outline'"
class="mat-block flex-1"
[required]="true"
formControlName="relatedEntity">

8
ui-ngx/src/assets/help/en_US/widget/action/examples_custom_pretty/custom_pretty_create_user_html.md

@ -17,7 +17,7 @@
</div>
<div mat-dialog-content class="flex flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Email</mat-label>
<input matInput formControlName="email" required
ng-pattern='/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\_\-0-9]+\.)+[a-zA-Z]{2,}))$/'>
@ -30,21 +30,21 @@
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>First Name</mat-label>
<input matInput
formControlName="firstName">
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Last Name</mat-label>
<input matInput
formControlName="lastName">
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>User activation method</mat-label>
<mat-select matInput formControlName="userActivationMethod">
<mat-option *ngFor="let activationMethod of activationMethods" [value]="activationMethod.value">

26
ui-ngx/src/assets/help/en_US/widget/action/examples_custom_pretty/custom_pretty_edit_dialog_html.md

@ -16,48 +16,48 @@
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
<div mat-dialog-content class="flex flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Entity Name</mat-label>
<input matInput formControlName="entityName" required readonly="">
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Entity Label</mat-label>
<input matInput formControlName="entityLabel">
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Entity Type</mat-label>
<input matInput formControlName="entityType" readonly>
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Type</mat-label>
<input matInput formControlName="type" readonly>
</mat-form-field>
</div>
<div formGroupName="attributes" class="flex flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Latitude</mat-label>
<input type="number" step="any" matInput formControlName="latitude">
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Longitude</mat-label>
<input type="number" step="any" matInput formControlName="longitude">
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Address</mat-label>
<input matInput formControlName="address">
</mat-form-field>
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Owner</mat-label>
<input matInput formControlName="owner">
</mat-form-field>
</div>
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block flex-1">
<mat-form-field class="mat-block flex-1" appearance="outline">
<mat-label>Integer Value</mat-label>
<input type="number" step="1" matInput formControlName="number">
<mat-error *ngIf="editEntityFormGroup.get('attributes.number').hasError('pattern')">
@ -80,7 +80,7 @@
<div [formGroupName]="i" class="mat-elevation-z2 flex flex-1 flex-row" style="padding: 5px 0 5px 5px;">
<div class="flex flex-1 flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block" style="min-width: 100px;">
<mat-form-field class="mat-block" style="min-width: 100px;" appearance="outline">
<mat-label>Direction</mat-label>
<mat-select formControlName="direction" name="direction">
<mat-option *ngFor="let direction of entitySearchDirection | keyvalue" [value]="direction.value">
@ -92,6 +92,7 @@
</mat-error>
</mat-form-field>
<tb-relation-type-autocomplete
[appearance]="'outline'"
class="mat-block flex-1"
formControlName="relationType"
required="true">
@ -99,6 +100,7 @@
</div>
<div class="flex flex-row xs:flex-col">
<tb-entity-select
[appearance]="'outline'"
class="mat-block flex-1"
required="true"
formControlName="relatedEntity">
@ -126,7 +128,7 @@
<div [formGroupName]="i" class="mat-elevation-z2 flex flex-1 flex-row" style="padding: 5px 0 5px 5px;">
<div class="flex flex-1 flex-col">
<div class="flex flex-row gap-2 xs:flex-col xs:gap-0">
<mat-form-field class="mat-block" style="min-width: 100px;">
<mat-form-field class="mat-block" style="min-width: 100px;" appearance="outline">
<mat-label>Direction</mat-label>
<mat-select formControlName="direction" name="direction">
<mat-option *ngFor="let direction of entitySearchDirection | keyvalue" [value]="direction.value">
@ -138,6 +140,7 @@
</mat-error>
</mat-form-field>
<tb-relation-type-autocomplete
[appearance]="'outline'"
class="mat-block flex-1"
formControlName="relationType"
[required]="true">
@ -145,6 +148,7 @@
</div>
<div class="flex flex-row xs:flex-col">
<tb-entity-select
[appearance]="'outline'"
class="mat-block flex-1"
[required]="true"
formControlName="relatedEntity">

4
ui-ngx/src/assets/help/en_US/widget/editor/examples/rpc_widget.md

@ -13,14 +13,14 @@ The **Widget Editor** will open, pre-populated with default **Control** template
```html
<form #rpcForm="ngForm" (submit)="sendCommand()">
<div class="mat-content mat-padding flex flex-col">
<mat-form-field class="mat-block">
<mat-form-field class="mat-block" appearance="outline">
<mat-label>RPC method</mat-label>
<input matInput required name="rpcMethod" #rpcMethodField="ngModel" [(ngModel)]="rpcMethod"/>
<mat-error *ngIf="rpcMethodField.hasError('required')">
RPC method name is required.
</mat-error>
</mat-form-field>
<mat-form-field class="mat-block">
<mat-form-field class="mat-block" appearance="outline">
<mat-label>RPC params</mat-label>
<input matInput required name="rpcParams" #rpcParamsField="ngModel" [(ngModel)]="rpcParams"/>
<mat-error *ngIf="rpcParamsField.hasError('required')">

4026
ui-ngx/src/assets/locale/locale.constant-es_ES.json

File diff suppressed because it is too large

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

@ -14225,13 +14225,13 @@
"upgrade-subscription-plan": "Будь ласка, перейдіть на вищий план",
"upgrade-subscription-plan-to-install-solution-template": "<b>{{solutionTemplateName}}</b> доступний, починаючи з плану <b>{{planName}}</b>. Щоб продовжити, попросіть системного адміністратора перейти на вищий план.",
"limit-reached": {
"device-count": "Ви досягли максимальної кількості пристроїв ({{value}}), дозволеної вашим тарифним планом!",
"asset-count": "Ви досягли максимальної кількості активів ({{value}}), дозволеної вашим тарифним планом!",
"edge-count": "Ви досягли максимальної кількості екземплярів Edge ({{value}}), дозволеної вашим тарифним планом!",
"agent-count": "Ви досягли максимальної кількості Remote Agent ({{value}}), дозволеної вашим тарифним планом!"
"device-count": "Ви досягли максимальної кількості пристроїв ({{value}}), дозволеної вашим планом підписки!",
"asset-count": "Ви досягли максимальної кількості активів ({{value}}), дозволеної вашим планом підписки!",
"edge-count": "Ви досягли максимальної кількості екземплярів Edge ({{value}}), дозволеної вашим планом підписки!",
"agent-count": "Ви досягли максимальної кількості Remote Agent ({{value}}), дозволеної вашим планом підписки!"
},
"feature-disabled": {
"white-labeling": "Функція брендування не дозволена вашим тарифним планом!"
"white-labeling": "Функція брендування не дозволена вашим планом підписки!"
}
},
"phone-input": {

8
ui-ngx/structure.md

@ -835,18 +835,18 @@ Key selectors: `mat-toolbar.details-toolbar`, `button[mat-fab][color="accent"]`,
<div class="mat-padding">
<form [formGroup]="entityForm">
<fieldset [disabled]="isEntityReadonly">
<mat-form-field>
<mat-form-field appearance="outline">
<mat-label><!-- translated label --></mat-label>
<input matInput formControlName="name">
<mat-error><!-- validation message --></mat-error>
</mat-form-field>
<mat-form-field>
<mat-form-field appearance="outline">
<mat-label><!-- translated label --></mat-label>
<input matInput formControlName="label">
</mat-form-field>
<tb-entity-autocomplete formControlName="someEntityId"/>
<tb-entity-autocomplete appearance="outline" formControlName="someEntityId"/>
<mat-slide-toggle formControlName="gateway"><!-- label --></mat-slide-toggle>
<mat-form-field>
<mat-form-field appearance="outline">
<textarea matInput formControlName="description"></textarea>
</mat-form-field>
</fieldset>

Loading…
Cancel
Save