mirror of https://github.com/grafana/grafana
Alerting: add toggle in Loki/Prom datasource config to opt out of alerting ui (#36552)
* wip * fix useIsRuleEditable * test for detecting editable-ness of a rules datasource * tests! * fix lint errors * add alerting ui opt-out toggle to loki and prom datasources * Apply suggestions from code review Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>pull/36702/head
parent
3ea8880d7f
commit
32a551b4ca
@ -0,0 +1,33 @@ |
||||
import { DataSourcePluginOptionsEditorProps } from '@grafana/data'; |
||||
import React from 'react'; |
||||
import { Switch } from '../Forms/Legacy/Switch/Switch'; |
||||
|
||||
type Props<T> = Pick<DataSourcePluginOptionsEditorProps<T>, 'options' | 'onOptionsChange'>; |
||||
|
||||
export function AlertingSettings<T extends { manageAlerts?: boolean }>({ |
||||
options, |
||||
onOptionsChange, |
||||
}: Props<T>): JSX.Element { |
||||
return ( |
||||
<> |
||||
<h3 className="page-heading">Alerting</h3> |
||||
<div className="gf-form-group"> |
||||
<div className="gf-form-inline"> |
||||
<div className="gf-form"> |
||||
<Switch |
||||
label="Manage alerts via Alerting UI" |
||||
labelClass="width-13" |
||||
checked={options.jsonData.manageAlerts !== false} |
||||
onChange={(event) => |
||||
onOptionsChange({ |
||||
...options, |
||||
jsonData: { ...options.jsonData, manageAlerts: event!.currentTarget.checked }, |
||||
}) |
||||
} |
||||
/> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</> |
||||
); |
||||
} |
||||
Loading…
Reference in new issue