From: Tiago Melo Date: Thu, 20 Dec 2018 13:23:36 +0000 (-0100) Subject: mgr/dashboard: Add missing frontend I18N X-Git-Tag: v14.1.0~362^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25654%2Fhead;p=ceph.git mgr/dashboard: Add missing frontend I18N Fixes: http://tracker.ceph.com/issues/36719 Signed-off-by: Tiago Melo --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.html index 92cd89c122f0..28546d0d0485 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-details/rbd-details.component.html @@ -1,5 +1,5 @@ -
+ Only available for RBD images with fast-diff enabled
@@ -8,106 +8,110 @@ heading="Details"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name{{ selectedItem.name }}
Pool{{ selectedItem.pool_name }}
Data Pool{{ selectedItem.data_pool | empty }}
Created{{ selectedItem.timestamp | cdDate }}
Size{{ selectedItem.size | dimlessBinary }}
Objects{{ selectedItem.num_objs | dimless }}
Object size{{ selectedItem.obj_size | dimlessBinary }}
Features - - {{ feature }} - -
Provisioned - - N/A - - - {{ selectedItem.disk_usage | dimlessBinary }} - -
Total provisioned - - N/A - - - {{ selectedItem.total_disk_usage | dimlessBinary }} - -
Striping unit{{ selectedItem.stripe_unit | dimlessBinary }}
Striping count{{ selectedItem.stripe_count }}
Parent - {{ selectedItem.parent.pool_name }}/{{ selectedItem.parent.image_name }}@{{ selectedItem.parent.snap_name }} - - -
Block name prefix{{ selectedItem.block_name_prefix }}
Order{{ selectedItem.order }}
Name{{ selectedItem.name }}
Pool{{ selectedItem.pool_name }}
Data Pool{{ selectedItem.data_pool | empty }}
Created{{ selectedItem.timestamp | cdDate }}
Size{{ selectedItem.size | dimlessBinary }}
Objects{{ selectedItem.num_objs | dimless }}
Object size{{ selectedItem.obj_size | dimlessBinary }}
Features + + {{ feature }} + +
Provisioned + + N/A + + + {{ selectedItem.disk_usage | dimlessBinary }} + +
Total provisioned + + N/A + + + {{ selectedItem.total_disk_usage | dimlessBinary }} + +
Striping unit{{ selectedItem.stripe_unit | dimlessBinary }}
Striping count{{ selectedItem.stripe_count }}
Parent + {{ selectedItem.parent.pool_name }} + /{{ selectedItem.parent.image_name }} + @{{ selectedItem.parent.snap_name }} + - +
Block name prefix{{ selectedItem.block_name_prefix }}
Order{{ selectedItem.order }}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts index 1494bc625491..eb408eb5f2d0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts @@ -1,69 +1,88 @@ +import { I18n } from '@ngx-translate/i18n-polyfill'; + import { CdTableAction } from '../../../shared/models/cd-table-action'; import { CdTableSelection } from '../../../shared/models/cd-table-selection'; export class RbdSnapshotActionsModel { - create: CdTableAction = { - permission: 'create', - icon: 'fa-plus', - name: 'Create' - }; - rename: CdTableAction = { - permission: 'update', - icon: 'fa-pencil', - name: 'Rename' - }; - protect: CdTableAction = { - permission: 'update', - icon: 'fa-lock', - visible: (selection: CdTableSelection) => - selection.hasSingleSelection && !selection.first().is_protected, - name: 'Protect' - }; - unprotect: CdTableAction = { - permission: 'update', - icon: 'fa-unlock', - visible: (selection: CdTableSelection) => - selection.hasSingleSelection && selection.first().is_protected, - name: 'Unprotect' - }; - clone: CdTableAction = { - permission: 'create', - canBePrimary: (selection: CdTableSelection) => selection.hasSingleSelection, - disable: (selection: CdTableSelection) => - !selection.hasSingleSelection || selection.first().cdExecuting, - icon: 'fa-clone', - name: 'Clone' - }; - copy: CdTableAction = { - permission: 'create', - canBePrimary: (selection: CdTableSelection) => selection.hasSingleSelection, - disable: (selection: CdTableSelection) => - !selection.hasSingleSelection || selection.first().cdExecuting, - icon: 'fa-copy', - name: 'Copy' - }; - rollback: CdTableAction = { - permission: 'update', - icon: 'fa-undo', - name: 'Rollback' - }; - deleteSnap: CdTableAction = { - permission: 'delete', - icon: 'fa-times', - disable: (selection: CdTableSelection) => { - const first = selection.first(); - return !selection.hasSingleSelection || first.cdExecuting || first.is_protected; - }, - name: 'Delete' - }; - ordering = [ - this.create, - this.rename, - this.protect, - this.unprotect, - this.clone, - this.copy, - this.rollback, - this.deleteSnap - ]; + i18n: I18n; + + create: CdTableAction; + rename: CdTableAction; + protect: CdTableAction; + unprotect: CdTableAction; + clone: CdTableAction; + copy: CdTableAction; + rollback: CdTableAction; + deleteSnap: CdTableAction; + ordering: CdTableAction[]; + + constructor(i18n: I18n) { + this.i18n = i18n; + + this.create = { + permission: 'create', + icon: 'fa-plus', + name: this.i18n('Create') + }; + this.rename = { + permission: 'update', + icon: 'fa-pencil', + name: this.i18n('Rename') + }; + this.protect = { + permission: 'update', + icon: 'fa-lock', + visible: (selection: CdTableSelection) => + selection.hasSingleSelection && !selection.first().is_protected, + name: this.i18n('Protect') + }; + this.unprotect = { + permission: 'update', + icon: 'fa-unlock', + visible: (selection: CdTableSelection) => + selection.hasSingleSelection && selection.first().is_protected, + name: this.i18n('Unprotect') + }; + this.clone = { + permission: 'create', + canBePrimary: (selection: CdTableSelection) => selection.hasSingleSelection, + disable: (selection: CdTableSelection) => + !selection.hasSingleSelection || selection.first().cdExecuting, + icon: 'fa-clone', + name: this.i18n('Clone') + }; + this.copy = { + permission: 'create', + canBePrimary: (selection: CdTableSelection) => selection.hasSingleSelection, + disable: (selection: CdTableSelection) => + !selection.hasSingleSelection || selection.first().cdExecuting, + icon: 'fa-copy', + name: this.i18n('Copy') + }; + this.rollback = { + permission: 'update', + icon: 'fa-undo', + name: this.i18n('Rollback') + }; + this.deleteSnap = { + permission: 'delete', + icon: 'fa-times', + disable: (selection: CdTableSelection) => { + const first = selection.first(); + return !selection.hasSingleSelection || first.cdExecuting || first.is_protected; + }, + name: this.i18n('Delete') + }; + + this.ordering = [ + this.create, + this.rename, + this.protect, + this.unprotect, + this.clone, + this.copy, + this.rollback, + this.deleteSnap + ]; + } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts index 41861135fe27..0294daf2b09f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts @@ -3,6 +3,7 @@ import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testin import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; +import { I18n } from '@ngx-translate/i18n-polyfill'; import { ToastModule } from 'ng2-toastr'; import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal'; import { Subject, throwError as observableThrowError } from 'rxjs'; @@ -80,11 +81,12 @@ describe('RbdSnapshotListComponent', () => { beforeEach(() => { fixture.detectChanges(); + const i18n = TestBed.get(I18n); called = false; rbdService = new RbdService(null); notificationService = new NotificationService(null, null); authStorageService = new AuthStorageService(); - authStorageService.set('user', { 'rbd-image': ['create', 'read', 'update', 'delete'] }); + authStorageService.set('user', '', { 'rbd-image': ['create', 'read', 'update', 'delete'] }); component = new RbdSnapshotListComponent( authStorageService, null, @@ -94,7 +96,8 @@ describe('RbdSnapshotListComponent', () => { null, notificationService, null, - null + null, + i18n ); spyOn(rbdService, 'deleteSnapshot').and.returnValue(observableThrowError({ status: 500 })); spyOn(notificationService, 'notifyTask').and.stub(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts index 8958dea84b2d..e186195c5c71 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts @@ -77,7 +77,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges { private i18n: I18n ) { this.permission = this.authStorageService.getPermissions().rbdImage; - const actions = new RbdSnapshotActionsModel(); + const actions = new RbdSnapshotActionsModel(this.i18n); actions.create.click = () => this.openCreateSnapshotModal(); actions.rename.click = () => this.openEditSnapshotModal(); actions.protect.click = () => this.toggleProtection(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.html index 0be5c92ddfbc..d19a2adfa5c4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.html @@ -9,13 +9,8 @@ [formGroup]="moveForm" novalidate>