problems: make timeline optional
This commit is contained in:
@@ -13,6 +13,7 @@ import FAIcon from '../FAIcon';
|
|||||||
interface ProblemDetailsProps extends RTRow<ZBXTrigger> {
|
interface ProblemDetailsProps extends RTRow<ZBXTrigger> {
|
||||||
rootWidth: number;
|
rootWidth: number;
|
||||||
timeRange: GFTimeRange;
|
timeRange: GFTimeRange;
|
||||||
|
showTimeline?: boolean;
|
||||||
getProblemEvents: (problem: ZBXTrigger) => Promise<ZBXEvent[]>;
|
getProblemEvents: (problem: ZBXTrigger) => Promise<ZBXEvent[]>;
|
||||||
onProblemAck?: (problem: ZBXTrigger, data: AckProblemData) => Promise<any> | any;
|
onProblemAck?: (problem: ZBXTrigger, data: AckProblemData) => Promise<any> | any;
|
||||||
onTagClick?: (tag: ZBXTag, datasource: string, ctrlKey?: boolean, shiftKey?: boolean) => void;
|
onTagClick?: (tag: ZBXTag, datasource: string, ctrlKey?: boolean, shiftKey?: boolean) => void;
|
||||||
@@ -35,7 +36,9 @@ export default class ProblemDetails extends PureComponent<ProblemDetailsProps, P
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.fetchProblemEvents();
|
if (this.props.showTimeline) {
|
||||||
|
this.fetchProblemEvents();
|
||||||
|
}
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
this.setState({ show: true });
|
this.setState({ show: true });
|
||||||
});
|
});
|
||||||
@@ -119,7 +122,7 @@ export default class ProblemDetails extends PureComponent<ProblemDetailsProps, P
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{this.state.events.length > 0 &&
|
{this.props.showTimeline && this.state.events.length > 0 &&
|
||||||
<ProblemTimeline events={this.state.events} timeRange={this.props.timeRange} />
|
<ProblemTimeline events={this.state.events} timeRange={this.props.timeRange} />
|
||||||
}
|
}
|
||||||
{showAcknowledges && !wideLayout &&
|
{showAcknowledges && !wideLayout &&
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ export default class ProblemList extends PureComponent<ProblemListProps, Problem
|
|||||||
<ProblemDetails {...props}
|
<ProblemDetails {...props}
|
||||||
rootWidth={this.rootWidth}
|
rootWidth={this.rootWidth}
|
||||||
timeRange={this.props.timeRange}
|
timeRange={this.props.timeRange}
|
||||||
|
showTimeline={panelOptions.problemTimeline}
|
||||||
getProblemEvents={this.props.getProblemEvents}
|
getProblemEvents={this.props.getProblemEvents}
|
||||||
onProblemAck={this.handleProblemAck}
|
onProblemAck={this.handleProblemAck}
|
||||||
onTagClick={this.handleTagClick}
|
onTagClick={this.handleTagClick}
|
||||||
|
|||||||
@@ -146,6 +146,13 @@
|
|||||||
ng-model="ctrl.panel.pageSize"
|
ng-model="ctrl.panel.pageSize"
|
||||||
ng-model-onblur ng-change="ctrl.render()">
|
ng-model-onblur ng-change="ctrl.render()">
|
||||||
</div>
|
</div>
|
||||||
|
<gf-form-switch ng-if="ctrl.panel.layout === 'table'"
|
||||||
|
class="gf-form"
|
||||||
|
label-class="width-10"
|
||||||
|
label="Problem timeline"
|
||||||
|
checked="ctrl.panel.problemTimeline"
|
||||||
|
on-change="ctrl.render()">
|
||||||
|
</gf-form-switch>
|
||||||
<gf-form-switch class="gf-form"
|
<gf-form-switch class="gf-form"
|
||||||
label-class="width-10"
|
label-class="width-10"
|
||||||
label="Highlight background"
|
label="Highlight background"
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ export const PANEL_DEFAULTS = {
|
|||||||
layout: 'table',
|
layout: 'table',
|
||||||
fontSize: '100%',
|
fontSize: '100%',
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
problemTimeline: true,
|
||||||
highlightBackground: false,
|
highlightBackground: false,
|
||||||
highlightNewEvents: false,
|
highlightNewEvents: false,
|
||||||
highlightNewerThan: '1h',
|
highlightNewerThan: '1h',
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export interface ProblemsPanelOptions {
|
|||||||
// View options
|
// View options
|
||||||
fontSize?: string;
|
fontSize?: string;
|
||||||
pageSize?: number;
|
pageSize?: number;
|
||||||
|
problemTimeline?: boolean;
|
||||||
highlightBackground?: boolean;
|
highlightBackground?: boolean;
|
||||||
highlightNewEvents?: boolean;
|
highlightNewEvents?: boolean;
|
||||||
highlightNewerThan?: string;
|
highlightNewerThan?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user