Skip to content

Commit

Permalink
refactor: compatible with query api response data exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jsers committed Oct 13, 2022
1 parent c0d3b8a commit ea7dfc4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/dashboard/VariableConfig/constant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export const convertExpressionToQuery = (expression: string, range: IRawTimeRang
} else if (expression.startsWith('query_result(')) {
const promql = expression.substring('query_result('.length, expression.length - 1);
return getQueryResult({ query: promql, start, end }).then((res) =>
res.data.result.map(({ metric, value }) => {
_.map(res?.data?.result, ({ metric, value }) => {
const metricName = metric['__name__'];
const labels = Object.keys(metric)
.filter((ml) => ml !== '__name__')
Expand All @@ -187,7 +187,7 @@ export const convertExpressionToQuery = (expression: string, range: IRawTimeRang
);
} else if (type === 'query') {
return getQueryResult({ query: expression, start, end }).then((res) =>
res.data.result.map(({ metric, value }) => {
_.map(res?.data?.result, ({ metric, value }) => {
const metricName = metric['__name__'];
const labels = Object.keys(metric)
.filter((ml) => ml !== '__name__')
Expand Down

0 comments on commit ea7dfc4

Please sign in to comment.