Execute scripts from problem details
This commit is contained in:
@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
|
||||
import moment from 'moment';
|
||||
import * as utils from '../../../datasource-zabbix/utils';
|
||||
import { ProblemDTO, ZBXHost, ZBXGroup, ZBXEvent, ZBXTag, ZBXAlert } from '../../../datasource-zabbix/types';
|
||||
import { ZBXScript } from '../../../datasource-zabbix/zabbix/connectors/zabbix_api/types';
|
||||
import { ZBXScript, APIExecuteScriptResponse } from '../../../datasource-zabbix/zabbix/connectors/zabbix_api/types';
|
||||
import { ZBXItem, GFTimeRange, RTRow } from '../../types';
|
||||
import { AckModal, AckProblemData } from '../AckModal';
|
||||
import EventTag from '../EventTag';
|
||||
@@ -10,7 +10,7 @@ import ProblemStatusBar from './ProblemStatusBar';
|
||||
import AcknowledgesList from './AcknowledgesList';
|
||||
import ProblemTimeline from './ProblemTimeline';
|
||||
import { FAIcon, ExploreButton, AckButton, Tooltip, ModalController, ExecScriptButton } from '../../../components';
|
||||
import { ExecScriptModal } from '../ExecScriptModal';
|
||||
import { ExecScriptModal, ExecScriptData } from '../ExecScriptModal';
|
||||
|
||||
interface ProblemDetailsProps extends RTRow<ProblemDTO> {
|
||||
rootWidth: number;
|
||||
@@ -20,6 +20,7 @@ interface ProblemDetailsProps extends RTRow<ProblemDTO> {
|
||||
getProblemEvents: (problem: ProblemDTO) => Promise<ZBXEvent[]>;
|
||||
getProblemAlerts: (problem: ProblemDTO) => Promise<ZBXAlert[]>;
|
||||
getScripts: (problem: ProblemDTO) => Promise<ZBXScript[]>;
|
||||
onExecuteScript(problem: ProblemDTO, scriptid: string): Promise<APIExecuteScriptResponse>;
|
||||
onProblemAck?: (problem: ProblemDTO, data: AckProblemData) => Promise<any> | any;
|
||||
onTagClick?: (tag: ZBXTag, datasource: string, ctrlKey?: boolean, shiftKey?: boolean) => void;
|
||||
}
|
||||
@@ -82,6 +83,11 @@ export class ProblemDetails extends PureComponent<ProblemDetailsProps, ProblemDe
|
||||
return this.props.getScripts(problem);
|
||||
}
|
||||
|
||||
onExecuteScript = (data: ExecScriptData) => {
|
||||
const problem = this.props.original as ProblemDTO;
|
||||
return this.props.onExecuteScript(problem, data.scriptid);
|
||||
}
|
||||
|
||||
render() {
|
||||
const problem = this.props.original as ProblemDTO;
|
||||
const alerts = this.state.alerts;
|
||||
@@ -117,7 +123,7 @@ export class ProblemDetails extends PureComponent<ProblemDetailsProps, ProblemDe
|
||||
onClick={() => {
|
||||
showModal(ExecScriptModal, {
|
||||
getScripts: this.getScripts,
|
||||
onSubmit: this.ackProblem,
|
||||
onSubmit: this.onExecuteScript,
|
||||
onDismiss: hideModal,
|
||||
});
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user