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`,
scenario = {
fn: () => tableActions.getCurrentButton().name,
single: 'Edit',
- empty: 'Add'
+ empty: 'Create'
};
});
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);
});
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],
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]]);
});
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';
private cephReleaseNamePipe: CephReleaseNamePipe,
private summaryservice: SummaryService,
private modalService: BsModalService,
- private taskWrapper: TaskWrapperService
+ private taskWrapper: TaskWrapperService,
+ public actionLabels: ActionLabelsI18n
) {
this.permissions = this.authStorageService.getPermissions();
{
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
}
];
}
!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',
!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,
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';
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',
disable: (selection: CdTableSelection) =>
!selection.hasSingleSelection || selection.first().cdExecuting,
icon: 'fa-clone',
- name: this.i18n('Clone')
+ name: actionLabels.CLONE
};
this.copy = {
permission: 'create',
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',
const first = selection.first();
return !selection.hasSingleSelection || first.cdExecuting || first.is_protected;
},
- name: this.i18n('Delete')
+ name: actionLabels.DELETE
};
this.ordering = [
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';
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);
notificationService,
null,
null,
- i18n
+ i18n,
+ actionLabelsI18n
);
spyOn(rbdService, 'deleteSnapshot').and.returnValue(observableThrowError({ status: 500 }));
spyOn(notificationService, 'notifyTask').and.stub();
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';
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();
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';
private cdDatePipe: CdDatePipe,
private taskListService: TaskListService,
private taskWrapper: TaskWrapperService,
- private i18n: I18n
+ private i18n: I18n,
+ public actionLabels: ActionLabelsI18n
) {
this.permission = this.authStorageService.getPermissions().rbdImage;
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];
}
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';
constructor(
private authStorageService: AuthStorageService,
private configurationService: ConfigurationService,
- private i18n: I18n
+ private i18n: I18n,
+ public actionLabels: ActionLabelsI18n
) {
this.permission = this.authStorageService.getPermissions().configOpt;
const getConfigOptUri = () =>
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];
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';
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(
icon: 'fa-unlink'
},
{
- name: this.i18n('Purge'),
+ name: this.actionLabels.PURGE,
permission: 'delete',
click: () =>
this.showCriticalConfirmationModal(
icon: 'fa-eraser'
},
{
- name: this.i18n('Destroy'),
+ name: this.actionLabels.DESTROY,
permission: 'delete',
click: () =>
this.showCriticalConfirmationModal(
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 */
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');
}
}