Commit 98df2ec7 by Marcus Efraimsson Committed by GitHub

Alerting: Handle image renderer unavailable when edit notifiers (#23711)

If no image renderer available/installed when adding a new  alert notification 
channel will set Include image to false per default, otherwise true as before.
If no image renderer available/installed when adding/edit alert notification 
channel will show an informational message that you need to install the 
Grafana Image Renderer plugin for Grafana to be able to render an image. 

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
parent 52154b46
...@@ -4,6 +4,7 @@ import { getBackendSrv } from '@grafana/runtime'; ...@@ -4,6 +4,7 @@ import { getBackendSrv } from '@grafana/runtime';
import { AppEvents } from '@grafana/data'; import { AppEvents } from '@grafana/data';
import { IScope } from 'angular'; import { IScope } from 'angular';
import { promiseToDigest } from '../../core/utils/promiseToDigest'; import { promiseToDigest } from '../../core/utils/promiseToDigest';
import config from 'app/core/config';
export class AlertNotificationEditCtrl { export class AlertNotificationEditCtrl {
theForm: any; theForm: any;
...@@ -27,6 +28,7 @@ export class AlertNotificationEditCtrl { ...@@ -27,6 +28,7 @@ export class AlertNotificationEditCtrl {
isDefault: false, isDefault: false,
}; };
getFrequencySuggestion: any; getFrequencySuggestion: any;
rendererAvailable: boolean;
/** @ngInject */ /** @ngInject */
constructor( constructor(
...@@ -43,6 +45,9 @@ export class AlertNotificationEditCtrl { ...@@ -43,6 +45,9 @@ export class AlertNotificationEditCtrl {
return ['1m', '5m', '10m', '15m', '30m', '1h']; return ['1m', '5m', '10m', '15m', '30m', '1h'];
}; };
this.defaults.settings.uploadImage = config.rendererAvailable;
this.rendererAvailable = config.rendererAvailable;
promiseToDigest(this.$scope)( promiseToDigest(this.$scope)(
getBackendSrv() getBackendSrv()
.get(`/api/alert-notifiers`) .get(`/api/alert-notifiers`)
......
...@@ -32,6 +32,16 @@ ...@@ -32,6 +32,16 @@
checked="ctrl.model.settings.uploadImage" checked="ctrl.model.settings.uploadImage"
tooltip="Captures an image and include it in the notification"> tooltip="Captures an image and include it in the notification">
</gf-form-switch> </gf-form-switch>
<div class="grafana-info-box m-t-2" ng-show="ctrl.model.settings.uploadImage && !ctrl.rendererAvailable">
<h5>No image renderer available/installed</h5>
<p>
Grafana cannot find an image renderer to capture an image for the notification.
Please make sure the <a href="https://grafana.com/grafana/plugins/grafana-image-renderer" target="_blank" rel="noreferrer">Grafana Image Renderer plugin</a> is installed.
</p>
<p>
Please contact your Grafana administrator to install the plugin.
</p>
</div>
<gf-form-switch <gf-form-switch
class="gf-form" class="gf-form"
label="Disable Resolve Message" label="Disable Resolve Message"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment