1 import { Pipe, PipeTransform } from '@angular/core';
3 import { I18n } from '@ngx-translate/i18n-polyfill';
4 import * as _ from 'lodash';
9 export class MdsSummaryPipe implements PipeTransform {
10 constructor(private i18n: I18n) {}
12 transform(value: any): any {
17 let contentLine1 = '';
18 let contentLine2 = '';
21 let standbyReplay = 0;
22 _.each(value.standbys, () => {
26 if (value.standbys && !value.filesystems) {
27 contentLine1 = `${standbys} ${this.i18n('up')}`;
28 contentLine2 = this.i18n('no filesystems');
29 } else if (value.filesystems.length === 0) {
30 contentLine1 = this.i18n('no filesystems');
32 _.each(value.filesystems, (fs) => {
33 _.each(fs.mdsmap.info, (mds) => {
34 if (mds.state === 'up:standby-replay') {
42 contentLine1 = `${active} ${this.i18n('active')}`;
43 contentLine2 = `${standbys + standbyReplay} ${this.i18n('standby')}`;
48 content: contentLine1,
56 class: 'card-text-line-break'
59 content: contentLine2,