]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Adds 'tcmu-runner' to the 'user:rbd' backstore descr
authorRicardo Marques <rimarques@suse.com>
Tue, 2 Apr 2019 15:59:51 +0000 (16:59 +0100)
committerRicardo Marques <rimarques@suse.com>
Thu, 4 Apr 2019 19:15:03 +0000 (20:15 +0100)
Signed-off-by: Ricardo Marques <rimarques@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iscsi-backstore.pipe.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iscsi-backstore.pipe.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/pipes.module.ts
src/pybind/mgr/dashboard/frontend/src/locale/messages.xlf

index 814dc44b9f58e7f8ae3b83a5e148b1dea24e76de..588c24b5c248f4e97f67256186251561bf448ec5 100644 (file)
@@ -7,6 +7,7 @@ import { NodeEvent, TreeModel } from 'ng2-tree';
 import { TableComponent } from '../../../shared/datatable/table/table.component';
 import { CdTableColumn } from '../../../shared/models/cd-table-column';
 import { CdTableSelection } from '../../../shared/models/cd-table-selection';
+import { IscsiBackstorePipe } from '../../../shared/pipes/iscsi-backstore.pipe';
 
 @Component({
   selector: 'cd-iscsi-target-details',
@@ -38,7 +39,7 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit {
   title: string;
   tree: TreeModel;
 
-  constructor(private i18n: I18n) {}
+  constructor(private i18n: I18n, private iscsiBackstorePipe: IscsiBackstorePipe) {}
 
   ngOnInit() {
     this.columns = [
@@ -248,8 +249,8 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit {
         });
         this.data.push({
           displayName: 'backstore',
-          default: this.settings.default_backstore,
-          current: tempData.backstore
+          default: this.iscsiBackstorePipe.transform(this.settings.default_backstore),
+          current: this.iscsiBackstorePipe.transform(tempData.backstore)
         });
       } else {
         this.columns[2].isHidden = true;
index 53e83cc8d83452cf0907d508d78161fb1305cd51..7dc6250aa897a85f70656894130d2a92e7064ee5 100644 (file)
 
               <span class="help-block">
                 <ng-container *ngIf="backstores.length > 1"
-                              i18n>Backstore: {{ imagesSettings[image].backstore }}.&nbsp;</ng-container>
+                              i18n>Backstore: {{ imagesSettings[image].backstore | iscsiBackstore }}.&nbsp;</ng-container>
 
                 <ng-container *ngIf="hasAdvancedSettings(imagesSettings[image][imagesSettings[image].backstore])"
                               i18n>This image has modified settings.</ng-container>
index cf163f28c22098a0de0849ce830fe97d996b6526..c0dd35b5fee947df980a743eefea342f02983a62 100644 (file)
@@ -20,7 +20,7 @@
                   [(ngModel)]="model.backstore"
                   [disabled]="backstores.length == 1">
             <option *ngFor="let bs of backstores"
-                    [value]="bs">{{ bs }}</option>
+                    [value]="bs">{{ bs | iscsiBackstore }}</option>
           </select>
         </div>
       </div>
index e9bae7f321395e29fe0fbed3daa8003356c07208..c7d533c186ddf3c022d2aeb0eb49cb24c29e2a00 100644 (file)
@@ -7,9 +7,11 @@ import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-h
 import { IscsiService } from '../../../shared/api/iscsi.service';
 import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
 import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
+import { IscsiBackstorePipe } from '../../../shared/pipes/iscsi-backstore.pipe';
 import { ListPipe } from '../../../shared/pipes/list.pipe';
 import { RelativeDatePipe } from '../../../shared/pipes/relative-date.pipe';
 import { FormatterService } from '../../../shared/services/formatter.service';
+import { SharedModule } from '../../../shared/shared.module';
 import { IscsiComponent } from './iscsi.component';
 
 describe('IscsiComponent', () => {
@@ -27,7 +29,7 @@ describe('IscsiComponent', () => {
   };
 
   configureTestBed({
-    imports: [],
+    imports: [SharedModule],
     declarations: [IscsiComponent],
     schemas: [NO_ERRORS_SCHEMA],
     providers: [
@@ -35,6 +37,7 @@ describe('IscsiComponent', () => {
       DimlessPipe,
       FormatterService,
       RelativeDatePipe,
+      IscsiBackstorePipe,
       ListPipe,
       { provide: IscsiService, useValue: fakeService },
       i18nProviders
index fe64d02c385be6209f184ac143d985870f6454df..27266f4339e872e8622b8a90e4c525e0538e0b97 100644 (file)
@@ -4,7 +4,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill';
 
 import { IscsiService } from '../../../shared/api/iscsi.service';
 import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
-import { RelativeDatePipe } from '../../../shared/pipes/relative-date.pipe';
+import { IscsiBackstorePipe } from '../../../shared/pipes/iscsi-backstore.pipe';
 
 @Component({
   selector: 'cd-iscsi',
@@ -29,7 +29,7 @@ export class IscsiComponent implements OnInit {
   constructor(
     private iscsiService: IscsiService,
     private dimlessPipe: DimlessPipe,
-    private relativeDatePipe: RelativeDatePipe,
+    private iscsiBackstorePipe: IscsiBackstorePipe,
     private i18n: I18n
   ) {}
 
@@ -60,7 +60,8 @@ export class IscsiComponent implements OnInit {
       },
       {
         name: this.i18n('Backstore'),
-        prop: 'backstore'
+        prop: 'backstore',
+        pipe: this.iscsiBackstorePipe
       },
       {
         name: this.i18n('Read Bytes'),
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iscsi-backstore.pipe.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iscsi-backstore.pipe.spec.ts
new file mode 100644 (file)
index 0000000..c82e375
--- /dev/null
@@ -0,0 +1,17 @@
+import { IscsiBackstorePipe } from './iscsi-backstore.pipe';
+
+describe('IscsiBackstorePipe', () => {
+  const pipe = new IscsiBackstorePipe();
+
+  it('create an instance', () => {
+    expect(pipe).toBeTruthy();
+  });
+
+  it('transforms "user:rbd"', () => {
+    expect(pipe.transform('user:rbd')).toBe('user:rbd (tcmu-runner)');
+  });
+
+  it('transforms "other"', () => {
+    expect(pipe.transform('other')).toBe('other');
+  });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iscsi-backstore.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/iscsi-backstore.pipe.ts
new file mode 100644 (file)
index 0000000..ae347b6
--- /dev/null
@@ -0,0 +1,17 @@
+import { Pipe, PipeTransform } from '@angular/core';
+
+@Pipe({
+  name: 'iscsiBackstore'
+})
+export class IscsiBackstorePipe implements PipeTransform {
+  constructor() {}
+
+  transform(value: any): any {
+    switch (value) {
+      case 'user:rbd':
+        return 'user:rbd (tcmu-runner)';
+      default:
+        return value;
+    }
+  }
+}
index b849af25bfd133294f8b8ab1e210430092285503..0248203a0db66d1ae55143f9b40f2b418a464ad8 100644 (file)
@@ -13,6 +13,7 @@ import { EncodeUriPipe } from './encode-uri.pipe';
 import { FilterPipe } from './filter.pipe';
 import { HealthColorPipe } from './health-color.pipe';
 import { IopsPipe } from './iops.pipe';
+import { IscsiBackstorePipe } from './iscsi-backstore.pipe';
 import { ListPipe } from './list.pipe';
 import { LogPriorityPipe } from './log-priority.pipe';
 import { MillisecondsPipe } from './milliseconds.pipe';
@@ -33,6 +34,7 @@ import { UpperFirstPipe } from './upper-first.pipe';
     CephShortVersionPipe,
     CephReleaseNamePipe,
     RelativeDatePipe,
+    IscsiBackstorePipe,
     ListPipe,
     LogPriorityPipe,
     FilterPipe,
@@ -55,6 +57,7 @@ import { UpperFirstPipe } from './upper-first.pipe';
     CephShortVersionPipe,
     CephReleaseNamePipe,
     RelativeDatePipe,
+    IscsiBackstorePipe,
     ListPipe,
     LogPriorityPipe,
     FilterPipe,
@@ -77,6 +80,7 @@ import { UpperFirstPipe } from './upper-first.pipe';
     DimlessBinaryPerSecondPipe,
     DimlessPipe,
     RelativeDatePipe,
+    IscsiBackstorePipe,
     ListPipe,
     LogPriorityPipe,
     CdDatePipe,
index 4ffef753b6ba85afc85d38a0f987158b41ff54a1..e0040aeeeaf9affb484a64ec8f0ec2476e341a69 100644 (file)
         <source>Backstore</source>
         <context-group purpose="location">
           <context context-type="sourcefile">app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.html</context>
-          <context context-type="linenumber">17</context>
+          <context context-type="linenumber">16</context>
         </context-group>
       </trans-unit><trans-unit id="68e710782ccb5398b3acb8844caf0b199da2c3da" datatype="html">
         <source>Confirm</source>
           <context context-type="sourcefile">app/ceph/block/iscsi-target-form/iscsi-target-form.component.html</context>
           <context context-type="linenumber">106</context>
         </context-group>
-      </trans-unit><trans-unit id="6c1c7f516d021abaf155aab1e9c2fe96e2c4ff40" datatype="html">
-        <source>Backstore: <x id="INTERPOLATION" equiv-text="{{ imagesSettings[image].backstore }}"/>. </source>
+      </trans-unit><trans-unit id="9aff25be088f0efe3eaaf62edf2bff41cc41a617" datatype="html">
+        <source>Backstore: <x id="INTERPOLATION" equiv-text="{{ imagesSettings[image].backstore | iscsiBackstore }}"/>. </source>
         <context-group purpose="location">
           <context context-type="sourcefile">app/ceph/block/iscsi-target-form/iscsi-target-form.component.html</context>
           <context context-type="linenumber">147</context>