fix: expressions (#278)

This commit is contained in:
Fine0830 2023-06-09 18:23:33 +08:00 committed by GitHub
parent 54997794b4
commit 9b1a5f7a74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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] = {};

View File

@ -179,9 +179,9 @@ limitations under the License. -->
);
endpoints.value = params.data;
colMetrics.value = params.names;
colSubMetrics.value = params.subNames;
metricTypes.value = params.metricTypesArr;
metricConfig.value = params.metricConfigArr;
colSubMetrics.value = params.colSubMetrics;
emit("expressionTips", { tips: params.expressionsTips, subTips: params.subExpressionsTips });
return;
@ -216,6 +216,7 @@ limitations under the License. -->
...(props.config.metrics || []),
...(props.config.metricConfig || []),
...(props.config.expressions || []),
...(props.config.subExpressions || []),
props.config.metricMode,
],
(data, old) => {

View File

@ -215,7 +215,7 @@ limitations under the License. -->
);
instances.value = params.data;
colMetrics.value = params.names;
colSubMetrics.value = params.colSubMetrics;
colSubMetrics.value = params.subNames;
metricTypes.value = params.metricTypesArr;
metricConfig.value = params.metricConfigArr;
emit("expressionTips", { tips: params.expressionsTips, subTips: params.subExpressionsTips });
@ -268,6 +268,7 @@ limitations under the License. -->
...(props.config.metrics || []),
...(props.config.metricConfig || []),
...(props.config.expressions || []),
...(props.config.subExpressions || []),
props.config.metricMode,
],
(data, old) => {