import {StagePropsInfo} from "./app"...

5/12/2021  •  63 views
import {StagePropsInfo} from "./app";
import {datasets, marketPlaces, services} from "./detail_level_metrics";
import {IGraphMetric} from "./constants";

export function getDetailLevelDashboardWidgetsArr(stageProps: StagePropsInfo){
let detailLevelDashboardWidgetsArr : IGraphMetric[] = [];

let datasetDetails = datasets.find(dataset => dataset.stage === stageProps.stage);

services.forEach(abasService => {
abasService.metrics.forEach(metric => {
marketPlaces.forEach(marketPlace => {
const metricData = {
properties: {
metrics: [
["Service", metric.metric, "DataSet", datasetDetails?.dataset, 'Marketplace',
abasService.service+':'+datasetDetails?.value+":"+marketPlace,
"HostGroup", "ALL", "Host", "ALL",
"ServiceName", abasService.service,
"MethodName", "ALL",
"Client", "ALL",
"MetricClass", "NONE",
"Instance",
"NONE", {
"accountId": "igraph",
"id": "m1"
}]
],
stat: metric.stat,
title: metric.title,
yAxis: {
left: {
label: "",
showUnits: false
}
}
}
}

detailLevelDashboardWidgetsArr.push(metricData);
})
})
});

return detailLevelDashboardWidgetsArr;
}
https://paste.ac/Wod3SMc