Problems: Add operational data field, closes #1260

This commit is contained in:
Alexander Zobnin
2023-01-20 16:51:54 +01:00
parent bc62e35477
commit 41d292c51d
5 changed files with 20 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ export function joinTriggersWithProblems(problems: ZBXProblem[], triggers: ZBXTr
description: p.name || t.description,
comments: t.comments,
value: t.value,
opdata: p.opdata,
groups: t.groups,
hosts: t.hosts,
items: t.items,

View File

@@ -235,6 +235,7 @@ export interface ProblemDTO {
proxy?: string;
severity?: string;
priority?: string;
opdata?: string;
acknowledged?: '1' | '0';
acknowledges?: ZBXAcknowledge[];

View File

@@ -174,6 +174,7 @@ export default class ProblemList extends PureComponent<ProblemListProps, Problem
},
{ Header: 'Status', accessor: 'value', show: options.statusField, width: 100, Cell: statusCell },
{ Header: 'Problem', accessor: 'name', minWidth: 200, Cell: ProblemCell },
{ Header: 'Operational data', accessor: 'opdata', show: options.opdataField, width: 150, Cell: OpdataCell },
{
Header: 'Ack',
id: 'ack',
@@ -362,6 +363,15 @@ function ProblemCell(props: RTCell<ProblemDTO>) {
);
}
function OpdataCell(props: RTCell<ProblemDTO>) {
const problem = props.original;
return (
<div>
<span>{problem.opdata}</span>
</div>
);
}
function AgeCell(props: RTCell<ProblemDTO>) {
const problem = props.original;
const timestamp = moment.unix(problem.timestamp);

View File

@@ -195,6 +195,12 @@ export const plugin = new PanelPlugin<ProblemsPanelOptions, {}>(ProblemsPanel)
defaultValue: defaultPanelOptions.ageField,
category: ['Fields'],
})
.addBooleanSwitch({
path: 'opdataField',
name: 'Operational data',
defaultValue: defaultPanelOptions.opdataField,
category: ['Fields'],
})
.addBooleanSwitch({
path: 'descriptionField',
name: 'Description',

View File

@@ -16,6 +16,7 @@ export interface ProblemsPanelOptions {
severityField?: boolean;
ackField?: boolean;
ageField?: boolean;
opdataField?: boolean;
descriptionField?: boolean;
descriptionAtNewLine?: boolean;
// Options
@@ -66,6 +67,7 @@ export const defaultPanelOptions: Partial<ProblemsPanelOptions> = {
severityField: true,
ackField: true,
ageField: false,
opdataField: false,
descriptionField: true,
descriptionAtNewLine: false,
// Options