refactor: update

This commit is contained in:
Fine 2024-04-16 14:38:52 +08:00
parent 7101cc93ad
commit b52e5a6988

View File

@ -112,20 +112,7 @@ export async function useExpressionsQueryProcessor(config: Indexable) {
tips.push(obj.error); tips.push(obj.error);
typesOfMQE.push(type); typesOfMQE.push(type);
if (!obj.error) { if (!obj.error) {
if (type === ExpressionResultType.TIME_SERIES_VALUES) { if ([ExpressionResultType.SINGLE_VALUE, ExpressionResultType.TIME_SERIES_VALUES].includes(type)) {
for (const item of results) {
const values = item.values.map((d: { value: unknown }) => d.value) || [];
const label = item.metric.labels
.map((d: { key: string; value: string }) => `${d.key}=${d.value}`)
.join(",");
if (results.length === 1) {
source[label || c.label || name] = values;
} else {
source[label] = values;
}
}
}
if (type === ExpressionResultType.SINGLE_VALUE) {
for (const item of results) { for (const item of results) {
const label = const label =
item.metric && item.metric &&