mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-14 00:37:33 +00:00
refactor query source
This commit is contained in:
parent
3bc2011a78
commit
989212810b
@ -381,9 +381,12 @@ export function usePodsSource(
|
||||
aggregation(Number(d.value), c)
|
||||
);
|
||||
const indexNum = labelsIdx.findIndex((d: string) => d === item.label);
|
||||
let key = item.label;
|
||||
if (labels[indexNum] && indexNum > -1) {
|
||||
if (!d[labels[indexNum]]) {
|
||||
d[labels[indexNum]] = {};
|
||||
key = labels[indexNum];
|
||||
}
|
||||
if (!d[key]) {
|
||||
d[key] = {};
|
||||
}
|
||||
if (
|
||||
[
|
||||
@ -392,24 +395,9 @@ export function usePodsSource(
|
||||
Calculations.PercentageAvg,
|
||||
].includes(c.calculation)
|
||||
) {
|
||||
d[labels[indexNum]]["avg"] = calculateExp(item.values.values, c);
|
||||
}
|
||||
d[labels[indexNum]]["values"] = values;
|
||||
} else {
|
||||
if (!d[item.label]) {
|
||||
d[item.label] = {};
|
||||
}
|
||||
if (
|
||||
[
|
||||
Calculations.Average,
|
||||
Calculations.ApdexAvg,
|
||||
Calculations.PercentageAvg,
|
||||
].includes(c.calculation)
|
||||
) {
|
||||
d[item.label]["avg"] = calculateExp(item.values.values, c);
|
||||
}
|
||||
d[item.label]["values"] = values;
|
||||
d[key]["avg"] = calculateExp(item.values.values, c);
|
||||
}
|
||||
d[key]["values"] = values;
|
||||
if (idx === 0) {
|
||||
names.push(item.label);
|
||||
metricConfigArr.push({ ...c, index: i });
|
||||
|
Loading…
Reference in New Issue
Block a user