From a2b50df7cda8c7329b0c7728990a450ca98333e3 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Fri, 4 Dec 2026 12:19:10 +0200 Subject: [PATCH 1/7] fix(ai): / does not open the docked chat while a dashboard is in edit mode, also on a dashboard with an HTML layout; the Home Alarms card shows its sort arrow and aria-sort for the order it requests, so Critical first is the up arrow as on the Alarms page --- .../src/app/core/services/ai-slash.service.ts | 9 ++++++++- .../dashboard-page/dashboard-page.component.ts | 10 ++++++++++ .../components/alarms-home.component.html | 4 ++-- .../components/alarms-home.component.ts | 18 ++++++++++++------ 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/ui-ngx/src/app/core/services/ai-slash.service.ts b/ui-ngx/src/app/core/services/ai-slash.service.ts index 4d74aa93a1..8debf0285e 100644 --- a/ui-ngx/src/app/core/services/ai-slash.service.ts +++ b/ui-ngx/src/app/core/services/ai-slash.service.ts @@ -22,6 +22,7 @@ export class AiSlashService { private dialog = inject(MatDialog); private composers = new Set(); private opener: AiSlashOpener | null = null; + private blocks = new Set(); private listening = false; addComposer(composer: AiSlashComposer): () => void { @@ -40,6 +41,12 @@ export class AiSlashService { }; } + block(): () => void { + const token = {}; + this.blocks.add(token); + return () => this.blocks.delete(token); + } + private listen(): void { if (this.listening) { return; @@ -66,7 +73,7 @@ export class AiSlashService { this.zone.run(() => last.focusEnd()); return; } - if (this.opener?.canOpen()) { + if (!this.blocks.size && this.opener?.canOpen()) { event.preventDefault(); this.zone.run(() => this.opener.open()); } diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts index 38abf31428..32fe773d58 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts @@ -2,6 +2,7 @@ // SPDX-FileCopyrightText: Modifications Copyright ThingsBoard, Inc. // SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 import { DashboardSelectComponent } from '@shared/components/dashboard-select.component'; +import { AiSlashService } from '@core/services/ai-slash.service'; import { AfterViewInit, ChangeDetectionStrategy, @@ -12,6 +13,7 @@ import { EventEmitter, HostBinding, Inject, + inject, Injector, Input, NgZone, @@ -241,6 +243,9 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC isFullscreen = false; isEdit = false; + private aiSlash = inject(AiSlashService); + private releaseSlash: (() => void) | null = null; + private editedWhileEmpty = false; isEditingWidget = false; isEditingWidgetClosed = true; @@ -715,6 +720,8 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC this.panelService.clearKeptEdits('dashboard'); } this.isEdit = false; + this.releaseSlash?.(); + this.releaseSlash = null; this.isEditingWidget = false; this.isEditingWidgetClosed = true; this.forceDashboardMobileMode = false; @@ -741,6 +748,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC ngOnDestroy(): void { this.destroyed = true; + this.releaseSlash?.(); if (this.aiAssistantPanelEnabled) { this.panelService.teardown(); } @@ -1344,6 +1352,8 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC this.panelService.clearKeptEdits('dashboard'); } this.isEdit = isEdit; + this.releaseSlash?.(); + this.releaseSlash = isEdit ? this.aiSlash.block() : null; this.editedWhileEmpty = false; if (this.isEdit) { this.dashboardCtx.stateController.preserveState(); diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.html index bd9aec8262..49e179d603 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.html @@ -62,7 +62,7 @@ {{ 'home.alarms.type' | translate }} @@ -70,7 +70,7 @@ @if (!mine()) { diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.ts index a023778112..5c56a031d7 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.ts @@ -47,6 +47,8 @@ const SEVERITIES = [AlarmSeverity.CRITICAL, AlarmSeverity.MAJOR, AlarmSeverity.M type AlarmSortKey = 'severity' | 'createdTime'; +const DEFAULT_DIRECTION: Record = {severity: Direction.ASC, createdTime: Direction.DESC}; + interface SeverityTile { severity: AlarmSeverity; count: number; @@ -113,7 +115,7 @@ export class AlarmsHomeComponent { readonly severity = signal(null); readonly expanded = signal(false); readonly sortKey = signal('severity'); - readonly sortDesc = signal(true); + readonly sortDirection = signal(DEFAULT_DIRECTION.severity); readonly total = signal(null); readonly hasRules = signal(null); @@ -179,13 +181,12 @@ export class AlarmsHomeComponent { private readonly pageLink = computed(() => { const severity = this.severity(); const key = this.sortKey(); - const desc = this.sortDesc(); return { page: 0, pageSize: homeListPageSize(this.expanded()), sortOrder: { key: {type: EntityKeyType.ALARM_FIELD, key}, - direction: key === 'severity' ? (desc ? Direction.ASC : Direction.DESC) : (desc ? Direction.DESC : Direction.ASC) + direction: this.sortDirection() }, statusList: [AlarmSearchStatus.ACTIVE], ...(severity ? {severityList: [severity]} : {}), @@ -243,18 +244,23 @@ export class AlarmsHomeComponent { sortBy(key: AlarmSortKey): void { if (this.sortKey() === key) { - this.sortDesc.set(!this.sortDesc()); + this.sortDirection.set(this.sortDirection() === Direction.ASC ? Direction.DESC : Direction.ASC); } else { this.sortKey.set(key); - this.sortDesc.set(true); + this.sortDirection.set(DEFAULT_DIRECTION[key]); } } + sortIcon(key: AlarmSortKey): string { + const direction = this.sortKey() === key ? this.sortDirection() : DEFAULT_DIRECTION[key]; + return direction === Direction.ASC ? 'arrow_upward' : 'arrow_downward'; + } + ariaSort(key: AlarmSortKey): string { if (this.sortKey() !== key) { return 'none'; } - return this.sortDesc() ? 'descending' : 'ascending'; + return this.sortDirection() === Direction.ASC ? 'ascending' : 'descending'; } addAlarmRule(): void { From 9c48e62c1c3dc718cf10c0de6968c906fc161418 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Fri, 4 Dec 2026 13:13:26 +0200 Subject: [PATCH 2/7] Design sync of 3 Dec: Home cards load with skeletons at their kept height (live state) or their last read at once (the person's own things), a failed read shows Retry or a 'Not refreshed since' foot, in-card reloads dim the old rows, and Home's reads no longer run the progress bar or error toasts; menu entries and IoT Hub categories draw the chat's icon for their entity type (Notifications the bell for tenants and customers); the AI Assistant page has a tab title; Mark all as read follows the card width both ways and the header never wraps; Generate dashboard with AI puts its words into an open docked chat, a closed one opens as a new chat --- ui-ngx/src/app/core/services/menu.models.ts | 82 +++--- .../ai/ai-assistant-panel.component.ts | 8 +- .../ai-assistant-routing.module.ts | 1 + .../components/alarms-home.component.html | 267 +++++++++--------- .../components/alarms-home.component.ts | 6 +- .../components/api-usage-home.component.html | 3 +- .../components/api-usage-home.component.ts | 57 +++- .../components/dashboards-home.component.html | 3 +- .../components/dashboards-home.component.ts | 61 +++- .../devices-activity-home.component.html | 40 +-- .../devices-activity-home.component.ts | 4 + .../components/devices-home.component.html | 165 +++++------ .../components/devices-home.component.ts | 21 ++ .../get-started-home.component.html | 9 +- .../get-started-home.component.scss | 7 + .../components/get-started-home.component.ts | 41 ++- .../get-started-sys-admin-home.component.html | 5 +- .../get-started-sys-admin-home.component.ts | 94 ++++-- .../components/home-card.component.scss | 127 +++++++++ .../components/home-card.component.ts | 165 ++++++++++- .../components/home-skeleton.component.scss | 170 +++++++++++ .../components/home-skeleton.component.ts | 205 ++++++++++++++ .../install-items-home.component.html | 66 ++--- .../install-items-home.component.ts | 28 +- .../components/iot-hub-home.component.html | 9 +- .../components/iot-hub-home.component.scss | 6 - .../components/iot-hub-home.component.ts | 23 +- .../components/license-home.component.html | 3 +- .../components/license-home.component.ts | 60 ++-- .../components/mobile-app-home.component.html | 17 +- .../components/mobile-app-home.component.scss | 62 ++++ .../components/mobile-app-home.component.ts | 49 +++- .../notifications-home.component.html | 5 +- .../notifications-home.component.ts | 32 ++- .../quick-links-home.component.html | 5 +- .../components/quick-links-home.component.ts | 34 ++- .../system-status-home.component.html | 2 +- .../system-status-home.component.ts | 33 ++- .../home/pages/home-page/home-load.service.ts | 104 +++++++ .../home/pages/home-page/home-page.module.ts | 2 + .../pages/home-page/sys-admin-home.service.ts | 12 +- .../pages/iot-hub/iot-hub-home.component.ts | 8 +- .../pages/iot-hub/iot-hub-routing.module.ts | 8 +- .../assets/locale/locale.constant-en_US.json | 9 +- 44 files changed, 1664 insertions(+), 454 deletions(-) create mode 100644 ui-ngx/src/app/modules/home/pages/home-page/components/home-skeleton.component.scss create mode 100644 ui-ngx/src/app/modules/home/pages/home-page/components/home-skeleton.component.ts create mode 100644 ui-ngx/src/app/modules/home/pages/home-page/home-load.service.ts diff --git a/ui-ngx/src/app/core/services/menu.models.ts b/ui-ngx/src/app/core/services/menu.models.ts index e035b89a13..59599ec354 100644 --- a/ui-ngx/src/app/core/services/menu.models.ts +++ b/ui-ngx/src/app/core/services/menu.models.ts @@ -283,8 +283,8 @@ export const menuSectionMap = new Map([ name: 'image.images', type: 'link', path: '/resources/images', - icon: 'filter', - outlinedIcon: 'filter' + icon: 'image', + outlinedIcon: 'image' } ], [ @@ -724,8 +724,8 @@ export const menuSectionMap = new Map([ name: 'device.devices', type: 'link', path: '/entities/devices', - icon: 'devices_other', - outlinedIcon: 'devices_other' + icon: 'memory', + outlinedIcon: 'memory' } ], [ @@ -735,8 +735,8 @@ export const menuSectionMap = new Map([ name: 'asset.assets', type: 'link', path: '/entities/assets', - icon: 'domain', - outlinedIcon: 'domain' + icon: 'mdi:cube-outline', + outlinedIcon: 'mdi:cube-outline' } ], [ @@ -904,8 +904,8 @@ export const menuSectionMap = new Map([ fullName: 'agent.agents', type: 'link', path: '/edgeManagement/agents', - icon: 'memory', - outlinedIcon: 'memory', + icon: 'settings_applications', + outlinedIcon: 'settings_applications', isNew: true } ], @@ -917,8 +917,8 @@ export const menuSectionMap = new Map([ fullName: 'agent.all-agents', type: 'link', path: '/edgeManagement/agents/all', - icon: 'memory', - outlinedIcon: 'memory' + icon: 'settings_applications', + outlinedIcon: 'settings_applications' } ], [ @@ -929,8 +929,8 @@ export const menuSectionMap = new Map([ fullName: 'entity-group.agent-groups', type: 'link', path: '/edgeManagement/agents/groups', - icon: 'memory', - outlinedIcon: 'memory' + icon: 'settings_applications', + outlinedIcon: 'settings_applications' } ], [ @@ -941,8 +941,8 @@ export const menuSectionMap = new Map([ fullName: 'entity-group.shared-agent-groups', type: 'link', path: '/edgeManagement/agents/shared', - icon: 'memory', - outlinedIcon: 'memory', + icon: 'settings_applications', + outlinedIcon: 'settings_applications', rootOnly: true } ], @@ -986,8 +986,8 @@ export const menuSectionMap = new Map([ name: 'ota-update.ota-updates', type: 'link', path: '/features/otaUpdates', - icon: 'memory', - outlinedIcon: 'memory' + icon: 'system_update_alt', + outlinedIcon: 'system_update_alt' } ], [ @@ -1125,8 +1125,8 @@ export const menuSectionMap = new Map([ fullName: 'device.all-devices', type: 'link', path: '/entities/devices/all', - icon: 'devices_other', - outlinedIcon: 'devices_other' + icon: 'memory', + outlinedIcon: 'memory' } ], [ @@ -1137,8 +1137,8 @@ export const menuSectionMap = new Map([ fullName: 'entity-group.device-groups', type: 'link', path: '/entities/devices/groups', - icon: 'devices_other', - outlinedIcon: 'devices_other' + icon: 'memory', + outlinedIcon: 'memory' } ], [ @@ -1149,8 +1149,8 @@ export const menuSectionMap = new Map([ fullName: 'entity-group.shared-device-groups', type: 'link', path: '/entities/devices/shared', - icon: 'devices_other', - outlinedIcon: 'devices_other', + icon: 'memory', + outlinedIcon: 'memory', rootOnly: true } ], @@ -1162,8 +1162,8 @@ export const menuSectionMap = new Map([ fullName: 'asset.all-assets', type: 'link', path: '/entities/assets/all', - icon: 'domain', - outlinedIcon: 'domain' + icon: 'mdi:cube-outline', + outlinedIcon: 'mdi:cube-outline' } ], [ @@ -1174,8 +1174,8 @@ export const menuSectionMap = new Map([ fullName: 'entity-group.asset-groups', type: 'link', path: '/entities/assets/groups', - icon: 'domain', - outlinedIcon: 'domain' + icon: 'mdi:cube-outline', + outlinedIcon: 'mdi:cube-outline' } ], [ @@ -1186,8 +1186,8 @@ export const menuSectionMap = new Map([ fullName: 'entity-group.shared-asset-groups', type: 'link', path: '/entities/assets/shared', - icon: 'domain', - outlinedIcon: 'domain', + icon: 'mdi:cube-outline', + outlinedIcon: 'mdi:cube-outline', rootOnly: true } ], @@ -1436,8 +1436,8 @@ export const menuSectionMap = new Map([ name: 'secret-storage.secrets-storage', type: 'link', path: '/security-settings/secrets', - icon: 'mdi:key-variant', - outlinedIcon: 'mdi:key-variant' + icon: 'lock', + outlinedIcon: 'lock' } ], [ @@ -1469,8 +1469,8 @@ export const menuSectionMap = new Map([ name: 'report.reports', type: 'link', path: '/reporting', - icon: 'mdi:chart-box-multiple', - outlinedIcon: 'mdi:chart-box-multiple-outline' + icon: 'summarize', + outlinedIcon: 'summarize' } ], [ @@ -1502,8 +1502,8 @@ export const menuSectionMap = new Map([ name: 'report.reports', type: 'link', path: '/reporting/reports', - icon: 'mdi:chart-box-multiple', - outlinedIcon: 'mdi:chart-box-multiple-outline' + icon: 'summarize', + outlinedIcon: 'summarize' } ], [ @@ -2392,8 +2392,7 @@ export const menuItemToMenuSection = (authState: AuthState, if (isDefinedAndNotNull(item.visible) && !item.visible) { return undefined; } - const section = menuSectionMap.get(item.id); - const result = deepClone(section); + const result = roleSection(authState, menuSectionMap.get(item.id)); if (isNotEmptyStr(item.icon)) { result.icon = item.icon; result.outlinedIcon = item.icon; @@ -2426,12 +2425,21 @@ export const menuItemToMenuSection = (authState: AuthState, } }; +const roleSection = (authState: AuthState, section: MenuSection): MenuSection => { + const result = deepClone(section); + if (result?.id === MenuId.notifications_center && authState.authUser.authority !== Authority.SYS_ADMIN) { + result.icon = 'notifications'; + result.outlinedIcon = 'notifications'; + } + return result; +}; + const referenceToMenuSection = (authState: AuthState, userPermissionsService: UserPermissionsService, reference: MenuReference): MenuSection | undefined => { if (filterMenuReference(authState, userPermissionsService, [], reference)) { const section = menuSectionMap.get(MenuId[reference.id]); if (section) { - const result = deepClone(section); + const result = roleSection(authState, section); if (reference.pages?.length) { result.pages = reference.pages.map(page => referenceToMenuSection(authState, userPermissionsService, page)).filter(page => !!page); diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts index 5d3d56b737..0d224800bb 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts @@ -119,11 +119,13 @@ export class AiAssistantPanelComponent { }); private startComposed(text: string, opened: boolean): void { + if (!opened && this.chat) { + this.chat.composeText(text); + return; + } this.chat?.keepDraftForCompose(); this.chatId.set(undefined); - if (opened) { - this.chats.load().subscribe(); - } + this.chats.load().subscribe(); setTimeout(() => this.chat?.composeText(text), AiAssistantPanelComponent.COMPOSE_DELAY_MS); } diff --git a/ui-ngx/src/app/modules/home/pages/ai-assistant/ai-assistant-routing.module.ts b/ui-ngx/src/app/modules/home/pages/ai-assistant/ai-assistant-routing.module.ts index 282b123c93..660117cb50 100644 --- a/ui-ngx/src/app/modules/home/pages/ai-assistant/ai-assistant-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/ai-assistant/ai-assistant-routing.module.ts @@ -12,6 +12,7 @@ const routes: Routes = [ path: 'ai-assistant', loadChildren: () => import('./ai-assistant-page.module').then(m => m.AiAssistantPageModule), data: { + title: 'ai-assistant.ai-assistant', breadcrumb: { menuId: MenuId.ai_assistant }, diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.html index 49e179d603..34bd8fdbd3 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.html @@ -4,9 +4,10 @@ SPDX-License-Identifier: BUSL-1.1 --> - + - @if (total()) { + @if (ready() && total()) { } @if (canAddRule) { @@ -16,149 +17,151 @@ } - @if (emptyState() === 'rules') { -
- -
-

{{ 'home.alarms.no-rules' | translate }}

- - } @else if (emptyState() === 'devices') { -
- -
{{ 'home.alarms.no-alarms-yet' | translate }}
-
- } @else if (emptyState() === 'clear') { -
- - {{ 'home.alarms.none-active' | translate }} {{ 'home.alarms.view-cleared' | translate }} -
- } @else if (total()) { -
- @for (tile of tiles(); track tile.severity) { - - } -
- @if (rows().length) { - - - - - - - - @if (!mine()) { - - } - - - - - - @for (row of rows(); track row.alarm.id.id) { - - - + + } + +
- - {{ 'home.alarms.type' | translate }}{{ 'home.alarms.originator' | translate }} - - {{ 'home.alarms.assignee' | translate }}{{ 'home.alarms.ack' | translate }}
- - - {{ severityLabel(row.alarm.severity) | translate }} - - - - {{ row.alarm.type }} - - + } @else if (emptyState() === 'devices') { +
+ +
{{ 'home.alarms.no-alarms-yet' | translate }}
+
+ } @else if (emptyState() === 'clear') { +
+ + {{ 'home.alarms.none-active' | translate }} {{ 'home.alarms.view-cleared' | translate }} +
+ } @else if (total()) { +
+ @for (tile of tiles(); track tile.severity) { + + } +
+ @if (rows().length) { + + + + + + + + @if (!mine()) { + + } + + + + + + @for (row of rows(); track row.alarm.id.id) { + + + + - + + @if (!mine()) { + } - - - @if (!mine()) { - - } - - - - } - -
+ + {{ 'home.alarms.type' | translate }}{{ 'home.alarms.originator' | translate }} + + {{ 'home.alarms.assignee' | translate }}{{ 'home.alarms.ack' | translate }}
+ + + {{ severityLabel(row.alarm.severity) | translate }} + + + + {{ row.alarm.type }} + + + @if (row.originatorLink) { + {{ row.alarm.originatorDisplayName || row.alarm.originatorName }} + } @else { + {{ row.alarm.originatorDisplayName || row.alarm.originatorName }} + } + · {{ row.ago }} + + @if (row.originatorLink) { {{ row.alarm.originatorDisplayName || row.alarm.originatorName }} } @else { {{ row.alarm.originatorDisplayName || row.alarm.originatorName }} } - · {{ row.ago }} - - - @if (row.originatorLink) { - {{ row.alarm.originatorDisplayName || row.alarm.originatorName }} - } @else { - {{ row.alarm.originatorDisplayName || row.alarm.originatorName }} + {{ row.ago }} + @if (row.assigneeName) { + {{ row.initials }} + } @else { + + — + @if (canWrite) { + + } + + } + {{ row.ago }} - @if (row.assigneeName) { - {{ row.initials }} + + @if (row.alarm.acknowledged) { + check_circle + } @else if (canWrite) { + } @else { - - — - @if (canWrite) { - - } - + radio_button_unchecked } - @if (row.alarm.acknowledged) { - check_circle - } @else if (canWrite) { - + - } @else { - radio_button_unchecked - } - - -
- } @else if (alarmsLoaded()) { -
{{ emptyNote().key | translate: emptyNote().params }}
+
+ } @else if (alarmsLoaded()) { +
{{ emptyNote().key | translate: emptyNote().params }}
+ } + } - } diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.ts index 5c56a031d7..9664bf06e8 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/alarms-home.component.ts @@ -139,6 +139,8 @@ export class AlarmsHomeComponent { private readonly alarms = signal(null); readonly listed = signal(0); readonly alarmsLoaded = computed(() => this.alarms() !== null); + readonly ready = computed(() => this.total() !== null && this.alarms() !== null && this.hasRules() !== null && this.devices() !== null); + readonly refreshing = signal(false); private readonly now = signal(Date.now()); private totalSubscriber: TelemetrySubscriber | null = null; @@ -336,6 +338,7 @@ export class AlarmsHomeComponent { private subscribeAlarms(pageLink: AlarmDataPageLink): void { this.dataSubscriber?.unsubscribe(); + this.refreshing.set(this.alarms() !== null); const cmd = new AlarmDataCmd(); cmd.query = { entityFilter: null, @@ -351,6 +354,7 @@ export class AlarmsHomeComponent { if (update.data) { this.listed.set(update.data.totalElements); this.alarms.set(update.data.data); + this.refreshing.set(false); } else if (update.update) { const byId = new Map(update.update.map(alarm => [alarm.id.id, alarm])); this.alarms.set((this.alarms() ?? []).map(alarm => byId.get(alarm.id.id) ?? alarm)); @@ -379,7 +383,7 @@ export class AlarmsHomeComponent { return subscriber; } - private refresh(): void { + refresh(): void { this.subscribeAlarms(this.pageLink()); this.totalSubscriber?.unsubscribe(); this.totalSubscriber = this.subscribeCount(this.total); diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/api-usage-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/api-usage-home.component.html index c76a9c4718..20ea2e356f 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/api-usage-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/api-usage-home.component.html @@ -4,7 +4,8 @@ SPDX-License-Identifier: BUSL-1.1 --> - + @if (groups().length) { (null); private tabChosen = false; + private readonly load = inject(HomeLoadService); + private readonly usageService = inject(UsageInfoService); + private readonly telemetryWsService = inject(TelemetryWebsocketService); + private readonly zone = inject(NgZone); + private subscriber: TelemetrySubscriber | null = null; + private readonly usageRead = signal(false); + private readonly apiRead = signal(false); + readonly failed = signal(false); + readonly readAt = signal(null); + readonly reading = computed(() => !this.failed() && (!this.usageRead() || !this.apiRead())); + readonly tab = signal('entities'); readonly groups = computed(() => { @@ -94,12 +111,41 @@ export class ApiUsageHomeComponent { }); constructor() { - inject(UsageInfoService).getUsageInfo().subscribe(usage => { - this.usage.set(usage); + const last = this.load.lastRead(this.card.id); + if (last) { + this.usage.set(last.usage); + this.apiUsage.set(last.apiUsage); + this.readAt.set(this.load.readAt(this.card.id)); this.chooseTab(); + } + this.read(); + effect(() => { + if (this.usageRead() && this.apiRead()) { + const usage = this.usage(); + const apiUsage = this.apiUsage(); + untracked(() => { + this.load.keepRead(this.card.id, {usage, apiUsage}); + this.readAt.set(Date.now()); + }); + } + }); + inject(DestroyRef).onDestroy(() => this.subscriber?.unsubscribe()); + } + + read(): void { + this.failed.set(false); + this.usageRead.set(false); + this.apiRead.set(false); + this.usageService.getUsageInfo({ignoreLoading: true, ignoreErrors: true}).subscribe({ + next: usage => { + this.usage.set(usage); + this.usageRead.set(true); + this.chooseTab(); + }, + error: () => this.failed.set(true) }); - const subscriber = this.subscribeApiUsage(inject(TelemetryWebsocketService), inject(NgZone)); - inject(DestroyRef).onDestroy(() => subscriber.unsubscribe()); + this.subscriber?.unsubscribe(); + this.subscriber = this.subscribeApiUsage(this.telemetryWsService, this.zone); } private subscribeApiUsage(telemetryWsService: TelemetryWebsocketService, zone: NgZone): TelemetrySubscriber { @@ -128,6 +174,7 @@ export class ApiUsageHomeComponent { } }); this.apiUsage.set(values); + this.apiRead.set(true); this.chooseTab(); }); subscriber.subscribe(); diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/dashboards-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/dashboards-home.component.html index e11e8e8e79..9648873064 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/dashboards-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/dashboards-home.component.html @@ -4,7 +4,8 @@ SPDX-License-Identifier: BUSL-1.1 --> - + @if (total()) { diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/dashboards-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/dashboards-home.component.ts index 54925fa96e..8c55c8b772 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/dashboards-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/dashboards-home.component.ts @@ -5,7 +5,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { Router } from '@angular/router'; import { Store } from '@ngrx/store'; import { TranslateService } from '@ngx-translate/core'; -import { of, Subject } from 'rxjs'; +import { forkJoin, of, Subject } from 'rxjs'; import { catchError, debounceTime, map, switchMap } from 'rxjs/operators'; import { AppState } from '@core/core.state'; import { getCurrentAuthState, getCurrentAuthUser } from '@core/auth/auth.selectors'; @@ -22,6 +22,7 @@ import { HomeCardId, UserDashboardAction, UserDashboardsInfo } from '@shared/mod import { HOME_CARDS } from '@home/pages/home-page/home-cards.models'; import { homeAgo, homeListShown, homeToast } from '@home/pages/home-page/home-list.models'; import { MINUTE } from '@shared/models/time/time.models'; +import { HomeLoadService } from '@home/pages/home-page/home-load.service'; import { HomeToggleOption } from '@home/pages/home-page/components/home-toggle.component'; type DashboardsTab = 'last' | 'starred'; @@ -44,6 +45,12 @@ interface StarCandidate { ago: string | null; } +interface DashboardsRead { + info: UserDashboardsInfo; + others: {id: string; title: string}[]; + total: number; +} + @Component({ selector: 'tb-dashboards-home', templateUrl: './dashboards-home.component.html', @@ -94,6 +101,11 @@ export class DashboardsHomeComponent { readonly loaded = computed(() => this.total() !== null && this.info() !== null); + private readonly load = inject(HomeLoadService); + readonly reading = signal(false); + readonly failed = signal(false); + readonly readAt = signal(null); + private readonly starredIds = computed(() => new Set((this.info()?.starred ?? []).map(dashboard => dashboard.id))); private readonly visits = computed(() => new Map((this.info()?.last ?? []).map(dashboard => [dashboard.id, dashboard.lastVisited]))); @@ -144,16 +156,14 @@ export class DashboardsHomeComponent { constructor() { if (this.dashboardsLink && this.authUser?.authority !== Authority.SYS_ADMIN) { - this.userSettingsService.getUserDashboardsInfo({ignoreLoading: true}).subscribe(info => { - this.info.set({last: info?.last ?? [], starred: info?.starred ?? []}); - }); - this.dashboardService.getUserDashboards(this.authUser.userId, null, - new PageLink(FILL_SIZE, 0, null, {property: 'createdTime', direction: Direction.DESC}), {ignoreLoading: true}).pipe( - catchError(() => of(null)) - ).subscribe(page => { - this.others.set((page?.data ?? []).map(dashboard => ({id: dashboard.id.id, title: dashboard.title}))); - this.total.set(page?.totalElements ?? 0); - }); + const last = this.load.lastRead(this.card.id); + if (last) { + this.info.set(last.info); + this.others.set(last.others); + this.total.set(last.total); + this.readAt.set(this.load.readAt(this.card.id)); + } + this.read(); } else { this.info.set({last: [], starred: []}); this.total.set(0); @@ -179,6 +189,35 @@ export class DashboardsHomeComponent { inject(DestroyRef).onDestroy(() => clearInterval(tick)); } + read(): void { + this.reading.set(true); + this.failed.set(false); + const config = {ignoreLoading: true, ignoreErrors: true}; + forkJoin([ + this.userSettingsService.getUserDashboardsInfo(config), + this.dashboardService.getUserDashboards(this.authUser.userId, null, + new PageLink(FILL_SIZE, 0, null, {property: 'createdTime', direction: Direction.DESC}), config) + ]).subscribe({ + next: ([info, page]) => { + const read: DashboardsRead = { + info: {last: info?.last ?? [], starred: info?.starred ?? []}, + others: (page?.data ?? []).map(dashboard => ({id: dashboard.id.id, title: dashboard.title})), + total: page?.totalElements ?? 0 + }; + this.info.set(read.info); + this.others.set(read.others); + this.total.set(read.total); + this.load.keepRead(this.card.id, read); + this.readAt.set(Date.now()); + this.reading.set(false); + }, + error: () => { + this.failed.set(true); + this.reading.set(false); + } + }); + } + setTab(tab: DashboardsTab): void { this.tab.set(tab); this.closePicker(); diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/devices-activity-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/devices-activity-home.component.html index f8d917b85d..21502a97d9 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/devices-activity-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/devices-activity-home.component.html @@ -4,7 +4,7 @@ SPDX-License-Identifier: BUSL-1.1 --> - + {{ 'home.activity.period' | translate }} @if (loaded() && !empty() && series.length > 1) { @@ -12,23 +12,25 @@ (valueChange)="setTab($event)"> } - @if (empty()) { -
- -
{{ (sysAdmin ? 'home.activity.no-messages' : 'home.activity.none') | translate }}
-
- } @else { -
- @for (series of series; track series.id) { -
-
{{ series.label | translate }}
- @if (series.id === 'devices') { - - } @else { - - } -
- } -
+ @if (loaded()) { + @if (empty()) { +
+ +
{{ (sysAdmin ? 'home.activity.no-messages' : 'home.activity.none') | translate }}
+
+ } @else { +
+ @for (series of series; track series.id) { +
+
{{ series.label | translate }}
+ @if (series.id === 'devices') { + + } @else { + + } +
+ } +
+ } }
diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/devices-activity-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/devices-activity-home.component.ts index b34021b089..2ae01901a3 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/devices-activity-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/devices-activity-home.component.ts @@ -249,6 +249,10 @@ export class DevicesActivityHomeComponent implements AfterViewInit { return `${day}, ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`; } + retry(): void { + this.subscribe(); + } + setTab(tab: ActivitySeries): void { this.tab.set(tab); setTimeout(() => Object.values(this.charts).forEach(chart => chart.resize())); diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/devices-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/devices-home.component.html index cfc7ac383b..e97c7cdf89 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/devices-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/devices-home.component.html @@ -4,7 +4,8 @@ SPDX-License-Identifier: BUSL-1.1 --> - + @if (canAdd) { @@ -13,90 +14,92 @@ } - @if (total() === 0) { -
- - @if (canAdd) { -
-

{{ 'home.devices.none' | translate }}

-
- {{ 'home.devices.how-to' | translate }}{{ 'home.dashboards.opens-new-tab' | translate }} + @if (ready()) { + @if (total() === 0) { +
+ + @if (canAdd) { + + } @else { +
{{ 'home.devices.none-assigned' | translate }}
+ } +
+ } @else if (total()) { +
+ @for (tile of tiles(); track tile.state) { + + } +
+ @if (allActive()) { +
+ + {{ (total() === 1 ? 'home.devices.one-active' : 'home.devices.all-active') | translate: {count: total()} }}
- } @else { -
{{ 'home.devices.none-assigned' | translate }}
- } -
- } @else if (total()) { -
- @for (tile of tiles(); track tile.state) { - } -
- @if (allActive()) { -
- - {{ (total() === 1 ? 'home.devices.one-active' : 'home.devices.all-active') | translate: {count: total()} }} -
- } - @if (rows().length) { - - - - - - - - - - - @for (row of rows(); track row.id) { - - - - - @if (row.lastActivity) { - - } @else { - - } + @if (rows().length) { +
- - {{ 'home.devices.profile' | translate }}{{ 'home.devices.state' | translate }} - -
- - @if (row.url) { - {{ row.name }} - } @else { - {{ row.name }} - } - - {{ row.profile }} - {{ row.profile }} - - {{ (row.active ? 'home.devices.active' : 'home.devices.inactive') | translate }} - - {{ row.ago }}{{ 'home.devices.never' | translate }}
+ + + + + + - } - -
+ + {{ 'home.devices.profile' | translate }}{{ 'home.devices.state' | translate }} + +
- } @else if (loaded()) { -
{{ ('home.devices.none-' + (filter() ?? 'active')) | translate }}
+ + + @for (row of rows(); track row.id) { + + + + @if (row.url) { + {{ row.name }} + } @else { + {{ row.name }} + } + + {{ row.profile }} + + {{ row.profile }} + + + {{ (row.active ? 'home.devices.active' : 'home.devices.inactive') | translate }} + + + @if (row.lastActivity) { + {{ row.ago }} + } @else { + {{ 'home.devices.never' | translate }} + } + + } + + + } @else if (loaded()) { +
{{ ('home.devices.none-' + (filter() ?? 'active')) | translate }}
+ } + } - } diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/devices-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/devices-home.component.ts index fb68fc1bd8..3d65823f52 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/devices-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/devices-home.component.ts @@ -123,6 +123,14 @@ export class DevicesHomeComponent { readonly loaded = computed(() => this.lists().length > 0 && this.lists().every(list => list !== null)); + private readonly settled = signal(false); + private readonly waiting = signal(new Set()); + + readonly ready = computed(() => this.total() !== null && this.inactive() !== null && this.active() !== null + && (this.total() === 0 || this.loaded() || this.settled())); + + readonly refreshing = computed(() => this.settled() && this.waiting().size > 0); + readonly listed = computed(() => this.listTotals().reduce((sum, count, index) => this.listQueries[index]?.counted ? sum + count : sum, 0)); @@ -219,6 +227,10 @@ export class DevicesHomeComponent { return this.sortKey() === 'last' && !this.sortDesc() ? 'arrow_upward' : 'arrow_downward'; } + refresh(): void { + this.subscribeLists(this.queries(), homeListPageSize(this.expanded())); + } + open(row: DeviceHomeRow): void { if (row.url) { this.router.navigateByUrl(row.url); @@ -233,6 +245,7 @@ export class DevicesHomeComponent { return; } this.listQueries = queries; + this.waiting.set(new Set(queries.map((_, index) => index))); const previous = this.lists(); const previousTotals = this.listTotals(); this.lists.set(queries.map((_, index) => previous[index] ?? null)); @@ -282,6 +295,14 @@ export class DevicesHomeComponent { const lists = [...this.lists()]; lists[index] = data; this.lists.set(lists); + if (this.waiting().has(index)) { + const waiting = new Set(this.waiting()); + waiting.delete(index); + this.waiting.set(waiting); + } + if (this.loaded()) { + this.settled.set(true); + } if (total !== null) { const totals = [...this.listTotals()]; totals[index] = total; diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.html index c7f1cb015a..381d922925 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.html @@ -4,16 +4,17 @@ SPDX-License-Identifier: BUSL-1.1 --> - + @if (loaded()) { -
    +
      @for (step of steps; track step.key; let i = $index) {
    1. } diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.scss b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.scss index c2b73ddfeb..0f35ce5255 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.scss +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.scss @@ -78,6 +78,13 @@ li.done .tb-gs-mark { color: var(--tb-ok, #198038); } +.tb-gs-steps.pending .tb-gs-mark { + border-color: transparent; + background: rgba(0, 0, 0, 0.06); + color: transparent; + cursor: default; +} + .tb-gs-title { display: flex; flex: 1; diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.ts index 7628503b41..1ae6344bff 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.ts @@ -21,6 +21,7 @@ import { baseUrl } from '@core/utils'; import { GettingStarted, HomeCardId } from '@shared/models/user-settings.models'; import { HOME_CARDS } from '@home/pages/home-page/home-cards.models'; import { homeToast } from '@home/pages/home-page/home-list.models'; +import { HomeLoadService } from '@home/pages/home-page/home-load.service'; import { decorateCodeBlocks } from '@home/components/ai/ai-code-block'; export interface GetStartedStep { @@ -68,6 +69,13 @@ export class GetStartedHomeComponent { readonly loaded = computed(() => this.settings() !== null); + private readonly load = inject(HomeLoadService); + readonly known = signal(false); + readonly reading = signal(false); + readonly failed = signal(false); + readonly readAt = signal(null); + readonly footText = computed(() => this.failed() && !this.known() ? this.translate.instant('home.load.progress-failed') : null); + readonly done = computed(() => Math.min(this.steps.length, Math.max(0, this.settings()?.maxSelectedIndex ?? 0))); readonly allDone = computed(() => this.done() >= this.steps.length); @@ -81,7 +89,7 @@ export class GetStartedHomeComponent { }); readonly progress = computed(() => { - if (!this.loaded() || !this.done()) { + if (!this.known() || !this.done()) { return null; } return this.allDone() @@ -90,10 +98,13 @@ export class GetStartedHomeComponent { }); constructor() { - this.userSettingsService.getGettingStarted({ignoreLoading: true}).subscribe({ - next: settings => this.settings.set({lastSelectedIndex: settings?.lastSelectedIndex ?? 0, maxSelectedIndex: settings?.maxSelectedIndex ?? 0}), - error: () => this.settings.set({lastSelectedIndex: 0, maxSelectedIndex: 0}) - }); + const last = this.load.lastRead(this.card.id); + this.settings.set(last ?? {lastSelectedIndex: 0, maxSelectedIndex: 0}); + if (last) { + this.known.set(true); + this.readAt.set(this.load.readAt(this.card.id)); + } + this.read(); effect(() => { this.open(); untracked(() => afterNextRender(() => decorateCodeBlocks(this.host.nativeElement, this.translate, @@ -101,6 +112,25 @@ export class GetStartedHomeComponent { }); } + read(): void { + this.reading.set(true); + this.failed.set(false); + this.userSettingsService.getGettingStarted({ignoreLoading: true, ignoreErrors: true}).subscribe({ + next: settings => { + const read = {lastSelectedIndex: settings?.lastSelectedIndex ?? 0, maxSelectedIndex: settings?.maxSelectedIndex ?? 0}; + this.settings.set(read); + this.load.keepRead(this.card.id, read); + this.readAt.set(Date.now()); + this.known.set(true); + this.reading.set(false); + }, + error: () => { + this.failed.set(true); + this.reading.set(false); + } + }); + } + docUrl(step: GetStartedStep): string { return this.docs + step.doc; } @@ -135,6 +165,7 @@ export class GetStartedHomeComponent { private save(settings: GettingStarted): void { this.settings.set(settings); + this.load.keepRead(this.card.id, settings); this.userSettingsService.updateGettingStarted(settings, {ignoreLoading: true}).subscribe(); } } diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.html index b48969c846..dae0e87ea5 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.html @@ -4,9 +4,10 @@ SPDX-License-Identifier: BUSL-1.1 --> - + @if (loaded()) { -
      diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.ts index a96d059529..378e9b75e9 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.ts @@ -5,24 +5,22 @@ import { Component, computed, DestroyRef, - ElementRef, inject, signal } from '@angular/core'; import { Store } from '@ngrx/store'; import { TranslateService } from '@ngx-translate/core'; -import { of } from 'rxjs'; -import { catchError } from 'rxjs/operators'; import { AppState } from '@core/core.state'; import { ActionPreferencesUpdateHomeCards } from '@core/auth/auth.actions'; import { UserSettingsService } from '@core/http/user-settings.service'; +import { AdminService } from '@core/http/admin.service'; import { WhiteLabelingService } from '@core/http/white-labeling.service'; import { EntityType } from '@shared/models/entity-type.models'; import { FeaturesInfo } from '@shared/models/settings.models'; import { HomeCardId } from '@shared/models/user-settings.models'; import { HOME_CARDS } from '@home/pages/home-page/home-cards.models'; import { HomeCountService } from '@home/pages/home-page/home-count.service'; -import { readStored, writeStored } from '@core/local-storage/stored'; +import { HomeLoadService } from '@home/pages/home-page/home-load.service'; import { SysAdminHomeService } from '@home/pages/home-page/sys-admin-home.service'; type SysAdminStepKey = 'tenant' | 'email' | 'sms' | 'wl' | '2fa' | 'oauth' | 'slack'; @@ -47,12 +45,11 @@ const STEPS: SysAdminStep[] = [ {key: 'slack', needed: false, link: '/settings/notifications', guide: 'user-guide/ui/slack-settings/', feature: 'notificationEnabled'} ]; -const LOADING_HEIGHT = 398; -const HEIGHT_KEY = 'tb-home-get-started-sys-admin-height'; - -const storedHeight = (): number => { - return Number(readStored(HEIGHT_KEY)) || LOADING_HEIGHT; -}; +interface SysAdminStartRead { + tenants: number; + features: FeaturesInfo; + skipped: string[]; +} export type StepState = 'done' | 'skipped' | 'todo'; @@ -65,7 +62,7 @@ export type StepState = 'done' | 'skipped' | 'todo'; }) export class GetStartedSysAdminHomeComponent { - private readonly card = HOME_CARDS[HomeCardId.GET_STARTED_SYS_ADMIN]; + readonly card = HOME_CARDS[HomeCardId.GET_STARTED_SYS_ADMIN]; readonly total = STEPS.length; @@ -86,7 +83,12 @@ export class GetStartedSysAdminHomeComponent { readonly loaded = computed(() => this.tenants() !== null && this.features() !== null && this.skipped() !== null); - readonly cardDefinition = computed(() => this.loaded() ? this.card : {...this.card, height: storedHeight()}); + private readonly load = inject(HomeLoadService); + private readonly fresh = signal({tenants: false, features: false, skipped: false}); + readonly reading = computed(() => !this.failed() && Object.values(this.fresh()).some(value => !value)); + readonly failed = signal(false); + readonly readAt = signal(null); + private readonly adminService = inject(AdminService); readonly states = computed>(() => { const features = this.features(); @@ -121,18 +123,32 @@ export class GetStartedSysAdminHomeComponent { readonly tenantCount = computed(() => this.tenants() ?? 0); constructor() { - const config = {ignoreErrors: true, ignoreLoading: true}; - inject(SysAdminHomeService).featuresInfo$.subscribe(features => this.features.set(features ?? {} as FeaturesInfo)); - this.userSettingsService.getGettingStarted(config).pipe(catchError(() => of(null))) - .subscribe(settings => this.skipped.set(settings?.skipped ?? [])); - const destroyRef = inject(DestroyRef); - inject(HomeCountService).watchEntityCount(EntityType.TENANT, count => this.tenants.set(count), destroyRef); - const host = inject>(ElementRef); - const observer = new ResizeObserver(() => this.rememberHeight(host.nativeElement)); - observer.observe(host.nativeElement); - destroyRef.onDestroy(() => { - observer.disconnect(); - }); + const last = this.load.lastRead(this.card.id); + if (last) { + this.tenants.set(last.tenants); + this.features.set(last.features); + this.skipped.set(last.skipped); + this.readAt.set(this.load.readAt(this.card.id)); + } + inject(SysAdminHomeService).featuresInfo$.subscribe(features => this.setFeatures(features)); + this.readSkipped(); + inject(HomeCountService).watchEntityCount(EntityType.TENANT, count => { + this.tenants.set(count); + this.markFresh('tenants'); + }, inject(DestroyRef)); + } + + read(): void { + this.failed.set(false); + if (!this.fresh().features) { + this.adminService.getFeaturesInfo({ignoreErrors: true, ignoreLoading: true}).subscribe({ + next: features => this.setFeatures(features), + error: () => this.failed.set(true) + }); + } + if (!this.fresh().skipped) { + this.readSkipped(); + } } state(step: SysAdminStep): StepState { @@ -156,15 +172,37 @@ export class GetStartedSysAdminHomeComponent { const next = skipped.includes(step.key) ? skipped.filter(key => key !== step.key) : [...skipped, step.key]; this.skipped.set(next); this.selected.set(null); + if (this.loaded()) { + this.load.keepRead(this.card.id, {tenants: this.tenants(), features: this.features(), skipped: next}); + } this.userSettingsService.updateGettingStarted({skipped: next}).subscribe(); } - private rememberHeight(element: HTMLElement): void { - const height = Math.round(element.getBoundingClientRect().height); - if (!this.loaded() || !height) { + private readSkipped(): void { + this.userSettingsService.getGettingStarted({ignoreErrors: true, ignoreLoading: true}).subscribe({ + next: settings => { + this.skipped.set(settings?.skipped ?? []); + this.markFresh('skipped'); + }, + error: () => this.failed.set(true) + }); + } + + private setFeatures(features: FeaturesInfo | null): void { + if (!features) { + this.failed.set(true); return; } - writeStored(HEIGHT_KEY, String(height)); + this.features.set(features); + this.markFresh('features'); + } + + private markFresh(part: 'tenants' | 'features' | 'skipped'): void { + this.fresh.set({...this.fresh(), [part]: true}); + if (Object.values(this.fresh()).every(value => value)) { + this.load.keepRead(this.card.id, {tenants: this.tenants(), features: this.features(), skipped: this.skipped()}); + this.readAt.set(Date.now()); + } } close(): void { diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.scss b/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.scss index d6d496d07f..eac004b336 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.scss +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.scss @@ -165,3 +165,130 @@ padding-top: var(--tb-home-card-padding, 20px); } } + +:host(.tb-mark-all-icon) .tb-home-card-header { + flex-wrap: nowrap; +} + +:host(.tb-mark-all-icon) .tb-home-card-title-group { + flex: 1 1 auto; +} + +:host(.tb-mark-all-icon) .tb-home-card-title > span:not(.tb-home-card-count) { + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; +} + +.tb-home-load-failed { + display: flex; + flex: none; + align-items: center; + gap: 12px; + padding: 2px 0; + font: 400 14px/20px var(--tb-font, Roboto, sans-serif); + letter-spacing: 0.2px; + color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); +} + +.tb-home-load-failed-glyph { + display: inline-flex; + flex: none; + align-items: center; + justify-content: center; + width: 36px; + height: 36px; + border-radius: 50%; + background: rgba(0, 0, 0, 0.06); + color: var(--tb-ink-54, rgba(0, 0, 0, 0.54)); + + .mat-icon { + width: 20px; + height: 20px; + font-size: 20px; + } +} + +.tb-home-load-failed-text { + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 2px; +} + +.tb-home-load-retry { + padding: 0; + border: none; + background: none; + font: inherit; + color: var(--tb-primary-500, #305680); + cursor: pointer; + + &:hover { + text-decoration: underline; + } + + &:focus-visible { + outline: 2px solid var(--tb-primary-500, #305680); + outline-offset: 2px; + border-radius: 2px; + } +} + +.tb-home-load-stale { + display: flex; + align-items: center; + gap: 8px; + padding-top: 8px; + border-top: 1px solid var(--tb-line-soft, rgba(0, 0, 0, 0.05)); + font: 400 14px/20px var(--tb-font, Roboto, sans-serif); + color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); + + .mat-icon { + width: 16px; + height: 16px; + font-size: 16px; + color: var(--tb-ink-38, rgba(0, 0, 0, 0.38)); + } + + .tb-home-load-retry { + margin-left: auto; + } +} + +.tb-landed ::ng-deep > :not(.tb-home-card-header) { + animation: tb-home-load-land var(--motion-enter, 240ms) var(--ease-standard, cubic-bezier(0.2, 0, 0, 1)) both; +} + +@keyframes tb-home-load-land { + from { + opacity: 0; + } +} + +.tb-refreshing ::ng-deep > :not(.tb-home-card-header) { + pointer-events: none; + animation: tb-home-load-dim var(--motion-base, 150ms) var(--ease-standard, cubic-bezier(0.2, 0, 0, 1)) 300ms both; +} + +@keyframes tb-home-load-dim { + to { + opacity: 0.45; + } +} + +@media (prefers-reduced-motion: reduce) { + .tb-landed ::ng-deep > :not(.tb-home-card-header) { + animation: none; + } + + .tb-refreshing ::ng-deep > :not(.tb-home-card-header) { + animation: none; + opacity: 0.45; + } +} + +:host ::ng-deep tb-home-list-footer + .tb-home-load-stale { + padding-top: 0; + border-top: none; +} diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.ts index c970bf9efa..610c73ef36 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.ts @@ -1,6 +1,20 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 -import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core'; +import { + afterNextRender, + ChangeDetectionStrategy, + Component, + computed, + DestroyRef, + effect, + ElementRef, + inject, + input, + output, + signal, + untracked, + viewChild +} from '@angular/core'; import { Store } from '@ngrx/store'; import { ToastNotificationService } from '@core/services/toast-notification.service'; import { TranslateService } from '@ngx-translate/core'; @@ -8,12 +22,20 @@ import { AppState } from '@core/core.state'; import { ActionPreferencesUpdateHomeCards } from '@core/auth/auth.actions'; import { homeToast } from '@home/pages/home-page/home-list.models'; import { HomeCardDefinition } from '@home/pages/home-page/home-cards.models'; +import { HomeSkeletonShape } from '@home/pages/home-page/components/home-skeleton.component'; +import { HomeLoadService } from '@home/pages/home-page/home-load.service'; +import { aiClockText } from '@home/components/ai/ai-text'; + +const READ_TIMEOUT_MS = 20_000; +const SHIMMER_AFTER_MS = 400; @Component({ selector: 'tb-home-card', template: ` -
      +
      @if (card().link) { @@ -46,7 +68,25 @@ import { HomeCardDefinition } from '@home/pages/home-page/home-cards.models';
      + @if (showSkeleton()) { + + } @else if (showFailed()) { +
      + +
      + {{ errorText() || ('home.load.failed' | translate: {name: (card().name | translate)}) }} + +
      +
      + } + @if (showStale()) { +
      + + {{ staleText() }} + +
      + }
      `, styleUrls: ['./home-card.component.scss'], @@ -65,9 +105,128 @@ export class HomeCardComponent { countText = input(null); + skeleton = input(null); + + reading = input(false); + + failed = input(false); + + hasData = input(true); + + readAt = input(null); + + refreshing = input(false); + + errorText = input(null); + + footText = input(null); + + retry = output(); + private store = inject(Store); private translate = inject(TranslateService); private toast = inject(ToastNotificationService); + private load = inject(HomeLoadService); + private section = viewChild>('section'); + + private readonly timedOut = signal(false); + private readonly readStart = signal(0); + private readonly width = signal(0); + private readonly skeletonShown = signal(false); + readonly landed = signal(false); + + private readonly bad = computed(() => this.failed() || this.timedOut()); + + readonly showSkeleton = computed(() => !!this.skeleton() && !this.hasData() && !this.bad()); + + readonly showFailed = computed(() => !this.hasData() && this.bad()); + + readonly showStale = computed(() => this.hasData() && this.bad() && (!!this.readAt() || !!this.footText())); + + readonly skeletonDelay = computed(() => Math.max(0, SHIMMER_AFTER_MS - (Date.now() - this.readStart()))); + + readonly keptHeight = computed(() => this.showSkeleton() && this.width() ? this.load.height(this.card().id, this.width()) : null); + + readonly minHeight = computed(() => this.keptHeight() ? null : this.card().height ?? null); + + readonly staleText = computed(() => { + const at = this.readAt(); + if (this.footText()) { + return this.footText(); + } + if (!at) { + return ''; + } + const lang = this.translate.currentLang; + const time = aiClockText(at, lang); + const date = new Date(at); + if (date.toDateString() === new Date().toDateString()) { + return this.translate.instant('home.load.stale-today', {time}); + } + const day = date.toLocaleDateString(lang?.replace('_', '-'), {day: 'numeric', month: 'short'}); + return this.translate.instant('home.load.stale-date', {date: day, time}); + }); + + private timer: ReturnType | null = null; + + constructor() { + const destroyRef = inject(DestroyRef); + effect(() => { + const reading = this.reading(); + untracked(() => this.watchRead(reading)); + }); + effect(() => { + const skeleton = this.showSkeleton(); + const hasData = this.hasData(); + untracked(() => { + if (skeleton) { + this.skeletonShown.set(true); + this.landed.set(false); + } else if (hasData && this.skeletonShown()) { + this.skeletonShown.set(false); + this.landed.set(true); + } + }); + }); + let observer: ResizeObserver | null = null; + afterNextRender(() => { + const element = this.section()?.nativeElement; + if (!element) { + return; + } + this.width.set(element.offsetWidth); + observer = new ResizeObserver(() => { + if (element.offsetWidth !== this.width()) { + this.width.set(element.offsetWidth); + } + if (this.skeleton() && this.hasData() && !this.reading() && !this.bad() && !this.refreshing()) { + this.load.keepHeight(this.card().id, element.offsetWidth, element.offsetHeight); + } + }); + observer.observe(element); + }); + destroyRef.onDestroy(() => { + this.watchRead(false); + observer?.disconnect(); + }); + } + + onRetry(): void { + this.retry.emit(); + this.watchRead(true); + } + + private watchRead(reading: boolean): void { + if (this.timer) { + clearTimeout(this.timer); + this.timer = null; + } + this.timedOut.set(false); + if (reading) { + this.readStart.set(Date.now()); + this.timer = setTimeout(() => this.timedOut.set(true), READ_TIMEOUT_MS); + } + } hide(): void { const id = this.card().id; diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/home-skeleton.component.scss b/ui-ngx/src/app/modules/home/pages/home-page/components/home-skeleton.component.scss new file mode 100644 index 0000000000..fd0f47dca5 --- /dev/null +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/home-skeleton.component.scss @@ -0,0 +1,170 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +:host { + --sk-fill: rgba(0, 0, 0, 0.06); + box-sizing: border-box; + position: relative; + display: flex; + flex: 1 1 auto; + flex-direction: column; + gap: 12px; + min-height: 0; + overflow: hidden; + + &::after { + content: ''; + position: absolute; + inset: 0 auto 0 0; + width: 300%; + pointer-events: none; + background: linear-gradient(90deg, transparent 33.3%, rgba(255, 255, 255, 0.8) 50%, transparent 66.7%); + transform: translateX(-66.667%); + animation: tb-home-shimmer var(--loop-shimmer, 2.4s) linear infinite; + animation-delay: var(--sk-delay, 400ms); + } +} + +@keyframes tb-home-shimmer { + from { + transform: translateX(-66.667%); + } + to { + transform: none; + } +} + +.tb-sk-bar, .tb-sk-dot, .tb-sk-block, .tb-sk-tile { + display: block; + flex: none; + background: var(--sk-fill); +} + +.tb-sk-bar { + max-width: 100%; + height: 10px; + border-radius: 5px; +} + +.tb-sk-dot { + border-radius: 50%; +} + +.tb-sk-block { + max-width: 100%; + border-radius: 8px; +} + +.tb-sk-tiles { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +.tb-sk-tile { + width: 104px; + height: 60px; + border-radius: 8px; +} + +.tb-sk-rows { + display: flex; + flex: 1 1 auto; + flex-direction: column; + min-height: 0; +} + +.tb-sk-row { + display: flex; + flex: 1 1 40px; + align-items: center; + gap: 16px; + min-height: 30px; + max-height: 56px; + border-bottom: 1px solid var(--tb-line-soft, rgba(0, 0, 0, 0.05)); + + &:last-child { + border-bottom: none; + } +} + +.tb-sk-row > .end, .tb-sk-foot > .end { + margin-left: auto; +} + +.tb-sk-rows > .tb-sk-head { + flex: none; + min-height: 32px; + + .tb-sk-bar { + height: 8px; + } +} + +.tb-sk-rows.tall .tb-sk-row { + flex-basis: 56px; + min-height: 44px; + max-height: 80px; +} + +.tb-sk-rows.plain .tb-sk-row { + flex-basis: 36px; + min-height: 28px; + max-height: 48px; + border-bottom: none; +} + +.tb-sk-foot { + display: flex; + align-items: center; + min-height: 36px; + margin-top: auto; + padding-top: 8px; + border-top: 1px solid var(--tb-line-soft, rgba(0, 0, 0, 0.05)); +} + +.tb-sk-stack { + display: flex; + flex: 1; + flex-direction: column; + gap: 8px; + min-width: 0; +} + +.tb-sk-kicker { + display: flex; + align-items: center; + min-height: 20px; +} + +.tb-sk-chart { + display: flex; + flex: 1 1 auto; + flex-direction: column; + gap: 8px; + min-height: 0; +} + +.tb-sk-chart-plot { + display: flex; + flex: 1 1 110px; + flex-direction: column; + justify-content: space-between; + min-height: 60px; + + i { + display: block; + height: 1px; + background: var(--sk-fill); + } +} + +.tb-sk-chart-x { + display: flex; + justify-content: space-between; +} + +@media (prefers-reduced-motion: reduce) { + :host::after { + display: none; + } +} diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/home-skeleton.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/home-skeleton.component.ts new file mode 100644 index 0000000000..16f57258f6 --- /dev/null +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/home-skeleton.component.ts @@ -0,0 +1,205 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core'; + +export type HomeSkeletonShape = 'alarms' | 'devices' | 'notifications' | 'activity' | 'dashboards' | 'links' | 'usage' + | 'system' | 'system-cluster' | 'install' | 'license' | 'get-started-sys-admin'; + +type Width = number | string; + +type Part = + {kind: 'bar'; width: Width; end?: boolean} + | {kind: 'dot'; size: number; end?: boolean} + | {kind: 'block'; width: Width; height: Width} + | {kind: 'stack'; parts: Part[]}; + +type Section = + {kind: 'tiles'; count: number} + | {kind: 'rows'; rows: Part[][]; head?: Part[]; look?: 'tall' | 'plain'} + | {kind: 'chart'} + | {kind: 'foot'} + | {kind: 'kicker'; width: number} + | {kind: 'part'; part: Part}; + +const bar = (width: Width, end = false): Part => ({kind: 'bar', width, end}); +const dot = (size: number, end = false): Part => ({kind: 'dot', size, end}); +const block = (width: Width, height: Width): Part => ({kind: 'block', width, height}); +const stack = (...parts: Part[]): Part => ({kind: 'stack', parts}); +const rows = (widths: string[], cells: (width: string, index: number) => Part[], head?: Part[], look?: 'tall' | 'plain'): Section => + ({kind: 'rows', rows: widths.map((width, index) => cells(width, index)), head, look}); + +const SHAPES: Record = { + alarms: [ + {kind: 'tiles', count: 2}, + rows(['30%', '24%', '34%', '26%', '28%'], width => [dot(16), bar(width), bar('16%'), bar(36, true), dot(20)], + [bar(56), bar('12%'), bar('12%'), bar(48, true)]), + {kind: 'foot'} + ], + devices: [ + {kind: 'tiles', count: 2}, + rows(['34%', '28%', '38%', '30%', '32%'], width => [bar(width), bar('20%'), dot(10), bar(40, true)], + [bar(40), bar('14%'), bar(72, true)]), + {kind: 'foot'} + ], + notifications: [ + rows(['72%', '60%', '80%', '56%', '66%'], (width, index) => + [dot(32), stack(bar(width), bar(['44%', '36%', '52%', '40%', '30%'][index])), bar(28, true)], undefined, 'tall'), + {kind: 'foot'} + ], + activity: [ + {kind: 'chart'} + ], + dashboards: [ + rows(['46%', '38%', '52%', '34%', '42%'], width => [dot(16), bar(width), bar(48, true)], [bar(40), bar(72, true)]), + {kind: 'foot'} + ], + links: [ + rows(['48%', '60%', '40%'], width => [block(20, 20), bar(width)], undefined, 'plain') + ], + usage: [ + {kind: 'kicker', width: 64}, + rows(['34%', '28%', '24%', '38%', '30%'], width => [bar(width), bar(48), bar('28%', true)], undefined, 'plain') + ], + system: [ + {kind: 'tiles', count: 3}, + {kind: 'chart'} + ], + 'system-cluster': [ + rows(['30%', '26%', '34%', '28%', '32%', '24%'], width => [bar(width), bar('18%'), bar(36, true), bar(36), bar(36)], + [bar(64), bar('12%'), bar(28, true), bar(28), bar(28)]) + ], + install: [ + {kind: 'tiles', count: 6}, + {kind: 'kicker', width: 80}, + rows(['40%', '52%', '34%'], width => [dot(16), bar(width)], undefined, 'plain') + ], + license: [ + {kind: 'part', part: block('100%', 72)}, + rows(['30%', '24%', '36%', '28%', '20%'], width => [bar(width), bar(56), bar('30%', true)], undefined, 'plain') + ], + 'get-started-sys-admin': [ + {kind: 'part', part: block('100%', 6)}, + {kind: 'kicker', width: 160}, + rows(['50%', '38%', '44%', '56%', '40%', '48%', '36%'], width => [dot(22), bar(width)], undefined, 'plain') + ] +}; + +@Component({ + selector: 'tb-home-skeleton', + template: ` + + @switch (part.kind) { + @case ('bar') { + + } + @case ('dot') { + + } + @case ('block') { + + } + @case ('stack') { + + @for (child of part.parts; track $index) { + + } + + } + } + + @for (section of sections(); track $index) { + @switch (section.kind) { + @case ('tiles') { + + @for (tile of tiles(section); track $index) { + + } + + } + @case ('rows') { + + @if (head(section); as head) { + + @for (part of head; track $index) { + + } + + } + @for (row of rowsOf(section); track $index) { + + @for (part of row; track $index) { + + } + + } + + } + @case ('chart') { + + + + @for (label of chartLabels; track $index) { + + } + + + } + @case ('foot') { + + } + @case ('kicker') { + + } + @case ('part') { + + } + } + } + `, + styleUrls: ['./home-skeleton.component.scss'], + host: { + 'class': 'tb-sk', + 'aria-hidden': 'true', + '[style.--sk-delay.ms]': 'delay()' + }, + standalone: false, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class HomeSkeletonComponent { + + shape = input.required(); + + delay = input(400); + + readonly sections = computed(() => SHAPES[this.shape()]); + + readonly chartLabels = [0, 1, 2, 3, 4]; + + size(value: Width): string { + return typeof value === 'number' ? `${value}px` : value; + } + + tiles(section: Section): number[] { + return section.kind === 'tiles' ? Array.from({length: section.count}, (_, index) => index) : []; + } + + rowsOf(section: Section): Part[][] { + return section.kind === 'rows' ? section.rows : []; + } + + head(section: Section): Part[] | null { + return section.kind === 'rows' ? section.head ?? null : null; + } + + look(section: Section): string | null { + return section.kind === 'rows' ? section.look ?? null : null; + } + + kickerWidth(section: Section): number { + return section.kind === 'kicker' ? section.width : 0; + } + + partOf(section: Section): Part | null { + return section.kind === 'part' ? section.part : null; + } +} diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/install-items-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/install-items-home.component.html index ce5c790bac..54c0c9f03f 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/install-items-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/install-items-home.component.html @@ -4,44 +4,46 @@ SPDX-License-Identifier: BUSL-1.1 --> - + add{{ 'home.install.add-tenant' | translate }} -
      - @for (item of counts; track item.entityType) { - @let count = item.count(); - @if (item.link && count) { - - {{ item.label | translate }} - {{ count | shortNumber }} - - } @else { -
      - {{ item.label | translate }} - {{ count === null ? '–' : (count | shortNumber) }} -
      - } - } -
      - @if (withFeatures()) { -
      - {{ 'home.install.features' | translate }} - @if (loaded()) { - {{ 'home.install.features-count' | translate: {on: configured(), total: features().length} }} - } -
      -
      - @for (feature of features(); track feature.key) { - - {{ feature.on ? 'check_circle' : 'radio_button_unchecked' }} - {{ feature.label | translate }} - {{ (feature.on === null ? 'home.install.checking' : feature.on ? 'home.install.configured' : 'home.install.not-configured') | translate }} - + @if (ready()) { +
      + @for (item of counts; track item.entityType) { + @let count = item.count(); + @if (item.link && count) { + + {{ item.label | translate }} + {{ count | shortNumber }} + + } @else { +
      + {{ item.label | translate }} + {{ count === null ? '–' : (count | shortNumber) }} +
      + } }
      + @if (withFeatures()) { +
      + {{ 'home.install.features' | translate }} + @if (loaded()) { + {{ 'home.install.features-count' | translate: {on: configured(), total: features().length} }} + } +
      + + } } diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/install-items-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/install-items-home.component.ts index 1420b32d6b..be8b2f8632 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/install-items-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/install-items-home.component.ts @@ -7,6 +7,7 @@ import { HomeCardId } from '@shared/models/user-settings.models'; import { HOME_CARDS } from '@home/pages/home-page/home-cards.models'; import { HomeCountService } from '@home/pages/home-page/home-count.service'; import { SysAdminHomeService } from '@home/pages/home-page/sys-admin-home.service'; +import { AdminService } from '@core/http/admin.service'; interface InstallCount { label: string; @@ -63,10 +64,31 @@ export class InstallItemsHomeComponent { readonly configured = computed(() => this.features().filter(feature => feature.on).length); + readonly ready = computed(() => this.counts.every(item => item.count() !== null) && (!this.withFeatures() || this.loaded())); + + private readonly adminService = inject(AdminService); + private readonly homeCounts = inject(HomeCountService); + private readonly destroyRef = inject(DestroyRef); + private releases: (() => void)[] = []; + constructor() { inject(SysAdminHomeService).featuresInfo$.subscribe(info => this.featuresInfo.set(info)); - const homeCounts = inject(HomeCountService); - const destroyRef = inject(DestroyRef); - this.counts.forEach(item => homeCounts.watchEntityCount(item.entityType, count => item.count.set(count), destroyRef)); + this.watchCounts(); + } + + retry(): void { + if (!this.loaded()) { + this.adminService.getFeaturesInfo({ignoreErrors: true, ignoreLoading: true}).subscribe({ + next: info => this.featuresInfo.set(info), + error: () => {} + }); + } + this.releases.forEach(release => release()); + this.watchCounts(); + } + + private watchCounts(): void { + this.releases = this.counts.map(item => + this.homeCounts.watchEntityCount(item.entityType, count => item.count.set(count), this.destroyRef)); } } diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/iot-hub-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/iot-hub-home.component.html index a0fc3678a2..0cb0f94858 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/iot-hub-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/iot-hub-home.component.html @@ -4,7 +4,8 @@ SPDX-License-Identifier: BUSL-1.1 --> - + @if (searching()) { - @if (failed()) { -

      {{ 'home.iot-hub.unavailable' | translate }}

      - } @else { + @if (!failed() || loaded()) {
      {{ 'home.iot-hub.templates' | translate }} @@ -115,7 +114,7 @@
    @if (allDone()) {
    - +
    } } diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.scss b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.scss index 0f35ce5255..d3c977681a 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.scss +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.scss @@ -61,11 +61,15 @@ color: inherit; } - &:hover { + &:hover:not(:disabled) { border-color: var(--tb-ok, #198038); color: var(--tb-ok, #198038); } + &:disabled { + cursor: default; + } + &:focus-visible { outline: 2px solid var(--tb-primary-500); outline-offset: 2px; diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.ts index 1ae6344bff..67cefa8eb4 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-home.component.ts @@ -13,6 +13,7 @@ import { untracked } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; +import { map } from 'rxjs/operators'; import { ClipboardService } from 'ngx-clipboard'; import { UserSettingsService } from '@core/http/user-settings.service'; import { WhiteLabelingService } from '@core/http/white-labeling.service'; @@ -69,12 +70,13 @@ export class GetStartedHomeComponent { readonly loaded = computed(() => this.settings() !== null); - private readonly load = inject(HomeLoadService); - readonly known = signal(false); - readonly reading = signal(false); - readonly failed = signal(false); - readonly readAt = signal(null); - readonly footText = computed(() => this.failed() && !this.known() ? this.translate.instant('home.load.progress-failed') : null); + readonly state = inject(HomeLoadService).reader(this.card.id, + () => this.userSettingsService.getGettingStarted({ignoreLoading: true, ignoreErrors: true}).pipe( + map(settings => ({lastSelectedIndex: settings?.lastSelectedIndex ?? 0, maxSelectedIndex: settings?.maxSelectedIndex ?? 0})) + ), + settings => this.settings.set(settings)); + readonly known = computed(() => !!this.state.last || this.state.fresh()); + readonly footText = computed(() => this.state.failed() && !this.known() ? this.translate.instant('home.load.progress-failed') : null); readonly done = computed(() => Math.min(this.steps.length, Math.max(0, this.settings()?.maxSelectedIndex ?? 0))); @@ -98,13 +100,8 @@ export class GetStartedHomeComponent { }); constructor() { - const last = this.load.lastRead(this.card.id); - this.settings.set(last ?? {lastSelectedIndex: 0, maxSelectedIndex: 0}); - if (last) { - this.known.set(true); - this.readAt.set(this.load.readAt(this.card.id)); - } - this.read(); + this.settings.set({lastSelectedIndex: 0, maxSelectedIndex: 0}); + this.state.start(); effect(() => { this.open(); untracked(() => afterNextRender(() => decorateCodeBlocks(this.host.nativeElement, this.translate, @@ -112,25 +109,6 @@ export class GetStartedHomeComponent { }); } - read(): void { - this.reading.set(true); - this.failed.set(false); - this.userSettingsService.getGettingStarted({ignoreLoading: true, ignoreErrors: true}).subscribe({ - next: settings => { - const read = {lastSelectedIndex: settings?.lastSelectedIndex ?? 0, maxSelectedIndex: settings?.maxSelectedIndex ?? 0}; - this.settings.set(read); - this.load.keepRead(this.card.id, read); - this.readAt.set(Date.now()); - this.known.set(true); - this.reading.set(false); - }, - error: () => { - this.failed.set(true); - this.reading.set(false); - } - }); - } - docUrl(step: GetStartedStep): string { return this.docs + step.doc; } @@ -140,8 +118,13 @@ export class GetStartedHomeComponent { } select(index: number): void { - if (index !== this.open()) { + if (index === this.open()) { + return; + } + if (this.state.fresh()) { this.save({...this.settings(), lastSelectedIndex: index}); + } else { + this.settings.set({...this.settings(), lastSelectedIndex: index}); } } @@ -165,7 +148,7 @@ export class GetStartedHomeComponent { private save(settings: GettingStarted): void { this.settings.set(settings); - this.load.keepRead(this.card.id, settings); + this.state.keep(settings); this.userSettingsService.updateGettingStarted(settings, {ignoreLoading: true}).subscribe(); } } diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.html index dae0e87ea5..c6d8d8e39c 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.html @@ -62,7 +62,7 @@ } @if (!step.needed && stepState !== 'done') { - } diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.ts index 378e9b75e9..895798cf90 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/get-started-sys-admin-home.component.ts @@ -87,8 +87,10 @@ export class GetStartedSysAdminHomeComponent { private readonly fresh = signal({tenants: false, features: false, skipped: false}); readonly reading = computed(() => !this.failed() && Object.values(this.fresh()).some(value => !value)); readonly failed = signal(false); + readonly canSkip = computed(() => this.fresh().skipped); readonly readAt = signal(null); private readonly adminService = inject(AdminService); + private readonly homeCounts = inject(HomeCountService); readonly states = computed>(() => { const features = this.features(); @@ -132,7 +134,7 @@ export class GetStartedSysAdminHomeComponent { } inject(SysAdminHomeService).featuresInfo$.subscribe(features => this.setFeatures(features)); this.readSkipped(); - inject(HomeCountService).watchEntityCount(EntityType.TENANT, count => { + this.homeCounts.watchEntityCount(EntityType.TENANT, count => { this.tenants.set(count); this.markFresh('tenants'); }, inject(DestroyRef)); @@ -149,6 +151,9 @@ export class GetStartedSysAdminHomeComponent { if (!this.fresh().skipped) { this.readSkipped(); } + if (!this.fresh().tenants) { + this.homeCounts.reread(EntityType.TENANT); + } } state(step: SysAdminStep): StepState { diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.scss b/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.scss index eac004b336..1244544bb1 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.scss +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.scss @@ -1,5 +1,7 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 +@use './home-load'; + :host { display: block; min-width: 0; @@ -216,25 +218,6 @@ gap: 2px; } -.tb-home-load-retry { - padding: 0; - border: none; - background: none; - font: inherit; - color: var(--tb-primary-500, #305680); - cursor: pointer; - - &:hover { - text-decoration: underline; - } - - &:focus-visible { - outline: 2px solid var(--tb-primary-500, #305680); - outline-offset: 2px; - border-radius: 2px; - } -} - .tb-home-load-stale { display: flex; align-items: center; diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.ts index 610c73ef36..ad3463a219 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/home-card.component.ts @@ -74,7 +74,7 @@ const SHIMMER_AFTER_MS = 400;
    - {{ errorText() || ('home.load.failed' | translate: {name: (card().name | translate)}) }} + {{ 'home.load.failed' | translate: {name: (card().name | translate)} }}
    @@ -117,7 +117,7 @@ export class HomeCardComponent { refreshing = input(false); - errorText = input(null); + keepHeight = input(true); footText = input(null); @@ -199,7 +199,7 @@ export class HomeCardComponent { if (element.offsetWidth !== this.width()) { this.width.set(element.offsetWidth); } - if (this.skeleton() && this.hasData() && !this.reading() && !this.bad() && !this.refreshing()) { + if (this.skeleton() && this.keepHeight() && !this.expanded() && this.hasData() && !this.reading() && !this.bad() && !this.refreshing()) { this.load.keepHeight(this.card().id, element.offsetWidth, element.offsetHeight); } }); diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/home-skeleton.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/home-skeleton.component.ts index 16f57258f6..4242c643f6 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/home-skeleton.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/home-skeleton.component.ts @@ -3,7 +3,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core'; export type HomeSkeletonShape = 'alarms' | 'devices' | 'notifications' | 'activity' | 'dashboards' | 'links' | 'usage' - | 'system' | 'system-cluster' | 'install' | 'license' | 'get-started-sys-admin'; + | 'system' | 'system-cluster' | 'install' | 'license' | 'get-started-sys-admin' | 'qr'; type Width = number | string; @@ -77,6 +77,9 @@ const SHAPES: Record = { {kind: 'part', part: block('100%', 72)}, rows(['30%', '24%', '36%', '28%', '20%'], width => [bar(width), bar(56), bar('30%', true)], undefined, 'plain') ], + qr: [ + {kind: 'part', part: block('100%', '100%')} + ], 'get-started-sys-admin': [ {kind: 'part', part: block('100%', 6)}, {kind: 'kicker', width: 160}, diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/install-items-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/install-items-home.component.ts index be8b2f8632..2fae5fd141 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/install-items-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/install-items-home.component.ts @@ -69,7 +69,6 @@ export class InstallItemsHomeComponent { private readonly adminService = inject(AdminService); private readonly homeCounts = inject(HomeCountService); private readonly destroyRef = inject(DestroyRef); - private releases: (() => void)[] = []; constructor() { inject(SysAdminHomeService).featuresInfo$.subscribe(info => this.featuresInfo.set(info)); @@ -83,12 +82,10 @@ export class InstallItemsHomeComponent { error: () => {} }); } - this.releases.forEach(release => release()); - this.watchCounts(); + this.counts.filter(item => item.count() === null).forEach(item => this.homeCounts.reread(item.entityType)); } private watchCounts(): void { - this.releases = this.counts.map(item => - this.homeCounts.watchEntityCount(item.entityType, count => item.count.set(count), this.destroyRef)); + this.counts.forEach(item => this.homeCounts.watchEntityCount(item.entityType, count => item.count.set(count), this.destroyRef)); } } diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/iot-hub-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/iot-hub-home.component.ts index 328f196fe2..6f738f1eb8 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/iot-hub-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/iot-hub-home.component.ts @@ -7,7 +7,7 @@ import { HomeCardId } from '@shared/models/user-settings.models'; import { HOME_CARDS } from '@home/pages/home-page/home-cards.models'; import { IotHubApiService } from '@core/http/iot-hub-api.service'; import { IotHubActionsService } from '@home/components/iot-hub/iot-hub-actions.service'; -import { ItemType } from '@shared/models/iot-hub/iot-hub-item.models'; +import { getItemTypeIcon, ItemType } from '@shared/models/iot-hub/iot-hub-item.models'; import { MpItemVersionQuery, MpItemVersionView } from '@shared/models/iot-hub/iot-hub-version.models'; import { IotHubInstalledItem } from '@shared/models/iot-hub/iot-hub-installed-item.models'; import { Direction, SortOrder } from '@shared/models/page/sort-order'; @@ -62,10 +62,10 @@ export interface IotHubKind { } const KINDS: IotHubKind[] = [ - {type: ItemType.WIDGET, name: 'home.iot-hub.widgets', icon: 'widgets', route: 'widgets'}, - {type: ItemType.CALCULATED_FIELD, name: 'home.iot-hub.calculated-fields', icon: 'mdi:function-variant', route: 'calculated-fields'}, - {type: ItemType.ALARM_RULE, name: 'home.iot-hub.alarm-rules', icon: 'mdi:bell-cog', route: 'alarm-rules'}, - {type: ItemType.RULE_CHAIN, name: 'home.iot-hub.rule-chains', icon: 'settings_ethernet', route: 'rule-chains'} + {type: ItemType.WIDGET, name: 'home.iot-hub.widgets', icon: getItemTypeIcon(ItemType.WIDGET), route: 'widgets'}, + {type: ItemType.CALCULATED_FIELD, name: 'home.iot-hub.calculated-fields', icon: getItemTypeIcon(ItemType.CALCULATED_FIELD), route: 'calculated-fields'}, + {type: ItemType.ALARM_RULE, name: 'home.iot-hub.alarm-rules', icon: getItemTypeIcon(ItemType.ALARM_RULE), route: 'alarm-rules'}, + {type: ItemType.RULE_CHAIN, name: 'home.iot-hub.rule-chains', icon: getItemTypeIcon(ItemType.RULE_CHAIN), route: 'rule-chains'} ]; interface HubTile { diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/license-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/license-home.component.html index b725df059f..f00d48b9e1 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/license-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/license-home.component.html @@ -4,8 +4,8 @@ SPDX-License-Identifier: BUSL-1.1 --> - + @if (managed() && updatedAgo()) { diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/license-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/license-home.component.ts index 8d1c5a7be0..98a3aa4b12 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/license-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/license-home.component.ts @@ -108,9 +108,9 @@ export class LicenseHomeComponent { readonly card = HOME_CARDS[HomeCardId.LICENSE]; private readonly load = inject(HomeLoadService); - readonly reading = signal(false); - readonly failed = signal(false); - readonly readAt = signal(null); + readonly state = this.load.reader(this.card.id, + () => this.adminService.getSubscriptionInfo({ignoreLoading: true, ignoreErrors: true}), + info => this.info.set(info)); readonly kind = computed(() => { const info = this.info(); @@ -213,35 +213,16 @@ export class LicenseHomeComponent { constructor() { const destroyRef = inject(DestroyRef); - const last = this.load.lastRead(this.card.id); - if (last) { - this.info.set(last); - this.readAt.set(this.load.readAt(this.card.id)); - } - this.read(); + this.state.start(); interval(AGO_REFRESH_MS).pipe(takeUntilDestroyed(destroyRef)).subscribe(() => this.now.set(Date.now())); } - read(): void { - this.reading.set(true); - this.failed.set(false); - this.adminService.getSubscriptionInfo({ignoreLoading: true, ignoreErrors: true}).subscribe({ - next: info => { - this.setInfo(info); - this.reading.set(false); - }, - error: () => { - this.failed.set(true); - this.reading.set(false); - } - }); - } - refresh(): void { this.refreshing.set(true); this.adminService.refreshLicense({ignoreLoading: true}).subscribe({ next: info => { - this.setInfo(info); + this.info.set(info); + this.state.keep(info); this.refreshing.set(false); }, error: () => this.refreshing.set(false) @@ -276,12 +257,6 @@ export class LicenseHomeComponent { window.open(PLANS_URL, '_blank'); } - private setInfo(info: SubscriptionInfo): void { - this.info.set(info); - this.load.keepRead(this.card.id, info); - this.readAt.set(Date.now()); - } - private limit(info: SubscriptionInfo, itemType: UsageItemType, used: number, max: number, addEnabled: boolean, label = usageItemTypeTranslationMap.get(itemType)): LicenseLimit | null { if (max == null || max < 0) { diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/mobile-app-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/mobile-app-home.component.html index 92d423fc7c..fea3e77ea7 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/mobile-app-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/mobile-app-home.component.html @@ -4,8 +4,8 @@ SPDX-License-Identifier: BUSL-1.1 --> - + @if (settings()) {
    @@ -16,10 +16,10 @@
    {{ 'home.load.qr-failed' | translate }} - +
    } @else { - + } @if (badges()) {
    diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/mobile-app-home.component.scss b/ui-ngx/src/app/modules/home/pages/home-page/components/mobile-app-home.component.scss index c5bd51bacd..89e87d7bb2 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/mobile-app-home.component.scss +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/mobile-app-home.component.scss @@ -1,5 +1,7 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 +@use './home-load'; + :host { display: block; min-width: 0; @@ -39,22 +41,6 @@ height: 100%; } - &.loading { - position: relative; - overflow: hidden; - border-radius: 8px; - background: rgba(0, 0, 0, 0.06); - - &::after { - content: ''; - position: absolute; - inset: 0 auto 0 0; - width: 300%; - background: linear-gradient(90deg, transparent 33.3%, rgba(255, 255, 255, 0.8) 50%, transparent 66.7%); - transform: translateX(-66.667%); - animation: tb-app-qr-shimmer var(--loop-shimmer, 2.4s) linear 400ms infinite; - } - } &.failed { display: flex; @@ -78,28 +64,10 @@ } } -.tb-app-qr-retry { - padding: 0; - border: none; - background: none; - font: inherit; - color: var(--tb-primary-500, #305680); - cursor: pointer; -} - -@keyframes tb-app-qr-shimmer { - from { - transform: translateX(-66.667%); - } - to { - transform: none; - } -} - -@media (prefers-reduced-motion: reduce) { - .tb-app-qr.loading::after { - display: none; - } +.tb-app-qr-skeleton { + flex: none; + width: 96px; + height: 96px; } .tb-store-badges { diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/mobile-app-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-page/components/mobile-app-home.component.ts index 85f736f008..ca644543be 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/mobile-app-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/mobile-app-home.component.ts @@ -30,10 +30,9 @@ export class MobileAppHomeComponent { readonly qrFailed = signal(false); - private readonly load = inject(HomeLoadService); - readonly reading = signal(false); - readonly failed = signal(false); - readonly readAt = signal(null); + readonly state = inject(HomeLoadService).reader(this.card.id, + () => this.mobileAppService.getMergedMobileAppSettings({ignoreLoading: true, ignoreErrors: true}), + settings => this.settings.set(settings)); readonly badges = computed(() => { const settings = this.settings(); @@ -52,12 +51,8 @@ export class MobileAppHomeComponent { private destroyed = false; constructor() { - const last = this.load.lastRead(this.card.id); - if (last) { - this.settings.set(last); - this.readAt.set(this.load.readAt(this.card.id)); - } - this.read(); + this.state.start(); + this.loadDeepLink(); inject(DestroyRef).onDestroy(() => { this.destroyed = true; clearTimeout(this.deepLinkTimer); @@ -65,20 +60,7 @@ export class MobileAppHomeComponent { } read(): void { - this.reading.set(true); - this.failed.set(false); - this.mobileAppService.getMergedMobileAppSettings({ignoreLoading: true, ignoreErrors: true}).subscribe({ - next: settings => { - this.settings.set(settings); - this.load.keepRead(this.card.id, settings); - this.readAt.set(Date.now()); - this.reading.set(false); - }, - error: () => { - this.failed.set(true); - this.reading.set(false); - } - }); + this.state.read(); if (!this.qrCode()) { this.loadDeepLink(); } diff --git a/ui-ngx/src/app/modules/home/pages/home-page/components/notifications-home.component.html b/ui-ngx/src/app/modules/home/pages/home-page/components/notifications-home.component.html index 881833c979..4bcb95bc77 100644 --- a/ui-ngx/src/app/modules/home/pages/home-page/components/notifications-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-page/components/notifications-home.component.html @@ -5,7 +5,7 @@ --> + [hasData]="loaded()" [reading]="!loaded()" [keepHeight]="!expanded()" (retry)="refresh()"> @if (loaded() && rows().length) { } @else { -