fix: dynamic value does not work (#122)

This commit is contained in:
jsers 2020-04-27 13:28:27 +08:00
parent 10cf6d94df
commit d6f8c48b70
2 changed files with 7 additions and 3 deletions

View File

@ -139,7 +139,6 @@ class Comparison extends Component<Props, State> {
render() {
const { size, comparison, comparisonOptions } = this.props;
const { customValue, customType, errorText } = this.state;
console.log(this.props.intl.locale);
const addonUid = _.uniqueId('inputNumber-addon-');
return (
<div className="graph-config-inner-comparison">

View File

@ -1,6 +1,7 @@
/* eslint-disable no-plusplus */
import _ from 'lodash';
import request from '@common/request';
import api from '@common/api';
import commonApi from '@common/api';
import hasDtag from './util/hasDtag';
import getDTagV, { dFilter } from './util/getDTagV';
@ -95,7 +96,8 @@ export async function normalizeMetrics(metrics: any[], graphConfigInnerVisible:
let canUpdate = false;
for (let m = 0; m < metricsClone.length; m++) {
const { selectedEndpoint, selectedMetric, selectedTagkv, tagkv, endpoints } = metricsClone[m];
const { selectedEndpoint, selectedNid, selectedMetric, selectedTagkv, tagkv } = metricsClone[m];
let { endpoints } = metricsClone[m];
// 加载 tagkv 规则,满足
// 开启行级配置 或者 包含动态tag 或者 没有选择tag
if (
@ -103,9 +105,12 @@ export async function normalizeMetrics(metrics: any[], graphConfigInnerVisible:
(!!graphConfigInnerVisible || hasDtag(selectedTagkv) || _.isEmpty(selectedTagkv))
) {
canUpdate = true;
// eslint-disable-next-line no-await-in-loop
if (hasDtag(selectedEndpoint)) {
endpoints = await fetchEndPoints(selectedNid);
}
const newTagkv = await fetchTagkv(selectedEndpoint, selectedMetric, endpoints);
metricsClone[m].tagkv = newTagkv;
metricsClone[m].endpoints = endpoints;
if (_.isEmpty(selectedTagkv)) {
metricsClone[m].selectedTagkv = newTagkv;
}