From 855c69e0d68c57d3b9d714f94aacbdf0006c591f Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Mon, 10 Apr 2023 16:10:44 +0300 Subject: [PATCH] UI: Update sys admin home page. Add translations. --- .../widget_bundles/home_page_widgets.json | 21 ++- .../data/settings/UserSettingsType.java | 2 +- .../app/core/http/user-settings.service.ts | 11 ++ .../filter/filters-dialog.component.html | 2 +- .../add-doc-link-dialog.component.html | 2 +- .../cluster-info-table.component.html | 12 +- .../home-page/cluster-info-table.component.ts | 14 +- .../configured-features.component.html | 14 +- .../configured-features.component.ts | 6 +- .../lib/home-page/doc-link.component.html | 8 +- .../home-page/doc-links-widget.component.html | 6 +- .../edit-doc-links-dialog.component.html | 4 +- ...ng-started-completed-dialog.component.html | 34 ++++ ...ng-started-completed-dialog.component.scss | 62 +++++++ ...ting-started-completed-dialog.component.ts | 46 +++++ .../getting-started-widget.component.html | 101 +++++++++++ .../getting-started-widget.component.scss | 118 +++++++++++++ .../getting-started-widget.component.ts | 134 ++++++++++++++ .../lib/home-page/home-page-widgets.module.ts | 12 +- .../lib/home-page/version-info.component.html | 16 +- .../lib/home-page/version-info.component.scss | 3 - .../doc-links-widget-settings.component.html | 2 +- .../pages/home-links/sys_admin_home_page.raw | 164 +++++++----------- .../app/shared/models/user-settings.models.ts | 8 +- .../assets/locale/locale.constant-en_US.json | 109 +++++++++++- 25 files changed, 756 insertions(+), 155 deletions(-) create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-completed-dialog.component.html create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-completed-dialog.component.scss create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-completed-dialog.component.ts create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.html create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.scss create mode 100644 ui-ngx/src/app/modules/home/components/widget/lib/home-page/getting-started-widget.component.ts diff --git a/application/src/main/data/json/system/widget_bundles/home_page_widgets.json b/application/src/main/data/json/system/widget_bundles/home_page_widgets.json index f84d4cbbc6..fc5b13154c 100644 --- a/application/src/main/data/json/system/widget_bundles/home_page_widgets.json +++ b/application/src/main/data/json/system/widget_bundles/home_page_widgets.json @@ -24,7 +24,26 @@ "settingsSchema": "", "dataKeySettingsSchema": "", "settingsDirective": "tb-doc-links-widget-settings", - "defaultConfig": "{\"datasources\":[{\"type\":\"static\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"var value = prevValue + Math.random() * 100 - 50;\\nvar multiplier = Math.pow(10, 2 || 0);\\nvar value = Math.round(value * multiplier) / multiplier;\\nif (value < -1000) {\\n\\tvalue = -1000;\\n} else if (value > 1000) {\\n\\tvalue = 1000;\\n}\\nreturn value;\"}]}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":false,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"columns\":3},\"title\":\"Documentation links\",\"dropShadow\":true}" + "defaultConfig": "{\"showTitle\":false,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"columns\":3},\"title\":\"Documentation links\",\"dropShadow\":true}" + } + }, + { + "alias": "getting_started", + "name": "Getting started", + "image": null, + "description": null, + "descriptor": { + "type": "static", + "sizeX": 7.5, + "sizeY": 6.5, + "resources": [], + "templateHtml": "\n\n", + "templateCss": "", + "controllerScript": "self.onInit = function() {\n}", + "settingsSchema": "", + "dataKeySettingsSchema": "", + "settingsDirective": "", + "defaultConfig": "{\"showTitle\":false,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{},\"title\":\"Getting started\",\"dropShadow\":true}" } } ] diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/settings/UserSettingsType.java b/common/data/src/main/java/org/thingsboard/server/common/data/settings/UserSettingsType.java index 97ef85a5f2..b19dbbbaee 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/settings/UserSettingsType.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/settings/UserSettingsType.java @@ -19,7 +19,7 @@ import lombok.Getter; public enum UserSettingsType { - GENERAL, VISITED_DASHBOARDS(true), QUICK_LINKS, DOC_LINKS, DASHBOARDS; + GENERAL, VISITED_DASHBOARDS(true), QUICK_LINKS, DOC_LINKS, DASHBOARDS, GETTING_STARTED; @Getter private final boolean reserved; diff --git a/ui-ngx/src/app/core/http/user-settings.service.ts b/ui-ngx/src/app/core/http/user-settings.service.ts index 82bc726f72..55ce524750 100644 --- a/ui-ngx/src/app/core/http/user-settings.service.ts +++ b/ui-ngx/src/app/core/http/user-settings.service.ts @@ -18,6 +18,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { DocumentationLink, DocumentationLinks, + GettingStarted, initialUserSettings, UserSettings, UserSettingsType @@ -66,4 +67,14 @@ export class UserSettingsService { defaultHttpOptionsFromConfig(config)); } + public getGettingStarted(config?: RequestConfig): Observable { + return this.http.get(`/api/user/settings/${UserSettingsType.GETTING_STARTED}`, + defaultHttpOptionsFromConfig(config)); + } + + public updateGettingStarted(gettingStarted: GettingStarted, config?: RequestConfig): Observable { + return this.http.put(`/api/user/settings/${UserSettingsType.GETTING_STARTED}`, gettingStarted, + defaultHttpOptionsFromConfig(config)); + } + } diff --git a/ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.html b/ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.html index 2d24bc479f..69f72c8aaf 100644 --- a/ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.html @@ -69,7 +69,7 @@ style="min-width: 48px;" type="button" (click)="duplicateFilter($index)" - matTooltip="{{ 'filter.duplicate-filter' | translate }}" + matTooltip="{{ 'filter.duplicate-filter-action' | translate }}" matTooltipPosition="above"> content_copy diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/home-page/add-doc-link-dialog.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/home-page/add-doc-link-dialog.component.html index 92e46e8cf0..b276301ec8 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/home-page/add-doc-link-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/home-page/add-doc-link-dialog.component.html @@ -17,7 +17,7 @@ -->