]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Unify the labels on all table actions objects 28162/head
authorTiago Melo <tmelo@suse.com>
Fri, 17 May 2019 10:55:43 +0000 (10:55 +0000)
committerTiago Melo <tmelo@suse.com>
Thu, 23 May 2019 11:05:18 +0000 (11:05 +0000)
Fixes: http://tracker.ceph.com/issues/39102
Signed-off-by: Tiago Melo <tmelo@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/block.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.spec.ts
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/rbd-list/rbd-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.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/cluster/configuration/configuration.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/constants/app.constants.ts

index b4322d2d0fdf49ecdd1e1521ffe7584953a3139d..ca56b9623aee3f73d30ac66dac2f232dd4b4857b 100644 (file)
@@ -149,9 +149,9 @@ const routes: Routes = [
         children: [
           { path: '', component: IscsiTargetListComponent },
           {
-            path: URLVerbs.ADD,
+            path: URLVerbs.CREATE,
             component: IscsiTargetFormComponent,
-            data: { breadcrumbs: ActionLabels.ADD }
+            data: { breadcrumbs: ActionLabels.CREATE }
           },
           {
             path: `${URLVerbs.EDIT}/:target_iqn`,
index 7a48d2ab6bf22fc24ddab198c0df1332ce8fc957..09070055170fb98343d49e40c6215d3586e6979d 100644 (file)
@@ -190,7 +190,7 @@ describe('IscsiTargetListComponent', () => {
       scenario = {
         fn: () => tableActions.getCurrentButton().name,
         single: 'Edit',
-        empty: 'Add'
+        empty: 'Create'
       };
     });
 
@@ -199,7 +199,7 @@ describe('IscsiTargetListComponent', () => {
         tableActions = permissionHelper.setPermissionsAndGetActions(1, 1, 1);
       });
 
-      it(`shows 'Edit' for single selection else 'Add' as main action`, () => {
+      it(`shows 'Edit' for single selection else 'Create' as main action`, () => {
         permissionHelper.testScenarios(scenario);
       });
 
@@ -231,12 +231,12 @@ describe('IscsiTargetListComponent', () => {
         tableActions = permissionHelper.setPermissionsAndGetActions(1, 0, 1);
       });
 
-      it(`shows 'Delete' for single selection else 'Add' as main action`, () => {
+      it(`shows 'Delete' for single selection else 'Create' as main action`, () => {
         scenario.single = 'Delete';
         permissionHelper.testScenarios(scenario);
       });
 
-      it(`shows 'Add' and 'Delete' actions`, () => {
+      it(`shows 'Create' and 'Delete' actions`, () => {
         expect(tableActions.tableActions.length).toBe(2);
         expect(tableActions.tableActions).toEqual([
           component.tableActions[0],
@@ -269,12 +269,12 @@ describe('IscsiTargetListComponent', () => {
         tableActions = permissionHelper.setPermissionsAndGetActions(1, 0, 0);
       });
 
-      it(`shows 'Add' for single selection and 'Add' as main action`, () => {
-        scenario.single = 'Add';
+      it(`shows 'Create' for single selection and 'Create' as main action`, () => {
+        scenario.single = 'Create';
         permissionHelper.testScenarios(scenario);
       });
 
-      it(`shows 'Add' actions`, () => {
+      it(`shows 'Create' actions`, () => {
         expect(tableActions.tableActions.length).toBe(1);
         expect(tableActions.tableActions).toEqual([component.tableActions[0]]);
       });
index c1f66967f9b56c7573c386927bfcfd4fb3075693..42a2a80b7751e8573c43dbaa0a9f02e17f3f8d56 100644 (file)
@@ -6,6 +6,7 @@ import { Subscription } from 'rxjs';
 
 import { IscsiService } from '../../../shared/api/iscsi.service';
 import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
 import { TableComponent } from '../../../shared/datatable/table/table.component';
 import { CellTemplate } from '../../../shared/enum/cell-template.enum';
 import { CdTableAction } from '../../../shared/models/cd-table-action';
@@ -58,7 +59,8 @@ export class IscsiTargetListComponent implements OnInit, OnDestroy {
     private cephReleaseNamePipe: CephReleaseNamePipe,
     private summaryservice: SummaryService,
     private modalService: BsModalService,
-    private taskWrapper: TaskWrapperService
+    private taskWrapper: TaskWrapperService,
+    public actionLabels: ActionLabelsI18n
   ) {
     this.permissions = this.authStorageService.getPermissions();
 
@@ -66,20 +68,20 @@ export class IscsiTargetListComponent implements OnInit, OnDestroy {
       {
         permission: 'create',
         icon: 'fa-plus',
-        routerLink: () => '/block/iscsi/targets/add',
-        name: this.i18n('Add')
+        routerLink: () => '/block/iscsi/targets/create',
+        name: this.actionLabels.CREATE
       },
       {
         permission: 'update',
         icon: 'fa-pencil',
         routerLink: () => `/block/iscsi/targets/edit/${this.selection.first().target_iqn}`,
-        name: this.i18n('Edit')
+        name: this.actionLabels.EDIT
       },
       {
         permission: 'delete',
         icon: 'fa-times',
         click: () => this.deleteIscsiTargetModal(),
-        name: this.i18n('Delete')
+        name: this.actionLabels.DELETE
       }
     ];
   }
index 0ba72c8ef67973f7eef178fb1892f0c4fae3b2c8..de6eca2aa81e566de893de69bb0be6565312ec5e 100644 (file)
@@ -120,7 +120,7 @@ export class RbdListComponent implements OnInit {
         !selection.hasSingleSelection || selection.first().cdExecuting,
       icon: 'fa-copy',
       routerLink: () => `/block/rbd/copy/${getImageUri()}`,
-      name: this.i18n('Copy')
+      name: this.actionLabels.COPY
     };
     const flattenAction: CdTableAction = {
       permission: 'update',
@@ -128,13 +128,13 @@ export class RbdListComponent implements OnInit {
         !selection.hasSingleSelection || selection.first().cdExecuting || !selection.first().parent,
       icon: 'fa-chain-broken',
       click: () => this.flattenRbdModal(),
-      name: this.i18n('Flatten')
+      name: this.actionLabels.FLATTEN
     };
     const moveAction: CdTableAction = {
       permission: 'delete',
       icon: 'fa-trash-o',
       click: () => this.trashRbdModal(),
-      name: this.i18n('Move to Trash')
+      name: this.actionLabels.TRASH
     };
     this.tableActions = [
       addAction,
index eb408eb5f2d0f151d325e6fd84d0672daa73e057..b3e3a186a3a7c00b53f0d4757f5b36c755207de9 100644 (file)
@@ -1,5 +1,6 @@
 import { I18n } from '@ngx-translate/i18n-polyfill';
 
+import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
 import { CdTableAction } from '../../../shared/models/cd-table-action';
 import { CdTableSelection } from '../../../shared/models/cd-table-selection';
 
@@ -16,32 +17,32 @@ export class RbdSnapshotActionsModel {
   deleteSnap: CdTableAction;
   ordering: CdTableAction[];
 
-  constructor(i18n: I18n) {
+  constructor(i18n: I18n, actionLabels: ActionLabelsI18n) {
     this.i18n = i18n;
 
     this.create = {
       permission: 'create',
       icon: 'fa-plus',
-      name: this.i18n('Create')
+      name: actionLabels.CREATE
     };
     this.rename = {
       permission: 'update',
       icon: 'fa-pencil',
-      name: this.i18n('Rename')
+      name: actionLabels.RENAME
     };
     this.protect = {
       permission: 'update',
       icon: 'fa-lock',
       visible: (selection: CdTableSelection) =>
         selection.hasSingleSelection && !selection.first().is_protected,
-      name: this.i18n('Protect')
+      name: actionLabels.PROTECT
     };
     this.unprotect = {
       permission: 'update',
       icon: 'fa-unlock',
       visible: (selection: CdTableSelection) =>
         selection.hasSingleSelection && selection.first().is_protected,
-      name: this.i18n('Unprotect')
+      name: actionLabels.UNPROTECT
     };
     this.clone = {
       permission: 'create',
@@ -49,7 +50,7 @@ export class RbdSnapshotActionsModel {
       disable: (selection: CdTableSelection) =>
         !selection.hasSingleSelection || selection.first().cdExecuting,
       icon: 'fa-clone',
-      name: this.i18n('Clone')
+      name: actionLabels.CLONE
     };
     this.copy = {
       permission: 'create',
@@ -57,12 +58,12 @@ export class RbdSnapshotActionsModel {
       disable: (selection: CdTableSelection) =>
         !selection.hasSingleSelection || selection.first().cdExecuting,
       icon: 'fa-copy',
-      name: this.i18n('Copy')
+      name: actionLabels.COPY
     };
     this.rollback = {
       permission: 'update',
       icon: 'fa-undo',
-      name: this.i18n('Rollback')
+      name: actionLabels.ROLLBACK
     };
     this.deleteSnap = {
       permission: 'delete',
@@ -71,7 +72,7 @@ export class RbdSnapshotActionsModel {
         const first = selection.first();
         return !selection.hasSingleSelection || first.cdExecuting || first.is_protected;
       },
-      name: this.i18n('Delete')
+      name: actionLabels.DELETE
     };
 
     this.ordering = [
index e6d0031b6d5e76a8c14c4c1fb3df92d7201ac0d4..0159f99cc9d0e820bca3da052cb1390573ff0181 100644 (file)
@@ -16,6 +16,7 @@ import {
 import { ApiModule } from '../../../shared/api/api.module';
 import { RbdService } from '../../../shared/api/rbd.service';
 import { ComponentsModule } from '../../../shared/components/components.module';
+import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
 import { DataTableModule } from '../../../shared/datatable/datatable.module';
 import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
 import { ExecutingTask } from '../../../shared/models/executing-task';
@@ -82,6 +83,7 @@ describe('RbdSnapshotListComponent', () => {
     beforeEach(() => {
       fixture.detectChanges();
       const i18n = TestBed.get(I18n);
+      const actionLabelsI18n = TestBed.get(ActionLabelsI18n);
       called = false;
       rbdService = new RbdService(null, null);
       notificationService = new NotificationService(null, null, null);
@@ -97,7 +99,8 @@ describe('RbdSnapshotListComponent', () => {
         notificationService,
         null,
         null,
-        i18n
+        i18n,
+        actionLabelsI18n
       );
       spyOn(rbdService, 'deleteSnapshot').and.returnValue(observableThrowError({ status: 500 }));
       spyOn(notificationService, 'notifyTask').and.stub();
index 101525bf30b552f24922479251ff06dc2bb3e1b3..e8ef32a41114a8561bb776e3d250522fe4f12070 100644 (file)
@@ -8,6 +8,7 @@ import { of } from 'rxjs';
 import { RbdService } from '../../../shared/api/rbd.service';
 import { ConfirmationModalComponent } from '../../../shared/components/confirmation-modal/confirmation-modal.component';
 import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
 import { CellTemplate } from '../../../shared/enum/cell-template.enum';
 import { CdTableAction } from '../../../shared/models/cd-table-action';
 import { CdTableColumn } from '../../../shared/models/cd-table-column';
@@ -74,10 +75,11 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges {
     private notificationService: NotificationService,
     private summaryService: SummaryService,
     private taskListService: TaskListService,
-    private i18n: I18n
+    private i18n: I18n,
+    private actionLabels: ActionLabelsI18n
   ) {
     this.permission = this.authStorageService.getPermissions().rbdImage;
-    const actions = new RbdSnapshotActionsModel(this.i18n);
+    const actions = new RbdSnapshotActionsModel(this.i18n, this.actionLabels);
     actions.create.click = () => this.openCreateSnapshotModal();
     actions.rename.click = () => this.openEditSnapshotModal();
     actions.protect.click = () => this.toggleProtection();
index 71f32dbeb284505a57589e2190973d9283610ada..f5770ebdddf592a3c22e665cba80ed7ab4ea6a5c 100644 (file)
@@ -7,6 +7,7 @@ import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
 
 import { RbdService } from '../../../shared/api/rbd.service';
 import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
 import { TableComponent } from '../../../shared/datatable/table/table.component';
 import { CellTemplate } from '../../../shared/enum/cell-template.enum';
 import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
@@ -54,7 +55,8 @@ export class RbdTrashListComponent implements OnInit {
     private cdDatePipe: CdDatePipe,
     private taskListService: TaskListService,
     private taskWrapper: TaskWrapperService,
-    private i18n: I18n
+    private i18n: I18n,
+    public actionLabels: ActionLabelsI18n
   ) {
     this.permission = this.authStorageService.getPermissions().rbdImage;
 
@@ -62,13 +64,13 @@ export class RbdTrashListComponent implements OnInit {
       permission: 'update',
       icon: 'fa-undo',
       click: () => this.restoreModal(),
-      name: this.i18n('Restore')
+      name: this.actionLabels.RESTORE
     };
     const deleteAction: CdTableAction = {
       permission: 'delete',
       icon: 'fa-times',
       click: () => this.deleteModal(),
-      name: this.i18n('Delete')
+      name: this.actionLabels.DELETE
     };
     this.tableActions = [restoreAction, deleteAction];
   }
index f504d544853212ba549e96d9d8649f06bdc56eb4..82ea4b444e68d5380014e67804b624ed0d4963ca 100644 (file)
@@ -3,6 +3,7 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
 import { I18n } from '@ngx-translate/i18n-polyfill';
 
 import { ConfigurationService } from '../../../shared/api/configuration.service';
+import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
 import { CellTemplate } from '../../../shared/enum/cell-template.enum';
 import { CdTableAction } from '../../../shared/models/cd-table-action';
 import { CdTableColumn } from '../../../shared/models/cd-table-column';
@@ -83,7 +84,8 @@ export class ConfigurationComponent implements OnInit {
   constructor(
     private authStorageService: AuthStorageService,
     private configurationService: ConfigurationService,
-    private i18n: I18n
+    private i18n: I18n,
+    public actionLabels: ActionLabelsI18n
   ) {
     this.permission = this.authStorageService.getPermissions().configOpt;
     const getConfigOptUri = () =>
@@ -92,7 +94,7 @@ export class ConfigurationComponent implements OnInit {
       permission: 'update',
       icon: 'fa-pencil',
       routerLink: () => `/configuration/edit/${getConfigOptUri()}`,
-      name: this.i18n('Edit'),
+      name: this.actionLabels.EDIT,
       disable: () => !this.isEditable(this.selection)
     };
     this.tableActions = [editAction];
index 7fe5abd41b0cee2058b16a61819d585a44170b47..86cd7bd0ab503b36290264e48bc83dcb9fca3aad 100644 (file)
@@ -7,6 +7,7 @@ import { Observable } from 'rxjs';
 import { OsdService } from '../../../../shared/api/osd.service';
 import { ConfirmationModalComponent } from '../../../../shared/components/confirmation-modal/confirmation-modal.component';
 import { CriticalConfirmationModalComponent } from '../../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
+import { ActionLabelsI18n } from '../../../../shared/constants/app.constants';
 import { TableComponent } from '../../../../shared/datatable/table/table.component';
 import { CellTemplate } from '../../../../shared/enum/cell-template.enum';
 import { CdTableAction } from '../../../../shared/models/cd-table-action';
@@ -58,54 +59,55 @@ export class OsdListComponent implements OnInit {
     private osdService: OsdService,
     private dimlessBinaryPipe: DimlessBinaryPipe,
     private modalService: BsModalService,
-    private i18n: I18n
+    private i18n: I18n,
+    public actionLabels: ActionLabelsI18n
   ) {
     this.permissions = this.authStorageService.getPermissions();
     this.tableActions = [
       {
-        name: this.i18n('Scrub'),
+        name: this.actionLabels.SCRUB,
         permission: 'update',
         icon: 'fa-stethoscope',
         click: () => this.scrubAction(false),
         disable: () => !this.hasOsdSelected
       },
       {
-        name: this.i18n('Deep Scrub'),
+        name: this.actionLabels.DEEP_SCRUB,
         permission: 'update',
         icon: 'fa-cog',
         click: () => this.scrubAction(true),
         disable: () => !this.hasOsdSelected
       },
       {
-        name: this.i18n('Reweight'),
+        name: this.actionLabels.REWEIGHT,
         permission: 'update',
         click: () => this.reweight(),
         disable: () => !this.hasOsdSelected,
         icon: 'fa-balance-scale'
       },
       {
-        name: this.i18n('Mark Out'),
+        name: this.actionLabels.MARK_OUT,
         permission: 'update',
         click: () => this.showConfirmationModal(this.i18n('out'), this.osdService.markOut),
         disable: () => this.isNotSelectedOrInState('out'),
         icon: 'fa-arrow-left'
       },
       {
-        name: this.i18n('Mark In'),
+        name: this.actionLabels.MARK_IN,
         permission: 'update',
         click: () => this.showConfirmationModal(this.i18n('in'), this.osdService.markIn),
         disable: () => this.isNotSelectedOrInState('in'),
         icon: 'fa-arrow-right'
       },
       {
-        name: this.i18n('Mark Down'),
+        name: this.actionLabels.MARK_DOWN,
         permission: 'update',
         click: () => this.showConfirmationModal(this.i18n('down'), this.osdService.markDown),
         disable: () => this.isNotSelectedOrInState('down'),
         icon: 'fa-arrow-down'
       },
       {
-        name: this.i18n('Mark Lost'),
+        name: this.actionLabels.MARK_LOST,
         permission: 'delete',
         click: () =>
           this.showCriticalConfirmationModal(
@@ -118,7 +120,7 @@ export class OsdListComponent implements OnInit {
         icon: 'fa-unlink'
       },
       {
-        name: this.i18n('Purge'),
+        name: this.actionLabels.PURGE,
         permission: 'delete',
         click: () =>
           this.showCriticalConfirmationModal(
@@ -131,7 +133,7 @@ export class OsdListComponent implements OnInit {
         icon: 'fa-eraser'
       },
       {
-        name: this.i18n('Destroy'),
+        name: this.actionLabels.DESTROY,
         permission: 'delete',
         click: () =>
           this.showCriticalConfirmationModal(
index c60d8d7544477175ead425d86cd51aa3b1d9c9ec..15bafc6c7da8afa66b3ee68f949203d3c3a548f5 100644 (file)
@@ -74,7 +74,23 @@ export class ActionLabelsI18n {
   CANCEL: string;
   COPY: string;
   CLONE: string;
+  DEEP_SCRUB: string;
+  DESTROY: string;
+  FLATTEN: string;
+  MARK_DOWN: string;
+  MARK_IN: string;
+  MARK_LOST: string;
+  MARK_OUT: string;
+  PROTECT: string;
+  PURGE: string;
+  RENAME: string;
+  RESTORE: string;
+  REWEIGHT: string;
+  ROLLBACK: string;
+  SCRUB: string;
   SHOW: string;
+  TRASH: string;
+  UNPROTECT: string;
 
   constructor(private i18n: I18n) {
     /* Create a new item */
@@ -94,9 +110,24 @@ export class ActionLabelsI18n {
     this.CANCEL = this.i18n('Cancel');
 
     /* Non-standard actions */
-    this.COPY = this.i18n('Copy');
     this.CLONE = this.i18n('Clone');
-
+    this.COPY = this.i18n('Copy');
+    this.DEEP_SCRUB = this.i18n('Deep Scrub');
+    this.DESTROY = this.i18n('Destroy');
+    this.FLATTEN = this.i18n('Flatten');
+    this.MARK_DOWN = this.i18n('Mark Down');
+    this.MARK_IN = this.i18n('Mark In');
+    this.MARK_LOST = this.i18n('Mark Lost');
+    this.MARK_OUT = this.i18n('Mark Out');
+    this.PROTECT = this.i18n('Protect');
+    this.PURGE = this.i18n('Purge');
+    this.RENAME = this.i18n('Rename');
+    this.RESTORE = this.i18n('Restore');
+    this.REWEIGHT = this.i18n('Reweight');
+    this.ROLLBACK = this.i18n('Rollback');
+    this.SCRUB = this.i18n('Scrub');
     this.SHOW = this.i18n('Show');
+    this.TRASH = this.i18n('Move to Trash');
+    this.UNPROTECT = this.i18n('Unprotect');
   }
 }