diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.html b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.html
index f7bcce1201..4b0d6fc93c 100644
--- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.html
@@ -8,13 +8,21 @@
{{ 'iot-hub.remove-confirm-title' | translate:{ name: data.itemName } }}
{{ description }}
- @if (keptReferences) {
+ @if (keptGroups.length) {
}
diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.scss b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.scss
index 63fa684164..15bbef3f08 100644
--- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.scss
+++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.scss
@@ -23,3 +23,39 @@
color: rgba(0, 0, 0, 0.54);
margin: 0;
}
+
+// The kept entities: one white list as tb-image-references draws it, a group per reason
+.tb-iot-hub-kept-groups {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ padding: 8px 0;
+ border-radius: 4px;
+ background: #fff;
+ border: 1px solid color-mix(in srgb, var(--tb-primary-500) 40%, transparent);
+
+ // The groups share the outer border: no border of its own around each group's list
+ ::ng-deep tb-image-references table.tb-entities-list-table {
+ padding: 0 10px 0 4px !important;
+ background: transparent !important;
+
+ &:before {
+ display: none !important;
+ }
+ }
+}
+
+.tb-iot-hub-kept-reason {
+ padding: 4px 12px 2px;
+ font-size: 12px;
+ font-weight: 500;
+ line-height: 16px;
+ letter-spacing: 0.4px;
+ color: rgba(0, 0, 0, 0.6);
+}
+
+.tb-iot-hub-kept-divider {
+ height: 1px;
+ margin: 6px 12px 4px;
+ background: rgba(0, 0, 0, 0.08);
+}
diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.ts b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.ts
index f1910d662d..2fe865940e 100644
--- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.ts
+++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.ts
@@ -7,7 +7,7 @@ import { Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { DialogComponent } from '@shared/components/dialog.component';
-import { IotHubInstalledItemKeptEntities } from 'src/app/shared/models/iot-hub/iot-hub-installed-item.models';
+import { IotHubInstalledItemKeptEntities, IotHubKeptEntity } from 'src/app/shared/models/iot-hub/iot-hub-installed-item.models';
import { IotHubApiService } from '@core/http/iot-hub-api.service';
import { TranslateService } from '@ngx-translate/core';
import { ResourceReferences } from '@shared/models/resource.models';
@@ -30,10 +30,10 @@ export class TbIotHubDeleteDialogComponent extends DialogComponent
,
@@ -48,23 +48,20 @@ export class TbIotHubDeleteDialogComponent extends DialogComponent ({ id: entity.entityId as EntityId, name: entity.name }));
- const reasons: string[] = [];
- if (shared.length) {
- // Kept because other packages use them, because the user had them before the package, or both
- const reasonKey = !kept.usedExistingCount ? 'iot-hub.remove-kept-used' :
- !kept.usedByItemsCount ? 'iot-hub.remove-kept-own' : 'iot-hub.remove-kept-own-or-used';
- reasons.push(this.translate.instant(reasonKey, { kept: shared.length }));
- }
- if (withDevices.length) {
- // The profiles devices use, and what they use (default rule chains, dashboard), which stays with them
- const profiles = withDevices.filter(entity => entity.entityId.entityType === 'DEVICE_PROFILE').length;
- const key = withDevices.length > profiles ? 'iot-hub.remove-kept-devices-with-references' : 'iot-hub.remove-kept-devices';
- reasons.push(this.translate.instant(key, { profiles, devices: kept.devicesCount ?? 0 }));
- }
+ const references = (entities: IotHubKeptEntity[]): ResourceReferences =>
+ entities.map(entity => ({ id: entity.entityId as EntityId, name: entity.name }));
+ if (shared.length) {
+ // Kept because other packages use them, because the user had them before the package, or both
+ const reasonKey = !kept.usedExistingCount ? 'iot-hub.remove-kept-used' :
+ !kept.usedByItemsCount ? 'iot-hub.remove-kept-own' : 'iot-hub.remove-kept-own-or-used';
+ this.keptGroups.push({ reason: this.translate.instant(reasonKey, { kept: shared.length }), references: references(shared) });
+ }
+ if (withDevices.length) {
+ // The profiles devices use, and what those profiles use (default rule chains, dashboard)
+ this.keptGroups.push({ reason: this.translate.instant('iot-hub.remove-kept-referenced'), references: references(withDevices) });
+ }
+ if (this.keptGroups.length) {
this.keptTitle = this.translate.instant('iot-hub.remove-kept-title', { kept: shared.length + withDevices.length });
- this.keptReason = reasons.join(' ');
}
}
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 07d90f4b3a..944ab99022 100644
--- a/ui-ngx/src/assets/locale/locale.constant-en_US.json
+++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json
@@ -6449,8 +6449,7 @@
"remove-kept-title": "{ kept, plural, =1 {This entity will not be removed} other {These entities will not be removed} }",
"remove-kept-used": "Other installed packages use { kept, plural, =1 {it} other {them} }.",
"remove-kept-own": "You had { kept, plural, =1 {it} other {them} } before the package was installed.",
- "remove-kept-devices": "{ devices, plural, =1 {1 device still uses} other {# devices still use} } { profiles, plural, =1 {the device profile, so it stays} other {the device profiles, so they stay} }.",
- "remove-kept-devices-with-references": "{ devices, plural, =1 {1 device still uses} other {# devices still use} } { profiles, plural, =1 {the device profile, so it stays with the entities it uses} other {the device profiles, so they stay with the entities they use} }.",
+ "remove-kept-referenced": "Referenced by other tenant entities.",
"remove-kept-own-or-used": "You had { kept, plural, =1 {it} other {them} } before the package was installed, or other installed packages use { kept, plural, =1 {it} other {them} }.",
"remove-desc-solution-template": "Removing this solution template will also remove all created entities including dashboards, rule chains, devices, and other associated resources within your tenant",
"remove-anyway": "Remove anyway",