Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 2x 2x 2x 2x 2x 3x 3x 2x 2x 3x | import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { I18n } from '@ngx-translate/i18n-polyfill';
import { IscsiService } from '../../../shared/api/iscsi.service';
import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
import { IscsiBackstorePipe } from '../../../shared/pipes/iscsi-backstore.pipe';
@Component({
selector: 'cd-iscsi',
template: require('./iscsi.component.html'),
styles: []
})
export class IscsiComponent implements OnInit {
@ViewChild('statusColorTpl')
statusColorTpl: TemplateRef<any>;
@ViewChild('iscsiSparklineTpl')
iscsiSparklineTpl: TemplateRef<any>;
@ViewChild('iscsiPerSecondTpl')
iscsiPerSecondTpl: TemplateRef<any>;
@ViewChild('iscsiRelativeDateTpl')
iscsiRelativeDateTpl: TemplateRef<any>;
gateways = [];
gatewaysColumns: any;
images = [];
imagesColumns: any;
constructor(
private iscsiService: IscsiService,
private dimlessPipe: DimlessPipe,
private iscsiBackstorePipe: IscsiBackstorePipe,
private i18n: I18n
) {}
ngOnInit() {
this.gatewaysColumns = [
{
name: this.i18n('Name'),
prop: 'name'
},
{
name: this.i18n('State'),
prop: 'state',
cellTemplate: this.statusColorTpl
},
{
name: this.i18n('# Targets'),
prop: 'num_targets'
},
{
name: this.i18n('# Sessions'),
prop: 'num_sessions'
}
];
this.imagesColumns = [
{
name: this.i18n('Pool'),
prop: 'pool'
},
{
name: this.i18n('Image'),
prop: 'image'
},
{
name: this.i18n('Backstore'),
prop: 'backstore',
pipe: this.iscsiBackstorePipe
},
{
name: this.i18n('Read Bytes'),
prop: 'stats_history.rd_bytes',
cellTemplate: this.iscsiSparklineTpl
},
{
name: this.i18n('Write Bytes'),
prop: 'stats_history.wr_bytes',
cellTemplate: this.iscsiSparklineTpl
},
{
name: this.i18n('Read Ops'),
prop: 'stats.rd',
pipe: this.dimlessPipe,
cellTemplate: this.iscsiPerSecondTpl
},
{
name: this.i18n('Write Ops'),
prop: 'stats.wr',
pipe: this.dimlessPipe,
cellTemplate: this.iscsiPerSecondTpl
},
{
name: this.i18n('A/O Since'),
prop: 'optimized_since',
cellTemplate: this.iscsiRelativeDateTpl
}
];
}
refresh() {
this.iscsiService.overview().subscribe((overview: Array<any>) => {
this.gateways = overview['gateways'];
this.images = overview['images'];
this.images.map((image) => {
if (image.stats_history) {
image.stats_history.rd_bytes = image.stats_history.rd_bytes.map((i) => i[1]);
image.stats_history.wr_bytes = image.stats_history.wr_bytes.map((i) => i[1]);
}
image.cdIsBinary = true;
return image;
});
});
}
}
|