fix: expressions (#278)

This commit is contained in:
Fine0830
2023-06-09 18:23:33 +08:00
committed by GitHub
parent 54997794b4
commit 9b1a5f7a74
3 changed files with 7 additions and 5 deletions

View File

@@ -129,7 +129,7 @@ export async function useExpressionsQueryProcessor(config: Indexable) {
}
}
if (type === ExpressionResultType.SINGLE_VALUE) {
source[c.label || name] = results[0].values[0].value;
source[c.label || name] = (results[0].values[0] || {}).value;
}
if (([ExpressionResultType.RECORD_LIST, ExpressionResultType.SORTED_LIST] as string[]).includes(type)) {
source[name] = results[0].values;
@@ -259,7 +259,7 @@ export async function useExpressionsQueryPodsMetrics(
if (subValues) {
d[name]["values"] = subValues;
}
d[name]["avg"] = results[i].values[0].value;
d[name]["avg"] = (results[i].values[0] || {}).value;
const j = names.find((d: string) => d === name);
@@ -278,7 +278,7 @@ export async function useExpressionsQueryPodsMetrics(
if (!d[name]) {
d[name] = {};
}
d[name]["avg"] = [results[0].values[0].value];
d[name]["avg"] = [(results[0].values[0] || {}).value];
if (subResults[0]) {
if (!d[subName]) {
d[subName] = {};