]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/mgr-summary.pipe.ts
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / pipes / mgr-summary.pipe.ts
1 import { Pipe, PipeTransform } from '@angular/core';
2
3 import _ from 'lodash';
4
5 @Pipe({
6 name: 'mgrSummary'
7 })
8 export class MgrSummaryPipe implements PipeTransform {
9 transform(value: any): any {
10 if (!value) {
11 return {
12 success: 0,
13 info: 0,
14 total: 0
15 };
16 }
17
18 let activeCount: number;
19 const activeTitleText = _.isUndefined(value.active_name)
20 ? ''
21 : `${$localize`active daemon`}: ${value.active_name}`;
22 // There is always one standbyreplay to replace active daemon, if active one is down
23 if (activeTitleText.length > 0) {
24 activeCount = 1;
25 }
26 const standbyCount = value.standbys.length;
27 const totalCount = activeCount + standbyCount;
28
29 const mgrSummary = {
30 success: activeCount,
31 info: standbyCount,
32 total: totalCount
33 };
34
35 return mgrSummary;
36 }
37 }