import { of } from 'rxjs';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { TcmuIscsiService } from '../../../shared/api/tcmu-iscsi.service';
import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
FormatterService,
RelativeDatePipe,
ListPipe,
- { provide: TcmuIscsiService, useValue: fakeService }
+ { provide: TcmuIscsiService, useValue: fakeService },
+ i18nProviders
]
});
import { Component } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
import { TcmuIscsiService } from '../../../shared/api/tcmu-iscsi.service';
import { CellTemplate } from '../../../shared/enum/cell-template.enum';
import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
cephShortVersionPipe: CephShortVersionPipe,
dimlessPipe: DimlessPipe,
relativeDatePipe: RelativeDatePipe,
- listPipe: ListPipe
+ listPipe: ListPipe,
+ private i18n: I18n
) {
this.daemonsColumns = [
{
- name: 'Hostname',
+ name: this.i18n('Hostname'),
prop: 'server_hostname'
},
{
- name: '# Active/Optimized',
+ name: this.i18n('# Active/Optimized'),
prop: 'optimized_paths'
},
{
- name: '# Active/Non-Optimized',
+ name: this.i18n('# Active/Non-Optimized'),
prop: 'non_optimized_paths'
},
{
- name: 'Version',
+ name: this.i18n('Version'),
prop: 'version',
pipe: cephShortVersionPipe
}
];
this.imagesColumns = [
{
- name: 'Pool',
+ name: this.i18n('Pool'),
prop: 'pool_name'
},
{
- name: 'Image',
+ name: this.i18n('Image'),
prop: 'name'
},
{
- name: 'Active/Optimized',
+ name: this.i18n('Active/Optimized'),
prop: 'optimized_paths',
pipe: listPipe
},
{
- name: 'Active/Non-Optimized',
+ name: this.i18n('Active/Non-Optimized'),
prop: 'non_optimized_paths',
pipe: listPipe
},
{
- name: 'Read Bytes',
+ name: this.i18n('Read Bytes'),
prop: 'stats_history.rd_bytes',
cellTransformation: CellTemplate.sparkline
},
{
- name: 'Write Bytes',
+ name: this.i18n('Write Bytes'),
prop: 'stats_history.wr_bytes',
cellTransformation: CellTemplate.sparkline
},
{
- name: 'Read Ops',
+ name: this.i18n('Read Ops'),
prop: 'stats.rd',
pipe: dimlessPipe,
cellTransformation: CellTemplate.perSecond
},
{
- name: 'Write Ops',
+ name: this.i18n('Write Ops'),
prop: 'stats.wr',
pipe: dimlessPipe,
cellTransformation: CellTemplate.perSecond
},
{
- name: 'A/O Since',
+ name: this.i18n('A/O Since'),
prop: 'optimized_since',
pipe: relativeDatePipe
}
import { ProgressbarModule } from 'ngx-bootstrap/progressbar';
import { TabsModule } from 'ngx-bootstrap/tabs';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { MirrorHealthColorPipe } from '../mirror-health-color.pipe';
import { MirroringComponent } from './mirroring.component';
TabsModule.forRoot(),
ProgressbarModule.forRoot(),
HttpClientTestingModule
- ]
+ ],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
import { RbdMirroringService } from '../../../shared/api/rbd-mirroring.service';
import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
constructor(
private rbdMirroringService: RbdMirroringService,
- private cephShortVersionPipe: CephShortVersionPipe
+ private cephShortVersionPipe: CephShortVersionPipe,
+ private i18n: I18n
) {}
ngOnInit() {
this.daemons.columns = [
- { prop: 'instance_id', name: 'Instance', flexGrow: 2 },
- { prop: 'id', name: 'ID', flexGrow: 2 },
- { prop: 'server_hostname', name: 'Hostname', flexGrow: 2 },
+ { prop: 'instance_id', name: this.i18n('Instance'), flexGrow: 2 },
+ { prop: 'id', name: this.i18n('ID'), flexGrow: 2 },
+ { prop: 'server_hostname', name: this.i18n('Hostname'), flexGrow: 2 },
{
prop: 'version',
- name: 'Version',
+ name: this.i18n('Version'),
pipe: this.cephShortVersionPipe,
flexGrow: 2
},
{
prop: 'health',
- name: 'Health',
+ name: this.i18n('Health'),
cellTemplate: this.healthTmpl,
flexGrow: 1
}
];
this.pools.columns = [
- { prop: 'name', name: 'Name', flexGrow: 2 },
- { prop: 'mirror_mode', name: 'Mode', flexGrow: 2 },
- { prop: 'leader_id', name: 'Leader', flexGrow: 2 },
- { prop: 'image_local_count', name: '# Local', flexGrow: 2 },
- { prop: 'image_remote_count', name: '# Remote', flexGrow: 2 },
+ { prop: 'name', name: this.i18n('Name'), flexGrow: 2 },
+ { prop: 'mirror_mode', name: this.i18n('Mode'), flexGrow: 2 },
+ { prop: 'leader_id', name: this.i18n('Leader'), flexGrow: 2 },
+ { prop: 'image_local_count', name: this.i18n('# Local'), flexGrow: 2 },
+ { prop: 'image_remote_count', name: this.i18n('# Remote'), flexGrow: 2 },
{
prop: 'health',
- name: 'Health',
+ name: this.i18n('Health'),
cellTemplate: this.healthTmpl,
flexGrow: 1
}
];
this.image_error.columns = [
- { prop: 'pool_name', name: 'Pool', flexGrow: 2 },
- { prop: 'name', name: 'Image', flexGrow: 2 },
- { prop: 'description', name: 'Issue', flexGrow: 4 },
+ { prop: 'pool_name', name: this.i18n('Pool'), flexGrow: 2 },
+ { prop: 'name', name: this.i18n('Image'), flexGrow: 2 },
+ { prop: 'description', name: this.i18n('Issue'), flexGrow: 4 },
{
prop: 'state',
- name: 'State',
+ name: this.i18n('State'),
cellTemplate: this.stateTmpl,
flexGrow: 1
}
];
this.image_syncing.columns = [
- { prop: 'pool_name', name: 'Pool', flexGrow: 2 },
- { prop: 'name', name: 'Image', flexGrow: 2 },
+ { prop: 'pool_name', name: this.i18n('Pool'), flexGrow: 2 },
+ { prop: 'name', name: this.i18n('Image'), flexGrow: 2 },
{
prop: 'progress',
- name: 'Progress',
+ name: this.i18n('Progress'),
cellTemplate: this.progressTmpl,
flexGrow: 2
},
{
prop: 'state',
- name: 'State',
+ name: this.i18n('State'),
cellTemplate: this.syncTmpl,
flexGrow: 1
}
];
this.image_ready.columns = [
- { prop: 'pool_name', name: 'Pool', flexGrow: 2 },
- { prop: 'name', name: 'Image', flexGrow: 2 },
- { prop: 'description', name: 'Description', flexGrow: 4 },
+ { prop: 'pool_name', name: this.i18n('Pool'), flexGrow: 2 },
+ { prop: 'name', name: this.i18n('Image'), flexGrow: 2 },
+ { prop: 'description', name: this.i18n('Description'), flexGrow: 4 },
{
prop: 'state',
- name: 'State',
+ name: this.i18n('State'),
cellTemplate: this.stateTmpl,
flexGrow: 1
}
import { ToastModule } from 'ng2-toastr';
import { ActivatedRouteStub } from '../../../../testing/activated-route-stub';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { RbdService } from '../../../shared/api/rbd.service';
import { SharedModule } from '../../../shared/shared.module';
import { RbdFormMode } from './rbd-form-mode.enum';
{
provide: ActivatedRoute,
useValue: new ActivatedRouteStub({ pool: 'foo', name: 'bar', snap: undefined })
- }
+ },
+ i18nProviders
]
});
import { FormControl, ValidatorFn, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { Observable } from 'rxjs';
private rbdService: RbdService,
private formatter: FormatterService,
private taskWrapper: TaskWrapperService,
- private dimlessBinaryPipe: DimlessBinaryPipe
+ private dimlessBinaryPipe: DimlessBinaryPipe,
+ private i18n: I18n
) {
this.poolPermission = this.authStorageService.getPermissions().pool;
this.features = {
'deep-flatten': {
- desc: 'Deep flatten',
+ desc: this.i18n('Deep flatten'),
requires: null,
allowEnable: false,
allowDisable: true
},
layering: {
- desc: 'Layering',
+ desc: this.i18n('Layering'),
requires: null,
allowEnable: false,
allowDisable: false
},
'exclusive-lock': {
- desc: 'Exclusive lock',
+ desc: this.i18n('Exclusive lock'),
requires: null,
allowEnable: true,
allowDisable: true
},
'object-map': {
- desc: 'Object map (requires exclusive-lock)',
+ desc: this.i18n('Object map (requires exclusive-lock)'),
requires: 'exclusive-lock',
allowEnable: true,
allowDisable: true
},
journaling: {
- desc: 'Journaling (requires exclusive-lock)',
+ desc: this.i18n('Journaling (requires exclusive-lock)'),
requires: 'exclusive-lock',
allowEnable: true,
allowDisable: true
},
'fast-diff': {
- desc: 'Fast diff (requires object-map)',
+ desc: this.i18n('Fast diff (requires object-map)'),
requires: 'object-map',
allowEnable: true,
allowDisable: true
import { TabsModule } from 'ngx-bootstrap/tabs';
import { TooltipModule } from 'ngx-bootstrap/tooltip';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { TaskListService } from '../../../shared/services/task-list.service';
import { SharedModule } from '../../../shared/shared.module';
import { RbdDetailsComponent } from '../rbd-details/rbd-details.component';
ToastModule.forRoot(),
TooltipModule.forRoot()
],
- providers: [TaskListService]
+ providers: [TaskListService, i18nProviders]
});
beforeEach(() => {
import { TooltipModule } from 'ngx-bootstrap/tooltip';
import { BehaviorSubject, of } from 'rxjs';
-import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper';
+import {
+ configureTestBed,
+ i18nProviders,
+ PermissionHelper
+} from '../../../../testing/unit-test-helper';
import { RbdService } from '../../../shared/api/rbd.service';
import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
HttpClientTestingModule
],
declarations: [RbdListComponent, RbdDetailsComponent, RbdSnapshotListComponent],
- providers: [TaskListService]
+ providers: [TaskListService, i18nProviders]
});
beforeEach(() => {
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
private dimlessPipe: DimlessPipe,
private modalService: BsModalService,
private taskWrapper: TaskWrapperService,
- private taskListService: TaskListService
+ private taskListService: TaskListService,
+ private i18n: I18n
) {
this.permission = this.authStorageService.getPermissions().rbdImage;
const getImageUri = () =>
icon: 'fa-plus',
routerLink: () => '/block/rbd/add',
canBePrimary: (selection: CdTableSelection) => !selection.hasSingleSelection,
- name: 'Add'
+ name: this.i18n('Add')
};
const editAction: CdTableAction = {
permission: 'update',
icon: 'fa-pencil',
routerLink: () => `/block/rbd/edit/${getImageUri()}`,
- name: 'Edit'
+ name: this.i18n('Edit')
};
const deleteAction: CdTableAction = {
permission: 'delete',
icon: 'fa-times',
click: () => this.deleteRbdModal(),
- name: 'Delete'
+ name: this.i18n('Delete')
};
const copyAction: CdTableAction = {
permission: 'create',
!selection.hasSingleSelection || selection.first().cdExecuting,
icon: 'fa-copy',
routerLink: () => `/block/rbd/copy/${getImageUri()}`,
- name: 'Copy'
+ name: this.i18n('Copy')
};
const flattenAction: CdTableAction = {
permission: 'update',
!selection.hasSingleSelection || selection.first().cdExecuting || !selection.first().parent,
icon: 'fa-chain-broken',
click: () => this.flattenRbdModal(),
- name: 'Flatten'
+ name: this.i18n('Flatten')
};
const moveAction: CdTableAction = {
permission: 'delete',
icon: 'fa-trash-o',
click: () => this.trashRbdModal(),
- name: 'Move to Trash'
+ name: this.i18n('Move to Trash')
};
this.tableActions = [
addAction,
ngOnInit() {
this.columns = [
{
- name: 'Name',
+ name: this.i18n('Name'),
prop: 'name',
flexGrow: 2,
cellTransformation: CellTemplate.executing
},
{
- name: 'Pool',
+ name: this.i18n('Pool'),
prop: 'pool_name',
flexGrow: 2
},
{
- name: 'Size',
+ name: this.i18n('Size'),
prop: 'size',
flexGrow: 1,
cellClass: 'text-right',
pipe: this.dimlessBinaryPipe
},
{
- name: 'Objects',
+ name: this.i18n('Objects'),
prop: 'num_objs',
flexGrow: 1,
cellClass: 'text-right',
pipe: this.dimlessPipe
},
{
- name: 'Object size',
+ name: this.i18n('Object size'),
prop: 'obj_size',
flexGrow: 1,
cellClass: 'text-right',
pipe: this.dimlessBinaryPipe
},
{
- name: 'Provisioned',
+ name: this.i18n('Provisioned'),
prop: 'disk_usage',
cellClass: 'text-center',
flexGrow: 1,
pipe: this.dimlessBinaryPipe
},
{
- name: 'Total provisioned',
+ name: this.i18n('Total provisioned'),
prop: 'total_disk_usage',
cellClass: 'text-center',
flexGrow: 1,
pipe: this.dimlessBinaryPipe
},
{
- name: 'Parent',
+ name: this.i18n('Parent'),
prop: 'parent',
flexGrow: 2,
cellTemplate: this.parentTpl
import { ToastModule } from 'ng2-toastr';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { ApiModule } from '../../../shared/api/api.module';
import { ComponentsModule } from '../../../shared/components/components.module';
import { AuthStorageService } from '../../../shared/services/auth-storage.service';
RouterTestingModule
],
declarations: [RbdSnapshotFormComponent],
- providers: [BsModalRef, BsModalService, AuthStorageService]
+ providers: [BsModalRef, BsModalService, AuthStorageService, i18nProviders]
});
beforeEach(() => {
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
import { Subject, throwError as observableThrowError } from 'rxjs';
-import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper';
+import {
+ configureTestBed,
+ i18nProviders,
+ PermissionHelper
+} from '../../../../testing/unit-test-helper';
import { ApiModule } from '../../../shared/api/api.module';
import { RbdService } from '../../../shared/api/rbd.service';
import { ComponentsModule } from '../../../shared/components/components.module';
RouterTestingModule,
PipesModule
],
- providers: [{ provide: AuthStorageService, useValue: fakeAuthStorageService }, TaskListService]
+ providers: [
+ { provide: AuthStorageService, useValue: fakeAuthStorageService },
+ TaskListService,
+ i18nProviders
+ ]
});
beforeEach(() => {
import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as moment from 'moment';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
import { of } from 'rxjs';
private taskManagerService: TaskManagerService,
private notificationService: NotificationService,
private summaryService: SummaryService,
- private taskListService: TaskListService
+ private taskListService: TaskListService,
+ private i18n: I18n
) {
this.permission = this.authStorageService.getPermissions().rbdImage;
const actions = new RbdSnapshotActionsModel();
ngOnInit() {
this.columns = [
{
- name: 'Name',
+ name: this.i18n('Name'),
prop: 'name',
cellTransformation: CellTemplate.executing,
flexGrow: 2
},
{
- name: 'Size',
+ name: this.i18n('Size'),
prop: 'size',
flexGrow: 1,
cellClass: 'text-right',
pipe: this.dimlessBinaryPipe
},
{
- name: 'Provisioned',
+ name: this.i18n('Provisioned'),
prop: 'disk_usage',
flexGrow: 1,
cellClass: 'text-right',
pipe: this.dimlessBinaryPipe
},
{
- name: 'State',
+ name: this.i18n('State'),
prop: 'is_protected',
flexGrow: 1,
cellClass: 'text-center',
cellTemplate: this.protectTpl
},
{
- name: 'Created',
+ name: this.i18n('Created'),
prop: 'timestamp',
flexGrow: 1,
pipe: this.cdDatePipe
rollbackModal() {
const snapshotName = this.selection.selected[0].name;
const initialState = {
- titleText: 'RBD snapshot rollback',
- buttonText: 'Rollback',
+ titleText: this.i18n('RBD snapshot rollback'),
+ buttonText: this.i18n('Rollback'),
bodyTpl: this.rollbackTpl,
bodyData: {
snapName: `${this.poolName}/${this.rbdName}@${snapshotName}`
const snapshotName = this.selection.selected[0].name;
this.modalRef = this.modalService.show(CriticalConfirmationModalComponent, {
initialState: {
- itemDescription: 'RBD snapshot',
+ itemDescription: this.i18n('RBD snapshot'),
submitAction: () => this._asyncTask('deleteSnapshot', 'rbd/snap/delete', snapshotName)
}
});
import { of } from 'rxjs';
import { By } from '@angular/platform-browser';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { RbdService } from '../../../shared/api/rbd.service';
import { CdTableSelection } from '../../../shared/models/cd-table-selection';
import { ExecutingTask } from '../../../shared/models/executing-task';
configureTestBed({
declarations: [RbdTrashListComponent],
imports: [SharedModule, HttpClientTestingModule, RouterTestingModule, ToastModule.forRoot()],
- providers: [TaskListService]
+ providers: [TaskListService, i18nProviders]
});
beforeEach(() => {
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import * as moment from 'moment';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
private modalService: BsModalService,
private cdDatePipe: CdDatePipe,
private taskListService: TaskListService,
- private taskWrapper: TaskWrapperService
+ private taskWrapper: TaskWrapperService,
+ private i18n: I18n
) {
this.permission = this.authStorageService.getPermissions().rbdImage;
permission: 'update',
icon: 'fa-undo',
click: () => this.restoreModal(),
- name: 'Restore'
+ name: this.i18n('Restore')
};
const deleteAction: CdTableAction = {
permission: 'delete',
icon: 'fa-times',
click: () => this.deleteModal(),
- name: 'Delete'
+ name: this.i18n('Delete')
};
this.tableActions = [restoreAction, deleteAction];
}
ngOnInit() {
this.columns = [
{
- name: 'ID',
+ name: this.i18n('ID'),
prop: 'id',
flexGrow: 1,
cellTransformation: CellTemplate.executing
},
{
- name: 'Name',
+ name: this.i18n('Name'),
prop: 'name',
flexGrow: 1
},
{
- name: 'Pool',
+ name: this.i18n('Pool'),
prop: 'pool_name',
flexGrow: 1
},
{
- name: 'Status',
+ name: this.i18n('Status'),
prop: 'deferment_end_time',
flexGrow: 1,
cellTemplate: this.expiresTpl
},
{
- name: 'Deleted At',
+ name: this.i18n('Deleted At'),
prop: 'deletion_time',
flexGrow: 1,
pipe: this.cdDatePipe
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { NotificationService } from '../../../shared/services/notification.service';
import { SharedModule } from '../../../shared/shared.module';
import { RbdTrashMoveModalComponent } from './rbd-trash-move-modal.component';
BsDatepickerModule.forRoot()
],
declarations: [RbdTrashMoveModalComponent],
- providers: [BsModalRef, BsModalService]
+ providers: [BsModalRef, BsModalService, i18nProviders]
});
beforeEach(() => {
import { ToastModule } from 'ng2-toastr';
import { BsModalRef } from 'ngx-bootstrap/modal';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { Permission } from '../../../shared/models/permissions';
import { NotificationService } from '../../../shared/services/notification.service';
import { SharedModule } from '../../../shared/shared.module';
RouterTestingModule
],
declarations: [RbdTrashPurgeModalComponent],
- providers: [BsModalRef]
+ providers: [BsModalRef, i18nProviders]
});
beforeEach(() => {
import { ToastModule } from 'ng2-toastr';
import { BsModalRef } from 'ngx-bootstrap/modal';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { NotificationService } from '../../../shared/services/notification.service';
import { SharedModule } from '../../../shared/shared.module';
import { RbdTrashRestoreModalComponent } from './rbd-trash-restore-modal.component';
SharedModule,
RouterTestingModule
],
- providers: [BsModalRef]
+ providers: [BsModalRef, i18nProviders]
});
beforeEach(() => {
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { CephfsClientsComponent } from './cephfs-clients.component';
SharedModule,
HttpClientTestingModule
],
- declarations: [CephfsClientsComponent]
+ declarations: [CephfsClientsComponent],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, Input, OnInit } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
import { CephfsService } from '../../../shared/api/cephfs.service';
import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
clients: any;
viewCacheStatus: ViewCacheStatus;
- constructor(private cephfsService: CephfsService) {}
+ constructor(private cephfsService: CephfsService, private i18n: I18n) {}
ngOnInit() {
this.clients = {
columns: [
- { prop: 'id' },
- { prop: 'type' },
- { prop: 'state' },
- { prop: 'version' },
- { prop: 'hostname', name: 'Host' },
- { prop: 'root' }
+ { prop: 'id', name: this.i18n('id') },
+ { prop: 'type', name: this.i18n('type') },
+ { prop: 'state', name: this.i18n('state') },
+ { prop: 'version', name: this.i18n('version') },
+ { prop: 'hostname', name: this.i18n('Host') },
+ { prop: 'root', name: this.i18n('root') }
],
data: []
};
import { ProgressbarModule } from 'ngx-bootstrap/progressbar';
import { TabsModule } from 'ngx-bootstrap/tabs';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { CephfsDetailComponent } from './cephfs-detail.component';
TabsModule.forRoot(),
HttpClientTestingModule
],
- declarations: [CephfsDetailComponent, CephfsChartStubComponent, CephfsClientsStubComponent]
+ declarations: [CephfsDetailComponent, CephfsChartStubComponent, CephfsClientsStubComponent],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { CephfsService } from '../../../shared/api/cephfs.service';
constructor(
private cephfsService: CephfsService,
private dimlessBinary: DimlessBinaryPipe,
- private dimless: DimlessPipe
+ private dimless: DimlessPipe,
+ private i18n: I18n
) {}
ngOnChanges() {
ngOnInit() {
this.ranks = {
columns: [
- { prop: 'rank' },
- { prop: 'state' },
- { prop: 'mds', name: 'Daemon' },
- { prop: 'activity', cellTemplate: this.activityTmpl },
- { prop: 'dns', name: 'Dentries', pipe: this.dimless },
- { prop: 'inos', name: 'Inodes', pipe: this.dimless }
+ { prop: 'rank', name: this.i18n('Rank') },
+ { prop: 'state', name: this.i18n('State') },
+ { prop: 'mds', name: this.i18n('Daemon') },
+ { prop: 'activity', name: this.i18n('Activity'), cellTemplate: this.activityTmpl },
+ { prop: 'dns', name: this.i18n('Dentries'), pipe: this.dimless },
+ { prop: 'inos', name: this.i18n('Inodes'), pipe: this.dimless }
],
data: []
};
this.pools = {
columns: [
- { prop: 'pool' },
- { prop: 'type' },
- { prop: 'size', pipe: this.dimlessBinary },
+ { prop: 'pool', name: this.i18n('Pool') },
+ { prop: 'type', name: this.i18n('Type') },
+ { prop: 'size', name: this.i18n('Size'), pipe: this.dimlessBinary },
{
- name: 'Usage',
+ name: this.i18n('Usage'),
cellTemplate: this.poolUsageTpl,
comparator: (valueA, valueB, rowA, rowB, sortDirection) => {
const valA = rowA.used / rowA.avail;
});
this.standbys = [
{
- key: 'Standby daemons',
+ key: this.i18n('Standby daemons'),
value: data.standbys.map((value) => value.name).join(', ')
}
];
import { Component, Input } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { CdTableSelection } from '../../../shared/models/cd-table-selection';
import { SharedModule } from '../../../shared/shared.module';
import { CephfsListComponent } from './cephfs-list.component';
configureTestBed({
imports: [SharedModule, HttpClientTestingModule],
- declarations: [CephfsListComponent, CephfsDetailStubComponent]
+ declarations: [CephfsListComponent, CephfsDetailStubComponent],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, OnInit } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
import { CephfsService } from '../../../shared/api/cephfs.service';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
filesystems: any = [];
selection = new CdTableSelection();
- constructor(private cephfsService: CephfsService) {}
+ constructor(private cephfsService: CephfsService, private i18n: I18n) {}
ngOnInit() {
this.columns = [
{
- name: 'Name',
+ name: this.i18n('Name'),
prop: 'mdsmap.fs_name',
flexGrow: 2
},
{
- name: 'Created',
+ name: this.i18n('Created'),
prop: 'mdsmap.created',
flexGrow: 2
},
{
- name: 'Enabled',
+ name: this.i18n('Enabled'),
prop: 'mdsmap.enabled',
flexGrow: 1
}
import { TabsModule } from 'ngx-bootstrap/tabs';
-import { configureTestBed } from '../../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
import { DataTableModule } from '../../../../shared/datatable/datatable.module';
import { ConfigurationDetailsComponent } from './configuration-details.component';
configureTestBed({
declarations: [ConfigurationDetailsComponent],
- imports: [DataTableModule, TabsModule.forRoot()]
+ imports: [DataTableModule, TabsModule.forRoot()],
+ providers: [i18nProviders]
});
beforeEach(() => {
import { Component, Input, OnChanges } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { CdTableSelection } from '../../../../shared/models/cd-table-selection';
selection: CdTableSelection;
selectedItem: any;
flags = {
- runtime: 'The value can be updated at runtime.',
- no_mon_update:
- 'Daemons/clients do not pull this value from the monitor config database. ' +
- `We disallow setting this option via 'ceph config set ...'. This option should be ` +
- 'configured via ceph.conf or via the command line.',
- startup: 'Option takes effect only during daemon startup.',
- cluster_create: 'Option only affects cluster creation.',
- create: 'Option only affects daemon creation.'
+ runtime: this.i18n('The value can be updated at runtime.'),
+ no_mon_update: this.i18n(`Daemons/clients do not pull this value from the
+ monitor config database. We disallow setting this option via 'ceph config
+ set ...'. This option should be configured via ceph.conf or via the
+ command line.`),
+ startup: this.i18n('Option takes effect only during daemon startup.'),
+ cluster_create: this.i18n('Option only affects cluster creation.'),
+ create: this.i18n('Option only affects daemon creation.')
};
- constructor() {}
+ constructor(private i18n: I18n) {}
ngOnChanges() {
if (this.selection.hasSelection) {
import { ToastModule } from 'ng2-toastr';
-import { configureTestBed } from '../../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
import { SharedModule } from '../../../../shared/shared.module';
import { ConfigurationFormComponent } from './configuration-form.component';
import { ConfigFormModel } from './configuration-form.model';
providers: [
{
provide: ActivatedRoute
- }
+ },
+ i18nProviders
]
});
import { FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { ConfigurationService } from '../../../../shared/api/configuration.service';
private route: ActivatedRoute,
private router: Router,
private configService: ConfigurationService,
- private notificationService: NotificationService
+ private notificationService: NotificationService,
+ private i18n: I18n
) {
this.createForm();
}
{
name: 'uint64_t',
inputType: 'number',
- humanReadable: 'Positive integer value',
+ humanReadable: this.i18n('Positive integer value'),
defaultMin: 0,
- patternHelpText: 'The entered value needs to be a positive number.',
+ patternHelpText: this.i18n('The entered value needs to be a positive number.'),
isNumberType: true,
allowsNegative: false
},
{
name: 'int64_t',
inputType: 'number',
- humanReadable: 'Integer value',
- patternHelpText: 'The entered value needs to be a number.',
+ humanReadable: this.i18n('Integer value'),
+ patternHelpText: this.i18n('The entered value needs to be a number.'),
isNumberType: true,
allowsNegative: true
},
{
name: 'size_t',
inputType: 'number',
- humanReadable: 'Positive integer value (size)',
+ humanReadable: this.i18n('Positive integer value (size)'),
defaultMin: 0,
- patternHelpText: 'The entered value needs to be a positive number.',
+ patternHelpText: this.i18n('The entered value needs to be a positive number.'),
isNumberType: true,
allowsNegative: false
},
{
name: 'secs',
inputType: 'number',
- humanReadable: 'Positive integer value (secs)',
+ humanReadable: this.i18n('Positive integer value (secs)'),
defaultMin: 1,
- patternHelpText: 'The entered value needs to be a positive number.',
+ patternHelpText: this.i18n('The entered value needs to be a positive number.'),
isNumberType: true,
allowsNegative: false
},
{
name: 'double',
inputType: 'number',
- humanReadable: 'Decimal value',
- patternHelpText: 'The entered value needs to be a number or decimal.',
+ humanReadable: this.i18n('Decimal value'),
+ patternHelpText: this.i18n('The entered value needs to be a number or decimal.'),
isNumberType: true,
allowsNegative: true
},
- { name: 'std::string', inputType: 'text', humanReadable: 'Text', isNumberType: false },
+ {
+ name: 'std::string',
+ inputType: 'text',
+ humanReadable: this.i18n('Text'),
+ isNumberType: false
+ },
{
name: 'entity_addr_t',
inputType: 'text',
- humanReadable: 'IPv4 or IPv6 address',
- patternHelpText: 'The entered value needs to be a valid IP address.',
+ humanReadable: this.i18n('IPv4 or IPv6 address'),
+ patternHelpText: this.i18n('The entered value needs to be a valid IP address.'),
isNumberType: false
},
{
name: 'uuid_d',
inputType: 'text',
- humanReadable: 'UUID',
- patternHelpText:
- 'The entered value is not a valid UUID, e.g.: 67dcac9f-2c03-4d6c-b7bd-1210b3a259a8',
+ humanReadable: this.i18n('UUID'),
+ patternHelpText: this.i18n(
+ 'The entered value is not a valid UUID, e.g.: 67dcac9f-2c03-4d6c-b7bd-1210b3a259a8'
+ ),
isNumberType: false
},
- { name: 'bool', inputType: 'checkbox', humanReadable: 'Boolean value', isNumberType: false }
+ {
+ name: 'bool',
+ inputType: 'checkbox',
+ humanReadable: this.i18n('Boolean value'),
+ isNumberType: false
+ }
];
let currentType = null;
() => {
this.notificationService.show(
NotificationType.success,
- 'Config option ' + request.name + ' has been updated.',
- 'Update config option'
+ this.i18n('Config option {{name}} has been updated.', { name: request.name }),
+ this.i18n('Update config option')
);
this.router.navigate(['/configuration']);
},
import { TabsModule } from 'ngx-bootstrap/tabs';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { ConfigurationDetailsComponent } from './configuration-details/configuration-details.component';
import { ConfigurationComponent } from './configuration.component';
TabsModule.forRoot(),
HttpClientTestingModule,
RouterTestingModule
- ]
+ ],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
import { ConfigurationService } from '../../../shared/api/configuration.service';
import { CdTableAction } from '../../../shared/models/cd-table-action';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
selection = new CdTableSelection();
filters = [
{
- label: 'Level',
+ label: this.i18n('Level'),
prop: 'level',
value: 'basic',
options: ['basic', 'advanced', 'dev'],
}
},
{
- label: 'Service',
+ label: this.i18n('Service'),
prop: 'services',
value: 'any',
options: ['any', 'mon', 'mgr', 'osd', 'mds', 'common', 'mds_client', 'rgw'],
}
},
{
- label: 'Source',
+ label: this.i18n('Source'),
prop: 'source',
value: 'any',
options: ['any', 'mon'],
constructor(
private authStorageService: AuthStorageService,
- private configurationService: ConfigurationService
+ private configurationService: ConfigurationService,
+ private i18n: I18n
) {
this.permission = this.authStorageService.getPermissions().configOpt;
const getConfigOptUri = () =>
permission: 'update',
icon: 'fa-pencil',
routerLink: () => `/configuration/edit/${getConfigOptUri()}`,
- name: 'Edit'
+ name: this.i18n('Edit')
};
this.tableActions = [editAction];
}
ngOnInit() {
this.columns = [
- { canAutoResize: true, prop: 'name' },
- { prop: 'desc', name: 'Description', cellClass: 'wrap' },
+ { canAutoResize: true, prop: 'name', name: this.i18n('Name') },
+ { prop: 'desc', name: this.i18n('Description'), cellClass: 'wrap' },
{
prop: 'value',
- name: 'Current value',
+ name: this.i18n('Current value'),
cellClass: 'wrap',
cellTemplate: this.confValTpl
},
- { prop: 'default', cellClass: 'wrap' }
+ { prop: 'default', name: this.i18n('Default'), cellClass: 'wrap' }
];
}
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { TabsModule } from 'ngx-bootstrap/tabs';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { HostService } from '../../../shared/api/host.service';
import { Permissions } from '../../../shared/models/permissions';
import { AuthStorageService } from '../../../shared/services/auth-storage.service';
BsDropdownModule.forRoot(),
RouterTestingModule
],
- providers: [{ provide: AuthStorageService, useValue: fakeAuthStorageService }],
+ providers: [{ provide: AuthStorageService, useValue: fakeAuthStorageService }, i18nProviders],
declarations: [HostsComponent, HostDetailsComponent]
});
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
import { HostService } from '../../../shared/api/host.service';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
constructor(
private authStorageService: AuthStorageService,
private hostService: HostService,
- private cephShortVersionPipe: CephShortVersionPipe
+ private cephShortVersionPipe: CephShortVersionPipe,
+ private i18n: I18n
) {
this.permissions = this.authStorageService.getPermissions();
}
ngOnInit() {
this.columns = [
{
- name: 'Hostname',
+ name: this.i18n('Hostname'),
prop: 'hostname',
flexGrow: 1
},
{
- name: 'Services',
+ name: this.i18n('Services'),
prop: 'services',
flexGrow: 3,
cellTemplate: this.servicesTpl
},
{
- name: 'Version',
+ name: this.i18n('Version'),
prop: 'ceph_version',
flexGrow: 1,
pipe: this.cephShortVersionPipe
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { MonitorService } from '../../../shared/api/monitor.service';
import { MonitorComponent } from './monitor.component';
configureTestBed({
declarations: [MonitorComponent],
schemas: [NO_ERRORS_SCHEMA],
- providers: [{ provide: MonitorService, useValue: fakeService }]
+ providers: [{ provide: MonitorService, useValue: fakeService }, i18nProviders]
});
beforeEach(() => {
import { Component } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
import { MonitorService } from '../../../shared/api/monitor.service';
import { CellTemplate } from '../../../shared/enum/cell-template.enum';
width: '50%'
};
- constructor(private monitorService: MonitorService) {
+ constructor(private monitorService: MonitorService, private i18n: I18n) {
this.inQuorum = {
columns: [
- { prop: 'name', name: 'Name', cellTransformation: CellTemplate.routerLink },
- { prop: 'rank', name: 'Rank' },
- { prop: 'public_addr', name: 'Public Address' },
+ { prop: 'name', name: this.i18n('Name'), cellTransformation: CellTemplate.routerLink },
+ { prop: 'rank', name: this.i18n('Rank') },
+ { prop: 'public_addr', name: this.i18n('Public Address') },
{
prop: 'cdOpenSessions',
- name: 'Open Sessions',
+ name: this.i18n('Open Sessions'),
cellTransformation: CellTemplate.sparkline
}
],
this.notInQuorum = {
columns: [
- { prop: 'name', name: 'Name', cellTransformation: CellTemplate.routerLink },
- { prop: 'rank', name: 'Rank' },
- { prop: 'public_addr', name: 'Public Address' }
+ { prop: 'name', name: this.i18n('Name'), cellTransformation: CellTemplate.routerLink },
+ { prop: 'rank', name: this.i18n('Rank') },
+ { prop: 'public_addr', name: this.i18n('Public Address') }
],
data: []
};
import { ToastModule } from 'ng2-toastr';
import { BsModalRef, ModalModule } from 'ngx-bootstrap/modal';
-import { configureTestBed } from '../../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
import { NotificationType } from '../../../../shared/enum/notification-type.enum';
import { NotificationService } from '../../../../shared/services/notification.service';
import { SharedModule } from '../../../../shared/shared.module';
ToastModule.forRoot()
],
declarations: [OsdFlagsModalComponent],
- providers: [BsModalRef]
+ providers: [BsModalRef, i18nProviders]
});
beforeEach(() => {
import { Component, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { BsModalRef } from 'ngx-bootstrap/modal';
allFlags = {
noin: {
code: 'noin',
- name: 'No In',
+ name: this.i18n('No In'),
value: false,
- description: 'OSDs that were previously marked out will not be marked back in when they start'
+ description: this.i18n(
+ 'OSDs that were previously marked out will not be marked back in when they start'
+ )
},
noout: {
code: 'noout',
- name: 'No Out',
+ name: this.i18n('No Out'),
value: false,
- description: 'OSDs will not automatically be marked out after the configured interval'
+ description: this.i18n(
+ 'OSDs will not automatically be marked out after the configured interval'
+ )
},
noup: {
code: 'noup',
- name: 'No Up',
+ name: this.i18n('No Up'),
value: false,
- description: 'OSDs are not allowed to start'
+ description: this.i18n('OSDs are not allowed to start')
},
nodown: {
code: 'nodown',
- name: 'No Down',
+ name: this.i18n('No Down'),
value: false,
- description:
+ description: this.i18n(
'OSD failure reports are being ignored, such that the monitors will not mark OSDs down'
+ )
},
pause: {
code: 'pause',
- name: 'Pause',
+ name: this.i18n('Pause'),
value: false,
- description: 'Pauses reads and writes'
+ description: this.i18n('Pauses reads and writes')
},
noscrub: {
code: 'noscrub',
- name: 'No Scrub',
+ name: this.i18n('No Scrub'),
value: false,
- description: 'Scrubbing is disabled'
+ description: this.i18n('Scrubbing is disabled')
},
'nodeep-scrub': {
code: 'nodeep-scrub',
- name: 'No Deep Scrub',
+ name: this.i18n('No Deep Scrub'),
value: false,
- description: 'Deep Scrubbing is disabled'
+ description: this.i18n('Deep Scrubbing is disabled')
},
nobackfill: {
code: 'nobackfill',
- name: 'No Backfill',
+ name: this.i18n('No Backfill'),
value: false,
- description: 'Backfilling of PGs is suspended'
+ description: this.i18n('Backfilling of PGs is suspended')
},
norecover: {
code: 'norecover',
- name: 'No Recover',
+ name: this.i18n('No Recover'),
value: false,
- description: 'Recovery of PGs is suspended'
+ description: this.i18n('Recovery of PGs is suspended')
},
sortbitwise: {
code: 'sortbitwise',
- name: 'Bitwise Sort',
+ name: this.i18n('Bitwise Sort'),
value: false,
- description: 'Use bitwise sort',
+ description: this.i18n('Use bitwise sort'),
disabled: true
},
purged_snapdirs: {
code: 'purged_snapdirs',
- name: 'Purged Snapdirs',
+ name: this.i18n('Purged Snapdirs'),
value: false,
- description: 'OSDs have converted snapsets',
+ description: this.i18n('OSDs have converted snapsets'),
disabled: true
},
recovery_deletes: {
code: 'recovery_deletes',
- name: 'Recovery Deletes',
+ name: this.i18n('Recovery Deletes'),
value: false,
- description: 'Deletes performed during recovery instead of peering',
+ description: this.i18n('Deletes performed during recovery instead of peering'),
disabled: true
}
};
constructor(
public bsModalRef: BsModalRef,
private osdService: OsdService,
- private notificationService: NotificationService
+ private notificationService: NotificationService,
+ private i18n: I18n
) {}
ngOnInit() {
() => {
this.notificationService.show(
NotificationType.success,
- 'OSD Flags were updated successfully.',
- 'OSD Flags'
+ this.i18n('OSD Flags were updated successfully.'),
+ this.i18n('OSD Flags')
);
this.bsModalRef.hide();
},
import { TabsModule } from 'ngx-bootstrap/tabs';
import { EMPTY, of } from 'rxjs';
-import { configureTestBed, PermissionHelper } from '../../../../../testing/unit-test-helper';
+import {
+ configureTestBed,
+ i18nProviders,
+ PermissionHelper
+} from '../../../../../testing/unit-test-helper';
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';
providers: [
{ provide: AuthStorageService, useValue: fakeAuthStorageService },
TableActionsComponent,
- BsModalService
+ BsModalService,
+ i18nProviders
]
});
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
import { Observable } from 'rxjs';
private authStorageService: AuthStorageService,
private osdService: OsdService,
private dimlessBinaryPipe: DimlessBinaryPipe,
- private modalService: BsModalService
+ private modalService: BsModalService,
+ private i18n: I18n
) {
this.permission = this.authStorageService.getPermissions().osd;
this.tableActions = [
{
- name: 'Scrub',
+ name: this.i18n('Scrub'),
permission: 'update',
icon: 'fa-stethoscope',
click: () => this.scrubAction(false),
disable: () => !this.hasOsdSelected
},
{
- name: 'Deep Scrub',
+ name: this.i18n('Deep Scrub'),
permission: 'update',
icon: 'fa-cog',
click: () => this.scrubAction(true),
disable: () => !this.hasOsdSelected
},
{
- name: 'Reweight',
+ name: this.i18n('Reweight'),
permission: 'update',
click: () => this.reweight(),
disable: () => !this.hasOsdSelected,
icon: 'fa-balance-scale'
},
{
- name: 'Mark Out',
+ name: this.i18n('Mark Out'),
permission: 'update',
- click: () => this.showConfirmationModal('out', this.osdService.markOut),
+ click: () => this.showConfirmationModal(this.i18n('out'), this.osdService.markOut),
disable: () => this.isNotSelectedOrInState('out'),
icon: 'fa-arrow-left'
},
{
- name: 'Mark In',
+ name: this.i18n('Mark In'),
permission: 'update',
- click: () => this.showConfirmationModal('in', this.osdService.markIn),
+ click: () => this.showConfirmationModal(this.i18n('in'), this.osdService.markIn),
disable: () => this.isNotSelectedOrInState('in'),
icon: 'fa-arrow-right'
},
{
- name: 'Mark Down',
+ name: this.i18n('Mark Down'),
permission: 'update',
- click: () => this.showConfirmationModal('down', this.osdService.markDown),
+ click: () => this.showConfirmationModal(this.i18n('down'), this.osdService.markDown),
disable: () => this.isNotSelectedOrInState('down'),
icon: 'fa-arrow-down'
},
{
- name: 'Mark Lost',
+ name: this.i18n('Mark Lost'),
permission: 'delete',
click: () =>
this.showCriticalConfirmationModal(
- 'Mark',
- 'OSD lost',
- 'marked lost',
+ this.i18n('Mark'),
+ this.i18n('OSD lost'),
+ this.i18n('marked lost'),
this.osdService.markLost
),
disable: () => this.isNotSelectedOrInState('up'),
icon: 'fa-unlink'
},
{
- name: 'Remove',
+ name: this.i18n('Remove'),
permission: 'delete',
click: () =>
- this.showCriticalConfirmationModal('Remove', 'OSD', 'removed', this.osdService.remove),
+ this.showCriticalConfirmationModal(
+ this.i18n('Remove'),
+ this.i18n('OSD'),
+ this.i18n('removed'),
+ this.osdService.remove
+ ),
disable: () => this.isNotSelectedOrInState('up'),
icon: 'fa-remove'
},
{
- name: 'Destroy',
+ name: this.i18n('Destroy'),
permission: 'delete',
click: () =>
this.showCriticalConfirmationModal(
- 'destroy',
- 'OSD',
- 'destroyed',
+ this.i18n('destroy'),
+ this.i18n('OSD'),
+ this.i18n('destroyed'),
this.osdService.destroy
),
disable: () => this.isNotSelectedOrInState('up'),
ngOnInit() {
this.columns = [
- { prop: 'host.name', name: 'Host' },
- { prop: 'id', name: 'ID', cellTransformation: CellTemplate.bold },
- { prop: 'collectedStates', name: 'Status', cellTemplate: this.statusColor },
- { prop: 'stats.numpg', name: 'PGs' },
- { prop: 'stats.stat_bytes', name: 'Size', pipe: this.dimlessBinaryPipe },
- { name: 'Usage', cellTemplate: this.osdUsageTpl },
+ { prop: 'host.name', name: this.i18n('Host') },
+ { prop: 'id', name: this.i18n('ID'), cellTransformation: CellTemplate.bold },
+ { prop: 'collectedStates', name: this.i18n('Status'), cellTemplate: this.statusColor },
+ { prop: 'stats.numpg', name: this.i18n('PGs') },
+ { prop: 'stats.stat_bytes', name: this.i18n('Size'), pipe: this.dimlessBinaryPipe },
+ { name: this.i18n('Usage'), cellTemplate: this.osdUsageTpl },
{
prop: 'stats_history.out_bytes',
- name: 'Read bytes',
+ name: this.i18n('Read bytes'),
cellTransformation: CellTemplate.sparkline
},
{
prop: 'stats_history.in_bytes',
- name: 'Writes bytes',
+ name: this.i18n('Writes bytes'),
cellTransformation: CellTemplate.sparkline
},
- { prop: 'stats.op_r', name: 'Read ops', cellTransformation: CellTemplate.perSecond },
- { prop: 'stats.op_w', name: 'Write ops', cellTransformation: CellTemplate.perSecond }
+ {
+ prop: 'stats.op_r',
+ name: this.i18n('Read ops'),
+ cellTransformation: CellTemplate.perSecond
+ },
+ {
+ prop: 'stats.op_w',
+ name: this.i18n('Write ops'),
+ cellTransformation: CellTemplate.perSecond
+ }
];
}
showConfirmationModal(markAction: string, onSubmit: (id: number) => Observable<any>) {
this.bsModalRef = this.modalService.show(ConfirmationModalComponent, {
initialState: {
- titleText: `Mark OSD ${markAction}`,
- buttonText: `Mark ${markAction}`,
+ titleText: this.i18n('Mark OSD {{markAction}}', { markAction: markAction }),
+ buttonText: this.i18n('Mark {{markAction}}', { markAction: markAction }),
bodyTpl: this.markOsdConfirmationTpl,
bodyContext: {
markActionDescription: markAction
import { BsModalRef } from 'ngx-bootstrap/modal';
-import { configureTestBed } from '../../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../../testing/unit-test-helper';
import { OsdService } from '../../../../shared/api/osd.service';
import { NotificationService } from '../../../../shared/services/notification.service';
import { OsdScrubModalComponent } from './osd-scrub-modal.component';
providers: [
BsModalRef,
{ provide: OsdService, useValue: fakeService },
- { provide: NotificationService, useValue: fakeService }
+ { provide: NotificationService, useValue: fakeService },
+ i18nProviders
]
});
import { Component, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import { BsModalRef } from 'ngx-bootstrap/modal';
import { OsdService } from '../../../../shared/api/osd.service';
constructor(
public bsModalRef: BsModalRef,
private osdService: OsdService,
- private notificationService: NotificationService
+ private notificationService: NotificationService,
+ private i18n: I18n
) {}
ngOnInit() {
this.notificationService.show(
NotificationType.success,
- `${operation} was initialized in the following OSD: ${id}`
+ this.i18n('{{operation}} was initialized in the following OSD: {{id}}', {
+ operation: operation,
+ id: id
+ })
);
this.bsModalRef.hide();
import { PopoverModule } from 'ngx-bootstrap/popover';
import { of } from 'rxjs';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { DashboardService } from '../../../shared/api/dashboard.service';
import { SharedModule } from '../../../shared/shared.module';
import { LogColorPipe } from '../log-color.pipe';
LogColorPipe,
PgStatusPipe
],
- schemas: [NO_ERRORS_SCHEMA]
+ schemas: [NO_ERRORS_SCHEMA],
+ providers: i18nProviders
});
beforeEach(() => {
import { ViewportScroller } from '@angular/common';
import { Component, OnDestroy, OnInit } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { DashboardService } from '../../../shared/api/dashboard.service';
constructor(
private dashboardService: DashboardService,
- public viewportScroller: ViewportScroller
+ public viewportScroller: ViewportScroller,
+ private i18n: I18n
) {}
ngOnInit() {
const ratioLabels = [];
const ratioData = [];
- ratioLabels.push('Writes');
+ ratioLabels.push(this.i18n('Writes'));
ratioData.push(this.contentData.client_perf.write_op_per_sec);
- ratioLabels.push('Reads');
+ ratioLabels.push(this.i18n('Reads'));
ratioData.push(this.contentData.client_perf.read_op_per_sec);
chart.dataset[0].data = ratioData;
if (chart === 'doughnut') {
chart.options.cutoutPercentage = 65;
}
- chart.labels = [`Used (${percentUsed}%)`, `Avail. (${percentAvailable}%)`];
+ chart.labels = [
+ `${this.i18n('Used')} (${percentUsed}%)`,
+ `${this.i18n('Avail.')} (${percentAvailable}%)`
+ ];
}
preparePgStatus(chart, data) {
- const pgCategoryClean = 'Clean';
+ const pgCategoryClean = this.i18n('Clean');
const pgCategoryCleanStates = ['active', 'clean'];
- const pgCategoryWarning = 'Warning';
+ const pgCategoryWarning = this.i18n('Warning');
const pgCategoryWarningStates = [
'backfill_toofull',
'backfill_unfound',
'stale',
'undersized'
];
- const pgCategoryUnknown = 'Unknown';
- const pgCategoryWorking = 'Working';
+ const pgCategoryUnknown = this.i18n('Unknown');
+ const pgCategoryWorking = this.i18n('Working');
const pgCategoryWorkingStates = [
'activating',
'backfill_wait',
+import { TestBed } from '@angular/core/testing';
+
+import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
import { MdsSummaryPipe } from './mds-summary.pipe';
describe('MdsSummaryPipe', () => {
- const pipe = new MdsSummaryPipe();
+ let pipe: MdsSummaryPipe;
+
+ configureTestBed({
+ providers: [MdsSummaryPipe, i18nProviders]
+ });
+
+ beforeEach(() => {
+ pipe = TestBed.get(MdsSummaryPipe);
+ });
it('create an instance', () => {
expect(pipe).toBeTruthy();
import { Pipe, PipeTransform } from '@angular/core';
+
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
@Pipe({
name: 'mdsSummary'
})
export class MdsSummaryPipe implements PipeTransform {
+ constructor(private i18n: I18n) {}
+
transform(value: any, args?: any): any {
if (!value) {
return '';
});
if (value.standbys && !value.filesystems) {
- return standbys + ', no filesystems';
+ return standbys + ', ' + this.i18n('no filesystems');
} else if (value.filesystems.length === 0) {
- return 'no filesystems';
+ return this.i18n('no filesystems');
} else {
_.each(value.filesystems, (fs, i) => {
_.each(fs.mdsmap.info, (mds, j) => {
});
});
- return active + ' active, ' + (standbys + standbyReplay) + ' standby';
+ return `${active} ${this.i18n('active')}, ${standbys + standbyReplay} ${this.i18n(
+ 'standby'
+ )}`;
}
}
}
+import { TestBed } from '@angular/core/testing';
+
+import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
+
import { MgrSummaryPipe } from './mgr-summary.pipe';
describe('MgrSummaryPipe', () => {
- const pipe = new MgrSummaryPipe();
+ let pipe: MgrSummaryPipe;
+
+ configureTestBed({
+ providers: [MgrSummaryPipe, i18nProviders]
+ });
+
+ beforeEach(() => {
+ pipe = TestBed.get(MgrSummaryPipe);
+ });
it('create an instance', () => {
expect(pipe).toBeTruthy();
import { Pipe, PipeTransform } from '@angular/core';
+
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
@Pipe({
name: 'mgrSummary'
})
export class MgrSummaryPipe implements PipeTransform {
+ constructor(private i18n: I18n) {}
+
transform(value: any, args?: any): any {
if (!value) {
return '';
result += _.isUndefined(value.active_name) ? 'n/a' : value.active_name;
if (value.standbys.length) {
- result += ', ' + value.standbys.length + ' standbys';
+ result += ', ' + value.standbys.length + ' ' + this.i18n('standbys');
}
return result;
+import { TestBed } from '@angular/core/testing';
+
+import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
import { MonSummaryPipe } from './mon-summary.pipe';
describe('MonSummaryPipe', () => {
- const pipe = new MonSummaryPipe();
+ let pipe: MonSummaryPipe;
+
+ configureTestBed({
+ providers: [MonSummaryPipe, i18nProviders]
+ });
+
+ beforeEach(() => {
+ pipe = TestBed.get(MonSummaryPipe);
+ });
it('create an instance', () => {
expect(pipe).toBeTruthy();
import { Pipe, PipeTransform } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
@Pipe({
name: 'monSummary'
})
export class MonSummaryPipe implements PipeTransform {
+ constructor(private i18n: I18n) {}
+
transform(value: any, args?: any): any {
if (!value) {
return '';
}
- let result = value.monmap.mons.length.toString() + ' (quorum ';
- result += value.quorum.join(', ');
- result += ')';
+ const result = `${value.monmap.mons.length.toString()} (${this.i18n(
+ 'quorum'
+ )} ${value.quorum.join(', ')})`;
return result;
}
+import { TestBed } from '@angular/core/testing';
+import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
import { OsdSummaryPipe } from './osd-summary.pipe';
describe('OsdSummaryPipe', () => {
- const pipe = new OsdSummaryPipe();
+ let pipe: OsdSummaryPipe;
+
+ configureTestBed({
+ providers: [OsdSummaryPipe, i18nProviders]
+ });
+
+ beforeEach(() => {
+ pipe = TestBed.get(OsdSummaryPipe);
+ });
it('create an instance', () => {
expect(pipe).toBeTruthy();
import { Pipe, PipeTransform } from '@angular/core';
+
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
@Pipe({
name: 'osdSummary'
})
export class OsdSummaryPipe implements PipeTransform {
+ constructor(private i18n: I18n) {}
+
transform(value: any, args?: any): any {
if (!value) {
return '';
const osdSummary = [
{
- content: `${value.osds.length} total`,
+ content: `${value.osds.length} ${this.i18n('total')}`,
class: ''
}
];
class: 'card-text-line-break'
});
osdSummary.push({
- content: `${upCount} up, ${inCount} in`,
+ content: `${upCount} ${this.i18n('up')}, ${inCount} ${this.i18n('in')}`,
class: ''
});
class: 'card-text-line-break'
});
- const downText = downCount > 0 ? `${downCount} down` : '';
+ const downText = downCount > 0 ? `${downCount} ${this.i18n('down')}` : '';
const separator = downCount > 0 && outCount > 0 ? ', ' : '';
- const outText = outCount > 0 ? `${outCount} out` : '';
+ const outText = outCount > 0 ? `${outCount} ${this.i18n('out')}` : '';
osdSummary.push({
content: `${downText}${separator}${outText}`,
class: 'card-text-error'
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { TablePerformanceCounterComponent } from '../table-performance-counter/table-performance-counter.component';
import { PerformanceCounterComponent } from './performance-counter.component';
configureTestBed({
declarations: [PerformanceCounterComponent, TablePerformanceCounterComponent],
- imports: [RouterTestingModule, SharedModule, HttpClientTestingModule]
+ imports: [RouterTestingModule, SharedModule, HttpClientTestingModule],
+ providers: i18nProviders
});
beforeEach(() => {
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { AppModule } from '../../../app.module';
import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
import { TablePerformanceCounterComponent } from './table-performance-counter.component';
let httpTesting: HttpTestingController;
configureTestBed({
- imports: [AppModule, HttpClientTestingModule]
+ imports: [AppModule, HttpClientTestingModule],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, Input, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
import { PerformanceCounterService } from '../../../shared/api/performance-counter.service';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
@Input()
serviceId: string;
- constructor(private performanceCounterService: PerformanceCounterService) {}
+ constructor(private performanceCounterService: PerformanceCounterService, private i18n: I18n) {}
ngOnInit() {
this.columns = [
{
- name: 'Name',
+ name: this.i18n('Name'),
prop: 'name',
flexGrow: 1
},
{
- name: 'Description',
+ name: this.i18n('Description'),
prop: 'description',
flexGrow: 1
},
{
- name: 'Value',
+ name: this.i18n('Value'),
cellTemplate: this.valueTpl,
flexGrow: 1
}
export class ErasureCodeProfileFormTooltips {
+ // TODO: I18N
// Copied from /srv/cephmgr/ceph-dev/doc/rados/operations/erasure-code.*.rst
k = `Each object is split in data-chunks parts, each stored on a different OSD.`;
import { BsModalRef } from 'ngx-bootstrap/modal';
import { of } from 'rxjs';
-import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper';
import { ErasureCodeProfileService } from '../../../shared/api/erasure-code-profile.service';
import { ErasureCodeProfile } from '../../../shared/models/erasure-code-profile';
import { TaskWrapperService } from '../../../shared/services/task-wrapper.service';
configureTestBed({
imports: [HttpClientTestingModule, RouterTestingModule, ToastModule.forRoot(), PoolModule],
- providers: [ErasureCodeProfileService, BsModalRef]
+ providers: [ErasureCodeProfileService, BsModalRef, i18nProviders]
});
beforeEach(() => {
import { Validators } from '@angular/forms';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
import { SelectBadgesMessages } from '../../../shared/components/select-badges/select-badges-messages.model';
import { SelectBadgesOption } from '../../../shared/components/select-badges/select-badges-option.model';
import { Pool } from '../pool';
export class PoolFormData {
- poolTypes = ['erasure', 'replicated'];
+ poolTypes: string[];
erasureInfo = false;
crushInfo = false;
- applications = {
- selected: [],
- available: [
- new SelectBadgesOption(false, 'cephfs', ''),
- new SelectBadgesOption(false, 'rbd', ''),
- new SelectBadgesOption(false, 'rgw', '')
- ],
- validators: [Validators.pattern('[A-Za-z0-9_]+'), Validators.maxLength(128)],
- messages: new SelectBadgesMessages({
- empty: 'No applications added',
- selectionLimit: {
- text: 'Applications limit reached',
- tooltip: 'A pool can only have up to four applications definitions.'
- },
- customValidations: {
- pattern: `Allowed characters '_a-zA-Z0-9'`,
- maxlength: 'Maximum length is 128 characters'
- },
- filter: 'Filter or add applications',
- add: 'Add application'
- })
- };
+ applications: any;
+
+ constructor(i18n: I18n) {
+ this.poolTypes = ['erasure', 'replicated'];
+ this.applications = {
+ selected: [],
+ available: [
+ new SelectBadgesOption(false, 'cephfs', ''),
+ new SelectBadgesOption(false, 'rbd', ''),
+ new SelectBadgesOption(false, 'rgw', '')
+ ],
+ validators: [Validators.pattern('[A-Za-z0-9_]+'), Validators.maxLength(128)],
+ messages: new SelectBadgesMessages({
+ empty: i18n('No applications added'),
+ selectionLimit: {
+ text: i18n('Applications limit reached'),
+ tooltip: i18n('A pool can only have up to four applications definitions.')
+ },
+ customValidations: {
+ pattern: i18n(`Allowed characters '_a-zA-Z0-9'`),
+ maxlength: i18n('Maximum length is 128 characters')
+ },
+ filter: i18n('Filter or add applications'),
+ add: i18n('Add application')
+ })
+ };
+ }
+
pgs = 1;
pool: Pool; // Only available during edit mode
}
import { TabsModule } from 'ngx-bootstrap/tabs';
import { of } from 'rxjs';
-import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper';
import { NotFoundComponent } from '../../../core/not-found/not-found.component';
import { ErasureCodeProfileService } from '../../../shared/api/erasure-code-profile.service';
import { PoolService } from '../../../shared/api/pool.service';
providers: [
ErasureCodeProfileService,
SelectBadgesComponent,
- { provide: ActivatedRoute, useValue: { params: of({ name: 'somePoolName' }) } }
+ { provide: ActivatedRoute, useValue: { params: of({ name: 'somePoolName' }) } },
+ i18nProviders
]
});
import { FormControl, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { BsModalService } from 'ngx-bootstrap/modal';
import { forkJoin, Subscription } from 'rxjs';
info: PoolFormInfo;
routeParamsSubscribe: any;
editing = false;
- data = new PoolFormData();
+ data = new PoolFormData(this.i18n);
externalPgChange = false;
private modalSubscription: Subscription;
current = {
private formatter: FormatterService,
private bsModalService: BsModalService,
private taskWrapper: TaskWrapperService,
- private ecpService: ErasureCodeProfileService
+ private ecpService: ErasureCodeProfileService,
+ private i18n: I18n
) {
this.editing = this.router.url.startsWith('/pool/edit');
this.authenticate();
this.modalSubscription = this.modalService.onHide.subscribe(() => this.reloadECPs());
this.modalService.show(CriticalConfirmationModalComponent, {
initialState: {
- itemDescription: 'erasure code profile',
+ itemDescription: this.i18n('erasure code profile'),
submitActionObservable: () =>
this.taskWrapper.wrapTaskAroundCall({
task: new FinishedTask('ecp/delete', { name: name }),
import { TabsModule } from 'ngx-bootstrap/tabs';
import { of } from 'rxjs';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { PoolService } from '../../../shared/api/pool.service';
import { DeletionModalComponent } from '../../../shared/components/deletion-modal/deletion-modal.component';
import { ExecutingTask } from '../../../shared/models/executing-task';
RouterTestingModule,
TabsModule.forRoot(),
HttpClientTestingModule
- ]
+ ],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, OnInit, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
import { PoolService } from '../../../shared/api/pool.service';
private taskWrapper: TaskWrapperService,
private authStorageService: AuthStorageService,
private taskListService: TaskListService,
- private modalService: BsModalService
+ private modalService: BsModalService,
+ private i18n: I18n
) {
this.permission = this.authStorageService.getPermissions().pool;
this.tableActions = [
- { permission: 'create', icon: 'fa-plus', routerLink: () => '/pool/add', name: 'Add' },
+ {
+ permission: 'create',
+ icon: 'fa-plus',
+ routerLink: () => '/pool/add',
+ name: this.i18n('Add')
+ },
{
permission: 'update',
icon: 'fa-pencil',
routerLink: () => '/pool/edit/' + this.selection.first().pool_name,
- name: 'Edit'
+ name: this.i18n('Edit')
},
{
permission: 'delete',
icon: 'fa-trash-o',
click: () => this.deletePoolModal(),
- name: 'Delete'
+ name: this.i18n('Delete')
}
];
this.columns = [
{
prop: 'pool_name',
- name: 'Name',
+ name: this.i18n('Name'),
flexGrow: 3,
cellTransformation: CellTemplate.executing
},
{
prop: 'type',
- name: 'Type',
+ name: this.i18n('Type'),
flexGrow: 2
},
{
prop: 'application_metadata',
- name: 'Applications',
+ name: this.i18n('Applications'),
flexGrow: 3
},
{
prop: 'pg_placement_num',
- name: 'Placement Groups',
+ name: this.i18n('Placement Groups'),
flexGrow: 1,
cellClass: 'text-right'
},
{
prop: 'size',
- name: 'Replica Size',
+ name: this.i18n('Replica Size'),
flexGrow: 1,
cellClass: 'text-right'
},
{
prop: 'last_change',
- name: 'Last Change',
+ name: this.i18n('Last Change'),
flexGrow: 1,
cellClass: 'text-right'
},
{
prop: 'erasure_code_profile',
- name: 'Erasure Coded Profile',
+ name: this.i18n('Erasure Coded Profile'),
flexGrow: 2
},
{
prop: 'crush_rule',
- name: 'Crush Ruleset',
+ name: this.i18n('Crush Ruleset'),
flexGrow: 2
}
];
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { Rgw501Component } from './rgw-501.component';
configureTestBed({
declarations: [Rgw501Component],
- imports: [HttpClientTestingModule, RouterTestingModule, SharedModule]
+ imports: [HttpClientTestingModule, RouterTestingModule, SharedModule],
+ providers: i18nProviders
});
beforeEach(() => {
import { ModalModule } from 'ngx-bootstrap/modal';
import { TabsModule } from 'ngx-bootstrap/tabs';
-import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper';
+import {
+ configureTestBed,
+ i18nProviders,
+ PermissionHelper
+} from '../../../../testing/unit-test-helper';
import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
import { SharedModule } from '../../../shared/shared.module';
import { RgwBucketDetailsComponent } from '../rgw-bucket-details/rgw-bucket-details.component';
SharedModule,
TabsModule.forRoot(),
HttpClientTestingModule
- ]
+ ],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import { BsModalService } from 'ngx-bootstrap/modal';
import { forkJoin as observableForkJoin, Observable, Subscriber } from 'rxjs';
constructor(
private authStorageService: AuthStorageService,
private rgwBucketService: RgwBucketService,
- private bsModalService: BsModalService
+ private bsModalService: BsModalService,
+ private i18n: I18n
) {
this.permission = this.authStorageService.getPermissions().rgw;
this.columns = [
{
- name: 'Name',
+ name: this.i18n('Name'),
prop: 'bucket',
flexGrow: 1
},
{
- name: 'Owner',
+ name: this.i18n('Owner'),
prop: 'owner',
flexGrow: 1
}
permission: 'create',
icon: 'fa-plus',
routerLink: () => '/rgw/bucket/add',
- name: 'Add'
+ name: this.i18n('Add')
};
const editAction: CdTableAction = {
permission: 'update',
icon: 'fa-pencil',
routerLink: () => `/rgw/bucket/edit/${getBucketUri()}`,
- name: 'Edit'
+ name: this.i18n('Edit')
};
const deleteAction: CdTableAction = {
permission: 'delete',
icon: 'fa-times',
click: () => this.deleteAction(),
- name: 'Delete'
+ name: this.i18n('Delete')
};
this.tableActions = [addAction, editAction, deleteAction];
}
deleteAction() {
this.bsModalService.show(CriticalConfirmationModalComponent, {
initialState: {
- itemDescription: this.selection.hasSingleSelection ? 'bucket' : 'buckets',
+ itemDescription: this.selection.hasSingleSelection
+ ? this.i18n('bucket')
+ : this.i18n('buckets'),
submitActionObservable: () => {
return new Observable((observer: Subscriber<any>) => {
// Delete all selected data table rows.
import { TabsModule } from 'ngx-bootstrap/tabs';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { PerformanceCounterModule } from '../../performance-counter/performance-counter.module';
import { RgwDaemonDetailsComponent } from '../rgw-daemon-details/rgw-daemon-details.component';
PerformanceCounterModule,
SharedModule,
RouterTestingModule
- ]
+ ],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
import { RgwDaemonService } from '../../../shared/api/rgw-daemon.service';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
constructor(
private rgwDaemonService: RgwDaemonService,
- cephShortVersionPipe: CephShortVersionPipe
+ cephShortVersionPipe: CephShortVersionPipe,
+ private i18n: I18n
) {
this.columns = [
{
- name: 'ID',
+ name: this.i18n('ID'),
prop: 'id',
flexGrow: 2
},
{
- name: 'Hostname',
+ name: this.i18n('Hostname'),
prop: 'server_hostname',
flexGrow: 2
},
{
- name: 'Version',
+ name: this.i18n('Version'),
prop: 'version',
flexGrow: 1,
pipe: cephShortVersionPipe
import { BsModalService } from 'ngx-bootstrap/modal';
import { TabsModule } from 'ngx-bootstrap/tabs';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { CdTableSelection } from '../../../shared/models/cd-table-selection';
import { SharedModule } from '../../../shared/shared.module';
import { RgwUserDetailsComponent } from './rgw-user-details.component';
configureTestBed({
declarations: [RgwUserDetailsComponent],
imports: [HttpClientTestingModule, SharedModule, TabsModule.forRoot()],
- providers: [BsModalService]
+ providers: [BsModalService, i18nProviders]
});
beforeEach(() => {
import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { BsModalService } from 'ngx-bootstrap/modal';
keysColumns: CdTableColumn[] = [];
keysSelection: CdTableSelection = new CdTableSelection();
- constructor(private rgwUserService: RgwUserService, private bsModalService: BsModalService) {}
+ constructor(
+ private rgwUserService: RgwUserService,
+ private bsModalService: BsModalService,
+ private i18n: I18n
+ ) {}
ngOnInit() {
this.keysColumns = [
{
- name: 'Username',
+ name: this.i18n('Username'),
prop: 'username',
flexGrow: 1
},
{
- name: 'Type',
+ name: this.i18n('Type'),
prop: 'type',
flexGrow: 1
}
import { ModalModule } from 'ngx-bootstrap/modal';
-import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper';
+import {
+ configureTestBed,
+ i18nProviders,
+ PermissionHelper
+} from '../../../../testing/unit-test-helper';
import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
import { SharedModule } from '../../../shared/shared.module';
import { RgwUserListComponent } from './rgw-user-list.component';
configureTestBed({
declarations: [RgwUserListComponent],
imports: [RouterTestingModule, HttpClientTestingModule, ModalModule.forRoot(), SharedModule],
- schemas: [NO_ERRORS_SCHEMA]
+ schemas: [NO_ERRORS_SCHEMA],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import { BsModalService } from 'ngx-bootstrap/modal';
import { forkJoin as observableForkJoin, Observable, Subscriber } from 'rxjs';
constructor(
private authStorageService: AuthStorageService,
private rgwUserService: RgwUserService,
- private bsModalService: BsModalService
+ private bsModalService: BsModalService,
+ private i18n: I18n
) {
this.permission = this.authStorageService.getPermissions().rgw;
this.columns = [
{
- name: 'Username',
+ name: this.i18n('Username'),
prop: 'user_id',
flexGrow: 1
},
{
- name: 'Full name',
+ name: this.i18n('Full name'),
prop: 'display_name',
flexGrow: 1
},
{
- name: 'Email address',
+ name: this.i18n('Email address'),
prop: 'email',
flexGrow: 1
},
{
- name: 'Suspended',
+ name: this.i18n('Suspended'),
prop: 'suspended',
flexGrow: 1,
cellTransformation: CellTemplate.checkIcon
},
{
- name: 'Max. buckets',
+ name: this.i18n('Max. buckets'),
prop: 'max_buckets',
flexGrow: 1
}
permission: 'create',
icon: 'fa-plus',
routerLink: () => '/rgw/user/add',
- name: 'Add'
+ name: this.i18n('Add')
};
const editAction: CdTableAction = {
permission: 'update',
icon: 'fa-pencil',
routerLink: () => `/rgw/user/edit/${getUserUri()}`,
- name: 'Edit'
+ name: this.i18n('Edit')
};
const deleteAction: CdTableAction = {
permission: 'delete',
icon: 'fa-times',
click: () => this.deleteAction(),
- name: 'Delete'
+ name: this.i18n('Delete')
};
this.tableActions = [addAction, editAction, deleteAction];
}
deleteAction() {
this.bsModalService.show(CriticalConfirmationModalComponent, {
initialState: {
- itemDescription: this.selection.hasSingleSelection ? 'user' : 'users',
+ itemDescription: this.selection.hasSingleSelection ? this.i18n('user') : this.i18n('users'),
submitActionObservable: (): Observable<any> => {
return new Observable((observer: Subscriber<any>) => {
// Delete all selected data table rows.
import { ToastModule } from 'ng2-toastr';
import { TabsModule } from 'ngx-bootstrap/tabs';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { CdTableSelection } from '../../../shared/models/cd-table-selection';
import { SharedModule } from '../../../shared/shared.module';
import { RoleDetailsComponent } from './role-details.component';
RouterTestingModule,
HttpClientTestingModule
],
- declarations: [RoleDetailsComponent]
+ declarations: [RoleDetailsComponent],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, Input, OnChanges, OnInit } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { CellTemplate } from '../../../shared/enum/cell-template.enum';
columns: CdTableColumn[];
scopes_permissions: Array<any> = [];
- constructor() {}
+ constructor(private i18n: I18n) {}
ngOnInit() {
this.columns = [
{
prop: 'scope',
- name: 'Scope',
+ name: this.i18n('Scope'),
flexGrow: 2
},
{
prop: 'read',
- name: 'Read',
+ name: this.i18n('Read'),
flexGrow: 1,
cellClass: 'text-center',
cellTransformation: CellTemplate.checkIcon
},
{
prop: 'create',
- name: 'Create',
+ name: this.i18n('Create'),
flexGrow: 1,
cellClass: 'text-center',
cellTransformation: CellTemplate.checkIcon
},
{
prop: 'update',
- name: 'Update',
+ name: this.i18n('Update'),
flexGrow: 1,
cellClass: 'text-center',
cellTransformation: CellTemplate.checkIcon
},
{
prop: 'delete',
- name: 'Delete',
+ name: this.i18n('Delete'),
flexGrow: 1,
cellClass: 'text-center',
cellTransformation: CellTemplate.checkIcon
import { ToastModule } from 'ng2-toastr';
import { of } from 'rxjs';
-import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper';
import { RoleService } from '../../../shared/api/role.service';
import { ScopeService } from '../../../shared/api/scope.service';
import { CdFormGroup } from '../../../shared/forms/cd-form-group';
ToastModule.forRoot(),
SharedModule
],
- declarations: [RoleFormComponent, FakeComponent]
+ declarations: [RoleFormComponent, FakeComponent],
+ providers: i18nProviders
},
true
);
import { FormControl, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { BsModalRef } from 'ngx-bootstrap/modal';
import { forkJoin as observableForkJoin } from 'rxjs';
private router: Router,
private roleService: RoleService,
private scopeService: ScopeService,
- private notificationService: NotificationService
+ private notificationService: NotificationService,
+ private i18n: I18n
) {
this.createForm();
this.listenToChanges();
this.columns = [
{
prop: 'scope',
- name: 'All',
+ name: this.i18n('All'),
flexGrow: 2,
cellTemplate: this.cellScopeCheckboxTpl,
headerTemplate: this.headerPermissionCheckboxTpl
},
{
prop: 'read',
- name: 'Read',
+ name: this.i18n('Read'),
flexGrow: 1,
cellClass: 'text-center',
cellTemplate: this.cellPermissionCheckboxTpl,
},
{
prop: 'create',
- name: 'Create',
+ name: this.i18n('Create'),
flexGrow: 1,
cellClass: 'text-center',
cellTemplate: this.cellPermissionCheckboxTpl,
},
{
prop: 'update',
- name: 'Update',
+ name: this.i18n('Update'),
flexGrow: 1,
cellClass: 'text-center',
cellTemplate: this.cellPermissionCheckboxTpl,
},
{
prop: 'delete',
- name: 'Delete',
+ name: this.i18n('Delete'),
flexGrow: 1,
cellClass: 'text-center',
cellTemplate: this.cellPermissionCheckboxTpl,
() => {
this.notificationService.show(
NotificationType.success,
- `Created role '${roleFormModel.name}'`
+ this.i18n(`Created role '{{role_name}}'`, { role_name: roleFormModel.name })
);
this.router.navigate(['/user-management/roles']);
},
() => {
this.notificationService.show(
NotificationType.success,
- `Updated role '${roleFormModel.name}'`
+ this.i18n(`Updated role '{{role_name}}'`, { role_name: roleFormModel.name })
);
this.router.navigate(['/user-management/roles']);
},
import { ToastModule } from 'ng2-toastr';
import { TabsModule } from 'ngx-bootstrap/tabs';
-import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper';
+import {
+ configureTestBed,
+ i18nProviders,
+ PermissionHelper
+} from '../../../../testing/unit-test-helper';
import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
import { SharedModule } from '../../../shared/shared.module';
import { RoleDetailsComponent } from '../role-details/role-details.component';
TabsModule.forRoot(),
RouterTestingModule,
HttpClientTestingModule
- ]
+ ],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, OnInit } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
import { forkJoin } from 'rxjs';
private emptyPipe: EmptyPipe,
private authStorageService: AuthStorageService,
private modalService: BsModalService,
- private notificationService: NotificationService
+ private notificationService: NotificationService,
+ private i18n: I18n
) {
this.permission = this.authStorageService.getPermissions().user;
const addAction: CdTableAction = {
permission: 'create',
icon: 'fa-plus',
routerLink: () => '/user-management/roles/add',
- name: 'Add'
+ name: this.i18n('Add')
};
const editAction: CdTableAction = {
permission: 'update',
disable: () => !this.selection.hasSingleSelection || this.selection.first().system,
routerLink: () =>
this.selection.first() && `/user-management/roles/edit/${this.selection.first().name}`,
- name: 'Edit'
+ name: this.i18n('Edit')
};
const deleteAction: CdTableAction = {
permission: 'delete',
icon: 'fa-times',
disable: () => !this.selection.hasSingleSelection || this.selection.first().system,
click: () => this.deleteRoleModal(),
- name: 'Delete'
+ name: this.i18n('Delete')
};
this.tableActions = [addAction, editAction, deleteAction];
}
ngOnInit() {
this.columns = [
{
- name: 'Name',
+ name: this.i18n('Name'),
prop: 'name',
flexGrow: 3
},
{
- name: 'Description',
+ name: this.i18n('Description'),
prop: 'description',
flexGrow: 5,
pipe: this.emptyPipe
},
{
- name: 'System Role',
+ name: this.i18n('System Role'),
prop: 'system',
cellClass: 'text-center',
flexGrow: 1,
() => {
this.getRoles();
this.modalRef.hide();
- this.notificationService.show(NotificationType.success, `Deleted role '${role}'`);
+ this.notificationService.show(
+ NotificationType.success,
+ this.i18n(`Deleted role '{{role_name}}'`, { role_name: role })
+ );
},
() => {
this.modalRef.content.stopLoadingSpinner();
import { BsModalService } from 'ngx-bootstrap/modal';
import { of } from 'rxjs';
-import { configureTestBed, FormHelper } from '../../../../testing/unit-test-helper';
+import { configureTestBed, FormHelper, i18nProviders } from '../../../../testing/unit-test-helper';
import { RoleService } from '../../../shared/api/role.service';
import { UserService } from '../../../shared/api/user.service';
import { ComponentsModule } from '../../../shared/components/components.module';
ToastModule.forRoot(),
SharedModule
],
- declarations: [UserFormComponent, FakeComponent]
+ declarations: [UserFormComponent, FakeComponent],
+ providers: i18nProviders
},
true
);
import { FormControl, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
private modalService: BsModalService,
private roleService: RoleService,
private userService: UserService,
- private notificationService: NotificationService
+ private notificationService: NotificationService,
+ private i18n: I18n
) {
this.createForm();
}
() => {
this.notificationService.show(
NotificationType.success,
- `Created user "${userFormModel.username}"`
+ this.i18n('Created user "{{username}}"', { username: userFormModel.username })
);
this.router.navigate(['/user-management/users']);
},
editAction() {
if (this.isUserRemovingNeededRolePermissions()) {
const initialState = {
- titleText: 'Update user',
- buttonText: 'Continue',
+ titleText: this.i18n('Update user'),
+ buttonText: this.i18n('Continue'),
bodyTpl: this.removeSelfUserReadUpdatePermissionTpl,
onSubmit: () => {
this.modalRef.hide();
this.authService.logout(() => {
this.notificationService.show(
NotificationType.info,
- 'You were automatically logged out because your roles have been changed.'
+ this.i18n('You were automatically logged out because your roles have been changed.')
);
});
} else {
this.notificationService.show(
NotificationType.success,
- `Updated user "${userFormModel.username}"`
+ this.i18n('Updated user "{{username}}"', { username: userFormModel.username })
);
this.router.navigate(['/user-management/users']);
}
import { ToastModule } from 'ng2-toastr';
import { TabsModule } from 'ngx-bootstrap/tabs';
-import { configureTestBed, PermissionHelper } from '../../../../testing/unit-test-helper';
+import {
+ configureTestBed,
+ i18nProviders,
+ PermissionHelper
+} from '../../../../testing/unit-test-helper';
import { TableActionsComponent } from '../../../shared/datatable/table-actions/table-actions.component';
import { SharedModule } from '../../../shared/shared.module';
import { UserTabsComponent } from '../user-tabs/user-tabs.component';
RouterTestingModule,
HttpClientTestingModule
],
- declarations: [UserListComponent, UserTabsComponent]
+ declarations: [UserListComponent, UserTabsComponent],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
import { UserService } from '../../../shared/api/user.service';
private emptyPipe: EmptyPipe,
private modalService: BsModalService,
private notificationService: NotificationService,
- private authStorageService: AuthStorageService
+ private authStorageService: AuthStorageService,
+ private i18n: I18n
) {
this.permission = this.authStorageService.getPermissions().user;
const addAction: CdTableAction = {
permission: 'create',
icon: 'fa-plus',
routerLink: () => '/user-management/users/add',
- name: 'Add'
+ name: this.i18n('Add')
};
const editAction: CdTableAction = {
permission: 'update',
icon: 'fa-pencil',
routerLink: () =>
this.selection.first() && `/user-management/users/edit/${this.selection.first().username}`,
- name: 'Edit'
+ name: this.i18n('Edit')
};
const deleteAction: CdTableAction = {
permission: 'delete',
icon: 'fa-times',
click: () => this.deleteUserModal(),
- name: 'Delete'
+ name: this.i18n('Delete')
};
this.tableActions = [addAction, editAction, deleteAction];
}
ngOnInit() {
this.columns = [
{
- name: 'Username',
+ name: this.i18n('Username'),
prop: 'username',
flexGrow: 1
},
{
- name: 'Name',
+ name: this.i18n('Name'),
prop: 'name',
flexGrow: 1,
pipe: this.emptyPipe
},
{
- name: 'Email',
+ name: this.i18n('Email'),
prop: 'email',
flexGrow: 1,
pipe: this.emptyPipe
},
{
- name: 'Roles',
+ name: this.i18n('Roles'),
prop: 'roles',
flexGrow: 1,
cellTemplate: this.userRolesTpl
() => {
this.getUsers();
this.modalRef.hide();
- this.notificationService.show(NotificationType.success, `Deleted user "${username}"`);
+ this.notificationService.show(
+ NotificationType.success,
+ this.i18n('Deleted user "{{username}}"', { username: username })
+ );
},
() => {
this.modalRef.content.stopLoadingSpinner();
if (sessionUsername === username) {
this.notificationService.show(
NotificationType.error,
- `Failed to delete user "${username}"`,
- `You are currently logged in as "${username}".`
+ this.i18n('Failed to delete user "{{username}}"', { username: username }),
+ this.i18n('You are currently logged in as "{{username}}".', { username: username })
);
return;
}
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { AppModule } from '../../../app.module';
import { NavigationComponent } from './navigation.component';
let fixture: ComponentFixture<NavigationComponent>;
configureTestBed({
- imports: [AppModule]
+ imports: [AppModule],
+ providers: i18nProviders
});
beforeEach(() => {
import { ToastModule } from 'ng2-toastr';
import { PopoverModule } from 'ngx-bootstrap/popover';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { SharedModule } from '../../../shared/shared.module';
import { NotificationsComponent } from './notifications.component';
configureTestBed({
imports: [PopoverModule.forRoot(), SharedModule, ToastModule.forRoot()],
- declarations: [NotificationsComponent]
+ declarations: [NotificationsComponent],
+ providers: i18nProviders
});
beforeEach(() => {
import { PopoverModule } from 'ngx-bootstrap/popover';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { ExecutingTask } from '../../../shared/models/executing-task';
import { FinishedTask } from '../../../shared/models/finished-task';
import { SharedModule } from '../../../shared/shared.module';
configureTestBed({
imports: [SharedModule, PopoverModule.forRoot(), HttpClientTestingModule, RouterTestingModule],
- declarations: [TaskManagerComponent]
+ declarations: [TaskManagerComponent],
+ providers: [i18nProviders]
});
beforeEach(() => {
import { AlertModule } from 'ngx-bootstrap/alert';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { SettingsService } from '../../../shared/api/settings.service';
import { SummaryService } from '../../../shared/services/summary.service';
import { CephReleaseNamePipe } from '../../pipes/ceph-release-name.pipe';
configureTestBed({
declarations: [GrafanaComponent, InfoPanelComponent, LoadingPanelComponent],
imports: [AlertModule.forRoot(), HttpClientTestingModule, RouterTestingModule],
- providers: [CephReleaseNamePipe, SettingsService, SummaryService]
+ providers: [CephReleaseNamePipe, SettingsService, SummaryService, i18nProviders]
});
beforeEach(() => {
import { AlertModule } from 'ngx-bootstrap/alert';
-import { configureTestBed } from '../../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
import { InfoPanelComponent } from './info-panel.component';
describe('InfoPanelComponent', () => {
configureTestBed({
declarations: [InfoPanelComponent],
- imports: [AlertModule.forRoot()]
+ imports: [AlertModule.forRoot()],
+ providers: i18nProviders
});
beforeEach(() => {
import { Component, Input } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
@Component({
selector: 'cd-info-panel',
templateUrl: './info-panel.component.html',
* @type {string}
*/
@Input()
- title = 'Information';
+ title = this.i18n('Information');
+
+ constructor(private i18n: I18n) {}
}
import { TestBed } from '@angular/core/testing';
import { Router } from '@angular/router';
-import { configureTestBed } from '../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
import { AppModule } from '../../app.module';
import { ApiInterceptorService } from './api-interceptor.service';
import { NotificationService } from './notification.service';
configureTestBed({
imports: [AppModule, HttpClientTestingModule],
- providers: [NotificationService]
+ providers: [NotificationService, i18nProviders]
});
beforeEach(() => {
import * as _ from 'lodash';
import { ToastsManager } from 'ng2-toastr';
-import { configureTestBed } from '../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
import { NotificationType } from '../enum/notification-type.enum';
import { FinishedTask } from '../models/finished-task';
import { NotificationService } from './notification.service';
providers: [
NotificationService,
TaskMessageService,
- { provide: ToastsManager, useValue: toastFakeService }
+ { provide: ToastsManager, useValue: toastFakeService },
+ i18nProviders
]
});
import { of } from 'rxjs';
-import { configureTestBed } from '../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
import { ExecutingTask } from '../models/executing-task';
import { SummaryService } from './summary.service';
import { TaskListService } from './task-list.service';
};
configureTestBed({
- providers: [TaskListService, TaskMessageService, SummaryService],
+ providers: [TaskListService, TaskMessageService, SummaryService, i18nProviders],
imports: [HttpClientTestingModule, RouterTestingModule]
});
+import { TestBed } from '@angular/core/testing';
+
import * as _ from 'lodash';
+import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
import { FinishedTask } from '../models/finished-task';
import { TaskException } from '../models/task-exception';
import { TaskMessageOperation, TaskMessageService } from './task-message.service';
let service: TaskMessageService;
let finishedTask: FinishedTask;
+ configureTestBed({
+ providers: [TaskMessageService, i18nProviders]
+ });
+
beforeEach(() => {
- service = new TaskMessageService();
+ service = TestBed.get(TaskMessageService);
finishedTask = new FinishedTask();
});
finishedTask.name = 'rbd/trash/restore';
testMessages(
new TaskMessageOperation('Restoring', 'restore', 'Restored'),
- `image '${metadata.pool_name}@${metadata.image_id}' \
- into '${metadata.pool_name}/${metadata.new_image_name}'`
+ `image '${metadata.pool_name}@${metadata.image_id}' ` +
+ `into '${metadata.pool_name}/${metadata.new_image_name}'`
);
testErrorCode(
17,
import { Injectable } from '@angular/core';
+import { I18n } from '@ngx-translate/i18n-polyfill';
+
import { Components } from '../enum/components.enum';
import { FinishedTask } from '../models/finished-task';
import { Task } from '../models/task';
errors: (metadata) => object;
failure(metadata): string {
+ // TODO: I18N
return `Failed to ${this.operation.failure} ${this.involves(metadata)}`;
}
providedIn: ServicesModule
})
export class TaskMessageService {
- constructor() {}
+ constructor(private i18n: I18n) {}
defaultMessage = new TaskMessage(
- new TaskMessageOperation('Executing', 'execute', 'Executed'),
+ new TaskMessageOperation(this.i18n('Executing'), this.i18n('execute'), this.i18n('Executed')),
(metadata) => {
- return (metadata && (Components[metadata.component] || metadata.component)) || 'unknown task';
+ return (
+ (metadata && (Components[metadata.component] || metadata.component)) ||
+ this.i18n('unknown task')
+ );
},
() => {
return {};
);
commonOperations = {
- create: new TaskMessageOperation('Creating', 'create', 'Created'),
- update: new TaskMessageOperation('Updating', 'update', 'Updated'),
- delete: new TaskMessageOperation('Deleting', 'delete', 'Deleted')
+ create: new TaskMessageOperation(
+ this.i18n('Creating'),
+ this.i18n('create'),
+ this.i18n('Created')
+ ),
+ update: new TaskMessageOperation(
+ this.i18n('Updating'),
+ this.i18n('update'),
+ this.i18n('Updated')
+ ),
+ delete: new TaskMessageOperation(
+ this.i18n('Deleting'),
+ this.i18n('delete'),
+ this.i18n('Deleted')
+ )
};
rbd = {
- default: (metadata) => `RBD '${metadata.pool_name}/${metadata.image_name}'`,
- child: (metadata) => `RBD '${metadata.child_pool_name}/${metadata.child_image_name}'`,
- destination: (metadata) => `RBD '${metadata.dest_pool_name}/${metadata.dest_image_name}'`,
+ default: (metadata) =>
+ this.i18n(`RBD '{{id}}'`, {
+ id: `${metadata.pool_name}/${metadata.image_name}`
+ }),
+ child: (metadata) =>
+ this.i18n(`RBD '{{id}}'`, {
+ id: `${metadata.child_pool_name}/${metadata.child_image_name}`
+ }),
+ destination: (metadata) =>
+ this.i18n(`RBD '{{id}}'`, {
+ id: `${metadata.dest_pool_name}/${metadata.dest_image_name}`
+ }),
snapshot: (metadata) =>
- `RBD snapshot '${metadata.pool_name}/${metadata.image_name}@${metadata.snapshot_name}'`
+ this.i18n(`RBD snapshot '{{id}}'`, {
+ id: `${metadata.pool_name}/${metadata.image_name}@${metadata.snapshot_name}`
+ })
};
messages = {
// Pool tasks
- 'pool/create': new TaskMessage(this.commonOperations.create, this.pool, (metadata) => ({
- '17': `Name is already used by ${this.pool(metadata)}.`
- })),
- 'pool/edit': new TaskMessage(this.commonOperations.update, this.pool, (metadata) => ({
- '17': `Name is already used by ${this.pool(metadata)}.`
- })),
- 'pool/delete': new TaskMessage(this.commonOperations.delete, this.pool),
+ 'pool/create': new TaskMessage(
+ this.commonOperations.create,
+ (metadata) => this.pool(metadata),
+ (metadata) => ({
+ '17': this.i18n('Name is already used by {{pool_name}}.', {
+ pool_name: this.pool(metadata)
+ })
+ })
+ ),
+ 'pool/edit': new TaskMessage(
+ this.commonOperations.update,
+ (metadata) => this.pool(metadata),
+ (metadata) => ({
+ '17': this.i18n('Name is already used by {{pool_name}}.', {
+ pool_name: this.pool(metadata)
+ })
+ })
+ ),
+ 'pool/delete': new TaskMessage(this.commonOperations.delete, (metadata) => this.pool(metadata)),
// Erasure code profile tasks
- 'ecp/create': new TaskMessage(this.commonOperations.create, this.ecp, (metadata) => ({
- '17': `Name is already used by ${this.ecp(metadata)}.`
- })),
- 'ecp/delete': new TaskMessage(this.commonOperations.delete, this.ecp),
+ 'ecp/create': new TaskMessage(
+ this.commonOperations.create,
+ (metadata) => this.ecp(metadata),
+ (metadata) => ({
+ '17': this.i18n('Name is already used by {{name}}.', {
+ name: this.ecp(metadata)
+ })
+ })
+ ),
+ 'ecp/delete': new TaskMessage(this.commonOperations.delete, (metadata) => this.ecp(metadata)),
// RBD tasks
'rbd/create': new TaskMessage(this.commonOperations.create, this.rbd.default, (metadata) => ({
- '17': `Name is already used by ${this.rbd.default(metadata)}.`
+ '17': this.i18n('Name is already used by {{rbd_name}}.', {
+ rbd_name: this.rbd.default(metadata)
+ })
})),
'rbd/edit': new TaskMessage(this.commonOperations.update, this.rbd.default, (metadata) => ({
- '17': `Name is already used by ${this.rbd.default(metadata)}.`
+ '17': this.i18n('Name is already used by {{rbd_name}}.', {
+ rbd_name: this.rbd.default(metadata)
+ })
})),
'rbd/delete': new TaskMessage(this.commonOperations.delete, this.rbd.default, (metadata) => ({
- '39': `${this.rbd.default(metadata)} contains snapshots.`
+ '39': this.i18n('{{rbd_name}} contains snapshots.', {
+ rbd_name: this.rbd.default(metadata)
+ })
})),
'rbd/clone': new TaskMessage(
- new TaskMessageOperation('Cloning', 'clone', 'Cloned'),
+ new TaskMessageOperation(this.i18n('Cloning'), this.i18n('clone'), this.i18n('Cloned')),
this.rbd.child,
(metadata) => ({
- '17': `Name is already used by ${this.rbd.child(metadata)}.`,
- '22': `Snapshot of ${this.rbd.child(metadata)} must be protected.`
+ '17': this.i18n('Name is already used by {{rbd_name}}.', {
+ rbd_name: this.rbd.child(metadata)
+ }),
+ '22': this.i18n('Snapshot of {{rbd_name}} must be protected.', {
+ rbd_name: this.rbd.child(metadata)
+ })
})
),
'rbd/copy': new TaskMessage(
- new TaskMessageOperation('Copying', 'copy', 'Copied'),
+ new TaskMessageOperation(this.i18n('Copying'), this.i18n('copy'), this.i18n('Copied')),
this.rbd.destination,
(metadata) => ({
- '17': `Name is already used by ${this.rbd.destination(metadata)}.`
+ '17': this.i18n('Name is already used by {{rbd_name}}.', {
+ rbd_name: this.rbd.destination(metadata)
+ })
})
),
'rbd/flatten': new TaskMessage(
- new TaskMessageOperation('Flattening', 'flatten', 'Flattened'),
+ new TaskMessageOperation(
+ this.i18n('Flattening'),
+ this.i18n('flatten'),
+ this.i18n('Flattened')
+ ),
this.rbd.default
),
// RBD snapshot tasks
this.commonOperations.create,
this.rbd.snapshot,
(metadata) => ({
- '17': `Name is already used by ${this.rbd.snapshot(metadata)}.`
+ '17': this.i18n('Name is already used by {{snap_name}}.', {
+ snap_name: this.rbd.snapshot(metadata)
+ })
})
),
'rbd/snap/edit': new TaskMessage(
this.commonOperations.update,
this.rbd.snapshot,
(metadata) => ({
- '16': `Cannot unprotect ${this.rbd.snapshot(metadata)} because it contains child images.`
+ '16': this.i18n('Cannot unprotect {{snap_name}} because it contains child images.', {
+ snap_name: this.rbd.snapshot(metadata)
+ })
})
),
'rbd/snap/delete': new TaskMessage(
this.commonOperations.delete,
this.rbd.snapshot,
(metadata) => ({
- '16': `Cannot delete ${this.rbd.snapshot(metadata)} because it's protected.`
+ '16': this.i18n(`Cannot delete {{snap_name}} because it's protected.`, {
+ snap_name: this.rbd.snapshot(metadata)
+ })
})
),
'rbd/snap/rollback': new TaskMessage(
- new TaskMessageOperation('Rolling back', 'rollback', 'Rolled back'),
+ new TaskMessageOperation(
+ this.i18n('Rolling back'),
+ this.i18n('rollback'),
+ this.i18n('Rolled back')
+ ),
this.rbd.snapshot
),
// RBD trash tasks
'rbd/trash/move': new TaskMessage(
- new TaskMessageOperation('Moving', 'move', 'Moved'),
- (metadata) => `image '${metadata.pool_name}/${metadata.image_name}' to trash`,
+ new TaskMessageOperation(this.i18n('Moving'), this.i18n('move'), this.i18n('Moved')),
+ (metadata) =>
+ this.i18n(`image '{{id}}' to trash`, {
+ id: `${metadata.pool_name}/${metadata.image_name}`
+ }),
() => ({
- 2: `Could not find image.`
+ 2: this.i18n('Could not find image.')
})
),
'rbd/trash/restore': new TaskMessage(
- new TaskMessageOperation('Restoring', 'restore', 'Restored'),
+ new TaskMessageOperation(this.i18n('Restoring'), this.i18n('restore'), this.i18n('Restored')),
(metadata) =>
- `image '${metadata.pool_name}@${metadata.image_id}' \
- into '${metadata.pool_name}/${metadata.new_image_name}'`,
+ this.i18n(`image '{{id}}' into '{{new_id}}'`, {
+ id: `${metadata.pool_name}@${metadata.image_id}`,
+ new_id: `${metadata.pool_name}/${metadata.new_image_name}`
+ }),
(metadata) => ({
- 17: `Image name '${metadata.pool_name}/${metadata.new_image_name}' is already in use.`
+ 17: this.i18n(`Image name '{{id}}' is already in use.`, {
+ id: `${metadata.pool_name}/${metadata.new_image_name}`
+ })
})
),
'rbd/trash/remove': new TaskMessage(
- new TaskMessageOperation('Deleting', 'delete', 'Deleted'),
- (metadata) => `image '${metadata.pool_name}/${metadata.image_name}@${metadata.image_id}'`
+ new TaskMessageOperation(this.i18n('Deleting'), this.i18n('delete'), this.i18n('Deleted')),
+ (metadata) =>
+ this.i18n(`image '{{id}}'`, {
+ id: `${metadata.pool_name}/${metadata.image_name}@${metadata.image_id}`
+ })
),
'rbd/trash/purge': new TaskMessage(
- new TaskMessageOperation('Purging', 'purge', 'Purged'),
+ new TaskMessageOperation(this.i18n('Purging'), this.i18n('purge'), this.i18n('Purged')),
(metadata) => {
- let message = 'all pools';
+ let message = this.i18n('all pools');
if (metadata.pool_name) {
message = `'${metadata.pool_name}'`;
}
- return `images from ${message}`;
+ return this.i18n('images from {{message}}', {
+ message: message
+ });
}
)
};
pool(metadata) {
- return `pool '${metadata.pool_name}'`;
+ return this.i18n(`pool '{{pool_name}}'`, {
+ pool_name: metadata.pool_name
+ });
}
ecp(metadata) {
- return `erasure code profile '${metadata.name}'`;
+ return this.i18n(`erasure code profile '{{name}}'`, { name: metadata.name });
}
_getTaskTitle(task: Task) {
import { ToastModule } from 'ng2-toastr';
import { Observable } from 'rxjs';
-import { configureTestBed } from '../../../testing/unit-test-helper';
+import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
import { FinishedTask } from '../models/finished-task';
import { SharedModule } from '../shared.module';
import { NotificationService } from './notification.service';
configureTestBed({
imports: [HttpClientTestingModule, ToastModule.forRoot(), SharedModule, RouterTestingModule],
- providers: [TaskWrapperService]
+ providers: [TaskWrapperService, i18nProviders]
});
beforeEach(inject([TaskWrapperService], (wrapper: TaskWrapperService) => {
+import { LOCALE_ID, TRANSLATIONS, TRANSLATIONS_FORMAT } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AbstractControl } from '@angular/forms';
import { By } from '@angular/platform-browser';
+import { I18n } from '@ngx-translate/i18n-polyfill';
import * as _ from 'lodash';
import { TableActionsComponent } from '../app/shared/datatable/table-actions/table-actions.component';
expect(Boolean(fixture.debugElement.query(By.css(css)))).toBe(visibility);
}
}
+
+const XLIFF = `<?xml version="1.0" encoding="UTF-8" ?>
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
+ <file source-language="en" datatype="plaintext" original="ng2.template">
+ <body>
+ </body>
+ </file>
+</xliff>
+`;
+
+const i18nProviders = [
+ { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' },
+ { provide: TRANSLATIONS, useValue: XLIFF },
+ { provide: LOCALE_ID, useValue: 'en' },
+ I18n
+];
+
+export { i18nProviders };