import { SsoNotFoundComponent } from './core/auth/sso/sso-not-found/sso-not-found.component';
import { ForbiddenComponent } from './core/forbidden/forbidden.component';
import { NotFoundComponent } from './core/not-found/not-found.component';
+import { ActionLabels, URLVerbs } from './shared/constants/app.constants';
import { BreadcrumbsResolver, IBreadcrumb } from './shared/models/breadcrumbs';
import { AuthGuardService } from './shared/services/auth-guard.service';
import { FeatureTogglesGuardService } from './shared/services/feature-toggles-guard.service';
{
path: 'edit/:name',
component: ConfigurationFormComponent,
- data: { breadcrumbs: 'Edit' }
+ data: { breadcrumbs: ActionLabels.EDIT }
}
]
},
},
children: [
{ path: '', component: NfsListComponent },
- { path: 'add', component: NfsFormComponent, data: { breadcrumbs: 'Add' } },
{
- path: 'edit/:cluster_id/:export_id',
+ path: URLVerbs.CREATE,
component: NfsFormComponent,
- data: { breadcrumbs: 'Edit' }
+ data: { breadcrumbs: ActionLabels.CREATE }
+ },
+ {
+ path: `${URLVerbs.EDIT}/:cluster_id/:export_id`,
+ component: NfsFormComponent,
+ data: { breadcrumbs: ActionLabels.EDIT }
}
]
},
novalidate>
<div class="panel panel-default">
<div class="panel-heading">
- <h3 class="panel-title"
- i18n>NFS export {{ export_id ? cluster_id + ':' + export_id : '' }}</h3>
+ <h3 i18n="form title|Example: Create Pool@@formTitle"
+ class="panel-title">{{ action | titlecase }} {{ resource | upperFirst }}</h3>
</div>
<div class="panel-body">
<div class="panel-footer">
<div class="button-group text-right">
- <cd-submit-button [form]="formDir"
- type="button"
- (submitAction)="submitAction()">
- <ng-container i18n>Submit</ng-container>
- </cd-submit-button>
+ <cd-submit-button
+ [form]="formDir"
+ (submitAction)="submitAction()"
+ i18n="form action button|Example: Create Pool@@formActionButton"
+ type="button">{{ action | titlecase }} {{ resource | upperFirst }}</cd-submit-button>
<cd-back-button></cd-back-button>
</div>
</div>
import { RgwUserService } from '../../../shared/api/rgw-user.service';
import { SelectMessages } from '../../../shared/components/select/select-messages.model';
import { SelectOption } from '../../../shared/components/select/select-option.model';
+import { ActionLabelsI18n } from '../../../shared/constants/app.constants';
import { CdFormBuilder } from '../../../shared/forms/cd-form-builder';
import { CdFormGroup } from '../../../shared/forms/cd-form-group';
import { CdValidators } from '../../../shared/forms/cd-validators';
nfsAccessType: any[] = this.nfsService.nfsAccessType;
nfsSquash: any[] = this.nfsService.nfsSquash;
+ action: string;
+ resource: string;
+
daemonsSelections: SelectOption[] = [];
daemonsMessages = new SelectMessages(
{ noOptions: this.i18n('There are no daemons available.') },
private formBuilder: CdFormBuilder,
private taskWrapper: TaskWrapperService,
private cdRef: ChangeDetectorRef,
- private i18n: I18n
+ private i18n: I18n,
+ public actionLabels: ActionLabelsI18n
) {
this.permission = this.authStorageService.getPermissions().pool;
+ this.resource = this.i18n('NFS export');
this.createForm();
}
}
if (this.isEdit) {
+ this.action = this.actionLabels.EDIT;
this.route.params.subscribe((params: { cluster_id: string; export_id: string }) => {
this.cluster_id = decodeURIComponent(params.cluster_id);
this.export_id = decodeURIComponent(params.export_id);
this.getData(promises);
});
} else {
+ this.action = this.actionLabels.CREATE;
this.getData(promises);
}
}
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));
it('shows all actions', () => {
tableActions = permissionHelper.setPermissionsAndGetActions(1, 1, 0);
});
- 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));
it(`shows all actions except for 'Delete'`, () => {
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' action`, () => {
+ it(`shows 'Create', and 'Delete' action`, () => {
expect(tableActions.tableActions.length).toBe(2);
expect(tableActions.tableActions).toEqual([
component.tableActions[0],
tableActions = permissionHelper.setPermissionsAndGetActions(1, 0, 0);
});
- it(`always shows 'Add' as main action`, () => {
- scenario.single = 'Add';
+ it(`always shows 'Create' as main action`, () => {
+ scenario.single = 'Create';
permissionHelper.testScenarios(scenario);
});
- it(`shows 'Add' action`, () => {
+ it(`shows 'Create' action`, () => {
expect(tableActions.tableActions.length).toBe(1);
expect(tableActions.tableActions).toEqual([component.tableActions[0]]);
});
import { NfsService } from '../../../shared/api/nfs.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 modalService: BsModalService,
private nfsService: NfsService,
private taskListService: TaskListService,
- private taskWrapper: TaskWrapperService
+ private taskWrapper: TaskWrapperService,
+ public actionLabels: ActionLabelsI18n
) {
this.permission = this.authStorageService.getPermissions().nfs;
const getNfsUri = () =>
this.selection.first().export_id
)}`;
- const addAction: CdTableAction = {
+ const createAction: CdTableAction = {
permission: 'create',
icon: 'fa-plus',
- routerLink: () => '/nfs/add',
+ routerLink: () => '/nfs/create',
canBePrimary: (selection: CdTableSelection) => !selection.hasSingleSelection,
- name: this.i18n('Add')
+ name: this.actionLabels.CREATE
};
const editAction: CdTableAction = {
permission: 'update',
icon: 'fa-pencil',
routerLink: () => `/nfs/edit/${getNfsUri()}`,
- name: this.i18n('Edit')
+ name: this.actionLabels.EDIT
};
const deleteAction: CdTableAction = {
permission: 'delete',
icon: 'fa-times',
click: () => this.deleteNfsModal(),
- name: this.i18n('Delete')
+ name: this.actionLabels.DELETE
};
- this.tableActions = [addAction, editAction, deleteAction];
+ this.tableActions = [createAction, editAction, deleteAction];
}
ngOnInit() {