Problems: use metrics query type for single item, #948
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import * as utils from '../../../datasource-zabbix/utils';
|
import * as utils from '../../../datasource-zabbix/utils';
|
||||||
import { MODE_ITEMID } from '../../../datasource-zabbix/constants';
|
import { MODE_ITEMID, MODE_METRICS } from '../../../datasource-zabbix/constants';
|
||||||
import { ProblemDTO, ZBXHost, ZBXGroup, ZBXEvent, ZBXTag, ZBXAlert } from '../../../datasource-zabbix/types';
|
import { ProblemDTO, ZBXHost, ZBXGroup, ZBXEvent, ZBXTag, ZBXAlert } from '../../../datasource-zabbix/types';
|
||||||
import { ZBXItem, ZBXAcknowledge, GFTimeRange, RTRow } from '../../types';
|
import { ZBXItem, ZBXAcknowledge, GFTimeRange, RTRow } from '../../types';
|
||||||
import { Modal, AckProblemData } from '../Modal';
|
import { Modal, AckProblemData } from '../Modal';
|
||||||
@@ -95,16 +95,31 @@ export default class ProblemDetails extends PureComponent<ProblemDetailsProps, P
|
|||||||
|
|
||||||
openInExplore = () => {
|
openInExplore = () => {
|
||||||
const problem = this.props.original as ProblemDTO;
|
const problem = this.props.original as ProblemDTO;
|
||||||
const itemids = problem.items?.map(p => p.itemid).join(',');
|
let query: any = {};
|
||||||
|
|
||||||
|
if (problem.items?.length === 1 && problem.hosts?.length === 1) {
|
||||||
|
const item = problem.items[0];
|
||||||
|
const host = problem.hosts[0];
|
||||||
|
query = {
|
||||||
|
queryType: MODE_METRICS,
|
||||||
|
group: { filter: '/.*/' },
|
||||||
|
application: { filter: '' },
|
||||||
|
host: { filter: host.name },
|
||||||
|
item: { filter: item.name },
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
const itemids = problem.items?.map(p => p.itemid).join(',');
|
||||||
|
query = {
|
||||||
|
queryType: MODE_ITEMID,
|
||||||
|
itemids: itemids,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const state: any = {
|
const state: any = {
|
||||||
datasource: problem.datasource,
|
datasource: problem.datasource,
|
||||||
context: 'explore',
|
context: 'explore',
|
||||||
originPanelId: this.props.panelId,
|
originPanelId: this.props.panelId,
|
||||||
queries: [{
|
queries: [query],
|
||||||
queryType: MODE_ITEMID,
|
|
||||||
itemids: itemids,
|
|
||||||
}],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const exploreState = JSON.stringify(state);
|
const exploreState = JSON.stringify(state);
|
||||||
|
|||||||
Reference in New Issue
Block a user