diff --git a/.changeset/happy-trainers-sniff.md b/.changeset/happy-trainers-sniff.md new file mode 100644 index 0000000..3bbb904 --- /dev/null +++ b/.changeset/happy-trainers-sniff.md @@ -0,0 +1,5 @@ +--- +'grafana-zabbix': minor +--- + +Problems Panel: Add option to show data source name diff --git a/devenv/dashboards/zabbix_datasource_features.json b/devenv/dashboards/zabbix_datasource_features.json index 3b243d7..e3bd80b 100644 --- a/devenv/dashboards/zabbix_datasource_features.json +++ b/devenv/dashboards/zabbix_datasource_features.json @@ -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, diff --git a/src/panel-triggers/components/AlertList/AlertCard.tsx b/src/panel-triggers/components/AlertList/AlertCard.tsx index 3f6e5f1..c3573b6 100644 --- a/src/panel-triggers/components/AlertList/AlertCard.tsx +++ b/src/panel-triggers/components/AlertList/AlertCard.tsx @@ -36,7 +36,6 @@ export default class AlertCard extends PureComponent { 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 { - {showDatasourceName && ( + {panelOptions.showDatasourceName && (
diff --git a/src/panel-triggers/migrations.ts b/src/panel-triggers/migrations.ts index 9a6a185..939b331 100644 --- a/src/panel-triggers/migrations.ts +++ b/src/panel-triggers/migrations.ts @@ -205,6 +205,7 @@ export const problemsPanelMigrationHandler = (panel: PanelModel(ProblemsPanel) defaultValue: defaultPanelOptions.descriptionAtNewLine, showIf: (options) => options.layout === 'list', category: ['Fields'], + }) + .addBooleanSwitch({ + path: 'showDatasourceName', + name: 'Datasource name', + defaultValue: defaultPanelOptions.showDatasourceName, + category: ['Fields'], }); }); diff --git a/src/panel-triggers/types.ts b/src/panel-triggers/types.ts index c8620d9..c1ee546 100644 --- a/src/panel-triggers/types.ts +++ b/src/panel-triggers/types.ts @@ -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 = { opdataField: false, descriptionField: true, descriptionAtNewLine: false, + showDatasourceName: false, // Options sortProblems: 'lastchange', limit: undefined,