Browse Source

Merge branch 'lts-4.3' into lts-4.4

# Conflicts:
#	application/src/main/java/org/thingsboard/server/service/iot_hub/DefaultIotHubService.java
#	common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/DashboardInstalledItemDescriptor.java
#	ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-routing.module.ts
pull/16270/head
Vladyslav_Prykhodko 2 months ago
parent
commit
1352ff6874
  1. 91
      application/src/main/java/org/thingsboard/server/service/iot_hub/DefaultIotHubService.java
  2. 12
      application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java
  3. 13
      common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/DashboardInstalledItemDescriptor.java
  4. 1
      common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/IotHubInstalledItemDescriptor.java
  5. 3
      ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.html
  6. 38
      ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts
  7. 3
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-browse.component.ts
  8. 1
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-installed-items-table.component.scss
  9. 1
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-installed-items-table.component.ts
  10. 2
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-item-card.component.html
  11. 6
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-item-detail-dialog.component.html
  12. 5
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-item-detail-dialog.component.ts
  13. 4
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-update-dialog.component.html
  14. 11
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-update-dialog.component.ts
  15. 1
      ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-deep-link.utils.ts
  16. 1
      ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-home.component.ts
  17. 7
      ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.ts
  18. 13
      ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-routing.module.ts
  19. 10
      ui-ngx/src/app/shared/models/iot-hub/iot-hub-installed-item.models.ts
  20. 6
      ui-ngx/src/app/shared/models/iot-hub/iot-hub-item.models.ts
  21. 102
      ui-ngx/src/assets/iot-hub/items-page-dashboards-hero.svg
  22. 7
      ui-ngx/src/assets/locale/locale.constant-en_US.json

91
application/src/main/java/org/thingsboard/server/service/iot_hub/DefaultIotHubService.java

@ -11,7 +11,6 @@ import org.springframework.stereotype.Service;
import org.thingsboard.common.util.ExceptionUtil;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.Customer;
import org.thingsboard.server.common.data.Dashboard;
import org.thingsboard.server.common.data.DeviceProfile;
import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.common.data.asset.AssetProfile;
@ -35,7 +34,6 @@ import org.thingsboard.server.common.data.id.RuleChainId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.iot_hub.AlarmRuleInstalledItemDescriptor;
import org.thingsboard.server.common.data.iot_hub.CalculatedFieldInstalledItemDescriptor;
import org.thingsboard.server.common.data.iot_hub.DashboardInstalledItemDescriptor;
import org.thingsboard.server.common.data.iot_hub.DeviceInstalledItemDescriptor;
import org.thingsboard.server.common.data.iot_hub.IotHubInstalledItem;
import org.thingsboard.server.common.data.iot_hub.IotHubInstalledItemDescriptor;
@ -100,7 +98,6 @@ public class DefaultIotHubService implements IotHubService {
private static final String SECTION_RULE_CHAIN_METADATA = "rule chain metadata";
private static final String ITEM_TYPE_WIDGET = "widget";
private static final String ITEM_TYPE_DASHBOARD = "dashboard";
private static final String ITEM_TYPE_CALCULATED_FIELD = "calculated field";
private static final String ITEM_TYPE_ALARM_RULE = "alarm rule";
private static final String ITEM_TYPE_RULE_CHAIN = "rule chain";
@ -183,7 +180,6 @@ public class DefaultIotHubService implements IotHubService {
IotHubInstalledItemDescriptor descriptor = switch (itemType) {
case "WIDGET" -> installWidget(user, tenantId, fileData);
case "DASHBOARD" -> installDashboard(user, tenantId, fileData, data);
case "CALCULATED_FIELD" -> installCalculatedField(user, tenantId, fileData, data);
case "ALARM_RULE" -> installAlarmRule(user, tenantId, fileData, data);
case "RULE_CHAIN" -> installRuleChain(user, tenantId, fileData, data);
@ -244,58 +240,6 @@ public class DefaultIotHubService implements IotHubService {
return descriptor;
}
private DashboardInstalledItemDescriptor installDashboard(SecurityUser user, TenantId tenantId, byte[] fileData, JsonNode data) throws Exception {
Dashboard dashboard;
try {
dashboard = JacksonUtil.fromString(new String(fileData), Dashboard.class, true);
} catch (Exception e) {
throw parseFailure(ACTION_INSTALL, ITEM_TYPE_DASHBOARD, e);
}
dashboard.setId(null);
dashboard.setTenantId(tenantId);
if (data != null && data.hasNonNull("customerId") && data.get("customerId").isTextual()) {
String strCustomerId = data.get("customerId").asText();
if (!strCustomerId.isEmpty()) {
CustomerId customerId = new CustomerId(UUID.fromString(strCustomerId));
Customer customer = customerService.findCustomerById(tenantId, customerId);
if (customer == null) {
throw new IllegalArgumentException("Customer with id [" + customerId + "] is not found");
}
if (!tenantId.equals(customer.getTenantId())) {
throw new IllegalArgumentException("Customer [" + customerId + "] does not belong to the current tenant");
}
dashboard.setCustomerId(customerId);
}
}
List<EntityGroup> entityGroups = null;
if (data != null && data.hasNonNull("entityGroupId") && data.get("entityGroupId").isTextual()) {
String strEntityGroupId = data.get("entityGroupId").asText();
if (!strEntityGroupId.isEmpty()) {
EntityGroupId entityGroupId = new EntityGroupId(UUID.fromString(strEntityGroupId));
EntityGroupInfo entityGroup = checkEntityGroup(user, entityGroupId);
if (entityGroup.getType() != EntityType.DASHBOARD) {
throw new IllegalArgumentException("Entity group [" + entityGroupId + "] is not a dashboard group (type: " + entityGroup.getType() + ")");
}
entityGroups = List.of(entityGroup);
// If the entity group is owned by a customer, align the dashboard owner with the group owner
// (mirrors BaseController.saveGroupEntity logic for new entities).
if (dashboard.getCustomerId() == null || dashboard.getCustomerId().isNullUid()) {
if (entityGroup.getOwnerId().getEntityType() == EntityType.CUSTOMER) {
dashboard.setOwnerId(new CustomerId(entityGroup.getOwnerId().getId()));
}
}
}
}
Dashboard saved = tbDashboardService.save(dashboard, entityGroups, user);
log.debug("[{}] Dashboard installed: {}", tenantId, saved.getTitle());
DashboardInstalledItemDescriptor descriptor = new DashboardInstalledItemDescriptor();
descriptor.setDashboardId(saved.getId());
return descriptor;
}
private EntityGroupInfo checkEntityGroup(SecurityUser user, EntityGroupId entityGroupId) throws ThingsboardException {
EntityGroupInfo entityGroup = entityGroupService.findEntityGroupInfoById(user.getTenantId(), entityGroupId);
if (entityGroup == null) {
@ -466,7 +410,6 @@ public class DefaultIotHubService implements IotHubService {
}
String itemType = installedItem.getItemType();
IotHubInstalledItemDescriptor descriptor = installedItem.getDescriptor();
// Skip checksum validation for solution templates
@ -508,7 +451,6 @@ public class DefaultIotHubService implements IotHubService {
switch (itemType) {
case "WIDGET" -> updateWidget(user, tenantId, (WidgetInstalledItemDescriptor) descriptor, fileData);
case "DASHBOARD" -> updateDashboard(user, tenantId, (DashboardInstalledItemDescriptor) descriptor, fileData);
case "CALCULATED_FIELD" -> updateCalculatedField(user, tenantId, (CalculatedFieldInstalledItemDescriptor) descriptor, fileData);
case "ALARM_RULE" -> updateAlarmRule(user, tenantId, (AlarmRuleInstalledItemDescriptor) descriptor, fileData);
case "RULE_CHAIN" -> updateRuleChain(tenantId, (RuleChainInstalledItemDescriptor) descriptor, fileData);
@ -567,22 +509,6 @@ public class DefaultIotHubService implements IotHubService {
tbWidgetTypeService.save(existing, false, user);
}
private void updateDashboard(SecurityUser user, TenantId tenantId, DashboardInstalledItemDescriptor descriptor, byte[] fileData) throws Exception {
Dashboard newDashboard;
try {
newDashboard = JacksonUtil.fromString(new String(fileData), Dashboard.class, true);
} catch (Exception e) {
throw parseFailure(ACTION_UPDATE, ITEM_TYPE_DASHBOARD, e);
}
Dashboard existing = dashboardService.findDashboardById(tenantId, descriptor.getDashboardId());
if (existing == null) {
throw new Exception("Dashboard not found for update");
}
existing.setTitle(newDashboard.getTitle());
existing.setConfiguration(newDashboard.getConfiguration());
tbDashboardService.save(existing, (List<EntityGroup>) null, user);
}
private void updateCalculatedField(SecurityUser user, TenantId tenantId, CalculatedFieldInstalledItemDescriptor descriptor, byte[] fileData) throws Exception {
CalculatedField newCf;
try {
@ -649,8 +575,6 @@ public class DefaultIotHubService implements IotHubService {
IotHubInstalledItemDescriptor descriptor = installedItem.getDescriptor();
if (descriptor instanceof WidgetInstalledItemDescriptor wd) {
return calculateWidgetChecksum(tenantId, wd);
} else if (descriptor instanceof DashboardInstalledItemDescriptor dd) {
return calculateDashboardChecksum(tenantId, dd);
} else if (descriptor instanceof CalculatedFieldInstalledItemDescriptor cd) {
return calculateCalculatedFieldChecksum(tenantId, cd.getCalculatedFieldId());
} else if (descriptor instanceof AlarmRuleInstalledItemDescriptor ad) {
@ -672,16 +596,6 @@ public class DefaultIotHubService implements IotHubService {
return sha256(content);
}
private String calculateDashboardChecksum(TenantId tenantId, DashboardInstalledItemDescriptor descriptor) {
Dashboard dashboard = dashboardService.findDashboardById(tenantId, descriptor.getDashboardId());
if (dashboard == null) {
return null;
}
String content = (dashboard.getTitle() != null ? dashboard.getTitle() : "") +
(dashboard.getConfiguration() != null ? dashboard.getConfiguration().toString() : "");
return sha256(content);
}
private String calculateWidgetChecksum(TenantId tenantId, WidgetInstalledItemDescriptor descriptor) {
WidgetTypeDetails widgetType = widgetTypeService.findWidgetTypeDetailsById(tenantId, descriptor.getWidgetTypeId());
if (widgetType == null) {
@ -865,11 +779,6 @@ public class DefaultIotHubService implements IotHubService {
if (widgetType != null) {
tbWidgetTypeService.delete(widgetType, user);
}
} else if (descriptor instanceof DashboardInstalledItemDescriptor dd) {
Dashboard dashboard = dashboardService.findDashboardById(tenantId, dd.getDashboardId());
if (dashboard != null) {
tbDashboardService.delete(dashboard, user);
}
} else if (descriptor instanceof CalculatedFieldInstalledItemDescriptor cd) {
CalculatedField calculatedField = calculatedFieldService.findById(tenantId, cd.getCalculatedFieldId());
if (calculatedField != null) {

12
application/src/test/java/org/thingsboard/server/service/iot_hub/DefaultIotHubServiceTest.java

@ -15,8 +15,8 @@ import org.mockito.junit.jupiter.MockitoExtension;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.id.IotHubInstalledItemId;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.iot_hub.DashboardInstalledItemDescriptor;
import org.thingsboard.server.common.data.iot_hub.IotHubInstalledItem;
import org.thingsboard.server.common.data.iot_hub.RuleChainInstalledItemDescriptor;
import org.thingsboard.server.dao.iot_hub.IotHubInstalledItemService;
import org.thingsboard.server.service.security.model.SecurityUser;
@ -89,7 +89,7 @@ class DefaultIotHubServiceTest {
mockTenant();
String versionId = UUID.randomUUID().toString();
String itemId = UUID.randomUUID().toString();
when(iotHubRestClient.getVersionInfo(versionId)).thenReturn(version(versionId, itemId, "DASHBOARD", "Root", "1.0"));
when(iotHubRestClient.getVersionInfo(versionId)).thenReturn(version(versionId, itemId, "RULE_CHAIN", "Root", "1.0"));
when(iotHubInstalledItemService.findInstalledItemIdsByTenantIdAndItemIdIn(eq(tenantId), any())).thenReturn(List.of());
InstallPlan plan = service.resolveInstallPlan(user, versionId);
@ -107,7 +107,7 @@ class DefaultIotHubServiceTest {
String versionId = UUID.randomUUID().toString();
String rootItemId = UUID.randomUUID().toString();
String relatedItemId = UUID.randomUUID().toString();
ObjectNode root = version(versionId, rootItemId, "DASHBOARD", "Root", "1.0");
ObjectNode root = version(versionId, rootItemId, "RULE_CHAIN", "Root", "1.0");
root.putArray("relatedItems").add(relatedItemId);
when(iotHubRestClient.getVersionInfo(versionId)).thenReturn(root);
when(iotHubRestClient.getPublishedVersionByItemId(relatedItemId))
@ -129,7 +129,7 @@ class DefaultIotHubServiceTest {
String versionId = UUID.randomUUID().toString();
String rootItemId = UUID.randomUUID().toString();
String relatedItemId = UUID.randomUUID().toString();
ObjectNode root = version(versionId, rootItemId, "DASHBOARD", "Root", "1.0");
ObjectNode root = version(versionId, rootItemId, "RULE_CHAIN", "Root", "1.0");
root.putArray("relatedItems").add(relatedItemId);
when(iotHubRestClient.getVersionInfo(versionId)).thenReturn(root);
when(iotHubRestClient.getPublishedVersionByItemId(relatedItemId)).thenReturn(null);
@ -149,7 +149,7 @@ class DefaultIotHubServiceTest {
String versionId = UUID.randomUUID().toString();
String rootItemId = UUID.randomUUID().toString();
String relatedItemId = UUID.randomUUID().toString();
ObjectNode root = version(versionId, rootItemId, "DASHBOARD", "Root", "1.0");
ObjectNode root = version(versionId, rootItemId, "RULE_CHAIN", "Root", "1.0");
root.putArray("relatedItems").add(relatedItemId);
when(iotHubRestClient.getVersionInfo(versionId)).thenReturn(root);
when(iotHubRestClient.getPublishedVersionByItemId(relatedItemId)).thenThrow(new RuntimeException("boom"));
@ -280,7 +280,7 @@ class DefaultIotHubServiceTest {
when(iotHubInstalledItemService.findInstalledItemIdsByTenantIdAndItemIdIn(eq(tenantId), any())).thenReturn(List.of());
IotHubInstalledItem depItem = installedItem(UUID.randomUUID());
IotHubInstalledItem rootItem = installedItem(UUID.randomUUID());
DashboardInstalledItemDescriptor rootDescriptor = new DashboardInstalledItemDescriptor();
RuleChainInstalledItemDescriptor rootDescriptor = new RuleChainInstalledItemDescriptor();
rootItem.setDescriptor(rootDescriptor);
doReturn(depItem).when(service).doInstallVersion(eq(user), eq(depVersionId), any(), any());
doReturn(rootItem).when(service).doInstallVersion(eq(user), eq(rootVersionId), any(), any());

13
common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/DashboardInstalledItemDescriptor.java

@ -1,13 +0,0 @@
// SPDX-FileCopyrightText: Copyright The ThingsBoard Authors
// SPDX-License-Identifier: Apache-2.0
package org.thingsboard.server.common.data.iot_hub;
import lombok.Data;
import org.thingsboard.server.common.data.id.DashboardId;
@Data
public class DashboardInstalledItemDescriptor implements IotHubInstalledItemDescriptor {
private DashboardId dashboardId;
}

1
common/data/src/main/java/org/thingsboard/server/common/data/iot_hub/IotHubInstalledItemDescriptor.java

@ -15,7 +15,6 @@ import java.io.Serializable;
property = "type")
@JsonSubTypes({
@Type(name = "WIDGET", value = WidgetInstalledItemDescriptor.class),
@Type(name = "DASHBOARD", value = DashboardInstalledItemDescriptor.class),
@Type(name = "CALCULATED_FIELD", value = CalculatedFieldInstalledItemDescriptor.class),
@Type(name = "ALARM_RULE", value = AlarmRuleInstalledItemDescriptor.class),
@Type(name = "RULE_CHAIN", value = RuleChainInstalledItemDescriptor.class),

3
ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.html

@ -199,7 +199,8 @@
<div mat-dialog-content>
<mat-stepper #installStepper
[linear]="true"
labelPosition="bottom">
labelPosition="bottom"
(selectionChange)="onStepSelectionChange($event)">
<ng-template matStepperIcon="edit">
<mat-icon>done</mat-icon>
</ng-template>

38
ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts

@ -9,6 +9,7 @@ import { AppState } from '@core/core.state';
import { DialogComponent } from '@shared/components/dialog.component';
import { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
import { MatStepper } from '@angular/material/stepper';
import { StepperSelectionEvent } from '@angular/cdk/stepper';
import { firstValueFrom } from 'rxjs';
import { TranslateService } from '@ngx-translate/core';
import { PageLink } from '@shared/models/page/page-link';
@ -252,10 +253,7 @@ export class TbDeviceInstallDialogComponent extends DialogComponent<TbDeviceInst
connectivityStep.completed = true;
this.cdr.detectChanges();
// Wait for new mat-step children to register before advancing.
setTimeout(() => {
this.stepper?.next();
this.onStepActivated();
}, 0);
setTimeout(() => this.stepper?.next(), 0);
return;
}
this.startWizard();
@ -306,12 +304,9 @@ export class TbDeviceInstallDialogComponent extends DialogComponent<TbDeviceInst
if (!step) {
return;
}
if (step.type === 'form') {
if (step.formGroup?.invalid) {
step.formGroup.markAllAsTouched();
return;
}
Object.assign(this.formValues, step.formGroup.getRawValue());
if (step.type === 'form' && step.formGroup?.invalid) {
step.formGroup.markAllAsTouched();
return;
}
if (this.isLastWizardStep) {
this.done();
@ -320,7 +315,22 @@ export class TbDeviceInstallDialogComponent extends DialogComponent<TbDeviceInst
step.completed = true;
this.cdr.detectChanges();
this.stepper.next();
this.onStepActivated();
}
onStepSelectionChange(event: StepperSelectionEvent): void {
if (event.selectedIndex <= event.previouslySelectedIndex) {
return;
}
// Forward moves can come from the stepper header, which bypasses nextStep(),
// so commit every step being passed over here.
for (let i = event.previouslySelectedIndex; i < event.selectedIndex; i++) {
const ws = this.wizardSteps[i];
if (ws.type === 'form') {
Object.assign(this.formValues, ws.formGroup.getRawValue());
}
ws.completed = true;
}
this.onStepActivated(this.wizardSteps[event.selectedIndex]);
}
get primaryEntityAction(): { url: string; label: string } | null {
@ -736,13 +746,14 @@ export class TbDeviceInstallDialogComponent extends DialogComponent<TbDeviceInst
return field.defaultValue ?? (field.type === FormFieldType.BOOLEAN ? false : '');
}
private onStepActivated(): void {
const step = this.currentWizardStep;
private onStepActivated(step = this.currentWizardStep): void {
if (!step) {
return;
}
if (step.type === 'instruction') {
step.markdown = this.zipFiles.get(step.rawSteps[0].file) || '';
// Nothing to validate here, so the linear stepper header may move past it right away.
step.completed = true;
} else if (step.type === 'progress' && !step.progressDone) {
if (this.reviewMode) {
this.showCompletedEntitySteps(step);
@ -858,7 +869,6 @@ export class TbDeviceInstallDialogComponent extends DialogComponent<TbDeviceInst
await this.delay(500);
this.stepper.next();
this.cdr.detectChanges();
this.onStepActivated();
}
}

3
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-browse.component.ts

@ -34,7 +34,6 @@ export class TbIotHubBrowseComponent implements OnInit, AfterViewInit, OnDestroy
private static typeTabLabel(t: ItemType): string {
switch (t) {
case ItemType.WIDGET: return 'item.type-widget-plural';
case ItemType.DASHBOARD: return 'item.type-dashboard-plural';
case ItemType.SOLUTION_TEMPLATE: return 'item.type-solution-template-plural';
case ItemType.CALCULATED_FIELD: return 'item.type-calculated-field-plural';
case ItemType.ALARM_RULE: return 'item.type-alarm-rule-plural';
@ -87,7 +86,6 @@ export class TbIotHubBrowseComponent implements OnInit, AfterViewInit, OnDestroy
get searchPlaceholderKey(): string {
switch (this._activeType) {
case ItemType.WIDGET: return 'iot-hub.search-widgets';
case ItemType.DASHBOARD: return 'iot-hub.search-dashboards';
case ItemType.SOLUTION_TEMPLATE: return 'iot-hub.search-solution-templates';
case ItemType.CALCULATED_FIELD: return 'iot-hub.search-calculated-fields';
case ItemType.ALARM_RULE: return 'iot-hub.search-alarm-rules';
@ -524,7 +522,6 @@ export class TbIotHubBrowseComponent implements OnInit, AfterViewInit, OnDestroy
getTitle(): string {
switch (this.activeType) {
case ItemType.WIDGET: return 'iot-hub.title-widgets';
case ItemType.DASHBOARD: return 'iot-hub.title-dashboards';
case ItemType.SOLUTION_TEMPLATE: return 'iot-hub.title-solution-templates';
case ItemType.CALCULATED_FIELD: return 'iot-hub.title-calculated-fields';
case ItemType.ALARM_RULE: return 'iot-hub.title-alarm-rules';

1
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-installed-items-table.component.scss

@ -116,7 +116,6 @@
.tb-type-calc-field { color: #3db5e0; background: rgba(61, 181, 224, 0.06); }
.tb-type-alarm-rule { color: #d7702f; background: rgba(215, 112, 47, 0.06); }
.tb-type-rule-chain { color: #aa5be3; background: rgba(170, 91, 227, 0.06); }
.tb-type-dashboard { color: #607d8b; background: rgba(96, 125, 139, 0.06); }
// "vX.X.X Available" button — Design: border rgba(0,0,0,0.12), rounded-4, px-12 py-6, gap-8
.tb-installed-version-btn {

1
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-installed-items-table.component.ts

@ -158,7 +158,6 @@ export class TbIotHubInstalledItemsTableComponent implements OnInit, OnChanges,
getItemTypeChipClass(itemType: string): string {
switch (itemType) {
case 'WIDGET': return 'tb-type-widget';
case 'DASHBOARD': return 'tb-type-dashboard';
case 'CALCULATED_FIELD': return 'tb-type-calc-field';
case 'ALARM_RULE': return 'tb-type-alarm-rule';
case 'RULE_CHAIN': return 'tb-type-rule-chain';

2
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-item-card.component.html

@ -71,7 +71,7 @@
}
</div>
} @else {
<!-- Big card (Widget / Dashboard / Solution Template) -->
<!-- Big card (Widget / Solution Template) -->
<div class="tb-iot-hub-item-card" role="button" tabindex="0" (click)="onCardClick()" (keyup.enter)="onCardClick()">
<div class="tb-iot-hub-card-preview">
@if (getPreviewUrl(); as previewUrl) {

6
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-item-detail-dialog.component.html

@ -13,7 +13,7 @@
</div>
}
<div class="flex min-w-0 flex-1 flex-col gap-2">
<span class="dlg-title">{{ item.name }}</span>
<span class="dlg-title">{{ itemTitle }}</span>
<div class="dlg-subtitle">
<span class="dlg-subtitle-group">
<tb-icon class="dlg-subtitle-icon">{{ getTypeIcon() }}</tb-icon>
@ -86,7 +86,7 @@
</div>
</div>
} @else {
<!-- Widget/Dashboard/Solution: image + description side by side -->
<!-- Widget/Solution: image + description side by side -->
<div class="flex gap-6 lt-md:flex-col">
<div class="dlg-preview"
[class.dlg-preview-carousel]="item.type === ItemType.SOLUTION_TEMPLATE && carouselImages.length > 1">
@ -156,7 +156,7 @@
<!-- Categories & Use Cases / Device metadata -->
<div class="dlg-meta-bar">
<div class="dlg-divider"></div>
<div class="dlg-meta" [class.dlg-meta-4-col]="item.type === ItemType.SOLUTION_TEMPLATE || item.type === ItemType.DASHBOARD">
<div class="dlg-meta" [class.dlg-meta-4-col]="item.type === ItemType.SOLUTION_TEMPLATE">
@if (showCreator) {
<div class="dlg-meta-group dlg-meta-creator-section">
<span class="dlg-meta-label">{{ 'iot-hub.creator' | translate }}</span>

5
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-item-detail-dialog.component.ts

@ -172,6 +172,11 @@ export class TbIotHubItemDetailDialogComponent extends DialogComponent<TbIotHubI
&& this.installedItem.itemVersionId !== this.item.id;
}
/** The tracking row keeps the item's current name; a version keeps the one it was published under. */
get itemTitle(): string {
return this.installedItem?.itemVersionId === this.item.id ? this.installedItem.itemName : this.item.name;
}
/** Runs whatever the item's action mode calls for: open the local copy, connect, or install. */
runPrimaryAction(): void {
if (iotHubItemActionMode(this.item) === 'connect') {

4
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-update-dialog.component.html

@ -8,11 +8,11 @@
@switch (state) {
@case ('confirm') {
<h2 class="tb-iot-hub-install-title">{{ 'iot-hub.update-confirm-title' | translate:{ name: data.itemName } }}</h2>
<p class="tb-iot-hub-install-desc">{{ 'iot-hub.update-desc' | translate }}</p>
<p class="tb-iot-hub-install-desc">{{ updateDescKey | translate }}</p>
}
@case ('updating') {
<h2 class="tb-iot-hub-install-title">{{ 'iot-hub.update-confirm-title' | translate:{ name: data.itemName } }}</h2>
<p class="tb-iot-hub-install-desc">{{ 'iot-hub.update-desc' | translate }}</p>
<p class="tb-iot-hub-install-desc">{{ updateDescKey | translate }}</p>
}
@case ('success') {
<h2 class="tb-iot-hub-install-title">{{ 'iot-hub.update-success-title' | translate }}</h2>

11
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-update-dialog.component.ts

@ -59,6 +59,17 @@ export class TbIotHubUpdateDialogComponent extends DialogComponent<TbIotHubUpdat
return key ? this.translate.instant(key) : '';
}
/**
* Updating a solution template is a delete + reinstall of every entity it created, and unlike the other item
* types it is not stopped by the modified-entity check, so the tenant's own edits to those dashboards, devices
* and rule chains are lost. Say that instead of the generic "replace the current version" wording.
*/
get updateDescKey(): string {
return this.data?.itemType === ItemType.SOLUTION_TEMPLATE
? 'iot-hub.update-desc-solution-template'
: 'iot-hub.update-desc';
}
update(force = false): void {
this.state = 'updating';
this.iotHubApiService.updateItemVersion(this.data.installedItemId, this.data.versionId, { ignoreLoading: true }, force).subscribe({

1
ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-deep-link.utils.ts

@ -12,7 +12,6 @@ export function isUUID(s: string | null | undefined): s is string {
export function typeSegment(t: ItemType): string | undefined {
switch (t) {
case ItemType.WIDGET: return 'widgets';
case ItemType.DASHBOARD: return 'dashboards';
case ItemType.SOLUTION_TEMPLATE: return 'solution-templates';
case ItemType.CALCULATED_FIELD: return 'calculated-fields';
case ItemType.ALARM_RULE: return 'alarm-rules';

1
ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-home.component.ts

@ -276,7 +276,6 @@ export class TbIotHubHomeComponent implements OnInit, OnDestroy {
private getTypeRoute(type: ItemType): string {
switch (type) {
case ItemType.WIDGET: return 'widgets';
case ItemType.DASHBOARD: return 'dashboards';
case ItemType.SOLUTION_TEMPLATE: return 'solution-templates';
case ItemType.CALCULATED_FIELD: return 'calculated-fields';
case ItemType.ALARM_RULE: return 'alarm-rules';

7
ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.ts

@ -29,13 +29,6 @@ const PAGE_CONFIGS: Record<string, ItemTypePageConfig> = {
image: 'assets/iot-hub/items-page-widgets-hero.svg',
routeSegment: 'widgets'
},
DASHBOARD: {
type: ItemType.DASHBOARD,
titleKey: 'item.type-dashboard-plural',
descriptionKey: 'iot-hub.items-page-desc-dashboards',
image: 'assets/iot-hub/items-page-dashboards-hero.svg',
routeSegment: 'dashboards'
},
SOLUTION_TEMPLATE: {
type: ItemType.SOLUTION_TEMPLATE,
titleKey: 'item.type-solution-template-plural',

13
ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-routing.module.ts

@ -49,19 +49,6 @@ const routes: Routes = [
breadcrumb: { label: 'item.type-widget-plural', icon: 'widgets' }
}
},
{
path: 'dashboards',
component: TbIotHubItemsPageComponent,
data: {
auth: [Authority.TENANT_ADMIN],
canActivate: (userPermissionsService: UserPermissionsService): boolean => {
return userPermissionsService.hasGenericPermission(Resource.ALL, Operation.ALL);
},
title: 'item.type-dashboard-plural',
itemType: 'DASHBOARD',
breadcrumb: { label: 'item.type-dashboard-plural', icon: 'dashboard' }
}
},
{
path: 'solution-templates',
component: TbIotHubItemsPageComponent,

10
ui-ngx/src/app/shared/models/iot-hub/iot-hub-installed-item.models.ts

@ -10,11 +10,6 @@ export interface WidgetInstalledItemDescriptor {
widgetTypeId: { id: string };
}
export interface DashboardInstalledItemDescriptor {
type: 'DASHBOARD';
dashboardId: { id: string };
}
export interface CalculatedFieldInstalledItemDescriptor {
type: 'CALCULATED_FIELD';
calculatedFieldId: { id: string };
@ -52,7 +47,6 @@ export interface SolutionTemplateInstalledItemDescriptor {
export type IotHubInstalledItemDescriptor =
| WidgetInstalledItemDescriptor
| DashboardInstalledItemDescriptor
| CalculatedFieldInstalledItemDescriptor
| AlarmRuleInstalledItemDescriptor
| RuleChainInstalledItemDescriptor
@ -142,10 +136,6 @@ export const getInstalledItemUrl = (descriptor?: IotHubInstalledItemDescriptor):
entityId = descriptor.widgetTypeId?.id;
entityType = EntityType.WIDGET_TYPE;
break;
case 'DASHBOARD':
entityId = descriptor.dashboardId?.id;
entityType = EntityType.DASHBOARD;
break;
case 'CALCULATED_FIELD':
case 'ALARM_RULE':
entityId = descriptor.calculatedFieldId?.id;

6
ui-ngx/src/app/shared/models/iot-hub/iot-hub-item.models.ts

@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
export enum ItemType {
WIDGET = 'WIDGET',
DASHBOARD = 'DASHBOARD',
SOLUTION_TEMPLATE = 'SOLUTION_TEMPLATE',
CALCULATED_FIELD = 'CALCULATED_FIELD',
ALARM_RULE = 'ALARM_RULE',
@ -13,7 +12,6 @@ export enum ItemType {
export const itemTypeTranslations = new Map<ItemType, string>(
[
[ItemType.WIDGET, 'item.type-widget'],
[ItemType.DASHBOARD, 'item.type-dashboard'],
[ItemType.SOLUTION_TEMPLATE, 'item.type-solution-template'],
[ItemType.CALCULATED_FIELD, 'item.type-calculated-field'],
[ItemType.ALARM_RULE, 'item.type-alarm-rule'],
@ -28,7 +26,6 @@ export const itemTypeTranslations = new Map<ItemType, string>(
// mapping stays consistent across the app.
export const itemTypeIcons: Record<string, string> = {
[ItemType.WIDGET]: 'widgets',
[ItemType.DASHBOARD]: 'dashboard',
[ItemType.SOLUTION_TEMPLATE]: 'apps',
[ItemType.CALCULATED_FIELD]: 'mdi:function-variant',
[ItemType.RULE_CHAIN]: 'settings_ethernet',
@ -41,9 +38,6 @@ export const getItemTypeIcon = (type?: string | null): string =>
/**
* Item types discoverable to creators in the marketplace UI.
* DASHBOARD is intentionally absent (IoT Hub no longer accepts Dashboard contributions).
* Defensive code paths (item card, detail dialog descriptor switch, installed-items table,
* install handler, /iot-hub/dashboards route) remain functional for already-installed items.
*/
export const CREATOR_VISIBLE_ITEM_TYPES: ItemType[] = [
ItemType.WIDGET,

102
ui-ngx/src/assets/iot-hub/items-page-dashboards-hero.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 95 KiB

7
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -6272,8 +6272,6 @@
"item": {
"type-widget": "Widget",
"type-widget-plural": "Widgets",
"type-dashboard": "Dashboard",
"type-dashboard-plural": "Dashboards",
"type-solution-template": "Solution Template",
"type-solution-template-plural": "Solution Templates",
"type-calculated-field": "Calculated Field",
@ -6319,7 +6317,6 @@
"filter": "Filter",
"available": "Available",
"items-page-desc-widgets": "Jumpstart your IoT journey with pre-configured widgets designed for your industry. Deploy proven architectures instantly and focus your energy on what matters: your unique business logic.",
"items-page-desc-dashboards": "Explore dashboards to find pre-built visualization templates and interactive UI layouts you can deploy in minutes to bring your IoT data to life.",
"items-page-desc-solution-templates": "Complete IoT solution packages with dashboards, rule chains, and device configurations. Get started with proven architectures.",
"items-page-desc-calculated-fields": "Use pre-configured Calculated Fields to automate complex metrics like fuel efficiency or power factor. Skip the manual logic and keep your dashboards clean and actionable.",
"items-page-desc-alarm-rules": "Use pre-built Alarm Rule templates to detect critical conditions like low battery, threshold breaches, or devices going offline. Skip writing the rule logic and start reacting to incidents the moment they happen.",
@ -6334,20 +6331,17 @@
"contribute": "Contribute",
"creator-profile": "Creator Profile",
"title-widgets": "Widgets",
"title-dashboards": "Dashboards",
"title-calculated-fields": "Calculated Fields",
"title-alarm-rules": "Alarm Rules",
"title-rule-chains": "Rule Chains",
"title-devices": "Devices",
"title-solution-templates": "Solution Templates",
"subtitle-widgets": "Browse community widgets for your dashboards",
"subtitle-dashboards": "Browse ready-to-use dashboards",
"subtitle-solution-templates": "Browse complete IoT solution packages",
"subtitle-calculated-fields": "Browse calculated field templates",
"subtitle-alarm-rules": "Browse alarm rule templates",
"subtitle-rule-chains": "Browse rule chain templates",
"subtitle-devices": "Browse device configurations",
"search-dashboards": "Search dashboards...",
"search-solution-templates": "Search solution templates...",
"search-calculated-fields": "Search calculated fields...",
"search-alarm-rules": "Search alarm rules...",
@ -6451,6 +6445,7 @@
"update-confirm": "Update '{{name}}' to version {{version}}?",
"update-confirm-title": "Update '{{name}}'?",
"update-desc": "Updating this will replace the current version with the latest and reconfigure the associated resources within your tenant",
"update-desc-solution-template": "Updating this solution template will delete and recreate all entities it created, including dashboards, rule chains, devices, and other associated resources within your tenant. Any changes you made to them will be lost",
"update-success-desc": "'{{name}}' has been updated successfully",
"updating": "Updating...",
"update-success-title": "Update Successful",

Loading…
Cancel
Save