Feat: add option to show data source name (#2007)
Original [PR](https://github.com/grafana/grafana-zabbix/pull/2003) Fixes #1766 --------- Co-authored-by: olaf <olaf@initworks.com>
This commit is contained in:
5
.changeset/happy-trainers-sniff.md
Normal file
5
.changeset/happy-trainers-sniff.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'grafana-zabbix': minor
|
||||
---
|
||||
|
||||
Problems Panel: Add option to show data source name
|
||||
@@ -37,6 +37,7 @@
|
||||
"uid": "PCAF1C06DCF802728"
|
||||
},
|
||||
"descriptionAtNewLine": false,
|
||||
"showDatasourceName": false,
|
||||
"descriptionField": true,
|
||||
"fontSize": "100%",
|
||||
"gridPos": {
|
||||
@@ -64,6 +65,7 @@
|
||||
"allowDangerousHTML": false,
|
||||
"customLastChangeFormat": false,
|
||||
"descriptionAtNewLine": false,
|
||||
"showDatasourceName": false,
|
||||
"descriptionField": true,
|
||||
"fontSize": "100%",
|
||||
"highlightBackground": false,
|
||||
|
||||
@@ -36,7 +36,6 @@ export default class AlertCard extends PureComponent<AlertCardProps> {
|
||||
|
||||
render() {
|
||||
const { problem, panelOptions } = this.props;
|
||||
const showDatasourceName = panelOptions.targets && panelOptions.targets.length > 1;
|
||||
const cardClass = cx('alert-rule-item', 'zbx-trigger-card', {
|
||||
'zbx-trigger-highlighted': panelOptions.highlightBackground,
|
||||
});
|
||||
@@ -153,7 +152,7 @@ export default class AlertCard extends PureComponent<AlertCardProps> {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{showDatasourceName && (
|
||||
{panelOptions.showDatasourceName && (
|
||||
<div className="alert-rule-item__time zabbix-trigger-source">
|
||||
<span>
|
||||
<i className="fa fa-database"></i>
|
||||
|
||||
@@ -205,6 +205,7 @@ export const problemsPanelMigrationHandler = (panel: PanelModel<Partial<Problems
|
||||
ageField: panel.ageField,
|
||||
descriptionField: panel.descriptionField,
|
||||
descriptionAtNewLine: panel.descriptionAtNewLine,
|
||||
showDatasourceName: panel.showDatasourceName,
|
||||
hostsInMaintenance: panel.hostsInMaintenance,
|
||||
showTriggers: panel.showTriggers,
|
||||
sortProblems: panel.sortProblems,
|
||||
|
||||
@@ -214,6 +214,12 @@ export const plugin = new PanelPlugin<ProblemsPanelOptions, {}>(ProblemsPanel)
|
||||
defaultValue: defaultPanelOptions.descriptionAtNewLine,
|
||||
showIf: (options) => options.layout === 'list',
|
||||
category: ['Fields'],
|
||||
})
|
||||
.addBooleanSwitch({
|
||||
path: 'showDatasourceName',
|
||||
name: 'Datasource name',
|
||||
defaultValue: defaultPanelOptions.showDatasourceName,
|
||||
category: ['Fields'],
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ export interface ProblemsPanelOptions {
|
||||
opdataField?: boolean;
|
||||
descriptionField?: boolean;
|
||||
descriptionAtNewLine?: boolean;
|
||||
showDatasourceName?: boolean;
|
||||
// Options
|
||||
hostsInMaintenance?: boolean;
|
||||
showTriggers?: 'all triggers' | 'unacknowledged' | 'acknowledged';
|
||||
@@ -70,6 +71,7 @@ export const defaultPanelOptions: Partial<ProblemsPanelOptions> = {
|
||||
opdataField: false,
|
||||
descriptionField: true,
|
||||
descriptionAtNewLine: false,
|
||||
showDatasourceName: false,
|
||||
// Options
|
||||
sortProblems: 'lastchange',
|
||||
limit: undefined,
|
||||
|
||||
Reference in New Issue
Block a user