problems: make timeline optional

This commit is contained in:
Alexander Zobnin
2019-02-13 20:21:18 +03:00
parent 58f1ee07eb
commit 9cabb58ac1
5 changed files with 15 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ import FAIcon from '../FAIcon';
interface ProblemDetailsProps extends RTRow<ZBXTrigger> {
rootWidth: number;
timeRange: GFTimeRange;
showTimeline?: boolean;
getProblemEvents: (problem: ZBXTrigger) => Promise<ZBXEvent[]>;
onProblemAck?: (problem: ZBXTrigger, data: AckProblemData) => Promise<any> | any;
onTagClick?: (tag: ZBXTag, datasource: string, ctrlKey?: boolean, shiftKey?: boolean) => void;
@@ -35,7 +36,9 @@ export default class ProblemDetails extends PureComponent<ProblemDetailsProps, P
}
componentDidMount() {
this.fetchProblemEvents();
if (this.props.showTimeline) {
this.fetchProblemEvents();
}
requestAnimationFrame(() => {
this.setState({ show: true });
});
@@ -119,7 +122,7 @@ export default class ProblemDetails extends PureComponent<ProblemDetailsProps, P
}
</div>
}
{this.state.events.length > 0 &&
{this.props.showTimeline && this.state.events.length > 0 &&
<ProblemTimeline events={this.state.events} timeRange={this.props.timeRange} />
}
{showAcknowledges && !wideLayout &&

View File

@@ -157,6 +157,7 @@ export default class ProblemList extends PureComponent<ProblemListProps, Problem
<ProblemDetails {...props}
rootWidth={this.rootWidth}
timeRange={this.props.timeRange}
showTimeline={panelOptions.problemTimeline}
getProblemEvents={this.props.getProblemEvents}
onProblemAck={this.handleProblemAck}
onTagClick={this.handleTagClick}