]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: remaning critical-confirmation-modal to delete-confirmation-modal...
authorNaman Munet <naman.munet@ibm.com>
Mon, 10 Feb 2025 03:34:19 +0000 (09:04 +0530)
committerNaman Munet <naman.munet@ibm.com>
Tue, 18 Feb 2025 10:58:45 +0000 (16:28 +0530)
Fixes: https://tracker.ceph.com/issues/69628
Signed-off-by: Naman Munet <naman.munet@ibm.com>
54 files changed:
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-initiators-list/nvmeof-initiators-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-listeners-list/nvmeof-listeners-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-namespaces-list/nvmeof-namespaces-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/nvmeof-subsystems/nvmeof-subsystems.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-clients/cephfs-clients.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-snapshotschedule-list/cephfs-snapshotschedule-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-subvolume-group/cephfs-subvolume-group.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-subvolume-list/cephfs-subvolume-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-subvolume-snapshots-list/cephfs-subvolume-snapshots-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/multi-cluster/multi-cluster-list/multi-cluster-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade-progress/upgrade-progress.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-list/rgw-bucket-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-sync-policy-details/rgw-multisite-sync-policy-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-sync-policy/rgw-multisite-sync-policy.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-storage-class-list/rgw-storage-class-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-accounts/rgw-user-accounts.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-list/rgw-user-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-cluster-list/smb-cluster-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-list/user-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/components.module.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.html [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.scss [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.html [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.scss [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/crud-table/crud-table.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/enum/critical-confirmation-modal-impact.enum.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/enum/delete-confirmation-modal-impact.enum.ts [new file with mode: 0644]

index 60b9869f2c3df12a8edaa9e8f2283c6c941992f4..520b50af51095dc7b27556ace7cb66d4b57b80cc 100644 (file)
@@ -6,7 +6,7 @@ import { Subscription } from 'rxjs';
 
 import { IscsiService } from '~/app/shared/api/iscsi.service';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { TableComponent } from '~/app/shared/datatable/table/table.component';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
@@ -223,7 +223,7 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit,
   deleteIscsiTargetModal() {
     const target_iqn = this.selection.first().target_iqn;
 
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: $localize`iSCSI target`,
       itemNames: [target_iqn],
       submitActionObservable: () =>
index ef075f0f4b629409c90e02243bdd4e284dfc283f..0b1d6700f8e019edb82a034053483efd6da9e12d 100644 (file)
@@ -5,7 +5,7 @@ import { Observable, Subscriber, Subscription } from 'rxjs';
 
 import { RbdMirroringService } from '~/app/shared/api/rbd-mirroring.service';
 import { TableStatusViewCache } from '~/app/shared/classes/table-status-view-cache';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { URLVerbs } from '~/app/shared/constants/app.constants';
 import { Icons } from '~/app/shared/enum/icons.enum';
 import { CdTableAction } from '~/app/shared/models/cd-table-action';
@@ -16,7 +16,7 @@ import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { PoolEditPeerModalComponent } from '../pool-edit-peer-modal/pool-edit-peer-modal.component';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 
 const BASE_URL = '/block/mirroring';
 @Component({
@@ -147,7 +147,7 @@ export class PoolListComponent implements OnInit, OnDestroy {
     const poolName = this.selection.first().name;
     const peerUUID = this.getPeerUUID();
 
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: $localize`mirror peer`,
       itemNames: [`${poolName} (${peerUUID})`],
index a5575a9c9267eabe99d7ef44c7757378685185be..f8deaff3eeb7d94d14ddcfe376002a0ab6f89b3d 100644 (file)
@@ -1,7 +1,7 @@
 import { Component, Input, OnInit, TemplateRef, ViewChild } from '@angular/core';
 import { Router } from '@angular/router';
 import { NvmeofService } from '~/app/shared/api/nvmeof.service';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
 import { Icons } from '~/app/shared/enum/icons.enum';
 import { CdTableAction } from '~/app/shared/models/cd-table-action';
@@ -106,7 +106,7 @@ export class NvmeofInitiatorsListComponent implements OnInit {
       hostNQNs.splice(allowAllHostIndex, 1);
       itemNames = [...hostNQNs, $localize`Allow any host(*)`];
     }
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: 'Initiator',
       itemNames,
       actionDescription: 'remove',
index b49adda7c1b92df846a75d2d51dd3bc565884ebd..5190b9022760c572c6233a900c662fc50eedad94 100644 (file)
@@ -1,7 +1,7 @@
 import { Component, Input, OnInit } from '@angular/core';
 import { Router } from '@angular/router';
 import { NvmeofService } from '~/app/shared/api/nvmeof.service';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
 import { Icons } from '~/app/shared/enum/icons.enum';
@@ -99,7 +99,7 @@ export class NvmeofListenersListComponent implements OnInit {
 
   deleteListenerModal() {
     const listener = this.selection.first();
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: 'Listener',
       actionDescription: 'delete',
       itemNames: [`listener ${listener.host_name} (${listener.traddr}:${listener.trsvcid})`],
index 8f8f6eb8d05988d5190aacc98631e287d4836d58..0caa018c8bfe23043a204524f5683110ff79b8cb 100644 (file)
@@ -1,7 +1,7 @@
 import { Component, Input, OnInit } from '@angular/core';
 import { Router } from '@angular/router';
 import { NvmeofService } from '~/app/shared/api/nvmeof.service';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
 import { Icons } from '~/app/shared/enum/icons.enum';
 import { CdTableAction } from '~/app/shared/models/cd-table-action';
@@ -170,7 +170,7 @@ export class NvmeofNamespacesListComponent implements OnInit {
 
   deleteNamespaceModal() {
     const namespace = this.selection.first();
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: 'Namespace',
       itemNames: [namespace.nsid],
       actionDescription: 'delete',
index 269e427be50814ad17a020c9505d85d4e1df84ed..7d712ba2d5cd797e851ea0e52dd56b401925cef4 100644 (file)
@@ -9,7 +9,7 @@ import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
 import { CdTableAction } from '~/app/shared/models/cd-table-action';
 import { Icons } from '~/app/shared/enum/icons.enum';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { FinishedTask } from '~/app/shared/models/finished-task';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { NvmeofService } from '~/app/shared/api/nvmeof.service';
@@ -111,7 +111,7 @@ export class NvmeofSubsystemsComponent extends ListWithDetails implements OnInit
 
   deleteSubsystemModal() {
     const subsystem = this.selection.first();
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: 'Subsystem',
       itemNames: [subsystem.nqn],
       actionDescription: 'delete',
index 9e5c4fc9e3f3dea530a42a192816aa0889775400..d079113a0e26d9a37cebe51d64c9173dd12ab633 100644 (file)
@@ -7,7 +7,7 @@ import { RbdService } from '~/app/shared/api/rbd.service';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
 import { TableStatus } from '~/app/shared/classes/table-status';
 import { ConfirmationModalComponent } from '~/app/shared/components/confirmation-modal/confirmation-modal.component';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { TableComponent } from '~/app/shared/datatable/table/table.component';
 import { Icons } from '~/app/shared/enum/icons.enum';
@@ -32,7 +32,7 @@ import { RbdTrashMoveModalComponent } from '../rbd-trash-move-modal/rbd-trash-mo
 import { RBDImageFormat, RbdModel } from './rbd-model';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
 import { RBDActionHelpers } from '../rbd-contants';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 const BASE_URL = 'block/rbd';
 
 @Component({
@@ -426,7 +426,7 @@ export class RbdListComponent extends ListWithDetails implements OnInit {
     const imageName = this.selection.first().name;
     const imageSpec = new ImageSpec(poolName, namespace, imageName);
 
-    this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    this.cdsModalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: 'RBD',
       itemNames: [imageSpec.imageName],
@@ -451,7 +451,7 @@ export class RbdListComponent extends ListWithDetails implements OnInit {
     const imageName = this.selection.first().name;
     const imageSpec = new ImageSpec(poolName, namespace, imageName);
 
-    this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    this.cdsModalService.show(DeleteConfirmationModalComponent, {
       itemDescription: 'RBD',
       itemNames: [imageSpec],
       actionDescription: 'resync',
@@ -533,7 +533,7 @@ export class RbdListComponent extends ListWithDetails implements OnInit {
       this.selection.first().name
     );
 
-    this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    this.cdsModalService.show(DeleteConfirmationModalComponent, {
       actionDescription: 'remove scheduling on',
       itemDescription: $localize`image`,
       itemNames: [`${imageName}`],
index da099cb123337ba332560d1364989468051e74f4..297f8e2ea83fbc6d7d427a4266c3d040d549bc04 100644 (file)
@@ -5,7 +5,7 @@ import { forkJoin, Observable } from 'rxjs';
 
 import { PoolService } from '~/app/shared/api/pool.service';
 import { RbdService } from '~/app/shared/api/rbd.service';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { Icons } from '~/app/shared/enum/icons.enum';
 import { NotificationType } from '~/app/shared/enum/notification-type.enum';
@@ -123,7 +123,7 @@ export class RbdNamespaceListComponent implements OnInit {
   deleteModal() {
     const pool = this.selection.first().pool;
     const namespace = this.selection.first().namespace;
-    const modalRef = this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    const modalRef = this.cdsModalService.show(DeleteConfirmationModalComponent, {
       itemDescription: 'Namespace',
       itemNames: [`${pool}/${namespace}`],
       submitAction: () =>
index ac20dc76fa310f018c02004931049e9264e19286..144d008867ae0fd801bf30b0251efedebe4575c3 100644 (file)
@@ -15,7 +15,7 @@ import { of } from 'rxjs';
 import { RbdService } from '~/app/shared/api/rbd.service';
 import { CdHelperClass } from '~/app/shared/classes/cd-helper.class';
 import { ConfirmationModalComponent } from '~/app/shared/components/confirmation-modal/confirmation-modal.component';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
 import { CdTableAction } from '~/app/shared/models/cd-table-action';
@@ -37,7 +37,7 @@ import { RbdSnapshotFormModalComponent } from '../rbd-snapshot-form/rbd-snapshot
 import { RbdSnapshotActionsModel } from './rbd-snapshot-actions.model';
 import { RbdSnapshotModel } from './rbd-snapshot.model';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 
 @Component({
   selector: 'cd-rbd-snapshot-list',
@@ -325,7 +325,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges {
 
   deleteSnapshotModal() {
     const snapshotName = this.selection.selected[0].name;
-    this.modalRef = this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.cdsModalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: $localize`RBD snapshot`,
       itemNames: [snapshotName],
index c5fc2e7d6623a4189d549f943177ddee3fdaf376..a79a8dad03047e860a075be0985aa3db36975b0d 100644 (file)
@@ -6,7 +6,7 @@ import moment from 'moment';
 
 import { RbdService } from '~/app/shared/api/rbd.service';
 import { TableStatusViewCache } from '~/app/shared/classes/table-status-view-cache';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { TableComponent } from '~/app/shared/datatable/table/table.component';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
@@ -204,7 +204,7 @@ export class RbdTrashListComponent implements OnInit {
     const isExpired = moment().isAfter(expiresAt);
     const imageIdSpec = new ImageSpec(poolName, namespace, imageId);
 
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: 'RBD',
       itemNames: [imageIdSpec],
       bodyTemplate: this.deleteTpl,
index 538f265776b104428d0f3b483ccf327c855218ba..897b490c77be4b2f0b41fee3d4f886cc838bb49a 100644 (file)
@@ -5,7 +5,7 @@ import { BaseModal } from 'carbon-components-angular';
 
 import { CephfsService } from '~/app/shared/api/cephfs.service';
 import { TableStatusViewCache } from '~/app/shared/classes/table-status-view-cache';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { Icons } from '~/app/shared/enum/icons.enum';
 import { NotificationType } from '~/app/shared/enum/notification-type.enum';
@@ -94,7 +94,7 @@ export class CephfsClientsComponent extends BaseModal implements OnInit {
 
   evictClientModal() {
     const clientId = this.selection.first().id;
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: 'client',
       itemNames: [clientId],
       actionDescription: 'evict',
index f51290e31ec2626e8ccccc4888dd040bdb2a443b..9da8f63e8e8f56559b59e0c4ad8463f092671f00 100644 (file)
@@ -8,11 +8,11 @@ import moment from 'moment';
 
 import { CephfsService } from '~/app/shared/api/cephfs.service';
 import { ConfirmationModalComponent } from '~/app/shared/components/confirmation-modal/confirmation-modal.component';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { FormModalComponent } from '~/app/shared/components/form-modal/form-modal.component';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 import { Icons } from '~/app/shared/enum/icons.enum';
 import { NotificationType } from '~/app/shared/enum/notification-type.enum';
 import { CdValidators } from '~/app/shared/forms/cd-validators';
@@ -682,7 +682,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
   }
 
   deleteSnapshotModal() {
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: $localize`CephFs Snapshot`,
       itemNames: this.snapshot.selection.selected.map((snapshot: CephfsSnapshot) => snapshot.name),
index 48bca420132e638b0794a24e9e5bc84e76a56781..85be92fa74a465597a923b4efe4719bae13f532e 100644 (file)
@@ -9,7 +9,7 @@ import { ToastrModule } from 'ngx-toastr';
 import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
 import { SharedModule } from '~/app/shared/shared.module';
 import { configureTestBed } from '~/testing/unit-test-helper';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { CephfsVolumeFormComponent } from '../cephfs-form/cephfs-form.component';
 import { ModalService } from '~/app/shared/services/modal.service';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
@@ -61,7 +61,7 @@ describe('CephfsListComponent', () => {
     const callDeletion = () => {
       component.removeVolumeModal();
       expect(modalRef).toBeTruthy();
-      const deletion: CriticalConfirmationModalComponent = modalRef && modalRef.componentInstance;
+      const deletion: DeleteConfirmationModalComponent = modalRef && modalRef.componentInstance;
       deletion.submitActionObservable();
     };
 
index cda087b0a33cab8b062dc3ab9f6e300a17950fd8..383cd0ece4dbf8a1a2ff08853407421d92bca301 100644 (file)
@@ -10,7 +10,7 @@ import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { Icons } from '~/app/shared/enum/icons.enum';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { CdTableAction } from '~/app/shared/models/cd-table-action';
 import { CdTableColumn } from '~/app/shared/models/cd-table-column';
 import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data-context';
@@ -26,7 +26,7 @@ import { map, switchMap } from 'rxjs/operators';
 import { HealthService } from '~/app/shared/api/health.service';
 import { CephfsAuthModalComponent } from '~/app/ceph/cephfs/cephfs-auth-modal/cephfs-auth-modal.component';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 
 const BASE_URL = 'cephfs/fs';
 
@@ -173,7 +173,7 @@ export class CephfsListComponent extends ListWithDetails implements OnInit {
 
   removeVolumeModal() {
     const volName = this.selection.first().mdsmap['fs_name'];
-    this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    this.cdsModalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: 'File System',
       itemNames: [volName],
index b61b9574a1b5d036e0b5450c2d9b46a94c4b2d4d..09b74b51d7b7f0e39e8fc451d12442c541679cf4 100644 (file)
@@ -27,7 +27,7 @@ import { BlockUI, NgBlockUI } from 'ng-block-ui';
 import { NotificationType } from '~/app/shared/enum/notification-type.enum';
 import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
 import { CephfsSnapshotscheduleFormComponent } from '../cephfs-snapshotschedule-form/cephfs-snapshotschedule-form.component';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { FinishedTask } from '~/app/shared/models/finished-task';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
@@ -245,7 +245,7 @@ export class CephfsSnapshotscheduleListComponent
   deactivateSnapshotSchedule() {
     const { path, start, fs, schedule, subvol, group } = this.selection.first();
 
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: $localize`snapshot schedule`,
       actionDescription: this.actionLabels.DEACTIVATE,
       submitActionObservable: () =>
@@ -268,7 +268,7 @@ export class CephfsSnapshotscheduleListComponent
   activateSnapshotSchedule() {
     const { path, start, fs, schedule, subvol, group } = this.selection.first();
 
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: $localize`snapshot schedule`,
       actionDescription: this.actionLabels.ACTIVATE,
       submitActionObservable: () =>
@@ -300,7 +300,7 @@ export class CephfsSnapshotscheduleListComponent
       })
       ?.join('|');
 
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: $localize`snapshot schedule`,
       submitActionObservable: () =>
         this.taskWrapper.wrapTaskAroundCall({
index 167ea4b8c5cedde0519c42d63ec6456fd718f70c..9d68fd5c006262e5ae12e24a07dc0bd116ecded8 100644 (file)
@@ -13,14 +13,14 @@ import { CephfsSubvolumegroupFormComponent } from '../cephfs-subvolumegroup-form
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
 import { Permissions } from '~/app/shared/models/permissions';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { FinishedTask } from '~/app/shared/models/finished-task';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { CephfsSubvolumeGroup } from '~/app/shared/models/cephfs-subvolume-group.model';
 import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
 import _ from 'lodash';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 
 @Component({
   selector: 'cd-cephfs-subvolume-group',
@@ -175,7 +175,7 @@ export class CephfsSubvolumeGroupComponent implements OnInit, OnChanges {
 
   removeSubVolumeModal() {
     const name = this.selection.first().name;
-    this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    this.cdsModalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: 'subvolume group',
       itemNames: [name],
index 013288fc36b342238cdd9f1157f80d3c08b9f0d0..eb048cb5b236b965d4026494e082367969b66670 100644 (file)
@@ -27,7 +27,7 @@ import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
 import { FormControl } from '@angular/forms';
 import { CdFormGroup } from '~/app/shared/forms/cd-form-group';
 import { CdForm } from '~/app/shared/forms/cd-form';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { CephfsSubvolumeGroupService } from '~/app/shared/api/cephfs-subvolume-group.service';
 import { CephfsSubvolumeGroup } from '~/app/shared/models/cephfs-subvolume-group.model';
 import { CephfsMountDetailsComponent } from '../cephfs-mount-details/cephfs-mount-details.component';
@@ -35,7 +35,7 @@ import { HealthService } from '~/app/shared/api/health.service';
 import _ from 'lodash';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
 import { DEFAULT_SUBVOLUME_GROUP } from '~/app/shared/constants/cephfs.constant';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 
 @Component({
   selector: 'cd-cephfs-subvolume-list',
@@ -246,7 +246,7 @@ export class CephfsSubvolumeListComponent extends CdForm implements OnInit, OnCh
     });
     this.errorMessage = '';
     this.selectedName = this.selection.first().name;
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       actionDescription: 'remove',
       itemNames: [this.selectedName],
index 770fbf2fe5225daebe5814544428e9d19d6e5f23..eabcee6b2ed4ec93fa0ad095893a486525955f92 100644 (file)
@@ -16,7 +16,7 @@ import { Permissions } from '~/app/shared/models/permissions';
 import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
 import { CdDatePipe } from '~/app/shared/pipes/cd-date.pipe';
 import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { FinishedTask } from '~/app/shared/models/finished-task';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { FormModalComponent } from '~/app/shared/components/form-modal/form-modal.component';
@@ -27,7 +27,7 @@ import { Validators } from '@angular/forms';
 import { CdValidators } from '~/app/shared/forms/cd-validators';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
 import { DEFAULT_SUBVOLUME_GROUP } from '~/app/shared/constants/cephfs.constant';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 
 @Component({
   selector: 'cd-cephfs-subvolume-snapshots-list',
@@ -228,7 +228,7 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
     const subVolumeName = this.activeSubVolumeName;
     const subVolumeGroupName = this.activeGroupName;
     const fsName = this.fsName;
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       actionDescription: 'remove',
       itemNames: [snapshotName],
index 118cb18430a3c4a52ef9653d1216a9239578cc7f..7d44deaba8d48968ea850ed86fd59ea253b04e60 100644 (file)
@@ -13,7 +13,7 @@ import { CdForm } from '~/app/shared/forms/cd-form';
 import { CdFormGroup } from '~/app/shared/forms/cd-form-group';
 import { NotificationService } from '~/app/shared/services/notification.service';
 import { ConfigFormCreateRequestModel } from './configuration-form-create-request.model';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
 
 const RGW = 'rgw';
@@ -158,7 +158,7 @@ export class ConfigurationFormComponent extends CdForm implements OnInit {
   }
 
   openCriticalConfirmModal() {
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       buttonText: $localize`Force Edit`,
       actionDescription: $localize`force edit`,
       itemDescription: $localize`configuration`,
index 702c90e3c5c877bebf97f8d1aafbfded1490b762..7a3bbf079d869f310afe8cfe335424b3bf844775 100644 (file)
@@ -10,7 +10,7 @@ import { HostService } from '~/app/shared/api/host.service';
 import { OrchestratorService } from '~/app/shared/api/orchestrator.service';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
 import { ConfirmationModalComponent } from '~/app/shared/components/confirmation-modal/confirmation-modal.component';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { FormModalComponent } from '~/app/shared/components/form-modal/form-modal.component';
 import { SelectMessages } from '~/app/shared/components/select/select-messages.model';
 import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
@@ -34,7 +34,7 @@ import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { URLBuilderService } from '~/app/shared/services/url-builder.service';
 import { HostFormComponent } from './host-form/host-form.component';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 
 const BASE_URL = 'hosts';
 
@@ -470,7 +470,7 @@ export class HostsComponent extends ListWithDetails implements OnDestroy, OnInit
 
   deleteAction() {
     const hostname = this.selection.first().hostname;
-    this.modalRef = this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.cdsModalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: 'Host',
       itemNames: [hostname],
index cfdc2e1720e8f35aeb2b57511a9c74de9481f0e0..ab03649e6377ffd5931fa5801f5d438c16bb91a4 100644 (file)
@@ -11,7 +11,7 @@ import { MultiClusterFormComponent } from '../multi-cluster-form/multi-cluster-f
 import { TableComponent } from '~/app/shared/datatable/table/table.component';
 import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
 import { Permissions } from '~/app/shared/models/permissions';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { NotificationService } from '~/app/shared/services/notification.service';
 import { NotificationType } from '~/app/shared/enum/notification-type.enum';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
@@ -230,7 +230,7 @@ export class MultiClusterListComponent extends ListWithDetails implements OnInit
 
   openDeleteClusterModal() {
     const cluster = this.selection.first();
-    this.modalRef = this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.cdsModalService.show(DeleteConfirmationModalComponent, {
       infoMessage: $localize`Please note that the data for the disconnected cluster will be visible for a duration of ~ 5 minutes. After this period, it will be automatically removed.`,
       actionDescription: $localize`Disconnect`,
       itemDescription: $localize`Cluster`,
index 85ea92404140523e6848418b687d47434c7724a2..f43c5108ce73ae1f2ce22b447addae88753c793c 100644 (file)
@@ -16,7 +16,7 @@ import { CoreModule } from '~/app/core/core.module';
 import { OrchestratorService } from '~/app/shared/api/orchestrator.service';
 import { OsdService } from '~/app/shared/api/osd.service';
 import { ConfirmationModalComponent } from '~/app/shared/components/confirmation-modal/confirmation-modal.component';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { FormModalComponent } from '~/app/shared/components/form-modal/form-modal.component';
 import { TableActionsComponent } from '~/app/shared/datatable/table-actions/table-actions.component';
 import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
@@ -501,7 +501,7 @@ describe('OsdListComponent', () => {
     });
 
     it.skip('opens all critical confirmation modals', () => {
-      const modalClass = CriticalConfirmationModalComponent;
+      const modalClass = DeleteConfirmationModalComponent;
       mockSafeToDestroy();
       expectOpensModal('Mark Lost', modalClass);
       expectOpensModal('Purge', modalClass);
index 19e3a6d2aba1201284d43c18ccf98bc67c9c87f2..670163dd909bec7982a79770f31ce0e27b0c51df 100644 (file)
@@ -11,7 +11,7 @@ import { OrchestratorService } from '~/app/shared/api/orchestrator.service';
 import { OsdService } from '~/app/shared/api/osd.service';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
 import { ConfirmationModalComponent } from '~/app/shared/components/confirmation-modal/confirmation-modal.component';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { FormModalComponent } from '~/app/shared/components/form-modal/form-modal.component';
 import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
@@ -41,7 +41,7 @@ import { OsdScrubModalComponent } from '../osd-scrub-modal/osd-scrub-modal.compo
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
 import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data-context';
 import { Osd } from '~/app/shared/models/osd.model';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 
 const BASE_URL = 'osd';
 
@@ -583,7 +583,7 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
   ): void {
     check(this.getSelectedOsdIds()).subscribe((result) => {
       const osdIds = this.getSelectedOsdIds();
-      this.cdsModalService.show(CriticalConfirmationModalComponent, {
+      this.cdsModalService.show(DeleteConfirmationModalComponent, {
         impact: DeletionImpact.high,
         itemNames: osdIds,
         actionDescription: actionDescription,
index 47793509747c7b6db1d0d7b962f6499f95e59478..7fdf0d37b53f263f7ff5f4e8c7664d150c25a08c 100644 (file)
@@ -8,7 +8,7 @@ import { ToastrModule } from 'ngx-toastr';
 import { of } from 'rxjs';
 
 import { PrometheusService } from '~/app/shared/api/prometheus.service';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { TableActionsComponent } from '~/app/shared/datatable/table-actions/table-actions.component';
 import { NotificationType } from '~/app/shared/enum/notification-type.enum';
 import { Permission } from '~/app/shared/models/permissions';
@@ -143,7 +143,7 @@ describe('SilenceListComponent', () => {
 
     const expireSilence = () => {
       component.expireSilence();
-      const deletion: CriticalConfirmationModalComponent = component.modalRef.componentInstance;
+      const deletion: DeleteConfirmationModalComponent = component.modalRef.componentInstance;
       // deletion.modalRef = new BsModalRef();
       deletion.ngOnInit();
       deletion.callSubmitAction();
index 7098e0027970f9cb694076b8e376627cb2134d96..d83b49223b5c5d90a1eff4934d99ec86def63629 100644 (file)
@@ -6,7 +6,7 @@ import { Observable, Subscriber } from 'rxjs';
 import { PrometheusListHelper } from '~/app/shared/helpers/prometheus-list-helper';
 import { SilenceFormComponent } from '~/app/ceph/cluster/prometheus/silence-form/silence-form.component';
 import { PrometheusService } from '~/app/shared/api/prometheus.service';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n, SucceededActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
 import { Icons } from '~/app/shared/enum/icons.enum';
@@ -195,7 +195,7 @@ export class SilenceListComponent extends PrometheusListHelper {
     const id = this.selection.first().id;
     const i18nSilence = $localize`Silence`;
     const applicationName = 'Prometheus';
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: i18nSilence,
       itemNames: [id],
       actionDescription: this.actionLabels.EXPIRE,
index 000cda887ef2967c0039686183aefe1ebfa3f4ad..e8202b7633cd9e95c1ef9495f5fccd03468691b1 100644 (file)
@@ -7,7 +7,7 @@ import { delay } from 'rxjs/operators';
 import { CephServiceService } from '~/app/shared/api/ceph-service.service';
 import { OrchestratorService } from '~/app/shared/api/orchestrator.service';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
 import { TableComponent } from '~/app/shared/datatable/table/table.component';
 import { Icons } from '~/app/shared/enum/icons.enum';
@@ -30,7 +30,6 @@ import { ServiceFormComponent } from './service-form/service-form.component';
 import { SettingsService } from '~/app/shared/api/settings.service';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
 
 const BASE_URL = 'services';
 
@@ -276,8 +275,7 @@ export class ServicesComponent extends ListWithDetails implements OnChanges, OnI
 
   deleteAction() {
     const service = this.selection.first();
-    this.cdsModalService.show(CriticalConfirmationModalComponent, {
-      impact: DeletionImpact.high,
+    this.cdsModalService.show(DeleteConfirmationModalComponent, {
       itemDescription: $localize`Service`,
       itemNames: [service.service_name],
       actionDescription: 'delete',
index a04b4577365867f37b3bdd2b5b0fad83208b2fcf..8a119a4c466864f14f24c93c8b14553917fdb8ed 100644 (file)
@@ -4,7 +4,7 @@ import { Observable, ReplaySubject, Subscription } from 'rxjs';
 import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
 
 import { Icons } from '~/app/shared/enum/icons.enum';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
 import { Permission } from '~/app/shared/models/permissions';
 import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
@@ -109,7 +109,7 @@ export class UpgradeProgressComponent implements OnInit, OnDestroy {
   stopUpgradeModal() {
     // pause the upgrade meanwhile we get stop confirmation from user
     this.pauseUpgrade();
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: 'Upgrade',
       actionDescription: 'stop',
       submitAction: () => this.stopUpgrade(),
index d6dc5007e21e7be9262c7fd1c5e2ea50e20ff067..53b764be0b637862531da4d528406adafec66d4f 100644 (file)
@@ -7,7 +7,7 @@ import { Subscription } from 'rxjs';
 
 import { NfsService } from '~/app/shared/api/nfs.service';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { TableComponent } from '~/app/shared/datatable/table/table.component';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
@@ -25,7 +25,7 @@ import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { getFsalFromRoute, getPathfromFsal } from '../utils';
 import { SUPPORTED_FSAL } from '../models/nfs.fsal';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 
 export enum RgwExportType {
   BUCKET = 'bucket',
@@ -212,7 +212,7 @@ export class NfsListComponent extends ListWithDetails implements OnInit, OnDestr
     const cluster_id = this.selection.first().cluster_id;
     const export_id = this.selection.first().export_id;
 
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: $localize`NFS export`,
       itemNames: [`${cluster_id}:${export_id}`],
index d831c59ca2f2035be80d99711679eec3906e0f85..9c2bb5ed5d9cccd26419be37454418791efc28d0 100644 (file)
@@ -21,7 +21,7 @@ import { ErrorComponent } from '~/app/core/error/error.component';
 import { CrushRuleService } from '~/app/shared/api/crush-rule.service';
 import { ErasureCodeProfileService } from '~/app/shared/api/erasure-code-profile.service';
 import { PoolService } from '~/app/shared/api/pool.service';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { SelectBadgesComponent } from '~/app/shared/components/select-badges/select-badges.component';
 import { CdFormGroup } from '~/app/shared/forms/cd-form-group';
 import { ErasureCodeProfile } from '~/app/shared/models/erasure-code-profile';
@@ -795,7 +795,7 @@ describe('PoolFormComponent', () => {
 
     describe('crush rule deletion', () => {
       let taskWrapper: TaskWrapperService;
-      let deletion: CriticalConfirmationModalComponent;
+      let deletion: DeleteConfirmationModalComponent;
       let deleteSpy: jasmine.Spy;
       let modalSpy: jasmine.Spy;
 
@@ -946,7 +946,7 @@ describe('PoolFormComponent', () => {
 
     describe('ecp deletion', () => {
       let taskWrapper: TaskWrapperService;
-      let deletion: CriticalConfirmationModalComponent;
+      let deletion: DeleteConfirmationModalComponent;
       let deleteSpy: jasmine.Spy;
       let modalSpy: jasmine.Spy;
       let modal: NgbModalRef;
index 692229c66bd96cff8369241c1e9cbeef62542761..b7cda346e984bdddfbe3ea78bdcc588f19d407fc 100644 (file)
@@ -11,7 +11,7 @@ import { CrushRuleService } from '~/app/shared/api/crush-rule.service';
 import { ErasureCodeProfileService } from '~/app/shared/api/erasure-code-profile.service';
 import { PoolService } from '~/app/shared/api/pool.service';
 import { CrushNodeSelectionClass } from '~/app/shared/classes/crush.node.selection.class';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { SelectOption } from '~/app/shared/components/select/select-option.model';
 import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
 import { Icons } from '~/app/shared/enum/icons.enum';
@@ -687,7 +687,7 @@ export class PoolFormComponent extends CdForm implements OnInit {
       return;
     }
     const name = value[nameAttribute];
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription,
       itemNames: [name],
       submitActionObservable: () => {
index 98a0e474500d5418566617fc3712aeac63fd8e1f..690aa74784d692a9a52bcf4220dd45739ed20525 100644 (file)
@@ -13,7 +13,7 @@ import { PgCategoryService } from '~/app/ceph/shared/pg-category.service';
 import { ConfigurationService } from '~/app/shared/api/configuration.service';
 import { ErasureCodeProfileService } from '~/app/shared/api/erasure-code-profile.service';
 import { PoolService } from '~/app/shared/api/pool.service';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ErasureCodeProfile } from '~/app/shared/models/erasure-code-profile';
 import { ExecutingTask } from '~/app/shared/models/executing-task';
 import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
@@ -152,7 +152,7 @@ describe('PoolListComponent', () => {
     const callDeletion = () => {
       component.deletePoolModal();
       expect(modalRef).toBeTruthy();
-      const deletion: CriticalConfirmationModalComponent = modalRef && modalRef.componentInstance;
+      const deletion: DeleteConfirmationModalComponent = modalRef && modalRef.componentInstance;
       deletion.submitActionObservable();
     };
 
index dddfbdd6385fb927dbc38bad4845f32adec9e9fd..6342897a7677ed67456182761bd513d3d0399dcd 100644 (file)
@@ -9,7 +9,7 @@ import { ErasureCodeProfileService } from '~/app/shared/api/erasure-code-profile
 import { PoolService } from '~/app/shared/api/pool.service';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
 import { TableStatusViewCache } from '~/app/shared/classes/table-status-view-cache';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
 import { TableComponent } from '~/app/shared/datatable/table/table.component';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
@@ -30,7 +30,7 @@ import { URLBuilderService } from '~/app/shared/services/url-builder.service';
 import { Pool } from '../pool';
 import { PoolStat, PoolStats } from '../pool-stat';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 
 const BASE_URL = 'pool';
 
@@ -224,7 +224,7 @@ export class PoolListComponent extends ListWithDetails implements OnInit {
 
   deletePoolModal() {
     const name = this.selection.first().pool_name;
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: 'Pool',
       itemNames: [name],
index b2fa1b4a5e520f5e36b53d1dd477ec464111ee30..347ed3745829cac935b440aca008f0cae51f3a45 100644 (file)
@@ -6,7 +6,7 @@ import { switchMap } from 'rxjs/operators';
 
 import { RgwBucketService } from '~/app/shared/api/rgw-bucket.service';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { TableComponent } from '~/app/shared/datatable/table/table.component';
 import { Icons } from '~/app/shared/enum/icons.enum';
@@ -23,7 +23,7 @@ import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { URLBuilderService } from '~/app/shared/services/url-builder.service';
 import { Bucket } from '../models/rgw-bucket';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 
 const BASE_URL = 'rgw/bucket';
 
@@ -154,7 +154,7 @@ export class RgwBucketListComponent extends ListWithDetails implements OnInit, O
 
   deleteAction() {
     const itemNames = this.selection.selected.map((bucket: any) => bucket['bid']);
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: $localize`bucket`,
       impact: DeletionImpact.high,
       itemNames: itemNames,
index 546b32b250c316dfd5dd682a6084c345b4a6d951..c213ae26a599c5d16fbbda157eb938c486080ed9 100644 (file)
@@ -15,7 +15,7 @@ import { forkJoin, Subscription, timer as observableTimer } from 'rxjs';
 import { RgwRealmService } from '~/app/shared/api/rgw-realm.service';
 import { RgwZoneService } from '~/app/shared/api/rgw-zone.service';
 import { RgwZonegroupService } from '~/app/shared/api/rgw-zonegroup.service';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n, TimerServiceInterval } from '~/app/shared/constants/app.constants';
 import { Icons } from '~/app/shared/enum/icons.enum';
 import { NotificationType } from '~/app/shared/enum/notification-type.enum';
@@ -581,7 +581,7 @@ export class RgwMultisiteDetailsComponent implements OnDestroy, OnInit {
 
   delete(node: Node) {
     if (node?.data?.type === 'realm') {
-      const modalRef = this.cdsModalService.show(CriticalConfirmationModalComponent, {
+      const modalRef = this.cdsModalService.show(DeleteConfirmationModalComponent, {
         itemDescription: $localize`${node?.data?.type} ${node?.data?.name}`,
         itemNames: [`${node?.data?.name}`],
         submitAction: () => {
index f6135515aa36c5c64d990d7024d83d056b1ed9b9..0f2175b0bcfc542e1306d6dc6c4269c026870559 100755 (executable)
@@ -8,7 +8,7 @@ import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
 import { Permission } from '~/app/shared/models/permissions';
 import { ModalService } from '~/app/shared/services/modal.service';
 import { RgwMultisiteService } from '~/app/shared/api/rgw-multisite.service';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { FinishedTask } from '~/app/shared/models/finished-task';
 import { Observable, Subscriber, forkJoin as observableForkJoin } from 'rxjs';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
@@ -244,7 +244,7 @@ export class RgwMultisiteSyncPolicyDetailsComponent implements OnChanges {
       selection = this.dirFlowSelection;
     }
     const flowIds = selection.selected.map((flow: any) => flow.id);
-    this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    this.cdsModalService.show(DeleteConfirmationModalComponent, {
       itemDescription: selection.hasSingleSelection ? $localize`Flow` : $localize`Flows`,
       itemNames: flowIds,
       bodyTemplate: this.deleteTpl,
@@ -309,7 +309,7 @@ export class RgwMultisiteSyncPolicyDetailsComponent implements OnChanges {
   deletePipe() {
     this.resourceType = MultisiteResourceType.pipe;
     const pipeIds = this.pipeSelection.selected.map((pipe: any) => pipe.id);
-    this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    this.cdsModalService.show(DeleteConfirmationModalComponent, {
       itemDescription: this.pipeSelection.hasSingleSelection ? $localize`Pipe` : $localize`Pipes`,
       itemNames: pipeIds,
       bodyTemplate: this.deleteTpl,
index 03228856125d9b327dfb02c2496232285dc1b479..80c6b033de759345f259a5bc28ab96f83a77a6ce 100644 (file)
@@ -5,7 +5,7 @@ import { forkJoin as observableForkJoin, Observable, Subscriber } from 'rxjs';
 import { RgwDaemonService } from '~/app/shared/api/rgw-daemon.service';
 import { RgwMultisiteService } from '~/app/shared/api/rgw-multisite.service';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n, URLVerbs } from '~/app/shared/constants/app.constants';
 import { TableComponent } from '~/app/shared/datatable/table/table.component';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
@@ -174,7 +174,7 @@ export class RgwMultisiteSyncPolicyComponent extends ListWithDetails implements
 
   deleteAction() {
     const groupNames = this.selection.selected.map((policy: any) => policy.groupName);
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: this.selection.hasSingleSelection
         ? $localize`Policy Group`
         : $localize`Policy Groups`,
index 16afef45d368916938cca8b53f66ec2b4c7ffbc1..1f6fddf032dca67cb708830574f410e3ceb34b2b 100644 (file)
@@ -15,8 +15,8 @@ import {
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { FinishedTask } from '~/app/shared/models/finished-task';
 import { Icons } from '~/app/shared/enum/icons.enum';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
 import { RgwZonegroupService } from '~/app/shared/api/rgw-zonegroup.service';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { RgwStorageClassService } from '~/app/shared/api/rgw-storage-class.service';
@@ -140,7 +140,7 @@ export class RgwStorageClassListComponent extends ListWithDetails implements OnI
   removeStorageClassModal() {
     const storage_class = this.selection.first().storage_class;
     const placement_target = this.selection.first().placement_target;
-    this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    this.cdsModalService.show(DeleteConfirmationModalComponent, {
       itemDescription: $localize`Tiering Storage Class`,
       itemNames: [storage_class],
       actionDescription: 'remove',
index dd4cf1b21aca4fb6866f50d0fc899f1da4c8bd46..6ac218093ea0ce2f83293d17d61029ce3f5fa43e 100644 (file)
@@ -14,7 +14,7 @@ import { URLBuilderService } from '~/app/shared/services/url-builder.service';
 import { Icons } from '~/app/shared/enum/icons.enum';
 import { Router } from '@angular/router';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
 import { Observable, Subscriber, forkJoin as observableForkJoin } from 'rxjs';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
@@ -175,7 +175,7 @@ export class RgwUserAccountsComponent extends ListWithDetails implements OnInit
 
   deleteAction() {
     const account_name = this.selection.first().name;
-    this.cdsModalService.show(CriticalConfirmationModalComponent, {
+    this.cdsModalService.show(DeleteConfirmationModalComponent, {
       itemDescription: $localize`Account`,
       itemNames: [account_name],
       submitActionObservable: () => {
index d7d74695864ab9678ba26b2fd175a2b08daecb02..f44e8f8c2cd03fc247c9e5826ebea28c04e03bc3 100644 (file)
@@ -4,11 +4,11 @@ import { forkJoin as observableForkJoin, Observable, Subscriber } from 'rxjs';
 
 import { RgwUserService } from '~/app/shared/api/rgw-user.service';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { TableComponent } from '~/app/shared/datatable/table/table.component';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 import { Icons } from '~/app/shared/enum/icons.enum';
 import { CdTableAction } from '~/app/shared/models/cd-table-action';
 import { CdTableColumn } from '~/app/shared/models/cd-table-column';
@@ -148,7 +148,7 @@ export class RgwUserListComponent extends ListWithDetails implements OnInit {
   }
 
   deleteAction() {
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: this.selection.hasSingleSelection ? $localize`user` : $localize`users`,
       itemNames: this.selection.selected.map((user: any) => user['uid']),
index d1217d87fb1978915a3340f34eea5651aff32409..4413d6486a1fafa825c37ef87ed360721be22457 100644 (file)
@@ -21,7 +21,7 @@ import { URLBuilderService } from '~/app/shared/services/url-builder.service';
 import { SMBCluster } from '../smb.model';
 import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { FinishedTask } from '~/app/shared/models/finished-task';
 
@@ -109,7 +109,7 @@ export class SmbClusterListComponent extends ListWithDetails implements OnInit {
   removeSMBClusterModal() {
     const cluster_id = this.selection.first().cluster_id;
 
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: $localize`Cluster`,
       itemNames: [cluster_id],
       actionDescription: $localize`remove`,
index 8e7e12b369207a58da3142d697a09c278f93719b..71e1e414df6832b451aea40ae3ada07cfe5adcbc 100644 (file)
@@ -6,7 +6,7 @@ import { forkJoin } from 'rxjs';
 import { RoleService } from '~/app/shared/api/role.service';
 import { ScopeService } from '~/app/shared/api/scope.service';
 import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { FormModalComponent } from '~/app/shared/components/form-modal/form-modal.component';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
@@ -134,7 +134,7 @@ export class RoleListComponent extends ListWithDetails implements OnInit {
 
   deleteRoleModal() {
     const name = this.selection.first().name;
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: 'Role',
       itemNames: [name],
       submitAction: () => this.deleteRole(name)
index a414b6a154a03df5681658c120ec7e0cb1274075..18c07cb445e2920936a51b8e57b07344d1743ece 100755 (executable)
@@ -4,10 +4,10 @@ import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
 
 import { SettingsService } from '~/app/shared/api/settings.service';
 import { UserService } from '~/app/shared/api/user.service';
-import { CriticalConfirmationModalComponent } from '~/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 import { Icons } from '~/app/shared/enum/icons.enum';
 import { NotificationType } from '~/app/shared/enum/notification-type.enum';
 import { CdTableAction } from '~/app/shared/models/cd-table-action';
@@ -174,7 +174,7 @@ export class UserListComponent implements OnInit {
       return;
     }
 
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: 'User',
       itemNames: [username],
index 47657aedf6177730e54beb10b7778cfc2a8e7a96..8f335822a779c608cb25c718da1bf5a622d92504 100644 (file)
@@ -48,7 +48,7 @@ import { ColorClassFromTextPipe } from './cd-label/color-class-from-text.pipe';
 import { ConfigOptionComponent } from './config-option/config-option.component';
 import { ConfirmationModalComponent } from './confirmation-modal/confirmation-modal.component';
 import { Copy2ClipboardButtonComponent } from './copy2clipboard-button/copy2clipboard-button.component';
-import { CriticalConfirmationModalComponent } from './critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from './delete-confirmation-modal/delete-confirmation-modal.component';
 import { CustomLoginBannerComponent } from './custom-login-banner/custom-login-banner.component';
 import { DateTimePickerComponent } from './date-time-picker/date-time-picker.component';
 import { DocComponent } from './doc/doc.component';
@@ -132,7 +132,7 @@ import InfoIcon from '@carbon/icons/es/information/16';
     LoadingPanelComponent,
     ModalComponent,
     NotificationsSidebarComponent,
-    CriticalConfirmationModalComponent,
+    DeleteConfirmationModalComponent,
     ConfirmationModalComponent,
     LanguageSelectorComponent,
     GrafanaComponent,
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.html
deleted file mode 100644 (file)
index 3ae4b33..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<cds-modal size="sm"
-           [open]="open"
-           (overlaySelected)="closeModal()">
-  <cds-modal-header (closeSelect)="closeModal()">
-    <ng-container *ngTemplateOutlet="deletionHeading"></ng-container>
-  </cds-modal-header>
-
-  <section cdsModalContent>
-    <form name="deletionForm"
-          #formDir="ngForm"
-          [formGroup]="deletionForm"
-          novalidate>
-      <cd-alert-panel *ngIf="infoMessage"
-                      type="info"
-                      spacingClass="mb-3"
-                      i18n>
-        <p>{{ infoMessage }}</p>
-      </cd-alert-panel>
-      <ng-container *ngTemplateOutlet="bodyTemplate; context: bodyContext"></ng-container>
-      <div class="question">
-        <span *ngIf="itemNames; else noNames">
-          <p *ngIf="itemNames.length === 1; else manyNames"
-             i18n>Are you sure that you want to {{ actionDescription | lowercase }} <strong>{{ itemNames[0] }}</strong>?</p>
-          <ng-template #manyNames>
-            <p i18n>Are you sure that you want to {{ actionDescription | lowercase }} the selected items?</p>
-            <ul>
-              <li *ngFor="let itemName of itemNames"><strong>{{ itemName }}</strong></li>
-            </ul>
-          </ng-template >
-        </span>
-        <ng-template #noNames>
-          <p i18n>Are you sure that you want to {{ actionDescription | lowercase }} the selected {{ itemDescription }}?</p>
-        </ng-template>
-        <ng-container *ngTemplateOutlet="childFormGroupTemplate; context:{form:deletionForm}"></ng-container>
-        <div class="form-item">
-          <ng-container *ngIf="impact == impactEnum.normal; else highImpactDeletion">
-            <cds-checkbox id="confirmation"
-                          name="confirmation"
-                          formControlName="confirmation"
-                          autofocus
-                          [required]="true"
-                          modal-primary-focus
-                          i18n>Yes, I am sure.</cds-checkbox>
-          </ng-container>
-          <ng-template #highImpactDeletion>
-            <cds-text-label label="Resource Name"
-                            for="resource_name"
-                            cdRequiredField="Resource Name"
-                            [invalid]="!deletionForm.controls.confirmInput.valid && deletionForm.controls.confirmInput.dirty"
-                            [invalidText]="ResourceError"
-                            i18n>Resource Name
-              <input cdsText
-                     type="text"
-                     placeholder="Enter resource name to delete"
-                     id="resource_name"
-                     formControlName="confirmInput"/>
-            </cds-text-label>
-            <ng-template #ResourceError>
-              <span *ngIf="deletionForm.showError('confirmInput', formDir, 'required')"
-                    class="invalid-feedback">
-                <ng-container i18n>This field is required.</ng-container>
-              </span>
-              <span *ngIf="deletionForm.showError('confirmInput', formDir, 'matchResource')"
-                    class="invalid-feedback">
-                <ng-container i18n>Enter the correct resource name.</ng-container>
-              </span>
-            </ng-template>
-          </ng-template>
-        </div>
-      </div>
-    </form>
-  </section>
-  <cd-form-button-panel (submitActionEvent)="callSubmitAction()"
-                        (backActionEvent)="backAction ? callBackAction() : hideModal()"
-                        [form]="deletionForm"
-                        [submitText]="(actionDescription | titlecase) + ' ' + itemDescription"
-                        [modalForm]="true"
-                        [submitBtnType]="(actionDescription === 'delete' || actionDescription === 'remove') ? 'danger' : 'primary'"></cd-form-button-panel>
-
-</cds-modal>
-
-<ng-template #deletionHeading>
-  <h3 cdsModalHeaderHeading
-      i18n>
-    {{ actionDescription | titlecase }} {{ itemDescription }}
-  </h3>
-</ng-template>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.scss
deleted file mode 100644 (file)
index 979cb13..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.modal-body .question {
-  margin-top: 1em;
-}
-
-.modal-body label {
-  font-weight: bold;
-}
-
-.modal-body .question .form-check {
-  padding-top: 7px;
-}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts
deleted file mode 100644 (file)
index 814f18a..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-import { Component, NgModule, TemplateRef, ViewChild } from '@angular/core';
-import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
-import { NgForm, ReactiveFormsModule } from '@angular/forms';
-
-import { Observable, Subscriber, timer as observableTimer } from 'rxjs';
-
-import { DirectivesModule } from '~/app/shared/directives/directives.module';
-import { configureTestBed, modalServiceShow } from '~/testing/unit-test-helper';
-import { AlertPanelComponent } from '../alert-panel/alert-panel.component';
-import { LoadingPanelComponent } from '../loading-panel/loading-panel.component';
-import { CriticalConfirmationModalComponent } from './critical-confirmation-modal.component';
-import { CheckboxModule, ModalService, PlaceholderService } from 'carbon-components-angular';
-import { ModalCdsService } from '../../services/modal-cds.service';
-import { DeletionImpact } from '../../enum/critical-confirmation-modal-impact.enum';
-
-@NgModule({})
-export class MockModule {}
-
-@Component({
-  template: `
-    <button type="button" class="btn btn-danger" (click)="openCtrlDriven()">
-      <i class="fa fa-times"></i>Deletion Ctrl-Test
-      <ng-template #ctrlDescription>
-        The spinner is handled by the controller if you have use the modal as ViewChild in order to
-        use it's functions to stop the spinner or close the dialog.
-      </ng-template>
-    </button>
-
-    <button type="button" class="btn btn-danger" (click)="openModalDriven()">
-      <i class="fa fa-times"></i>Deletion Modal-Test
-      <ng-template #modalDescription>
-        The spinner is handled by the modal if your given deletion function returns a Observable.
-      </ng-template>
-    </button>
-  `
-})
-class MockComponent {
-  @ViewChild('ctrlDescription', { static: true })
-  ctrlDescription: TemplateRef<any>;
-  @ViewChild('modalDescription', { static: true })
-  modalDescription: TemplateRef<any>;
-  someData = [1, 2, 3, 4, 5];
-  finished: number[];
-  ctrlRef: any;
-  modalRef: any;
-
-  // Normally private - public was needed for the tests
-  constructor(public modalService: ModalCdsService) {}
-
-  openCtrlDriven() {
-    this.ctrlRef = this.modalService.show(CriticalConfirmationModalComponent, {
-      submitAction: this.fakeDeleteController.bind(this),
-      bodyTemplate: this.ctrlDescription
-    });
-  }
-
-  openModalDriven() {
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
-      submitActionObservable: this.fakeDelete(),
-      bodyTemplate: this.modalDescription
-    });
-  }
-
-  finish() {
-    this.finished = [6, 7, 8, 9];
-  }
-
-  fakeDelete() {
-    return (): Observable<any> => {
-      return new Observable((observer: Subscriber<any>) => {
-        observableTimer(100).subscribe(() => {
-          observer.next(this.finish());
-          observer.complete();
-        });
-      });
-    };
-  }
-
-  fakeDeleteController() {
-    observableTimer(100).subscribe(() => {
-      this.finish();
-      this.ctrlRef.close();
-    });
-  }
-}
-
-describe('CriticalConfirmationModalComponent', () => {
-  let mockComponent: MockComponent;
-  let component: CriticalConfirmationModalComponent;
-  let mockFixture: ComponentFixture<MockComponent>;
-
-  configureTestBed({
-    declarations: [
-      MockComponent,
-      CriticalConfirmationModalComponent,
-      LoadingPanelComponent,
-      AlertPanelComponent
-    ],
-    imports: [ReactiveFormsModule, MockModule, DirectivesModule, CheckboxModule],
-    providers: [
-      ModalService,
-      PlaceholderService,
-      { provide: 'itemNames', useValue: [] },
-      { provide: 'itemDescription', useValue: 'entry' },
-      { provide: 'actionDescription', useValue: 'delete' }
-    ]
-  });
-
-  beforeEach(() => {
-    mockFixture = TestBed.createComponent(MockComponent);
-    mockComponent = mockFixture.componentInstance;
-    spyOn(mockComponent.modalService, 'show').and.callFake((_modalComp, config) => {
-      const data = modalServiceShow(CriticalConfirmationModalComponent, config);
-      component = data.componentInstance;
-      return data;
-    });
-    mockComponent.openCtrlDriven();
-    mockFixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-
-  it('should throw an error if no action is defined', () => {
-    component = Object.assign(component, {
-      submitAction: null,
-      submitActionObservable: null
-    });
-    expect(() => component.ngOnInit()).toThrowError('No submit action defined');
-  });
-
-  it('should test if the ctrl driven mock is set correctly through mock component', () => {
-    expect(component.bodyTemplate).toBeTruthy();
-    expect(component.submitAction).toBeTruthy();
-    expect(component.submitActionObservable).not.toBeTruthy();
-  });
-
-  it('should test if the modal driven mock is set correctly through mock component', () => {
-    mockComponent.openModalDriven();
-    expect(component.bodyTemplate).toBeTruthy();
-    expect(component.submitActionObservable).toBeTruthy();
-    expect(component.submitAction).not.toBeTruthy();
-  });
-
-  describe('component functions', () => {
-    const changeValue = (formControl: string, value: any) => {
-      const ctrl = component.deletionForm.get(formControl);
-      ctrl.setValue(value);
-      ctrl.markAsDirty();
-      ctrl.updateValueAndValidity();
-    };
-
-    it('should test hideModal', () => {
-      expect(component.hideModal).toBeTruthy();
-      spyOn(component, 'closeModal').and.callThrough();
-      expect(component.closeModal).not.toHaveBeenCalled();
-      component.hideModal();
-      expect(component.closeModal).toHaveBeenCalled();
-    });
-
-    describe('validate confirmation', () => {
-      const testValidation = (submitted: boolean, error: string, expected: boolean) => {
-        expect(
-          component.deletionForm.showError('confirmation', <NgForm>{ submitted: submitted }, error)
-        ).toBe(expected);
-      };
-
-      beforeEach(() => {
-        component.deletionForm.reset();
-        const ctrl = component.deletionForm.get('impact');
-        ctrl.setValue(DeletionImpact.normal);
-        ctrl.markAsDirty();
-        ctrl.updateValueAndValidity();
-        component.deletionForm.get('confirmation').updateValueAndValidity();
-      });
-
-      it('should test empty values', () => {
-        testValidation(true, 'required', true);
-        changeValue('confirmation', true);
-        changeValue('confirmation', false);
-        testValidation(true, 'required', true);
-      });
-    });
-
-    describe('validate confirmInput', () => {
-      const testValidation = (submitted: boolean, error: string, expected: boolean) => {
-        expect(
-          component.deletionForm.showError('confirmInput', <NgForm>{ submitted: submitted }, error)
-        ).toBe(expected);
-      };
-
-      beforeEach(() => {
-        component.deletionForm.reset();
-        const ctrl = component.deletionForm.get('impact');
-        ctrl.setValue(DeletionImpact.high);
-        ctrl.markAsDirty();
-        ctrl.updateValueAndValidity();
-        component.deletionForm.get('confirmInput').updateValueAndValidity();
-      });
-
-      it('should test empty values', () => {
-        testValidation(true, 'required', true);
-        changeValue('confirmInput', 'dummytext');
-        changeValue('confirmInput', '');
-        testValidation(true, 'required', true);
-      });
-
-      it('should give error, if entered resource name is wrong', () => {
-        component.itemNames = ['resource1'];
-        changeValue('confirmInput', 'dummytext');
-        testValidation(true, 'matchResource', true);
-      });
-
-      it('should give error, if entered resource name is correct', () => {
-        component.itemNames = ['resource1'];
-        changeValue('confirmInput', 'resource1');
-        testValidation(true, 'matchResource', false);
-      });
-    });
-
-    describe('deletion call', () => {
-      beforeEach(() => {
-        spyOn(component, 'stopLoadingSpinner').and.callThrough();
-        spyOn(component, 'hideModal').and.callThrough();
-      });
-
-      describe('Controller driven', () => {
-        beforeEach(() => {
-          spyOn(component, 'submitAction').and.callThrough();
-          spyOn(mockComponent.ctrlRef, 'close').and.callThrough();
-        });
-
-        it('should test fake deletion that closes modal', fakeAsync(() => {
-          // Before deletionCall
-          expect(component.submitAction).not.toHaveBeenCalled();
-          // During deletionCall
-          component.callSubmitAction();
-          expect(component.stopLoadingSpinner).not.toHaveBeenCalled();
-          expect(component.hideModal).not.toHaveBeenCalled();
-          expect(mockComponent.ctrlRef.close).not.toHaveBeenCalled();
-          expect(component.submitAction).toHaveBeenCalled();
-          expect(mockComponent.finished).toBe(undefined);
-          // After deletionCall
-          tick(2000);
-          expect(component.hideModal).not.toHaveBeenCalled();
-          expect(mockComponent.ctrlRef.close).toHaveBeenCalled();
-          expect(mockComponent.finished).toEqual([6, 7, 8, 9]);
-        }));
-      });
-
-      describe('Modal driven', () => {
-        beforeEach(() => {
-          mockComponent.openModalDriven();
-          spyOn(component, 'stopLoadingSpinner').and.callThrough();
-          spyOn(component, 'hideModal').and.callThrough();
-          spyOn(mockComponent, 'fakeDelete').and.callThrough();
-        });
-
-        it('should delete and close modal', fakeAsync(() => {
-          // During deletionCall
-          component.callSubmitAction();
-          expect(mockComponent.finished).toBe(undefined);
-          expect(component.hideModal).not.toHaveBeenCalled();
-          // After deletionCall
-          tick(2000);
-          expect(mockComponent.finished).toEqual([6, 7, 8, 9]);
-          expect(component.stopLoadingSpinner).not.toHaveBeenCalled();
-          expect(component.hideModal).toHaveBeenCalled();
-        }));
-      });
-    });
-  });
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.ts
deleted file mode 100644 (file)
index 5dc45f7..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-import { Component, Inject, OnInit, Optional, TemplateRef, ViewChild } from '@angular/core';
-import { UntypedFormControl, AbstractControl, ValidationErrors, Validators } from '@angular/forms';
-import { Observable } from 'rxjs';
-
-import { CdFormGroup } from '~/app/shared/forms/cd-form-group';
-import { SubmitButtonComponent } from '../submit-button/submit-button.component';
-import { BaseModal } from 'carbon-components-angular';
-import { CdValidators } from '../../forms/cd-validators';
-import { DeletionImpact } from '../../enum/critical-confirmation-modal-impact.enum';
-
-@Component({
-  selector: 'cd-deletion-modal',
-  templateUrl: './critical-confirmation-modal.component.html',
-  styleUrls: ['./critical-confirmation-modal.component.scss']
-})
-export class CriticalConfirmationModalComponent extends BaseModal implements OnInit {
-  @ViewChild(SubmitButtonComponent, { static: true })
-  submitButton: SubmitButtonComponent;
-  deletionForm: CdFormGroup;
-  impactEnum = DeletionImpact;
-  childFormGroup: CdFormGroup;
-  childFormGroupTemplate: TemplateRef<any>;
-
-  constructor(
-    @Optional() @Inject('impact') public impact: DeletionImpact,
-    @Optional() @Inject('itemDescription') public itemDescription: 'entry',
-    @Optional() @Inject('itemNames') public itemNames: string[],
-    @Optional() @Inject('actionDescription') public actionDescription = 'delete',
-    @Optional() @Inject('submitAction') public submitAction?: Function,
-    @Optional() @Inject('backAction') public backAction?: Function,
-    @Optional() @Inject('bodyTemplate') public bodyTemplate?: TemplateRef<any>,
-    @Optional() @Inject('bodyContext') public bodyContext?: object,
-    @Optional() @Inject('infoMessage') public infoMessage?: string,
-    @Optional()
-    @Inject('submitActionObservable')
-    public submitActionObservable?: () => Observable<any>,
-    @Optional()
-    @Inject('callBackAtionObservable')
-    public callBackAtionObservable?: () => Observable<any>
-  ) {
-    super();
-    this.actionDescription = actionDescription || 'delete';
-    this.impact = this.impact || DeletionImpact.normal;
-  }
-
-  ngOnInit() {
-    const controls = {
-      impact: new UntypedFormControl(this.impact),
-      confirmation: new UntypedFormControl(false, {
-        validators: [
-          CdValidators.composeIf(
-            {
-              impact: DeletionImpact.normal
-            },
-            [Validators.requiredTrue]
-          )
-        ]
-      }),
-      confirmInput: new UntypedFormControl('', [
-        CdValidators.composeIf({ impact: this.impactEnum.high }, [
-          this.matchResourceName.bind(this),
-          Validators.required
-        ])
-      ])
-    };
-    if (this.childFormGroup) {
-      controls['child'] = this.childFormGroup;
-    }
-    this.deletionForm = new CdFormGroup(controls);
-    if (!(this.submitAction || this.submitActionObservable)) {
-      throw new Error('No submit action defined');
-    }
-  }
-
-  matchResourceName(control: AbstractControl): ValidationErrors | null {
-    if (this.itemNames && control.value != this.itemNames[0]) {
-      return { matchResource: true };
-    }
-    return null;
-  }
-
-  callSubmitAction() {
-    if (this.submitActionObservable) {
-      this.submitActionObservable().subscribe({
-        error: this.stopLoadingSpinner.bind(this),
-        complete: this.hideModal.bind(this)
-      });
-    } else {
-      this.submitAction();
-    }
-  }
-
-  callBackAction() {
-    if (this.callBackAtionObservable) {
-      this.callBackAtionObservable().subscribe({
-        error: this.stopLoadingSpinner.bind(this),
-        complete: this.hideModal.bind(this)
-      });
-    } else {
-      this.backAction();
-    }
-  }
-
-  hideModal() {
-    this.closeModal();
-  }
-
-  stopLoadingSpinner() {
-    this.deletionForm.setErrors({ cdSubmitButton: true });
-  }
-}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.html
new file mode 100644 (file)
index 0000000..e041e6d
--- /dev/null
@@ -0,0 +1,88 @@
+<cds-modal size="sm"
+           [open]="open"
+           (overlaySelected)="closeModal()">
+  <cds-modal-header (closeSelect)="closeModal()">
+    <ng-container *ngTemplateOutlet="deletionHeading"></ng-container>
+  </cds-modal-header>
+
+  <section cdsModalContent>
+    <form name="deletionForm"
+          #formDir="ngForm"
+          [formGroup]="deletionForm"
+          novalidate>
+      <cd-alert-panel *ngIf="infoMessage"
+                      type="info"
+                      spacingClass="mb-3"
+                      i18n>
+        <p>{{ infoMessage }}</p>
+      </cd-alert-panel>
+      <ng-container *ngTemplateOutlet="bodyTemplate; context: bodyContext"></ng-container>
+      <div class="question">
+        <span *ngIf="itemNames; else noNames">
+          <p *ngIf="itemNames.length === 1; else manyNames"
+             i18n>Are you sure that you want to {{ actionDescription | lowercase }} <strong>{{ itemNames[0] }}</strong>?</p>
+          <ng-template #manyNames>
+            <p i18n>Are you sure that you want to {{ actionDescription | lowercase }} the selected items?</p>
+            <ul>
+              <li *ngFor="let itemName of itemNames"><strong>{{ itemName }}</strong></li>
+            </ul>
+          </ng-template >
+        </span>
+        <ng-template #noNames>
+          <p i18n>Are you sure that you want to {{ actionDescription | lowercase }} the selected {{ itemDescription }}?</p>
+        </ng-template>
+        <ng-container *ngTemplateOutlet="childFormGroupTemplate; context:{form:deletionForm}"></ng-container>
+        <div class="form-item">
+          <ng-container *ngIf="impact == impactEnum.medium; else highImpactDeletion">
+            <cds-checkbox id="confirmation"
+                          formControlName="confirmation"
+                          autofocus
+                          [required]="true"
+                          modal-primary-focus
+                          i18n>Yes, I am sure.</cds-checkbox>
+          </ng-container>
+          <ng-template #highImpactDeletion>
+            <cds-text-label label="Resource Name"
+                            labelInputID="resource_name"
+                            cdRequiredField="Resource Name"
+                            [invalid]="!deletionForm.controls.confirmInput.valid && deletionForm.controls.confirmInput.dirty"
+                            [invalidText]="ResourceError"
+                            i18n
+                            i18n-label>Resource Name
+              <input cdsText
+                     type="text"
+                     placeholder="Enter resource name to delete"
+                     id="resource_name"
+                     formControlName="confirmInput"
+                     i18n-placeholder/>
+            </cds-text-label>
+            <ng-template #ResourceError>
+              <span *ngIf="deletionForm.showError('confirmInput', formDir, 'required')"
+                    class="invalid-feedback">
+                <ng-container i18n>This field is required.</ng-container>
+              </span>
+              <span *ngIf="deletionForm.showError('confirmInput', formDir, 'matchResource')"
+                    class="invalid-feedback">
+                <ng-container i18n>Enter the correct resource name.</ng-container>
+              </span>
+            </ng-template>
+          </ng-template>
+        </div>
+      </div>
+    </form>
+  </section>
+  <cd-form-button-panel (submitActionEvent)="callSubmitAction()"
+                        (backActionEvent)="backAction ? callBackAction() : hideModal()"
+                        [form]="deletionForm"
+                        [submitText]="(actionDescription | titlecase) + ' ' + itemDescription"
+                        [modalForm]="true"
+                        [submitBtnType]="(actionDescription === 'delete' || actionDescription === 'remove') ? 'danger' : 'primary'"></cd-form-button-panel>
+
+</cds-modal>
+
+<ng-template #deletionHeading>
+  <h3 cdsModalHeaderHeading
+      i18n>
+    {{ actionDescription | titlecase }} {{ itemDescription }}
+  </h3>
+</ng-template>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.scss
new file mode 100644 (file)
index 0000000..979cb13
--- /dev/null
@@ -0,0 +1,11 @@
+.modal-body .question {
+  margin-top: 1em;
+}
+
+.modal-body label {
+  font-weight: bold;
+}
+
+.modal-body .question .form-check {
+  padding-top: 7px;
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.spec.ts
new file mode 100644 (file)
index 0000000..7a28f81
--- /dev/null
@@ -0,0 +1,276 @@
+import { Component, NgModule, NO_ERRORS_SCHEMA, TemplateRef, ViewChild } from '@angular/core';
+import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
+import { NgForm, ReactiveFormsModule } from '@angular/forms';
+
+import { Observable, Subscriber, timer as observableTimer } from 'rxjs';
+
+import { DirectivesModule } from '~/app/shared/directives/directives.module';
+import { configureTestBed, modalServiceShow } from '~/testing/unit-test-helper';
+import { AlertPanelComponent } from '../alert-panel/alert-panel.component';
+import { LoadingPanelComponent } from '../loading-panel/loading-panel.component';
+import { DeleteConfirmationModalComponent } from './delete-confirmation-modal.component';
+import { ModalService, PlaceholderService } from 'carbon-components-angular';
+import { ModalCdsService } from '../../services/modal-cds.service';
+import { DeletionImpact } from '../../enum/delete-confirmation-modal-impact.enum';
+
+@NgModule({})
+export class MockModule {}
+
+@Component({
+  template: `
+    <button type="button" class="btn btn-danger" (click)="openCtrlDriven()">
+      <i class="fa fa-times"></i>Deletion Ctrl-Test
+      <ng-template #ctrlDescription>
+        The spinner is handled by the controller if you have use the modal as ViewChild in order to
+        use it's functions to stop the spinner or close the dialog.
+      </ng-template>
+    </button>
+
+    <button type="button" class="btn btn-danger" (click)="openModalDriven()">
+      <i class="fa fa-times"></i>Deletion Modal-Test
+      <ng-template #modalDescription>
+        The spinner is handled by the modal if your given deletion function returns a Observable.
+      </ng-template>
+    </button>
+  `
+})
+class MockComponent {
+  @ViewChild('ctrlDescription', { static: true })
+  ctrlDescription: TemplateRef<any>;
+  @ViewChild('modalDescription', { static: true })
+  modalDescription: TemplateRef<any>;
+  someData = [1, 2, 3, 4, 5];
+  finished: number[];
+  ctrlRef: any;
+  modalRef: any;
+
+  // Normally private - public was needed for the tests
+  constructor(public modalService: ModalCdsService) {}
+
+  openCtrlDriven() {
+    this.ctrlRef = this.modalService.show(DeleteConfirmationModalComponent, {
+      submitAction: this.fakeDeleteController.bind(this),
+      bodyTemplate: this.ctrlDescription
+    });
+  }
+
+  openModalDriven() {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
+      submitActionObservable: this.fakeDelete(),
+      bodyTemplate: this.modalDescription
+    });
+  }
+
+  finish() {
+    this.finished = [6, 7, 8, 9];
+  }
+
+  fakeDelete() {
+    return (): Observable<any> => {
+      return new Observable((observer: Subscriber<any>) => {
+        observableTimer(100).subscribe(() => {
+          observer.next(this.finish());
+          observer.complete();
+        });
+      });
+    };
+  }
+
+  fakeDeleteController() {
+    observableTimer(100).subscribe(() => {
+      this.finish();
+      this.ctrlRef.close();
+    });
+  }
+}
+
+describe('DeleteConfirmationModalComponent', () => {
+  let mockComponent: MockComponent;
+  let component: DeleteConfirmationModalComponent;
+  let mockFixture: ComponentFixture<MockComponent>;
+
+  configureTestBed({
+    declarations: [
+      MockComponent,
+      DeleteConfirmationModalComponent,
+      LoadingPanelComponent,
+      AlertPanelComponent
+    ],
+    schemas: [NO_ERRORS_SCHEMA],
+    imports: [ReactiveFormsModule, MockModule, DirectivesModule],
+    providers: [
+      ModalService,
+      PlaceholderService,
+      { provide: 'itemNames', useValue: [] },
+      { provide: 'itemDescription', useValue: 'entry' },
+      { provide: 'actionDescription', useValue: 'delete' },
+      { provide: 'impact', useValue: DeletionImpact.medium }
+    ]
+  });
+
+  beforeEach(() => {
+    mockFixture = TestBed.createComponent(MockComponent);
+    mockComponent = mockFixture.componentInstance;
+    spyOn(mockComponent.modalService, 'show').and.callFake((_modalComp, config) => {
+      const data = modalServiceShow(DeleteConfirmationModalComponent, config);
+      component = data.componentInstance;
+      return data;
+    });
+    mockComponent.openCtrlDriven();
+    mockFixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+
+  it('should throw an error if no action is defined', () => {
+    component = Object.assign(component, {
+      submitAction: null,
+      submitActionObservable: null
+    });
+    expect(() => component.ngOnInit()).toThrowError('No submit action defined');
+  });
+
+  it('should test if the ctrl driven mock is set correctly through mock component', () => {
+    expect(component.bodyTemplate).toBeTruthy();
+    expect(component.submitAction).toBeTruthy();
+    expect(component.submitActionObservable).not.toBeTruthy();
+  });
+
+  it('should test if the modal driven mock is set correctly through mock component', () => {
+    mockComponent.openModalDriven();
+    expect(component.bodyTemplate).toBeTruthy();
+    expect(component.submitActionObservable).toBeTruthy();
+    expect(component.submitAction).not.toBeTruthy();
+  });
+
+  describe('component functions', () => {
+    const changeValue = (formControl: string, value: string | boolean) => {
+      const ctrl = component.deletionForm.get(formControl);
+      ctrl.setValue(value);
+      ctrl.markAsDirty();
+      ctrl.updateValueAndValidity();
+    };
+
+    it('should test hideModal', () => {
+      expect(component.hideModal).toBeTruthy();
+      spyOn(component, 'closeModal').and.callThrough();
+      expect(component.closeModal).not.toHaveBeenCalled();
+      component.hideModal();
+      expect(component.closeModal).toHaveBeenCalled();
+    });
+
+    describe('validate confirmation', () => {
+      const testValidation = (submitted: boolean, error: string, expected: boolean) => {
+        expect(
+          component.deletionForm.showError('confirmation', <NgForm>{ submitted: submitted }, error)
+        ).toBe(expected);
+      };
+
+      beforeEach(() => {
+        component.deletionForm.reset();
+        const ctrl = component.deletionForm.get('impact');
+        ctrl.setValue(DeletionImpact.medium);
+        ctrl.markAsDirty();
+        ctrl.updateValueAndValidity();
+        component.deletionForm.get('confirmation').updateValueAndValidity();
+      });
+
+      it('should test empty values', () => {
+        testValidation(true, 'required', true);
+        changeValue('confirmation', true);
+        changeValue('confirmation', false);
+        testValidation(true, 'required', true);
+      });
+    });
+
+    describe('validate confirmInput', () => {
+      const testValidation = (submitted: boolean, error: string, expected: boolean) => {
+        expect(
+          component.deletionForm.showError('confirmInput', <NgForm>{ submitted: submitted }, error)
+        ).toBe(expected);
+      };
+
+      beforeEach(() => {
+        component.deletionForm.reset();
+        const ctrl = component.deletionForm.get('impact');
+        ctrl.setValue(DeletionImpact.high);
+        ctrl.markAsDirty();
+        ctrl.updateValueAndValidity();
+        component.deletionForm.get('confirmInput').updateValueAndValidity();
+      });
+
+      it('should test empty values', () => {
+        testValidation(true, 'required', true);
+        changeValue('confirmInput', 'dummytext');
+        changeValue('confirmInput', '');
+        testValidation(true, 'required', true);
+      });
+
+      it('should give error, if entered resource name is wrong', () => {
+        component.itemNames = ['resource1'];
+        changeValue('confirmInput', 'dummytext');
+        testValidation(true, 'matchResource', true);
+      });
+
+      it('should give error, if entered resource name is correct', () => {
+        component.itemNames = ['resource1'];
+        changeValue('confirmInput', 'resource1');
+        testValidation(true, 'matchResource', false);
+      });
+    });
+
+    describe('deletion call', () => {
+      beforeEach(() => {
+        spyOn(component, 'stopLoadingSpinner').and.callThrough();
+        spyOn(component, 'hideModal').and.callThrough();
+      });
+
+      describe('Controller driven', () => {
+        beforeEach(() => {
+          spyOn(component, 'submitAction').and.callThrough();
+          spyOn(mockComponent.ctrlRef, 'close').and.callThrough();
+        });
+
+        it('should test fake deletion that closes modal', fakeAsync(() => {
+          // Before deletionCall
+          expect(component.submitAction).not.toHaveBeenCalled();
+          // During deletionCall
+          component.callSubmitAction();
+          expect(component.stopLoadingSpinner).not.toHaveBeenCalled();
+          expect(component.hideModal).not.toHaveBeenCalled();
+          expect(mockComponent.ctrlRef.close).not.toHaveBeenCalled();
+          expect(component.submitAction).toHaveBeenCalled();
+          expect(mockComponent.finished).toBe(undefined);
+          // After deletionCall
+          tick(2000);
+          expect(component.hideModal).not.toHaveBeenCalled();
+          expect(mockComponent.ctrlRef.close).toHaveBeenCalled();
+          expect(mockComponent.finished).toEqual([6, 7, 8, 9]);
+        }));
+      });
+
+      describe('Modal driven', () => {
+        beforeEach(() => {
+          mockComponent.openModalDriven();
+          spyOn(component, 'stopLoadingSpinner').and.callThrough();
+          spyOn(component, 'hideModal').and.callThrough();
+          spyOn(mockComponent, 'fakeDelete').and.callThrough();
+        });
+
+        it('should delete and close modal', fakeAsync(() => {
+          // During deletionCall
+          component.callSubmitAction();
+          expect(mockComponent.finished).toBe(undefined);
+          expect(component.hideModal).not.toHaveBeenCalled();
+          // After deletionCall
+          tick(2000);
+          expect(mockComponent.finished).toEqual([6, 7, 8, 9]);
+          expect(component.stopLoadingSpinner).not.toHaveBeenCalled();
+          expect(component.hideModal).toHaveBeenCalled();
+        }));
+      });
+    });
+  });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.ts
new file mode 100644 (file)
index 0000000..440ed0b
--- /dev/null
@@ -0,0 +1,111 @@
+import { Component, Inject, OnInit, Optional, TemplateRef, ViewChild } from '@angular/core';
+import { UntypedFormControl, AbstractControl, ValidationErrors, Validators } from '@angular/forms';
+import { Observable } from 'rxjs';
+
+import { CdFormGroup } from '~/app/shared/forms/cd-form-group';
+import { SubmitButtonComponent } from '../submit-button/submit-button.component';
+import { BaseModal } from 'carbon-components-angular';
+import { CdValidators } from '../../forms/cd-validators';
+import { DeletionImpact } from '../../enum/delete-confirmation-modal-impact.enum';
+
+@Component({
+  selector: 'cd-deletion-modal',
+  templateUrl: './delete-confirmation-modal.component.html',
+  styleUrls: ['./delete-confirmation-modal.component.scss']
+})
+export class DeleteConfirmationModalComponent extends BaseModal implements OnInit {
+  @ViewChild(SubmitButtonComponent, { static: true })
+  submitButton: SubmitButtonComponent;
+  deletionForm: CdFormGroup;
+  impactEnum = DeletionImpact;
+  childFormGroup: CdFormGroup;
+  childFormGroupTemplate: TemplateRef<any>;
+
+  constructor(
+    @Optional() @Inject('impact') public impact: DeletionImpact,
+    @Optional() @Inject('itemDescription') public itemDescription: 'entry',
+    @Optional() @Inject('itemNames') public itemNames: string[],
+    @Optional() @Inject('actionDescription') public actionDescription = 'delete',
+    @Optional() @Inject('submitAction') public submitAction?: Function,
+    @Optional() @Inject('backAction') public backAction?: Function,
+    @Optional() @Inject('bodyTemplate') public bodyTemplate?: TemplateRef<any>,
+    @Optional() @Inject('bodyContext') public bodyContext?: object,
+    @Optional() @Inject('infoMessage') public infoMessage?: string,
+    @Optional()
+    @Inject('submitActionObservable')
+    public submitActionObservable?: () => Observable<any>,
+    @Optional()
+    @Inject('callBackAtionObservable')
+    public callBackAtionObservable?: () => Observable<any>
+  ) {
+    super();
+    this.actionDescription = actionDescription || 'delete';
+    this.impact = this.impact || DeletionImpact.medium;
+  }
+
+  ngOnInit() {
+    const controls = {
+      impact: new UntypedFormControl(this.impact),
+      confirmation: new UntypedFormControl(false, {
+        validators: [
+          CdValidators.composeIf(
+            {
+              impact: DeletionImpact.medium
+            },
+            [Validators.requiredTrue]
+          )
+        ]
+      }),
+      confirmInput: new UntypedFormControl('', [
+        CdValidators.composeIf({ impact: this.impactEnum.high }, [
+          this.matchResourceName.bind(this),
+          Validators.required
+        ])
+      ])
+    };
+    if (this.childFormGroup) {
+      controls['child'] = this.childFormGroup;
+    }
+    this.deletionForm = new CdFormGroup(controls);
+    if (!(this.submitAction || this.submitActionObservable)) {
+      throw new Error('No submit action defined');
+    }
+  }
+
+  matchResourceName(control: AbstractControl): ValidationErrors | null {
+    if (this.itemNames && control.value !== String(this.itemNames?.[0])) {
+      return { matchResource: true };
+    }
+    return null;
+  }
+
+  callSubmitAction() {
+    if (this.submitActionObservable) {
+      this.submitActionObservable().subscribe({
+        error: this.stopLoadingSpinner.bind(this),
+        complete: this.hideModal.bind(this)
+      });
+    } else {
+      this.submitAction();
+    }
+  }
+
+  callBackAction() {
+    if (this.callBackAtionObservable) {
+      this.callBackAtionObservable().subscribe({
+        error: this.stopLoadingSpinner.bind(this),
+        complete: this.hideModal.bind(this)
+      });
+    } else {
+      this.backAction();
+    }
+  }
+
+  hideModal() {
+    this.closeModal();
+  }
+
+  stopLoadingSpinner() {
+    this.deletionForm.setErrors({ cdSubmitButton: true });
+  }
+}
index d380052651fe66e918b6c903543f1df87e332e87..08f2db4fcc7cd2910bf65477120cee222dda85d7 100644 (file)
@@ -14,7 +14,7 @@ import { FinishedTask } from '../../models/finished-task';
 import { Permission, Permissions } from '../../models/permissions';
 import { AuthStorageService } from '../../services/auth-storage.service';
 import { TaskWrapperService } from '../../services/task-wrapper.service';
-import { CriticalConfirmationModalComponent } from '../../components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '../../components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { ModalCdsService } from '../../services/modal-cds.service';
 import { BaseModal } from 'carbon-components-angular';
 
@@ -119,7 +119,7 @@ export class CRUDTableComponent implements OnInit {
 
   delete() {
     const selectedKey = this.selection.first()[this.meta.columnKey];
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: $localize`${this.meta.resource}`,
       itemNames: [selectedKey],
       submitAction: () => {
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/critical-confirmation-modal-impact.enum.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/critical-confirmation-modal-impact.enum.ts
deleted file mode 100644 (file)
index 045d6f5..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-export enum DeletionImpact {
-  normal = 'normal',
-  high = 'high' // NOTE: User should be able to select only single resource while deleting
-}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/delete-confirmation-modal-impact.enum.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/delete-confirmation-modal-impact.enum.ts
new file mode 100644 (file)
index 0000000..5009ea2
--- /dev/null
@@ -0,0 +1,4 @@
+export enum DeletionImpact {
+  medium = 'medium',
+  high = 'high' // NOTE: User should be able to select only single resource while deleting
+}