refactor, align config with rest

This commit is contained in:
FrancescoMolinaro
2023-12-29 15:09:37 +01:00
parent 055cc50cfb
commit cd4b6a4169
4 changed files with 5 additions and 29 deletions

View File

@@ -82,26 +82,7 @@ export class AdminNotifyDashboardComponent implements OnInit{
return this.metricsConfig.map(row => {
return {
...row,
boxes: row.boxes.map(rowBox => {
// TODO remove aggregate once rest is updated
if (rowBox.isRowAggregateCount) {
const currentRowBoxesWithCount = row.boxes.filter(box => !box.isRowAggregateCount)
.map(notAggregateBox => {
return {
...notAggregateBox,
count: boxesWithCount.find(boxWithCount => boxWithCount.config === notAggregateBox.config)?.count
};
});
return {
...rowBox,
count: currentRowBoxesWithCount.map(box => box.count).reduce((accumulator, currentValue) => {
return accumulator + currentValue;
},0)
};
} else {
return boxesWithCount.find(boxWithCount => boxWithCount.config === rowBox.config);
}
})
boxes: row.boxes.map(rowBox =>boxesWithCount.find(boxWithCount => boxWithCount.config === rowBox.config))
};
});
}

View File

@@ -4,7 +4,6 @@ export interface AdminNotifyMetricsBox {
title: string;
config: string;
count?: number;
isRowAggregateCount?: boolean;
}
export interface AdminNotifyMetricsRow {

View File

@@ -475,8 +475,7 @@ export class DefaultAppConfig implements AppConfig {
color: '#43515F',
title: 'admin-notify-dashboard.involved-items',
textColor: '#fff',
config: '',
isRowAggregateCount: true
config: 'NOTIFY.incoming.involvedItems',
},
]
},
@@ -507,8 +506,7 @@ export class DefaultAppConfig implements AppConfig {
color: '#43515F',
title: 'admin-notify-dashboard.involved-items',
textColor: '#fff',
config: '',
isRowAggregateCount: true
config: 'NOTIFY.outgoing.involvedItems',
},
]
}

View File

@@ -347,8 +347,7 @@ export const environment: BuildConfig = {
color: '#43515F',
title: 'admin-notify-dashboard.involved-items',
textColor: '#fff',
config: '',
isRowAggregateCount: true
config: 'NOTIFY.incoming.involvedItems',
},
]
},
@@ -379,8 +378,7 @@ export const environment: BuildConfig = {
color: '#43515F',
title: 'admin-notify-dashboard.involved-items',
textColor: '#fff',
config: '',
isRowAggregateCount: true
config: 'NOTIFY.outgoing.involvedItems',
},
]
}