From 9618b5b1e363a5b6821ef8a1197fd2bf970c5147 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Mon, 23 Nov 2026 19:19:36 +0200 Subject: [PATCH] feat: the Home Devices card: the count of all devices and the Inactive and Active tiles from entity counts; the list from entity data subscriptions on the device state keys (attributes or time series, as the platform keeps them), inactive first with the most recently silent on top, then the devices that never connected, then the active, reversible and sortable by name; a device opens its details page and View all and Add device keep their filter and action. The Home cards share their tiles, table, empty state and Add button styles. A dynamic entity data subscription now also sends the entity fields that changed (a renamed device) when its entities stay the same --- .../subscription/TbAbstractDataSubCtx.java | 4 + .../subscription/TbEntityDataSubCtx.java | 33 ++ .../home/components/_home-table.scss | 121 ++++++ .../home/components/_home-tiles.scss | 281 ++++++++++++++ .../components/alarms-home.component.html | 24 +- .../components/alarms-home.component.scss | 279 +------------- .../components/dashboards-home.component.html | 18 +- .../components/dashboards-home.component.scss | 147 +------- .../components/devices-home.component.html | 96 +++++ .../components/devices-home.component.scss | 118 ++++++ .../home/components/devices-home.component.ts | 344 +++++++++++++++++- .../home-list-footer.component.scss | 8 +- .../assets/locale/locale.constant-en_US.json | 24 ++ 13 files changed, 1056 insertions(+), 441 deletions(-) create mode 100644 ui-ngx/src/app/modules/home/pages/home-links/home/components/_home-table.scss create mode 100644 ui-ngx/src/app/modules/home/pages/home-links/home/components/_home-tiles.scss create mode 100644 ui-ngx/src/app/modules/home/pages/home-links/home/components/devices-home.component.html create mode 100644 ui-ngx/src/app/modules/home/pages/home-links/home/components/devices-home.component.scss diff --git a/application/src/main/java/org/thingsboard/server/service/subscription/TbAbstractDataSubCtx.java b/application/src/main/java/org/thingsboard/server/service/subscription/TbAbstractDataSubCtx.java index 6306ad7ab3..10db008227 100644 --- a/application/src/main/java/org/thingsboard/server/service/subscription/TbAbstractDataSubCtx.java +++ b/application/src/main/java/org/thingsboard/server/service/subscription/TbAbstractDataSubCtx.java @@ -66,6 +66,9 @@ public abstract class TbAbstractDataSubCtx newDataMap) { + } + @Override protected synchronized void update() { PageData newData = findEntityData(); @@ -78,6 +81,7 @@ public abstract class TbAbstractDataSubCtx newDataMap = newData.getData().stream().collect(Collectors.toMap(EntityData::getEntityId, Function.identity(), (a, b) -> a)); if (oldDataMap.size() == newDataMap.size() && oldDataMap.keySet().equals(newDataMap.keySet())) { log.trace("[{}][{}] No updates to entity data found", sessionRef.getSessionId(), cmdId); + onSameEntities(newDataMap); } else { this.data = newData; doUpdate(newDataMap); diff --git a/application/src/main/java/org/thingsboard/server/service/subscription/TbEntityDataSubCtx.java b/application/src/main/java/org/thingsboard/server/service/subscription/TbEntityDataSubCtx.java index 1197da0d09..fa599ecac0 100644 --- a/application/src/main/java/org/thingsboard/server/service/subscription/TbEntityDataSubCtx.java +++ b/application/src/main/java/org/thingsboard/server/service/subscription/TbEntityDataSubCtx.java @@ -3,6 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 AND BUSL-1.1 package org.thingsboard.server.service.subscription; +import java.util.Objects; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -177,6 +178,38 @@ public class TbEntityDataSubCtx extends TbAbstractDataSubCtx { }); } + @Override + protected void onSameEntities(Map newDataMap) { + List changed = new ArrayList<>(); + for (EntityData current : data.getData()) { + EntityData fresh = newDataMap.get(current.getEntityId()); + Map freshFields = fresh != null && fresh.getLatest() != null ? fresh.getLatest().get(EntityKeyType.ENTITY_FIELD) : null; + if (freshFields == null || freshFields.isEmpty() || current.getLatest() == null) { + continue; + } + if (!sameFieldValues(current.getLatest().get(EntityKeyType.ENTITY_FIELD), freshFields)) { + current.getLatest().put(EntityKeyType.ENTITY_FIELD, freshFields); + changed.add(new EntityData(current.getEntityId(), false, false, Map.of(EntityKeyType.ENTITY_FIELD, freshFields), null)); + } + } + if (!changed.isEmpty()) { + sendWsMsg(new EntityDataUpdate(cmdId, null, changed, maxEntitiesPerDataSubscription)); + } + } + + private static boolean sameFieldValues(Map current, Map fresh) { + if (current == null || current.size() != fresh.size()) { + return false; + } + for (Map.Entry entry : fresh.entrySet()) { + TsValue value = current.get(entry.getKey()); + if (value == null || !Objects.equals(value.getValue(), entry.getValue().getValue())) { + return false; + } + } + return true; + } + @Override public synchronized void doUpdate(Map newDataMap) { this.updateLatestTsData(this.data); diff --git a/ui-ngx/src/app/modules/home/pages/home-links/home/components/_home-table.scss b/ui-ngx/src/app/modules/home/pages/home-links/home/components/_home-table.scss new file mode 100644 index 0000000000..753e355875 --- /dev/null +++ b/ui-ngx/src/app/modules/home/pages/home-links/home/components/_home-table.scss @@ -0,0 +1,121 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +.tb-home-table { + width: 100%; + border-collapse: collapse; + + th { + height: 32px; + padding: 0 12px 0 0; + border-bottom: 1px solid var(--tb-line, rgba(0, 0, 0, 0.12)); + font: 400 12px/16px var(--tb-font, Roboto, sans-serif); + letter-spacing: 0.25px; + text-align: left; + white-space: nowrap; + color: var(--tb-text-muted, rgba(0, 0, 0, 0.56)); + } + + .th-label { + display: inline-flex; + align-items: center; + gap: 4px; + margin: 0; + padding: 0; + border: 0; + background: none; + font: inherit; + letter-spacing: inherit; + color: inherit; + cursor: pointer; + user-select: none; + + &:hover { + color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); + + .tb-sort-icon { + opacity: .6; + } + } + + &:focus-visible { + outline: 2px solid var(--tb-primary-500); + outline-offset: 2px; + border-radius: 2px; + } + } + + .tb-sort-icon { + width: 16px; + height: 16px; + font-size: 16px; + opacity: 0; + color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); + transition: opacity .15s ease; + } + + th.sorted .tb-sort-icon { + opacity: 1; + } + + td { + height: 36px; + padding: 0 12px 0 0; + border-bottom: 1px solid rgba(0, 0, 0, 0.06); + font: 400 14px/20px var(--tb-font, Roboto, sans-serif); + letter-spacing: 0.2px; + vertical-align: middle; + white-space: nowrap; + font-variant-numeric: tabular-nums; + color: var(--tb-ink, rgba(0, 0, 0, 0.87)); + } + + tbody tr { + cursor: pointer; + + &:last-child td { + border-bottom: none; + } + + &:hover td { + background: rgba(0, 0, 0, 0.02); + } + } + + .col-time { + text-align: right; + } + + td.col-time { + color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); + } + + th.col-time .th-label { + flex-direction: row-reverse; + } +} + +.tb-home-cell-link { + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + color: var(--tb-ink, rgba(0, 0, 0, 0.87)); + text-decoration: none; + + &, &:hover, &:focus, &:active { + border-bottom: none; + } + + &:hover { + text-decoration: underline; + } +} + +.tb-home-sr-only { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip: rect(0 0 0 0); + white-space: nowrap; +} diff --git a/ui-ngx/src/app/modules/home/pages/home-links/home/components/_home-tiles.scss b/ui-ngx/src/app/modules/home/pages/home-links/home/components/_home-tiles.scss new file mode 100644 index 0000000000..2e07ca4dbe --- /dev/null +++ b/ui-ngx/src/app/modules/home/pages/home-links/home/components/_home-tiles.scss @@ -0,0 +1,281 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +.tb-home-tiles { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +.tb-home-tile { + --tb-sel: var(--tb-ink-76, rgba(0, 0, 0, 0.76)); + position: relative; + display: flex; + flex: 0 0 auto; + flex-direction: column; + justify-content: space-evenly; + box-sizing: border-box; + width: 104px; + min-width: 0; + margin: 0; + padding: 5px 10px; + border: 1px solid rgba(0, 0, 0, 0.10); + border-radius: var(--tb-tile-radius, 10px); + background: #fff; + text-align: left; + color: inherit; + cursor: pointer; + transition: border-color .15s ease, background-color .15s ease; + + &:hover { + border-color: rgba(0, 0, 0, 0.22); + } + + &:focus-visible { + outline: 2px solid var(--tb-primary-500); + outline-offset: 2px; + } + + &[aria-pressed="true"], &[aria-pressed="true"]:hover { + padding-left: 8px; + border-color: transparent; + border-left: 3px solid var(--tb-sel); + border-radius: 0 var(--tb-tile-radius, 10px) var(--tb-tile-radius, 10px) 0; + background: color-mix(in srgb, var(--tb-sel) 6%, #fff); + + .tb-home-tile-label { + color: var(--tb-ink, rgba(0, 0, 0, 0.87)); + } + } + + &.can-reset { + .tb-home-tile-label { + padding-right: 16px; + } + + &::after { + content: 'close'; + position: absolute; + top: 4px; + right: 4px; + width: 20px; + height: 20px; + border-radius: 50%; + font-family: 'Material Icons'; + font-size: 16px; + line-height: 20px; + text-align: center; + font-feature-settings: 'liga'; + color: var(--tb-ink-54, rgba(0, 0, 0, 0.54)); + } + + &:hover::after { + background: #fff; + color: var(--tb-ink, rgba(0, 0, 0, 0.87)); + } + } + + &.zero { + .tb-home-tile-count { + color: var(--tb-ink-38, rgba(0, 0, 0, 0.38)); + } + + &:disabled { + cursor: default; + + &:hover { + border-color: rgba(0, 0, 0, 0.10); + } + } + } +} + +.tb-home-tile-label { + overflow: hidden; + font: 400 14px/20px var(--tb-font, Roboto, sans-serif); + letter-spacing: 0.1px; + white-space: nowrap; + text-overflow: ellipsis; + color: var(--tb-ink-76, rgba(0, 0, 0, 0.76)); +} + +.tb-home-tile-count { + display: flex; + align-items: center; + gap: 6px; + font: 500 20px/28px var(--tb-font, Roboto, sans-serif); + white-space: nowrap; + font-variant-numeric: tabular-nums; + color: var(--tb-ink, rgba(0, 0, 0, 0.87)); +} + +.tb-home-all-clear { + display: flex; + 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-all-clear-glyph { + display: inline-flex; + flex: none; + align-items: center; + justify-content: center; + width: 36px; + height: 36px; + border-radius: 50%; + background: var(--tb-ok-tint, rgba(25, 128, 56, 0.08)); + color: var(--tb-ok, #198038); + + .mat-icon { + width: 20px; + height: 20px; + font-size: 20px; + color: inherit; + } +} + +.tb-home-empty-note { + padding: 4px 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)); +} + +@container (max-width: 459px) { + .tb-home-tile { + flex: 1 1 88px; + width: auto; + max-width: 140px; + padding-left: 8px; + padding-right: 8px; + } + + .tb-home-tile-label { + letter-spacing: 0; + } +} + +.tb-home-setup-empty { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 8px; + padding: 8px 16px 12px; + text-align: center; +} + +.tb-home-setup-empty-glyph { + display: inline-flex; + flex: none; + align-items: center; + justify-content: center; + width: 44px; + height: 44px; + border-radius: 50%; + background: color-mix(in srgb, var(--tb-primary-500) 10%, transparent); + color: var(--tb-primary-500); + + .mat-icon { + width: 20px; + height: 20px; + font-size: 20px; + color: inherit; + } +} + +.tb-home-setup-empty-text { + display: flex; + flex-direction: column; + gap: 4px; + min-width: 0; + + p { + max-width: 36em; + margin: 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-setup-empty-title { + font: 500 14px/20px var(--tb-font, Roboto, sans-serif); + letter-spacing: 0.25px; + color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); +} + +.tb-home-setup-empty-actions { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: center; + gap: 4px 16px; + font: 400 14px/20px var(--tb-font, Roboto, sans-serif); + + a { + border-radius: 4px; + text-decoration: underline; + text-decoration-thickness: 1px; + text-underline-offset: 3px; + text-decoration-color: transparent; + color: var(--tb-primary-500); + transition: text-decoration-color .15s ease; + + &, &:hover, &:focus, &:active { + border-bottom: none; + } + + &:hover { + text-decoration-color: currentColor; + } + + &:focus-visible { + outline: 2px solid var(--tb-primary-500); + outline-offset: 2px; + } + } +} + +.tb-home-ext { + width: 14px; + height: 14px; + margin-left: 2px; + font-size: 14px; + line-height: 14px; + vertical-align: -2px; + opacity: .7; +} + +.tb-home-add.mat-mdc-button { + &, &:hover, &:focus, &:active { + border-bottom: none; + } + + .mat-icon { + margin-right: 6px; + } +} + +@container (max-width: 459px) { + .tb-home-add.mat-mdc-button { + min-width: 40px; + padding: 0 8px; + + .mat-icon { + margin: 0; + } + + .tb-home-add-label { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip: rect(0 0 0 0); + white-space: nowrap; + } + } +} diff --git a/ui-ngx/src/app/modules/home/pages/home-links/home/components/alarms-home.component.html b/ui-ngx/src/app/modules/home/pages/home-links/home/components/alarms-home.component.html index 1565807801..4dbb892b91 100644 --- a/ui-ngx/src/app/modules/home/pages/home-links/home/components/alarms-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-links/home/components/alarms-home.component.html @@ -10,28 +10,28 @@ } @if (tenantAdmin) { - } @if (total() === 0) { -
- +
+ {{ 'home.alarms.no-active' | translate }} {{ 'home.alarms.view-cleared' | translate }}
} @else if (total()) { -
+
@for (tile of tiles(); track tile.severity) { -
@if (rows().length) { - +
- - + @if (!mine()) {
@@ -52,7 +52,7 @@ {{ 'home.alarms.type' | translate }} {{ 'home.alarms.originator' | translate }} + {{ row.alarm.originatorDisplayName || row.alarm.originatorName }} {{ row.ago }}{{ row.ago }} @if (row.assigneeName) { @@ -127,7 +127,7 @@
} @else if (alarmsLoaded()) { -
{{ emptyNote().key | translate: emptyNote().params }}
+
{{ emptyNote().key | translate: emptyNote().params }}
} diff --git a/ui-ngx/src/app/modules/home/pages/home-links/home/components/alarms-home.component.scss b/ui-ngx/src/app/modules/home/pages/home-links/home/components/alarms-home.component.scss index 1265051ed7..da550c4cfd 100644 --- a/ui-ngx/src/app/modules/home/pages/home-links/home/components/alarms-home.component.scss +++ b/ui-ngx/src/app/modules/home/pages/home-links/home/components/alarms-home.component.scss @@ -1,46 +1,14 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 +@use './home-tiles'; +@use './home-table'; + :host { display: block; min-width: 0; container: tb-alarms-home / inline-size; } -.tb-alarms-add.mat-mdc-button { - .mat-icon { - margin-right: 6px; - } -} - -.tb-alarms-clear { - display: flex; - 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-alarms-clear-glyph { - display: inline-flex; - flex: none; - align-items: center; - justify-content: center; - width: 36px; - height: 36px; - border-radius: 50%; - background: var(--tb-ok-tint, rgba(25, 128, 56, 0.08)); - color: var(--tb-ok, #198038); - - .mat-icon { - width: 20px; - height: 20px; - font-size: 20px; - color: inherit; - } -} - .tb-alarms-clear-link, .tb-alarms-link { &, &:hover, &:focus, &:active { border-bottom: none; @@ -52,117 +20,11 @@ color: var(--tb-primary-500); } -.tb-alarms-tiles { - display: flex; - flex-wrap: wrap; - gap: 8px; -} - -.tb-alarms-tile { - --tb-sel: var(--tb-ink-76, rgba(0, 0, 0, 0.76)); - position: relative; - display: flex; - flex: 0 0 auto; - flex-direction: column; - justify-content: space-evenly; - box-sizing: border-box; - width: 104px; - min-width: 0; - margin: 0; - padding: 5px 10px; - border: 1px solid rgba(0, 0, 0, 0.10); - border-radius: var(--tb-tile-radius, 10px); - background: #fff; - text-align: left; - color: inherit; - cursor: pointer; - transition: border-color .15s ease, background-color .15s ease; - +.tb-home-tile { &.critical { --tb-sel: var(--tb-sev-critical, #D12730); } &.major { --tb-sel: var(--tb-sev-major, #F35E09); } &.minor { --tb-sel: var(--tb-sev-minor, #B47604); } &.warning { --tb-sel: var(--tb-sev-warning, #B47604); } - - &:hover { - border-color: rgba(0, 0, 0, 0.22); - } - - &:focus-visible { - outline: 2px solid var(--tb-primary-500); - outline-offset: 2px; - } - - &[aria-pressed="true"], &[aria-pressed="true"]:hover { - padding-left: 8px; - border-color: transparent; - border-left: 3px solid var(--tb-sel); - border-radius: 0 var(--tb-tile-radius, 10px) var(--tb-tile-radius, 10px) 0; - background: color-mix(in srgb, var(--tb-sel) 6%, #fff); - - .tb-alarms-tile-label { - color: var(--tb-ink, rgba(0, 0, 0, 0.87)); - } - } - - &.can-reset { - .tb-alarms-tile-label { - padding-right: 16px; - } - - &::after { - content: 'close'; - position: absolute; - top: 4px; - right: 4px; - width: 20px; - height: 20px; - border-radius: 50%; - font-family: 'Material Icons'; - font-size: 16px; - line-height: 20px; - text-align: center; - font-feature-settings: 'liga'; - color: var(--tb-ink-54, rgba(0, 0, 0, 0.54)); - } - - &:hover::after { - background: #fff; - color: var(--tb-ink, rgba(0, 0, 0, 0.87)); - } - } - - &.zero { - .tb-alarms-tile-count { - color: var(--tb-ink-38, rgba(0, 0, 0, 0.38)); - } - - &:disabled { - cursor: default; - - &:hover { - border-color: rgba(0, 0, 0, 0.10); - } - } - } -} - -.tb-alarms-tile-label { - overflow: hidden; - font: 400 14px/20px var(--tb-font, Roboto, sans-serif); - letter-spacing: 0.1px; - white-space: nowrap; - text-overflow: ellipsis; - color: var(--tb-ink-76, rgba(0, 0, 0, 0.76)); -} - -.tb-alarms-tile-count { - display: flex; - align-items: center; - gap: 6px; - font: 500 20px/28px var(--tb-font, Roboto, sans-serif); - white-space: nowrap; - font-variant-numeric: tabular-nums; - color: var(--tb-ink, rgba(0, 0, 0, 0.87)); } .tb-alarms-tile-mark ::ng-deep svg { @@ -171,88 +33,8 @@ } .tb-alarms-table { - width: 100%; - border-collapse: collapse; - - th { - height: 32px; - padding: 0 12px 0 0; - border-bottom: 1px solid var(--tb-line, rgba(0, 0, 0, 0.12)); - font: 400 12px/16px var(--tb-font, Roboto, sans-serif); - letter-spacing: 0.25px; - text-align: left; - white-space: nowrap; - color: var(--tb-text-muted, rgba(0, 0, 0, 0.56)); - } - - .th-label { - display: inline-flex; - align-items: center; - gap: 4px; - margin: 0; - padding: 0; - border: 0; - background: none; - font: inherit; - letter-spacing: inherit; - color: inherit; - cursor: pointer; - user-select: none; - - &:hover { - color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); - - .tb-sort-icon { - opacity: .6; - } - } - - &:focus-visible { - outline: 2px solid var(--tb-primary-500); - outline-offset: 2px; - border-radius: 2px; - } - } - - .tb-sort-icon { - width: 16px; - height: 16px; - font-size: 16px; - opacity: 0; - color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); - transition: opacity .15s ease; - } - - th.sorted .tb-sort-icon { - opacity: 1; - } - - td { - height: 36px; - padding: 0 12px 0 0; - border-bottom: 1px solid rgba(0, 0, 0, 0.06); - font: 400 14px/20px var(--tb-font, Roboto, sans-serif); - letter-spacing: 0.2px; - vertical-align: middle; - white-space: nowrap; - font-variant-numeric: tabular-nums; - color: var(--tb-ink, rgba(0, 0, 0, 0.87)); - } - - tbody tr { - cursor: pointer; - - &:last-child td { - border-bottom: none; - } - - &:hover td { - background: rgba(0, 0, 0, 0.02); - } - - &:is(:hover, :focus-within) .tb-alarms-assign { - visibility: visible; - } + tbody tr:is(:hover, :focus-within) .tb-alarms-assign { + visibility: visible; } td.col-type .tb-alarms-cell-main { @@ -270,18 +52,6 @@ color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); } - td.col-age { - color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); - } - - .col-age { - text-align: right; - } - - th.col-age .th-label { - flex-direction: row-reverse; - } - .col-assignee, .col-ack { width: 1%; padding-left: 8px; @@ -428,13 +198,6 @@ color: var(--tb-ink-54, rgba(0, 0, 0, 0.54)); } -.tb-alarms-empty-note { - padding: 4px 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)); -} - @container tb-alarms-home (max-width: 599px) { .tb-alarms-table { .col-origin { @@ -512,34 +275,4 @@ .tb-alarms-sub-age { display: inline; } - - .tb-alarms-tile { - flex: 1 1 88px; - width: auto; - max-width: 140px; - padding-left: 8px; - padding-right: 8px; - } - - .tb-alarms-tile-label { - letter-spacing: 0; - } - - .tb-alarms-add.mat-mdc-button { - min-width: 40px; - padding: 0 8px; - - .mat-icon { - margin: 0; - } - } - - .tb-alarms-add-label { - position: absolute; - width: 1px; - height: 1px; - overflow: hidden; - clip: rect(0 0 0 0); - white-space: nowrap; - } } diff --git a/ui-ngx/src/app/modules/home/pages/home-links/home/components/dashboards-home.component.html b/ui-ngx/src/app/modules/home/pages/home-links/home/components/dashboards-home.component.html index af286abf9b..dbec972563 100644 --- a/ui-ngx/src/app/modules/home/pages/home-links/home/components/dashboards-home.component.html +++ b/ui-ngx/src/app/modules/home/pages/home-links/home/components/dashboards-home.component.html @@ -10,26 +10,26 @@ } @if (canAdd) { - + add - {{ 'home.dashboards.add' | translate }} + {{ 'home.dashboards.add' | translate }} } @if (loaded()) { @if (!total()) { -
- +
+ @if (tenantAdmin) { -
+

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

- } @else { -
{{ 'home.dashboards.none-assigned' | translate }}
+
{{ 'home.dashboards.none-assigned' | translate }}
}
} @else { @@ -60,7 +60,7 @@ } @else { -
{{ (tab() === 'last' ? 'home.dashboards.none-viewed' : 'home.dashboards.none-starred') | translate }}
+
{{ (tab() === 'last' ? 'home.dashboards.none-viewed' : 'home.dashboards.none-starred') | translate }}
} @if (tab() === 'starred') {
diff --git a/ui-ngx/src/app/modules/home/pages/home-links/home/components/dashboards-home.component.scss b/ui-ngx/src/app/modules/home/pages/home-links/home/components/dashboards-home.component.scss index d284b6434f..e302bc336a 100644 --- a/ui-ngx/src/app/modules/home/pages/home-links/home/components/dashboards-home.component.scss +++ b/ui-ngx/src/app/modules/home/pages/home-links/home/components/dashboards-home.component.scss @@ -1,21 +1,14 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 +@use './home-tiles'; +@use './home-table'; + :host { display: block; min-width: 0; container: tb-dashboards-home / inline-size; } -.tb-dashboards-add.mat-mdc-button { - &, &:hover, &:focus, &:active { - border-bottom: none; - } - - .mat-icon { - margin-right: 6px; - } -} - .tb-dashboards-table { width: 100%; border-collapse: collapse; @@ -65,13 +58,13 @@ white-space: nowrap; a { + color: var(--tb-ink, rgba(0, 0, 0, 0.87)); + text-decoration: none; + &, &:hover, &:focus, &:active { border-bottom: none; } - color: var(--tb-ink, rgba(0, 0, 0, 0.87)); - text-decoration: none; - &:hover { text-decoration: underline; } @@ -127,13 +120,6 @@ } } -.tb-dashboards-empty-note { - padding: 4px 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-dashboards-picker { position: relative; } @@ -316,124 +302,3 @@ font-size: 13px; color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); } - -.tb-dashboards-empty { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - gap: 8px; - padding: 8px 16px 12px; - text-align: center; -} - -.tb-dashboards-empty-glyph { - display: inline-flex; - flex: none; - align-items: center; - justify-content: center; - width: 44px; - height: 44px; - border-radius: 50%; - background: color-mix(in srgb, var(--tb-primary-500) 10%, transparent); - color: var(--tb-primary-500); - - .mat-icon { - width: 20px; - height: 20px; - font-size: 20px; - color: inherit; - } -} - -.tb-dashboards-empty-text { - display: flex; - flex-direction: column; - gap: 4px; - min-width: 0; - - p { - max-width: 36em; - margin: 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-dashboards-empty-title { - font: 500 14px/20px var(--tb-font, Roboto, sans-serif); - letter-spacing: 0.25px; - color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); -} - -.tb-dashboards-empty-actions { - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: center; - gap: 4px 16px; - font: 400 14px/20px var(--tb-font, Roboto, sans-serif); - - a { - &, &:hover, &:focus, &:active { - border-bottom: none; - } - - border-radius: 4px; - text-decoration: underline; - text-decoration-thickness: 1px; - text-underline-offset: 3px; - text-decoration-color: transparent; - color: var(--tb-primary-500); - transition: text-decoration-color .15s ease; - - &:hover { - text-decoration-color: currentColor; - } - - &:focus-visible { - outline: 2px solid var(--tb-primary-500); - outline-offset: 2px; - } - } -} - -.tb-dashboards-ext { - width: 14px; - height: 14px; - margin-left: 2px; - font-size: 14px; - line-height: 14px; - vertical-align: -2px; - opacity: .7; -} - -.tb-dashboards-sr { - position: absolute; - width: 1px; - height: 1px; - overflow: hidden; - clip: rect(0 0 0 0); - white-space: nowrap; -} - -@container tb-dashboards-home (max-width: 459px) { - .tb-dashboards-add.mat-mdc-button { - min-width: 40px; - padding: 0 8px; - - .mat-icon { - margin: 0; - } - } - - .tb-dashboards-add-label { - position: absolute; - width: 1px; - height: 1px; - overflow: hidden; - clip: rect(0 0 0 0); - white-space: nowrap; - } -} diff --git a/ui-ngx/src/app/modules/home/pages/home-links/home/components/devices-home.component.html b/ui-ngx/src/app/modules/home/pages/home-links/home/components/devices-home.component.html new file mode 100644 index 0000000000..ae70d1e231 --- /dev/null +++ b/ui-ngx/src/app/modules/home/pages/home-links/home/components/devices-home.component.html @@ -0,0 +1,96 @@ + + + + @if (canAdd) { + + add + {{ 'home.devices.add' | translate }} + + } + + @if (total() === 0) { +
+ + @if (tenantAdmin) { + + } @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 { + + } + + } + +
+ + {{ 'home.devices.profile' | translate }}{{ 'home.devices.state' | translate }} + +
+ {{ row.name }} + {{ row.profile }} + {{ row.profile }} + + {{ (row.active ? 'home.devices.active' : 'home.devices.inactive') | translate }} + + {{ row.ago }}{{ 'home.devices.never' | translate }}
+ } @else if (loaded()) { +
{{ ('home.devices.none-' + (filter() ?? 'active')) | translate }}
+ } + + } +
diff --git a/ui-ngx/src/app/modules/home/pages/home-links/home/components/devices-home.component.scss b/ui-ngx/src/app/modules/home/pages/home-links/home/components/devices-home.component.scss new file mode 100644 index 0000000000..a389b202f2 --- /dev/null +++ b/ui-ngx/src/app/modules/home/pages/home-links/home/components/devices-home.component.scss @@ -0,0 +1,118 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +@use './home-tiles'; +@use './home-table'; + +:host { + display: block; + min-width: 0; + container: tb-devices-home / inline-size; +} + +.tb-home-tile { + &.inactive:not(.zero) { + --tb-sel: var(--tb-crit, #D12730); + } + + &.active { + --tb-sel: var(--tb-ok, #198038); + } +} + +.tb-devices-table { + .tb-devices-cell-main { + display: flex; + min-width: 0; + max-width: 220px; + overflow: hidden; + text-overflow: ellipsis; + } + + td.col-profile { + max-width: 160px; + overflow: hidden; + text-overflow: ellipsis; + color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); + } + + .col-state { + white-space: nowrap; + } +} + +.tb-devices-cell-sub { + display: none; + overflow: hidden; + font-size: 12px; + line-height: 16px; + white-space: nowrap; + text-overflow: ellipsis; + color: var(--tb-text-secondary, rgba(0, 0, 0, 0.6)); +} + +.tb-devices-state { + display: inline-flex; + align-items: center; + gap: 6px; + font: 400 13px/20px var(--tb-font, Roboto, sans-serif); + color: var(--tb-ink-76, rgba(0, 0, 0, 0.76)); + + &::before { + content: ''; + box-sizing: border-box; + width: 8px; + height: 8px; + border-radius: 50%; + background: var(--tb-ink-38, rgba(0, 0, 0, 0.38)); + } + + &.active::before { + background: var(--tb-ok, #198038); + } + + &.inactive::before { + border: 2px solid var(--tb-crit, #D12730); + background: transparent; + } +} + +.tb-devices-never { + color: var(--tb-text-muted, rgba(0, 0, 0, 0.56)); +} + +@container tb-devices-home (max-width: 599px) { + .tb-devices-state { + gap: 0; + } + + .tb-devices-state-word, .tb-devices-table th.col-state .th-text { + position: absolute; + width: 1px; + height: 1px; + overflow: hidden; + clip: rect(0 0 0 0); + white-space: nowrap; + } +} + +@container tb-devices-home (max-width: 459px) { + .tb-devices-table { + .col-profile { + display: none; + } + + td.col-name { + width: 99%; + padding-top: 6px; + padding-bottom: 6px; + } + + .tb-devices-cell-main { + max-width: none; + } + } + + .tb-devices-cell-sub { + display: block; + } +} diff --git a/ui-ngx/src/app/modules/home/pages/home-links/home/components/devices-home.component.ts b/ui-ngx/src/app/modules/home/pages/home-links/home/components/devices-home.component.ts index 1b7489f283..e88070962b 100644 --- a/ui-ngx/src/app/modules/home/pages/home-links/home/components/devices-home.component.ts +++ b/ui-ngx/src/app/modules/home/pages/home-links/home/components/devices-home.component.ts @@ -1,16 +1,356 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 -import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { + ChangeDetectionStrategy, + Component, + computed, + DestroyRef, + effect, + inject, + NgZone, + signal, + untracked, + WritableSignal +} from '@angular/core'; +import { Router } from '@angular/router'; +import { Store } from '@ngrx/store'; +import { TranslateService } from '@ngx-translate/core'; +import { take } from 'rxjs/operators'; +import { AppState } from '@core/core.state'; +import { getCurrentAuthUser, selectPersistDeviceStateToTelemetry } from '@core/auth/auth.selectors'; +import { TelemetryWebsocketService } from '@core/ws/telemetry-websocket.service'; +import { UserPermissionsService } from '@core/http/user-permissions.service'; +import { EntityCountCmd, EntityDataCmd, TelemetrySubscriber } from '@shared/models/telemetry/telemetry.models'; +import { AliasFilterType } from '@shared/models/alias.models'; +import { EntityType } from '@shared/models/entity-type.models'; +import { + BooleanOperation, + EntityData, + EntityDataPageLink, + EntityKey, + EntityKeyType, + EntityKeyValueType, + FilterPredicateType, + KeyFilter, + NumericOperation +} from '@shared/models/query/query.models'; +import { Direction } from '@shared/models/page/sort-order'; +import { Authority } from '@shared/models/authority.enum'; +import { Operation, Resource } from '@shared/models/security.models'; +import { HelpLinks } from '@shared/models/constants'; import { HomeCardId } from '@shared/models/user-settings.models'; +import { getEntityDetailsPageURL } from '@core/utils'; import { HOME_CARDS } from '@home/pages/home-links/home/home-cards.models'; +import { homeAgo, homeListPageSize, homeListShown } from '@home/pages/home-links/home/home-list.models'; + +type DeviceState = 'inactive' | 'active'; +type DeviceSortKey = 'last' | 'name'; + +const MINUTE = 60000; + +interface DeviceQuery { + state: DeviceState | null; + sortKey: EntityKey; + direction: Direction; + withActivity?: boolean; + neverConnected?: boolean; + counted: boolean; +} + +interface DeviceTile { + state: DeviceState; + count: number; + pressed: boolean; +} + +export interface DeviceHomeRow { + id: string; + name: string; + profile: string; + active: boolean; + lastActivity: number | null; + ago: string; + url: string; +} @Component({ selector: 'tb-devices-home', - template: ``, + templateUrl: './devices-home.component.html', + styleUrls: ['./devices-home.component.scss'], standalone: false, changeDetection: ChangeDetectionStrategy.OnPush }) export class DevicesHomeComponent { readonly card = HOME_CARDS[HomeCardId.DEVICES]; + + readonly howToLink = HelpLinks.linksMap.devices; + + private telemetryWsService = inject(TelemetryWebsocketService); + private zone = inject(NgZone); + private store = inject(Store); + private router = inject(Router); + private translate = inject(TranslateService); + private userPermissions = inject(UserPermissionsService); + + private readonly authUser = getCurrentAuthUser(this.store); + readonly tenantAdmin = this.authUser?.authority === Authority.TENANT_ADMIN; + readonly canAdd = this.tenantAdmin && this.userPermissions.hasGenericPermission(Resource.DEVICE, Operation.CREATE); + + readonly filter = signal(null); + readonly expanded = signal(false); + readonly sortKey = signal('last'); + readonly sortDesc = signal(true); + + readonly total = signal(null); + readonly inactive = signal(null); + readonly active = signal(null); + + private readonly stateKeyType = signal(null); + private readonly lists = signal<(EntityData[] | null)[]>([]); + private readonly listTotals = signal([]); + private readonly now = signal(Date.now()); + + private countSubscribers: TelemetrySubscriber[] = []; + private dataSubscribers: TelemetrySubscriber[] = []; + + readonly tiles = computed(() => { + const filter = this.filter(); + return [ + {state: 'inactive', count: this.inactive() ?? 0, pressed: filter === 'inactive'}, + {state: 'active', count: this.active() ?? 0, pressed: filter === 'active'} + ]; + }); + + readonly allActive = computed(() => !this.filter() && this.inactive() === 0 && !!this.total()); + + readonly loaded = computed(() => this.lists().length > 0 && this.lists().every(list => list !== null)); + + readonly listed = computed(() => this.listTotals().reduce((sum, count, index) => + this.listQueries[index]?.counted ? sum + count : sum, 0)); + + private listQueries: DeviceQuery[] = []; + + readonly rows = computed(() => { + const keyType = this.stateKeyType(); + const now = this.now(); + const merged = this.lists().flatMap((list, index) => { + const rows = list ?? []; + return this.listQueries[index]?.neverConnected && keyType + ? rows.filter(data => !Number(data.latest?.[keyType]?.lastActivityTime?.value)) + : rows; + }); + return merged.slice(0, homeListShown(this.listed(), this.expanded())).map(data => this.toRow(data, keyType, now)); + }); + + readonly viewAllParams = computed(() => { + const filter = this.filter(); + return filter ? {active: filter === 'active'} : null; + }); + + private readonly queries = computed(() => { + const keyType = this.stateKeyType(); + if (!keyType) { + return []; + } + const filter = this.filter(); + const desc = this.sortDesc(); + if (this.sortKey() === 'name') { + return [{state: filter, sortKey: {type: EntityKeyType.ENTITY_FIELD, key: 'name'}, direction: desc ? Direction.DESC : Direction.ASC, counted: true}]; + } + const lastActivity: EntityKey = {type: keyType, key: 'lastActivityTime'}; + const silent: DeviceQuery = {state: 'inactive', sortKey: lastActivity, direction: desc ? Direction.DESC : Direction.ASC, + withActivity: true, counted: false}; + const never: DeviceQuery = {state: 'inactive', sortKey: lastActivity, direction: Direction.DESC, neverConnected: true, counted: true}; + const active: DeviceQuery = {state: 'active', sortKey: lastActivity, direction: desc ? Direction.ASC : Direction.DESC, counted: true}; + const inactive = desc ? [silent, never] : [never, silent]; + if (filter === 'inactive') { + return inactive; + } + if (filter === 'active') { + return [active]; + } + return desc ? [...inactive, active] : [active, ...inactive]; + }); + + constructor() { + this.store.select(selectPersistDeviceStateToTelemetry).pipe(take(1)).subscribe(persisted => { + const keyType = persisted ? EntityKeyType.TIME_SERIES : EntityKeyType.SERVER_ATTRIBUTE; + this.countSubscribers = [ + this.subscribeCount(this.total), + this.subscribeCount(this.inactive, this.activeFilter(keyType, false)), + this.subscribeCount(this.active, this.activeFilter(keyType, true)) + ]; + this.stateKeyType.set(keyType); + }); + effect(() => { + const queries = this.queries(); + const pageSize = homeListPageSize(this.expanded()); + untracked(() => this.subscribeLists(queries, pageSize)); + }); + const tick = setInterval(() => this.now.set(Date.now()), MINUTE); + inject(DestroyRef).onDestroy(() => { + clearInterval(tick); + this.countSubscribers.forEach(subscriber => subscriber.unsubscribe()); + this.dataSubscribers.forEach(subscriber => subscriber.unsubscribe()); + }); + } + + pick(tile: DeviceTile): void { + if (tile.count || tile.pressed) { + this.filter.set(tile.pressed ? null : tile.state); + } + } + + sortBy(key: DeviceSortKey): void { + if (this.sortKey() === key) { + this.sortDesc.set(!this.sortDesc()); + } else { + this.sortKey.set(key); + this.sortDesc.set(key === 'last'); + } + } + + ariaSort(key: DeviceSortKey): string { + if (this.sortKey() !== key) { + return 'none'; + } + return this.sortDesc() ? 'descending' : 'ascending'; + } + + sortIcon(key: DeviceSortKey): string { + if (key === 'name') { + return this.sortKey() === 'name' && this.sortDesc() ? 'arrow_downward' : 'arrow_upward'; + } + return this.sortKey() === 'last' && !this.sortDesc() ? 'arrow_upward' : 'arrow_downward'; + } + + open(row: DeviceHomeRow): void { + this.router.navigateByUrl(row.url); + } + + private subscribeLists(queries: DeviceQuery[], pageSize: number): void { + this.dataSubscribers.forEach(subscriber => subscriber.unsubscribe()); + const keyType = this.stateKeyType(); + if (!keyType || !queries.length) { + this.dataSubscribers = []; + return; + } + this.listQueries = queries; + const previous = this.lists(); + const previousTotals = this.listTotals(); + this.lists.set(queries.map((_, index) => previous[index] ?? null)); + this.listTotals.set(queries.map((_, index) => previousTotals[index] ?? 0)); + this.dataSubscribers = queries.map((query, index) => { + const cmd = new EntityDataCmd(); + const pageLink: EntityDataPageLink = { + page: 0, + pageSize: query.neverConnected ? pageSize * 2 : pageSize, + sortOrder: {key: query.sortKey, direction: query.direction}, + dynamic: true + }; + cmd.query = { + entityFilter: {type: AliasFilterType.entityType, entityType: EntityType.DEVICE}, + pageLink, + keyFilters: [ + ...(query.state ? this.activeFilter(keyType, query.state === 'active') : []), + ...(query.withActivity ? [this.hasActivityFilter(keyType)] : []) + ], + entityFields: [ + {type: EntityKeyType.ENTITY_FIELD, key: 'name'}, + {type: EntityKeyType.ENTITY_FIELD, key: 'type'} + ], + latestValues: [ + {type: keyType, key: 'active'}, + {type: keyType, key: 'lastActivityTime'} + ] + }; + cmd.latestCmd = {keys: [{type: keyType, key: 'active'}, {type: keyType, key: 'lastActivityTime'}]}; + const subscriber = new TelemetrySubscriber(this.telemetryWsService, this.zone); + subscriber.subscriptionCommands.push(cmd); + subscriber.entityData$.subscribe(update => { + if (update.data) { + this.setList(index, update.data.data, update.data.totalElements); + } else if (update.update) { + const list = this.lists()[index] ?? []; + const byId = new Map(update.update.map(data => [data.entityId.id, data])); + this.setList(index, list.map(data => this.merge(data, byId.get(data.entityId.id))), null); + } + }); + subscriber.subscribe(); + return subscriber; + }); + } + + private setList(index: number, data: EntityData[], total: number | null): void { + const lists = [...this.lists()]; + lists[index] = data; + this.lists.set(lists); + if (total !== null) { + const totals = [...this.listTotals()]; + totals[index] = total; + this.listTotals.set(totals); + } + } + + private merge(current: EntityData, update?: EntityData): EntityData { + if (!update) { + return current; + } + const latest = {...current.latest}; + Object.keys(update.latest ?? {}).forEach(type => latest[type] = {...(latest[type] ?? {}), ...update.latest[type]}); + return {...current, latest}; + } + + private subscribeCount(target: WritableSignal, keyFilters?: KeyFilter[]): TelemetrySubscriber { + const cmd = new EntityCountCmd(); + cmd.query = { + entityFilter: {type: AliasFilterType.entityType, entityType: EntityType.DEVICE}, + keyFilters + }; + const subscriber = new TelemetrySubscriber(this.telemetryWsService, this.zone); + subscriber.subscriptionCommands.push(cmd); + subscriber.entityCount$.subscribe(update => target.set(update.count ?? 0)); + subscriber.subscribe(); + return subscriber; + } + + private activeFilter(keyType: EntityKeyType, active: boolean): KeyFilter[] { + return [{ + key: {type: keyType, key: 'active'}, + valueType: EntityKeyValueType.BOOLEAN, + predicate: { + type: FilterPredicateType.BOOLEAN, + operation: BooleanOperation.EQUAL, + value: {defaultValue: active} + } + }]; + } + + private hasActivityFilter(keyType: EntityKeyType): KeyFilter { + return { + key: {type: keyType, key: 'lastActivityTime'}, + valueType: EntityKeyValueType.NUMERIC, + predicate: { + type: FilterPredicateType.NUMERIC, + operation: NumericOperation.GREATER, + value: {defaultValue: 0} + } + }; + } + + private toRow(data: EntityData, keyType: EntityKeyType | null, now: number): DeviceHomeRow { + const fields = data.latest?.[EntityKeyType.ENTITY_FIELD] ?? {}; + const state = keyType ? data.latest?.[keyType] ?? {} : {}; + const lastActivity = Number(state.lastActivityTime?.value) || null; + return { + id: data.entityId.id, + name: fields.name?.value ?? '', + profile: fields.type?.value ?? '', + active: state.active?.value === 'true', + lastActivity, + ago: lastActivity ? homeAgo(this.translate, now - lastActivity) : '', + url: getEntityDetailsPageURL(data.entityId.id, EntityType.DEVICE) + }; + } } diff --git a/ui-ngx/src/app/modules/home/pages/home-links/home/components/home-list-footer.component.scss b/ui-ngx/src/app/modules/home/pages/home-links/home/components/home-list-footer.component.scss index 9adb27b3e7..d728472202 100644 --- a/ui-ngx/src/app/modules/home/pages/home-links/home/components/home-list-footer.component.scss +++ b/ui-ngx/src/app/modules/home/pages/home-links/home/components/home-list-footer.component.scss @@ -30,10 +30,6 @@ } .tb-home-list-view-all { - &, &:hover, &:focus, &:active { - border-bottom: none; - } - display: inline-flex; align-items: center; height: 36px; @@ -48,6 +44,10 @@ color: var(--tb-ink-76, rgba(0, 0, 0, 0.76)); transition: background-color .15s ease; + &, &:hover, &:focus, &:active { + border-bottom: none; + } + .mat-icon { width: 18px; height: 18px; diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 5fae4ff733..56b65dfb37 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -8628,6 +8628,30 @@ "starred-toast": "“{{title}}” starred", "opens-new-tab": "(opens in a new tab)" }, + "devices": { + "add": "Add device", + "none": "No devices yet. Add a device to see its state here.", + "none-assigned": "No devices assigned to you yet", + "how-to": "How to connect a device", + "inactive": "Inactive", + "active": "Active", + "show-only-inactive": "Show inactive only", + "show-only-active": "Show active only", + "show-every": "Show all devices", + "one-active": "The device is active.", + "all-active": "All {{count}} devices are active.", + "name": "Name", + "profile": "Device profile", + "state": "State", + "last-activity": "Last activity", + "last-activity-at": "Last activity {{time}}", + "sort-name": "Sort by name", + "sort-last": "Sort by last activity", + "never": "never", + "no-data": "No data received yet", + "none-inactive": "No inactive devices.", + "none-active": "No active devices." + }, "list": { "show-more": "Show more", "show-all": "Show all",