]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: renaming critical-confirmation-modal to delete-confirmation-modal... 61980/head
authorNaman Munet <naman.munet@ibm.com>
Mon, 10 Feb 2025 03:34:19 +0000 (09:04 +0530)
committerNaman Munet <naman.munet@ibm.com>
Mon, 24 Feb 2025 13:20:22 +0000 (18:50 +0530)
Fixes: https://tracker.ceph.com/issues/69628
Signed-off-by: Naman Munet <naman.munet@ibm.com>
(cherry picked from commit 6866d6a3fe72a62b5239267d2efa42729c9aa4a4)

 Conflicts:
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/cephfs/cephfs-directories/cephfs-directories.component.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-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/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-list/pool-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/smb/smb-cluster-list/smb-cluster-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/crud-table/crud-table.component.ts

48 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/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.spec.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.spec.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/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.spec.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-user-list/rgw-user-list.component.spec.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/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 d0eed6a72c77ed11cf3f77badafdac443056bbb8..08c9e51c832066d1a3519e07a821af02975b0e5a 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 5916a20e57e3e779aa756f803338e459205ef848..bc8850cc130a42f1eb68fc92617d766905760536 100644 (file)
@@ -6,7 +6,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';
@@ -17,7 +17,7 @@ import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
 import { ModalService } from '~/app/shared/services/modal.service';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { PoolEditPeerModalComponent } from '../pool-edit-peer-modal/pool-edit-peer-modal.component';
-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({
@@ -150,7 +150,7 @@ export class PoolListComponent implements OnInit, OnDestroy {
     const poolName = this.selection.first().name;
     const peerUUID = this.getPeerUUID();
 
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: $localize`mirror peer`,
       itemNames: [`${poolName} (${peerUUID})`],
index 61b7866eef6707b6fcf40fcef6471e1fc4fc331e..798de3bb7e8944914f2b92fcd33259f6ffe4863e 100644 (file)
@@ -8,7 +8,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 { RbdFormEditRequestModel } from '../rbd-form/rbd-form-edit-request.model
 import { RbdParentModel } from '../rbd-form/rbd-parent.model';
 import { RbdTrashMoveModalComponent } from '../rbd-trash-move-modal/rbd-trash-move-modal.component';
 import { RBDImageFormat, RbdModel } from './rbd-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 = 'block/rbd';
 
 @Component({
@@ -427,7 +427,7 @@ export class RbdListComponent extends ListWithDetails implements OnInit {
     const imageName = this.selection.first().name;
     const imageSpec = new ImageSpec(poolName, namespace, imageName);
 
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: 'RBD',
       itemNames: [imageSpec.imageName],
@@ -452,7 +452,7 @@ export class RbdListComponent extends ListWithDetails implements OnInit {
     const imageName = this.selection.first().name;
     const imageSpec = new ImageSpec(poolName, namespace, imageName);
 
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: 'RBD',
       itemNames: [imageSpec],
       actionDescription: 'resync',
@@ -534,7 +534,7 @@ export class RbdListComponent extends ListWithDetails implements OnInit {
       this.selection.first().name
     );
 
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       actionDescription: 'remove scheduling on',
       itemDescription: $localize`image`,
       itemNames: [`${imageName}`],
index 4617e13e4247c00cd13c3560cd8b18318f617ec8..8f82127356e7675138ebb81dd9ea6d4cdd43e7d2 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';
@@ -125,7 +125,7 @@ export class RbdNamespaceListComponent implements OnInit {
   deleteModal() {
     const pool = this.selection.first().pool;
     const namespace = this.selection.first().namespace;
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: 'Namespace',
       itemNames: [`${pool}/${namespace}`],
       submitAction: () =>
index 1b9b3854665109dd580b1bb428b03dd3527c4728..20cd2cc2cb149105b92112e7eb93d56e26b18c97 100644 (file)
@@ -10,7 +10,7 @@ import { Subject, throwError as observableThrowError } from 'rxjs';
 
 import { RbdService } from '~/app/shared/api/rbd.service';
 import { ComponentsModule } from '~/app/shared/components/components.module';
-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 { DataTableModule } from '~/app/shared/datatable/datatable.module';
 import { TableActionsComponent } from '~/app/shared/datatable/table-actions/table-actions.component';
@@ -67,7 +67,7 @@ describe('RbdSnapshotListComponent', () => {
         TaskListService
       ]
     },
-    [CriticalConfirmationModalComponent]
+    [DeleteConfirmationModalComponent]
   );
 
   beforeEach(() => {
index 5f12821aaa59c5e9ac521796ce3da9df16fa3b94..fc787be33656ef2f6c37348bbe9e4e53fc684c22 100644 (file)
@@ -16,7 +16,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';
@@ -38,7 +38,7 @@ import { TaskManagerService } from '~/app/shared/services/task-manager.service';
 import { RbdSnapshotFormModalComponent } from '../rbd-snapshot-form/rbd-snapshot-form-modal.component';
 import { RbdSnapshotActionsModel } from './rbd-snapshot-actions.model';
 import { RbdSnapshotModel } from './rbd-snapshot.model';
-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',
@@ -326,7 +326,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges {
 
   deleteSnapshotModal() {
     const snapshotName = this.selection.selected[0].name;
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: $localize`RBD snapshot`,
       itemNames: [snapshotName],
index 43fe42b99fa3895fb50470604b082b399e568908..bfc2d5be337d8e42cbc476aa101d7341d1085d0f 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 fb43cca4b20dfba17448d8e9974ec96d0d4d8ded..e705d3fad9f633004d0428a678bfc3008a21d370 100644 (file)
@@ -4,7 +4,7 @@ import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
 
 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';
@@ -92,7 +92,7 @@ export class CephfsClientsComponent 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 3a43ac5c77dc2e2b7dcc29df9410fb8caf552570..ff190176347d58b1e4e3fc3bd6fb0c37c5900c9f 100644 (file)
@@ -11,7 +11,7 @@ import { Observable, of } from 'rxjs';
 
 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 { NotificationType } from '~/app/shared/enum/notification-type.enum';
 import { CdValidators } from '~/app/shared/forms/cd-validators';
@@ -370,7 +370,7 @@ describe('CephfsDirectoriesComponent', () => {
       declarations: [CephfsDirectoriesComponent],
       providers: [NgbActiveModal]
     },
-    [CriticalConfirmationModalComponent, FormModalComponent, ConfirmationModalComponent]
+    [DeleteConfirmationModalComponent, FormModalComponent, ConfirmationModalComponent]
   );
 
   beforeEach(() => {
@@ -713,7 +713,7 @@ describe('CephfsDirectoriesComponent', () => {
     expect(tableActions).toEqual({
       'create,update,delete': {
         actions: ['Create', 'Delete'],
-        primary: { multiple: 'Delete', executing: 'Delete', single: 'Delete', no: 'Create' }
+        primary: { multiple: 'Create', executing: 'Delete', single: 'Delete', no: 'Create' }
       },
       'create,update': {
         actions: ['Create'],
@@ -721,7 +721,7 @@ describe('CephfsDirectoriesComponent', () => {
       },
       'create,delete': {
         actions: ['Create', 'Delete'],
-        primary: { multiple: 'Delete', executing: 'Delete', single: 'Delete', no: 'Create' }
+        primary: { multiple: 'Create', executing: 'Delete', single: 'Delete', no: 'Create' }
       },
       create: {
         actions: ['Create'],
index 8d24bd567db3abbbecb88c6b019aee8d06d4b6d5..6cfe173f6e606bebd17853221863fac7392bbad1 100644 (file)
@@ -14,10 +14,10 @@ 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 { 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';
@@ -694,7 +694,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
   }
 
   deleteSnapshotModal() {
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: $localize`CephFs Snapshot`,
       itemNames: this.snapshot.selection.selected.map((snapshot: CephfsSnapshot) => snapshot.name),
index 5659f131c99147246ffc2b94345fb1f513bafa3d..269048ad210c274ddd43b96ebd4d13a9cc1552b5 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';
@@ -59,7 +59,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 5caa4dd9c51a7401444152fc82006130c0f539de..2a9ea85db9b8960ab1f02a89db67f5970d0497c7 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 { CephfsMountDetailsComponent } from '../cephfs-mount-details/cephfs-moun
 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 { 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';
 
@@ -172,7 +172,7 @@ export class CephfsListComponent extends ListWithDetails implements OnInit {
 
   removeVolumeModal() {
     const volName = this.selection.first().mdsmap['fs_name'];
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: 'File System',
       itemNames: [volName],
index 53c8e924e82e7e3863d5bf4434a9cba69bba185a..963f815850bf612db07e6e0bdf0492e9a5cc198a 100644 (file)
@@ -28,7 +28,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';
 
@@ -247,7 +247,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: () =>
@@ -270,7 +270,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: () =>
@@ -302,7 +302,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 10d155fab023cce2158af27548738e1738cbb907..f1af838fd94f71ea00befd210430a69d933174e6 100644 (file)
@@ -14,13 +14,13 @@ import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
 import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
 import { ModalService } from '~/app/shared/services/modal.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 { 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',
@@ -178,7 +178,7 @@ export class CephfsSubvolumeGroupComponent implements OnInit, OnChanges {
 
   removeSubVolumeModal() {
     const name = this.selection.first().name;
-    this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: 'subvolume group',
       itemNames: [name],
index 64b71f9024640cb86da37c0452a6df19d7037d29..eb396d6c13c8c9bdc3c31d3a905e3db0953481e4 100644 (file)
@@ -28,13 +28,13 @@ 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';
 import { HealthService } from '~/app/shared/api/health.service';
 import _ from 'lodash';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
+import { DeletionImpact } from '~/app/shared/enum/delete-confirmation-modal-impact.enum';
 
 const DEFAULT_SUBVOLUME_GROUP = '_nogroup';
 
@@ -251,7 +251,7 @@ export class CephfsSubvolumeListComponent extends CdForm implements OnInit, OnCh
     });
     this.errorMessage = '';
     this.selectedName = this.selection.first().name;
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       actionDescription: 'Remove',
       itemNames: [this.selectedName],
index cc6e6e0df5bea27b3cf0e5319c31b5521ede2bf2..1cbf0ee374e995e021a9cd92fc1715d9f2b25497 100644 (file)
@@ -17,7 +17,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 moment from 'moment';
 import { Validators } from '@angular/forms';
 import { CdValidators } from '~/app/shared/forms/cd-validators';
 import { DEFAULT_SUBVOLUME_GROUP } from '~/app/shared/constants/cephfs';
-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',
@@ -232,7 +232,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 f95479fc53e012258af2e2668437622000015087..6282b73ad6b5f88880534a847cea2d2526eb9e84 100644 (file)
@@ -13,8 +13,8 @@ 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 { ModalService } from '~/app/shared/services/modal.service';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 
 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 082aef10780caed397b03cfd3f59f5deae65a39e..7957e06198fef790f98c6a3e23203a2af0959210 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';
@@ -35,7 +35,7 @@ import { NotificationService } from '~/app/shared/services/notification.service'
 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 { 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';
 
@@ -447,7 +447,7 @@ export class HostsComponent extends ListWithDetails implements OnDestroy, OnInit
 
   deleteAction() {
     const hostname = this.selection.first().hostname;
-    this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+    this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
       impact: DeletionImpact.high,
       itemDescription: 'Host',
       itemNames: [hostname],
index 7b215e42ad4dbf73a1d707548e58313a7551214b..83a1c5026f2973fc5b78addee628449bcf4cf8d7 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 { CdTableAction } from '~/app/shared/models/cd-table-action';
@@ -478,7 +478,7 @@ describe('OsdListComponent', () => {
     });
 
     it('opens all critical confirmation modals', () => {
-      const modalClass = CriticalConfirmationModalComponent;
+      const modalClass = DeleteConfirmationModalComponent;
       mockSafeToDestroy();
       expectOpensModal('Mark Lost', modalClass);
       expectOpensModal('Purge', modalClass);
index 592de5fb73ec9ed2b6335df4b904e356e260e438..fd36302949b01526e4236f7ca915d79c6d63ac26 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';
@@ -40,7 +40,7 @@ import { OsdReweightModalComponent } from '../osd-reweight-modal/osd-reweight-mo
 import { OsdScrubModalComponent } from '../osd-scrub-modal/osd-scrub-modal.component';
 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';
 
@@ -581,7 +581,7 @@ export class OsdListComponent extends ListWithDetails implements OnInit {
   ): void {
     check(this.getSelectedOsdIds()).subscribe((result) => {
       const osdIds = this.getSelectedOsdIds();
-      const modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+      const modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
         impact: DeletionImpact.high,
         itemNames: osdIds,
         actionDescription: actionDescription,
index a136b2bac1119b6c328e0d909bc5255df1402766..541edf5dc2e90f9552658decd4e8d42574c2162f 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';
@@ -103,7 +103,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 d5612a0949c05f1b6967743c1bc1e6ff89cc1f59..0331f5f826b6929547aa431f67b5287b91f10c35 100644 (file)
@@ -7,7 +7,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';
@@ -194,7 +194,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 a3f6ef90907819906e7b1db3b3a76e5cd76f9929..8ebed84eeea5211734d0b9a9f9b571c34eb2d8a4 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';
@@ -27,7 +27,6 @@ import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { URLBuilderService } from '~/app/shared/services/url-builder.service';
 import { PlacementPipe } from './placement.pipe';
 import { ServiceFormComponent } from './service-form/service-form.component';
-import { DeletionImpact } from '~/app/shared/enum/critical-confirmation-modal-impact.enum';
 
 const BASE_URL = 'services';
 
@@ -238,8 +237,7 @@ export class ServicesComponent extends ListWithDetails implements OnChanges, OnI
 
   deleteAction() {
     const service = this.selection.first();
-    this.modalService.show(CriticalConfirmationModalComponent, {
-      impact: DeletionImpact.high,
+    this.modalService.show(DeleteConfirmationModalComponent, {
       itemDescription: $localize`Service`,
       itemNames: [service.service_name],
       actionDescription: 'delete',
index 03bb6ed084dff1ca14cda041bf34204dcc5c4c4b..af857f481864b1e444f5a2b2b8138eb18efd876c 100644 (file)
@@ -4,8 +4,8 @@ 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 { ModalService } from '~/app/shared/services/modal.service';
+import { DeleteConfirmationModalComponent } from '~/app/shared/components/delete-confirmation-modal/delete-confirmation-modal.component';
 import { Permission } from '~/app/shared/models/permissions';
 import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
 import { UpgradeService } from '~/app/shared/api/upgrade.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 354f0186334d6d9f792be82e995e7cb145bc72e6..fe9b90c6a14f93bedb051095637cb30c51ef4366 100644 (file)
@@ -6,7 +6,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';
@@ -22,7 +22,7 @@ import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
 import { ModalService } from '~/app/shared/services/modal.service';
 import { TaskListService } from '~/app/shared/services/task-list.service';
 import { TaskWrapperService } from '~/app/shared/services/task-wrapper.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-nfs-list',
@@ -184,7 +184,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 87b791b690307b537ac5df3a1df28e8503f380a1..a323bdcb1cde150082e590650039d9fa9b62ee0c 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';
@@ -155,7 +155,7 @@ describe('PoolFormComponent', () => {
         { provide: ActivatedRoute, useValue: { params: of({ name: 'somePoolName' }) } }
       ]
     },
-    [CriticalConfirmationModalComponent]
+    [DeleteConfirmationModalComponent]
   );
 
   let navigationSpy: jasmine.Spy;
@@ -798,7 +798,7 @@ describe('PoolFormComponent', () => {
 
     describe('crush rule deletion', () => {
       let taskWrapper: TaskWrapperService;
-      let deletion: CriticalConfirmationModalComponent;
+      let deletion: DeleteConfirmationModalComponent;
       let deleteSpy: jasmine.Spy;
       let modalSpy: jasmine.Spy;
 
@@ -949,7 +949,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 c91ca765367259823e54c319d21b824b0a121d18..3167d4035d9da8de2d11ca4f42c91a9a7cad793b 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';
@@ -674,7 +674,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 8a8af7b73494f354f74cd81605b4dce53beaf680..c40543ddf7f8c9013b9a3e55d17c506977dc0bc5 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 2696a9d5e68139c08532e19c3e98c0b77ed2eece..55d62f0ae3427d08158ae9a998f3dee2c4f5cadd 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 { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
 import { URLBuilderService } from '~/app/shared/services/url-builder.service';
 import { Pool } from '../pool';
 import { PoolStat, PoolStats } from '../pool-stat';
-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 ff070579317652ed649c2135c3c271d631ca70f6..13ce274a0c51a82421ea8cf121307190e3878ac0 100644 (file)
@@ -54,7 +54,7 @@ describe('RgwBucketListComponent', () => {
     expect(tableActions).toEqual({
       'create,update,delete': {
         actions: ['Create', 'Edit', 'Delete'],
-        primary: { multiple: 'Delete', executing: 'Edit', single: 'Edit', no: 'Create' }
+        primary: { multiple: 'Create', executing: 'Edit', single: 'Edit', no: 'Create' }
       },
       'create,update': {
         actions: ['Create', 'Edit'],
@@ -62,7 +62,7 @@ describe('RgwBucketListComponent', () => {
       },
       'create,delete': {
         actions: ['Create', 'Delete'],
-        primary: { multiple: 'Delete', executing: 'Create', single: 'Create', no: 'Create' }
+        primary: { multiple: 'Create', executing: 'Delete', single: 'Delete', no: 'Create' }
       },
       create: {
         actions: ['Create'],
@@ -70,7 +70,7 @@ describe('RgwBucketListComponent', () => {
       },
       'update,delete': {
         actions: ['Edit', 'Delete'],
-        primary: { multiple: 'Delete', executing: 'Edit', single: 'Edit', no: 'Edit' }
+        primary: { multiple: 'Edit', executing: 'Edit', single: 'Edit', no: 'Edit' }
       },
       update: {
         actions: ['Edit'],
index e00895433d8df3b2d8ca607b4cdf884053a6bfde..23f77001ecb2e848db2cda879fa5603b14bd123c 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';
@@ -21,7 +21,7 @@ import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
 import { ModalService } from '~/app/shared/services/modal.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';
 
@@ -144,7 +144,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 6e898e789456b2e5afeae279496879cb61f95dab..fee9ad22093ed55544a15a9d2415b67bcab9c27d 100644 (file)
@@ -13,7 +13,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';
@@ -519,7 +519,7 @@ export class RgwMultisiteDetailsComponent implements OnDestroy, OnInit {
 
   delete(node: TreeNode) {
     if (node.data.type === 'realm') {
-      this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
+      this.modalRef = this.modalService.show(DeleteConfirmationModalComponent, {
         itemDescription: $localize`${node.data.type} ${node.data.name}`,
         itemNames: [`${node.data.name}`],
         submitAction: () => {
index 2f886ccf5d4a42cfa5f740e9496de884d859451c..26af6df36d9730f170350a40a7ffc2f2175e1e65 100644 (file)
@@ -48,7 +48,7 @@ describe('RgwUserListComponent', () => {
     expect(tableActions).toEqual({
       'create,update,delete': {
         actions: ['Create', 'Edit', 'Delete'],
-        primary: { multiple: 'Delete', executing: 'Edit', single: 'Edit', no: 'Create' }
+        primary: { multiple: 'Create', executing: 'Edit', single: 'Edit', no: 'Create' }
       },
       'create,update': {
         actions: ['Create', 'Edit'],
@@ -56,7 +56,7 @@ describe('RgwUserListComponent', () => {
       },
       'create,delete': {
         actions: ['Create', 'Delete'],
-        primary: { multiple: 'Delete', executing: 'Create', single: 'Create', no: 'Create' }
+        primary: { multiple: 'Create', executing: 'Delete', single: 'Delete', no: 'Create' }
       },
       create: {
         actions: ['Create'],
@@ -64,7 +64,7 @@ describe('RgwUserListComponent', () => {
       },
       'update,delete': {
         actions: ['Edit', 'Delete'],
-        primary: { multiple: 'Delete', executing: 'Edit', single: 'Edit', no: 'Edit' }
+        primary: { multiple: 'Edit', executing: 'Edit', single: 'Edit', no: 'Edit' }
       },
       update: {
         actions: ['Edit'],
index 4f7caedcea9ac1783a2e24a4d3d150d769098ae4..298bba44a73c1915adb07d50d8f52a7a774440a1 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 83dcd69fa57f27998d9750646cbe8167224dca4b..2aa311e7876ad77ca7499ec19bcaa61b7c55491a 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 1941cf3566dd55beb462b7007de277e7c8fff0d0..00e56e4313f0aab5ef80099ee8cdcdfacb21bbe6 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 c3baa9c13f59c1d8fef350c9324a74bc1a2869b2..cf28dbc483b12a4640bafedb03132ca72e42dc87 100644 (file)
@@ -26,7 +26,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';
@@ -85,7 +85,7 @@ import { FormAdvancedFieldsetComponent } from './form-advanced-fieldset/form-adv
     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 5f7988a..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<cd-modal #modal
-          [modalRef]="activeModal">
-  <ng-container class="modal-title">
-    <ng-container *ngTemplateOutlet="deletionHeading"></ng-container>
-  </ng-container>
-
-  <ng-container class="modal-content">
-    <form name="deletionForm"
-          #formDir="ngForm"
-          [formGroup]="deletionForm"
-          novalidate>
-      <div class="modal-body">
-        <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-group">
-            <ng-container *ngIf="impact == impactEnum.medium; else highImpactDeletion">
-              <div class="custom-control custom-checkbox">
-                <input type="checkbox"
-                       class="custom-control-input"
-                       name="confirmation"
-                       id="confirmation"
-                       formControlName="confirmation"
-                       autofocus>
-                <label class="custom-control-label"
-                       for="confirmation"
-                       i18n>Yes, I am sure.</label>
-              </div>
-            </ng-container>
-            <ng-template #highImpactDeletion>
-              <label i18n
-                     for="name">Resource Name</label>
-              <div class="cd-col-form-input">
-                <input class="form-control"
-                       type="text"
-                       placeholder="Enter resource name to delete"
-                       id="resource_name"
-                       name="resource_name"
-                       formControlName="confirmInput">
-                <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>
-              </div>
-            </ng-template>
-          </div>
-        </div>
-      </div>
-      <div class="modal-footer">
-        <cd-form-button-panel (submitActionEvent)="callSubmitAction()"
-                              (backActionEvent)="backAction ? callBackAction() : hideModal()"
-                              [form]="deletionForm"
-                              [submitText]="(actionDescription | titlecase) + ' ' + itemDescription"></cd-form-button-panel>
-      </div>
-    </form>
-  </ng-container>
-</cd-modal>
-
-<ng-template #deletionHeading>
-  {{ actionDescription | titlecase }} {{ itemDescription }}
-</ng-template>
\ No newline at end of file
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 066a7f4..0000000
+++ /dev/null
@@ -1,275 +0,0 @@
-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 { NgbActiveModal, NgbModalModule, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
-import { Observable, Subscriber, timer as observableTimer } from 'rxjs';
-
-import { DirectivesModule } from '~/app/shared/directives/directives.module';
-import { ModalService } from '~/app/shared/services/modal.service';
-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 { 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: NgbModalRef;
-  modalRef: NgbModalRef;
-
-  // Normally private - public was needed for the tests
-  constructor(public modalService: ModalService) {}
-
-  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
-      ],
-      schemas: [NO_ERRORS_SCHEMA],
-      imports: [ReactiveFormsModule, MockModule, DirectivesModule, NgbModalModule],
-      providers: [NgbActiveModal]
-    },
-    [CriticalConfirmationModalComponent]
-  );
-
-  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();
-      mockFixture.detectChanges();
-    };
-
-    it('should test hideModal', () => {
-      expect(component.activeModal).toBeTruthy();
-      expect(component.hideModal).toBeTruthy();
-      spyOn(component.activeModal, 'close').and.callThrough();
-      expect(component.activeModal.close).not.toHaveBeenCalled();
-      component.hideModal();
-      expect(component.activeModal.close).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(false, undefined, false);
-        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 9280d81..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { AbstractControl, UntypedFormControl, ValidationErrors, Validators } from '@angular/forms';
-
-import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
-import { Observable } from 'rxjs';
-
-import { CdFormGroup } from '~/app/shared/forms/cd-form-group';
-import { SubmitButtonComponent } from '../submit-button/submit-button.component';
-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 implements OnInit {
-  @ViewChild(SubmitButtonComponent, { static: true })
-  submitButton: SubmitButtonComponent;
-  bodyTemplate: TemplateRef<any>;
-  bodyContext: object;
-  submitActionObservable: () => Observable<any>;
-  callBackAtionObservable: () => Observable<any>;
-  submitAction: Function;
-  backAction: Function;
-  deletionForm: CdFormGroup;
-  itemDescription: 'entry';
-  itemNames: string[];
-  actionDescription = 'delete';
-  impactEnum = DeletionImpact;
-  childFormGroup: CdFormGroup;
-  childFormGroupTemplate: TemplateRef<any>;
-  impact: DeletionImpact;
-  constructor(public activeModal: NgbActiveModal) {
-    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 !== 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.activeModal.close();
-  }
-
-  stopLoadingSpinner() {
-    this.deletionForm.setErrors({ cdSubmitButton: true });
-  }
-}
\ No newline at end of file
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..5509b00
--- /dev/null
@@ -0,0 +1,78 @@
+<cd-modal #modal
+          [modalRef]="activeModal">
+  <ng-container class="modal-title">
+    <ng-container *ngTemplateOutlet="deletionHeading"></ng-container>
+  </ng-container>
+
+  <ng-container class="modal-content">
+    <form name="deletionForm"
+          #formDir="ngForm"
+          [formGroup]="deletionForm"
+          novalidate>
+      <div class="modal-body">
+        <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-group">
+            <ng-container *ngIf="impact == impactEnum.medium; else highImpactDeletion">
+              <div class="custom-control custom-checkbox">
+                <input type="checkbox"
+                       class="custom-control-input"
+                       name="confirmation"
+                       id="confirmation"
+                       formControlName="confirmation"
+                       autofocus>
+                <label class="custom-control-label"
+                       for="confirmation"
+                       i18n>Yes, I am sure.</label>
+              </div>
+            </ng-container>
+            <ng-template #highImpactDeletion>
+              <label i18n
+                     for="name">Resource Name</label>
+              <div class="cd-col-form-input">
+                <input class="form-control"
+                       type="text"
+                       placeholder="Enter resource name to delete"
+                       id="resource_name"
+                       name="resource_name"
+                       formControlName="confirmInput">
+                <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>
+              </div>
+            </ng-template>
+          </div>
+        </div>
+      </div>
+      <div class="modal-footer">
+        <cd-form-button-panel (submitActionEvent)="callSubmitAction()"
+                              (backActionEvent)="backAction ? callBackAction() : hideModal()"
+                              [form]="deletionForm"
+                              [submitText]="(actionDescription | titlecase) + ' ' + itemDescription"></cd-form-button-panel>
+      </div>
+    </form>
+  </ng-container>
+</cd-modal>
+
+<ng-template #deletionHeading>
+  {{ actionDescription | titlecase }} {{ itemDescription }}
+</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..7541b81
--- /dev/null
@@ -0,0 +1,275 @@
+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 { NgbActiveModal, NgbModalModule, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
+import { Observable, Subscriber, timer as observableTimer } from 'rxjs';
+
+import { DirectivesModule } from '~/app/shared/directives/directives.module';
+import { ModalService } from '~/app/shared/services/modal.service';
+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 { 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: NgbModalRef;
+  modalRef: NgbModalRef;
+
+  // Normally private - public was needed for the tests
+  constructor(public modalService: ModalService) {}
+
+  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, NgbModalModule],
+      providers: [NgbActiveModal]
+    },
+    [DeleteConfirmationModalComponent]
+  );
+
+  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();
+      mockFixture.detectChanges();
+    };
+
+    it('should test hideModal', () => {
+      expect(component.activeModal).toBeTruthy();
+      expect(component.hideModal).toBeTruthy();
+      spyOn(component.activeModal, 'close').and.callThrough();
+      expect(component.activeModal.close).not.toHaveBeenCalled();
+      component.hideModal();
+      expect(component.activeModal.close).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(false, undefined, false);
+        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..8ed5464
--- /dev/null
@@ -0,0 +1,103 @@
+import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { AbstractControl, UntypedFormControl, ValidationErrors, Validators } from '@angular/forms';
+
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { Observable } from 'rxjs';
+
+import { CdFormGroup } from '~/app/shared/forms/cd-form-group';
+import { SubmitButtonComponent } from '../submit-button/submit-button.component';
+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 implements OnInit {
+  @ViewChild(SubmitButtonComponent, { static: true })
+  submitButton: SubmitButtonComponent;
+  bodyTemplate: TemplateRef<any>;
+  bodyContext: object;
+  submitActionObservable: () => Observable<any>;
+  callBackAtionObservable: () => Observable<any>;
+  submitAction: Function;
+  backAction: Function;
+  deletionForm: CdFormGroup;
+  itemDescription: 'entry';
+  itemNames: string[];
+  actionDescription = 'delete';
+  impactEnum = DeletionImpact;
+  childFormGroup: CdFormGroup;
+  childFormGroupTemplate: TemplateRef<any>;
+  impact: DeletionImpact;
+  constructor(public activeModal: NgbActiveModal) {
+    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.activeModal.close();
+  }
+
+  stopLoadingSpinner() {
+    this.deletionForm.setErrors({ cdSubmitButton: true });
+  }
+}
index 340ddf7005bc46d2e8937c9818b406b63b756484..d8dd327ff26b62e1eb1ec879f52f22df95fdd63e 100644 (file)
@@ -16,7 +16,7 @@ import { Permission, Permissions } from '../../models/permissions';
 import { AuthStorageService } from '../../services/auth-storage.service';
 import { TaskWrapperService } from '../../services/task-wrapper.service';
 import { ModalService } from '../../services/modal.service';
-import { CriticalConfirmationModalComponent } from '../../components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { DeleteConfirmationModalComponent } from '../../components/delete-confirmation-modal/delete-confirmation-modal.component';
 
 @Component({
   selector: 'cd-crud-table',
@@ -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
+}