Browse Source

IoT Hub: the device package removal lists the kept entities in a hint that says why they stay

pull/16647/head
dshvaika 3 weeks ago
parent
commit
42d720cef5
  1. 9
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.html
  2. 12
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.ts
  3. 9
      ui-ngx/src/assets/locale/locale.constant-en_US.json

9
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.html

@ -9,7 +9,14 @@
<h2 class="tb-iot-hub-delete-title">{{ 'iot-hub.remove-confirm-title' | translate:{ name: data.itemName } }}</h2>
<p class="tb-iot-hub-delete-desc">{{ description }}</p>
@if (keptReferences) {
<tb-image-references [references]="keptReferences"></tb-image-references>
<div class="tb-form-hint tb-primary-fill">
<mat-icon>info_outline</mat-icon>
<div class="flex flex-col">
<div class="font-medium">{{ keptTitle }}</div>
<div>{{ keptReason }}</div>
<tb-image-references class="mt-3" [references]="keptReferences"></tb-image-references>
</div>
</div>
}
</div>
<div class="flex items-center justify-end gap-2 p-2">

12
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-delete-dialog.component.ts

@ -32,6 +32,8 @@ export class TbIotHubDeleteDialogComponent extends DialogComponent<TbIotHubDelet
// A device package keeps the entities other installed packages use, and the dialog lists them before the user confirms
keptReferences: ResourceReferences | null = null;
keptTitle: string;
keptReason: string;
constructor(
protected store: Store<AppState>,
@ -42,15 +44,15 @@ export class TbIotHubDeleteDialogComponent extends DialogComponent<TbIotHubDelet
private translate: TranslateService
) {
super(store, router, dialogRef);
this.description = this.translate.instant(data.itemType === 'SOLUTION_TEMPLATE' ? 'iot-hub.remove-desc-solution-template' : 'iot-hub.remove-desc');
const kept = data.keptEntities;
if (kept?.entities.length) {
this.keptReferences = kept.entities.map(entity => ({ id: entity.entityId as EntityId, name: entity.name }));
// Kept because other packages use them, because the user had them before the package, or both
const key = !kept.usedExistingCount ? 'iot-hub.remove-desc-kept' :
!kept.usedByItemsCount ? 'iot-hub.remove-desc-kept-own' : 'iot-hub.remove-desc-kept-own-or-used';
this.description = this.translate.instant(key, { count: kept.usedByItemsCount, kept: kept.entities.length });
} else {
this.description = this.translate.instant(data.itemType === 'SOLUTION_TEMPLATE' ? 'iot-hub.remove-desc-solution-template' : 'iot-hub.remove-desc');
const reasonKey = !kept.usedExistingCount ? 'iot-hub.remove-kept-used' :
!kept.usedByItemsCount ? 'iot-hub.remove-kept-own' : 'iot-hub.remove-kept-own-or-used';
this.keptTitle = this.translate.instant('iot-hub.remove-kept-title', { kept: kept.entities.length });
this.keptReason = this.translate.instant(reasonKey, { kept: kept.entities.length });
}
}

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

@ -6445,10 +6445,11 @@
"install-success-desc": "'{{name}}' has been installed successfully",
"remove": "Remove",
"remove-confirm-title": "Remove '{{name}}'?",
"remove-desc": "Removing this will also remove the installed entity and its associated resources within your tenant",
"remove-desc-kept-own": "Removing this will also remove the installed entity and its associated resources within your tenant. The following { kept, plural, =1 {entity will not be removed, because you had it} other {entities will not be removed, because you had them} } before the package was installed:",
"remove-desc-kept-own-or-used": "Removing this will also remove the installed entity and its associated resources within your tenant. The following { kept, plural, =1 {entity will not be removed, because you had it before the package was installed or it is used by} other {entities will not be removed, because you had them before the package was installed or they are used by} } { count, plural, =1 {1 other installed package} other {# other installed packages} }:",
"remove-desc-kept": "Removing this will also remove the installed entity and its associated resources within your tenant. The following { kept, plural, =1 {entity will not be removed, because it is} other {entities will not be removed, because they are} } used by { count, plural, =1 {1 other installed package} other {# other installed packages} }:",
"remove-desc": "Removing this will also remove the installed entity and its associated resources within your tenant.",
"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-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",
"select-entity-for-cf": "Select entity for calculated field '{{name}}'",

Loading…
Cancel
Save