Skip to content

Commit

Permalink
feat: 修复指标回填问题
Browse files Browse the repository at this point in the history
  • Loading branch information
liangling0628 committed Sep 26, 2023
1 parent 635c7e5 commit a85e446
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions bkmonitor-timeseries-datasource/src/components/query-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,34 @@ export default class MonitorQueryEditor extends React.PureComponent<IQueryEditor
source: item.source,
};
return this.props.datasource
.getMetricDetailById({
// result_table_label: item.result_table_label,
conditions: {
data_source_label: item.data_source_label,
data_type_label: item.data_type_label,
result_table_id: item.result_table_id || undefined,
metric_field: item.metric_field,
data_label: item.data_label || undefined,
},
flat_format: true,
.getMetricList({
conditions: [
{
key: 'data_source_label',
value: item.data_source_label,
},
{
key: 'data_type_label',
value: item.data_type_label,
},
{
key: 'data_label',
value: item.data_label || undefined,
},
{
key: 'result_table_id',
value: item.result_table_id || undefined,
},
{
key: 'metric_field',
value: item.metric_field,
},
].filter(item => item.value),
page: 1,
page_size: 1,
})
.then((metricList) => {
const metric = metricList.find(set => set.metric_field === item.metric_field
&& ((item.data_label && set.data_label === item.data_label) || set.result_table_id === (item.result_table_id || '')));
.then(({ metric_list }) => {
const metric = metric_list?.[0] || {};
const newMetric: IMetric = {
...item,
...metric,
Expand Down

0 comments on commit a85e446

Please sign in to comment.