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',
title: string;
tree: TreeModel;
- constructor(private i18n: I18n) {}
+ constructor(private i18n: I18n, private iscsiBackstorePipe: IscsiBackstorePipe) {}
ngOnInit() {
this.columns = [
});
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;
<span class="help-block">
<ng-container *ngIf="backstores.length > 1"
- i18n>Backstore: {{ imagesSettings[image].backstore }}. </ng-container>
+ i18n>Backstore: {{ imagesSettings[image].backstore | iscsiBackstore }}. </ng-container>
<ng-container *ngIf="hasAdvancedSettings(imagesSettings[image][imagesSettings[image].backstore])"
i18n>This image has modified settings.</ng-container>
[(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>
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', () => {
};
configureTestBed({
- imports: [],
+ imports: [SharedModule],
declarations: [IscsiComponent],
schemas: [NO_ERRORS_SCHEMA],
providers: [
DimlessPipe,
FormatterService,
RelativeDatePipe,
+ IscsiBackstorePipe,
ListPipe,
{ provide: IscsiService, useValue: fakeService },
i18nProviders
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',
constructor(
private iscsiService: IscsiService,
private dimlessPipe: DimlessPipe,
- private relativeDatePipe: RelativeDatePipe,
+ private iscsiBackstorePipe: IscsiBackstorePipe,
private i18n: I18n
) {}
},
{
name: this.i18n('Backstore'),
- prop: 'backstore'
+ prop: 'backstore',
+ pipe: this.iscsiBackstorePipe
},
{
name: this.i18n('Read Bytes'),
--- /dev/null
+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');
+ });
+});
--- /dev/null
+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;
+ }
+ }
+}
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';
CephShortVersionPipe,
CephReleaseNamePipe,
RelativeDatePipe,
+ IscsiBackstorePipe,
ListPipe,
LogPriorityPipe,
FilterPipe,
CephShortVersionPipe,
CephReleaseNamePipe,
RelativeDatePipe,
+ IscsiBackstorePipe,
ListPipe,
LogPriorityPipe,
FilterPipe,
DimlessBinaryPerSecondPipe,
DimlessPipe,
RelativeDatePipe,
+ IscsiBackstorePipe,
ListPipe,
LogPriorityPipe,
CdDatePipe,
<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>