Skip to content

Commit 2c9b36c

Browse files
feat: 【MF】PromQL转换UI经常有问题
1 parent 719fa5c commit 2c9b36c

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

src/timeseries/src/components/query-editor.tsx

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,6 @@ export default class MonitorQueryEditor extends React.PureComponent<IQueryEditor
411411
message: e.message || t('转换失败', this.state.language),
412412
});
413413
hasError = true;
414-
const message = e.data?.message || '';
415-
message && this.setErrorAlert(true, message);
416414
return '';
417415
});
418416
source &&
@@ -626,9 +624,7 @@ export default class MonitorQueryEditor extends React.PureComponent<IQueryEditor
626624
if (item.metricMetaId && v.length) {
627625
this.handleCommonSetMetric(metricIndex, 'loading', true, false);
628626
if (!hasError) {
629-
const data = await this.props.datasource.promqlToQueryConfig(v, 'code').catch((err) => {
630-
const message = err.data?.message || '';
631-
message && this.setErrorAlert(true, message);
627+
const data = await this.props.datasource.promqlToQueryConfig(v, 'code').catch(() => {
632628
this.handleCommonSetMetric(metricIndex, 'status', 'error', false);
633629
return {};
634630
});
@@ -733,9 +729,7 @@ export default class MonitorQueryEditor extends React.PureComponent<IQueryEditor
733729
},
734730
);
735731
} else {
736-
const data = await this.props.datasource.promqlToQueryConfig(v, 'code').catch((err) => {
737-
const message = err.data?.message || '';
738-
message && this.setErrorAlert(true, message);
732+
const data = await this.props.datasource.promqlToQueryConfig(v, 'code').catch(() => {
739733
this.setState({ editorStatus: 'error' });
740734
return {};
741735
});
@@ -784,10 +778,8 @@ export default class MonitorQueryEditor extends React.PureComponent<IQueryEditor
784778
let source = '';
785779
this.setState({ loading: true });
786780
const params = this.handleGetQueryData(this.state.metricList);
787-
source = await this.props.datasource.queryConfigToPromql(params as QueryData).catch((err) => {
781+
source = await this.props.datasource.queryConfigToPromql(params as QueryData).catch(() => {
788782
hasError = true;
789-
const message = err.data?.message || '';
790-
message && this.setErrorAlert(true, message);
791783
return '';
792784
});
793785
this.setState({ source });
@@ -806,10 +798,8 @@ export default class MonitorQueryEditor extends React.PureComponent<IQueryEditor
806798
return;
807799
}
808800
this.setState({ loading: true });
809-
const data = await this.props.datasource.promqlToQueryConfig(this.state.source, 'ui').catch((err) => {
801+
const data = await this.props.datasource.promqlToQueryConfig(this.state.source, 'ui').catch(() => {
810802
hasError = true;
811-
const message = err.data?.message || '';
812-
message && this.setErrorAlert(true, message);
813803
return {};
814804
});
815805
if (data?.query_configs?.length) {
@@ -854,10 +844,8 @@ export default class MonitorQueryEditor extends React.PureComponent<IQueryEditor
854844
if (curMetric.metricMetaId) {
855845
this.handleCommonSetMetric(metricIndex, 'loading', true, false);
856846
const params = this.handleGetQueryData([curMetric]);
857-
source = await this.props.datasource.queryConfigToPromql(params as QueryData).catch((err) => {
847+
source = await this.props.datasource.queryConfigToPromql(params as QueryData).catch(() => {
858848
hasError = true;
859-
const message = err.data?.message || '';
860-
message && this.setErrorAlert(true, message);
861849
return '';
862850
});
863851
this.handleCommonSetMetric(metricIndex, 'source', source, false);
@@ -876,10 +864,8 @@ export default class MonitorQueryEditor extends React.PureComponent<IQueryEditor
876864
return;
877865
}
878866
this.handleCommonSetMetric(metricIndex, 'loading', true, false);
879-
const data = await this.props.datasource.promqlToQueryConfig(curMetric.source, 'ui').catch((err) => {
867+
const data = await this.props.datasource.promqlToQueryConfig(curMetric.source, 'ui').catch(() => {
880868
hasError = true;
881-
const message = err.data?.message || '';
882-
message && this.setErrorAlert(true, message);
883869
return {};
884870
});
885871
if (data?.query_configs?.length && data.query_configs.length === 1) {

0 commit comments

Comments
 (0)