Skip to content

Commit

Permalink
fix: 兼容only_promql模式 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
liangling0628 authored Nov 17, 2022
1 parent b62cc1d commit 0f6154e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions bkmonitor-timeseries-datasource/src/datasource/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ export default class DashboardDatasource extends DataSourceApi<QueryData, QueryO
}],
};
}
return item;
return {
...item,
mode: item.only_promql ? 'code' : item.mode,
};
});
const promiseList = [];
let errorMsg = '';
Expand Down Expand Up @@ -177,8 +180,9 @@ export default class DashboardDatasource extends DataSourceApi<QueryData, QueryO
}
// 表达式图表数据请求
if (item.mode === 'code'
|| item.only_promql
|| (item.expressionList?.some(item => item.expression && item.active) && configList.length > 0)) {
if (item.mode === 'code') {
if (item.mode === 'code' || item.only_promql) {
const params = {
url: QueryUrl.graph_promql_query,
data: {
Expand Down
3 changes: 2 additions & 1 deletion bkmonitor-timeseries-datasource/src/typings/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@ export interface QueryData extends DataQuery {
showExpression?: boolean;
source?: string;
promqlAlias?: string;
expressionList?: IExpresionItem[]
expressionList?: IExpresionItem[];
only_promql?: boolean
}

0 comments on commit 0f6154e

Please sign in to comment.