This commit is contained in:
Fine 2024-11-14 11:15:32 +08:00
parent 75534fbc29
commit 5adec6dc4a
2 changed files with 9 additions and 9 deletions

View File

@ -113,4 +113,4 @@ export const LightChartColors = [
"#c4ccd3", "#c4ccd3",
]; ];
export const MaxQueryLength = 300; export const MaxQueryLength = 120;

View File

@ -464,19 +464,19 @@ export function useQueryTopologyExpressionsProcessor(metrics: string[], instance
return { queryStr, conditions }; return { queryStr, conditions };
} }
function handleExpressionValues(resp: { [key: string]: any }) { function handleExpressionValues(partMetrics: string[], resp: { [key: string]: any }) {
const obj: any = {}; const obj: any = {};
for (let idx = 0; idx < instances.length; idx++) { for (let idx = 0; idx < instances.length; idx++) {
for (let index = 0; index < metrics.length; index++) { for (let index = 0; index < partMetrics.length; index++) {
const k = "expression" + idx + index; const k = "expression" + idx + index;
if (metrics[index]) { if (partMetrics[index]) {
if (!obj[metrics[index]]) { if (!obj[partMetrics[index]]) {
obj[metrics[index]] = { obj[partMetrics[index]] = {
values: [], values: [],
}; };
} }
obj[metrics[index]].values.push({ obj[partMetrics[index]].values.push({
value: resp[k].results[0] && resp[k].results[0].values[0].value, value: resp[k] && resp[k].results[0] && resp[k].results[0].values[0].value,
id: instances[idx].id, id: instances[idx].id,
}); });
} }
@ -492,7 +492,7 @@ export function useQueryTopologyExpressionsProcessor(metrics: string[], instance
ElMessage.error(res.errors); ElMessage.error(res.errors);
return; return;
} }
return handleExpressionValues(res.data); return handleExpressionValues(partMetrics, res.data);
} }
async function getMetrics() { async function getMetrics() {