Skip to content

Commit

Permalink
fix: restore support for Grafana versions below v10 #159 (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
Loori-R authored Jul 31, 2024
1 parent d25ea09 commit 0f198ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## tip

* BUGFIX: restore support for Grafana versions below `10.0.0`. See [this issue](https://github.com/VictoriaMetrics/victoriametrics-datasource/issues/159).

## [v0.8.4](https://github.com/VictoriaMetrics/victoriametrics-datasource/releases/tag/v0.8.4)

* BUGFIX: fix label join function in builder mode. See [this issue](https://github.com/VictoriaMetrics/victoriametrics-datasource/issues/162).
Expand Down
9 changes: 8 additions & 1 deletion src/configuration/ConfigEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ import { HelpfulLinks } from "./HelpfulLinks";
import { LimitsSettings } from "./LimitsSettings";
import { PromSettings } from './PromSettings';

export enum DataSourceType {
Alertmanager = 'alertmanager',
}

export type Props = DataSourcePluginOptionsEditorProps<PromOptions>;
export const ConfigEditor = (props: Props) => {
const { options, onOptionsChange } = props;
Expand All @@ -45,6 +49,8 @@ export const ConfigEditor = (props: Props) => {
azureSettingsUI: AzureAuthSettings,
};

const alertmanagers = Object.values(config.datasources).filter((ds) => ds.type === DataSourceType.Alertmanager);

return (
<>
<HelpfulLinks/>
Expand All @@ -59,7 +65,8 @@ export const ConfigEditor = (props: Props) => {
renderSigV4Editor={<SIGV4ConnectionConfig {...props}></SIGV4ConnectionConfig>}
/>

<AlertingSettings<PromOptions> {...props}/>
{/*// @ts-ignore The prop `alertmanagerDataSources` is absent in Grafana > 10.0.0. */}
<AlertingSettings<PromOptions> {...props} alertmanagerDataSources={alertmanagers}/>

<PromSettings {...props}/>

Expand Down

0 comments on commit 0f198ce

Please sign in to comment.