From 98df2ec745ef137b281de68a687338580104e663 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Fri, 24 Apr 2020 10:42:13 +0200 Subject: [PATCH] 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 --- public/app/features/alerting/NotificationsEditCtrl.ts | 5 +++++ .../features/alerting/partials/notification_edit.html | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/public/app/features/alerting/NotificationsEditCtrl.ts b/public/app/features/alerting/NotificationsEditCtrl.ts index 7ea0137ae29..f967e7924c1 100644 --- a/public/app/features/alerting/NotificationsEditCtrl.ts +++ b/public/app/features/alerting/NotificationsEditCtrl.ts @@ -4,6 +4,7 @@ import { getBackendSrv } from '@grafana/runtime'; import { AppEvents } from '@grafana/data'; import { IScope } from 'angular'; import { promiseToDigest } from '../../core/utils/promiseToDigest'; +import config from 'app/core/config'; export class AlertNotificationEditCtrl { theForm: any; @@ -27,6 +28,7 @@ export class AlertNotificationEditCtrl { isDefault: false, }; getFrequencySuggestion: any; + rendererAvailable: boolean; /** @ngInject */ constructor( @@ -43,6 +45,9 @@ export class AlertNotificationEditCtrl { return ['1m', '5m', '10m', '15m', '30m', '1h']; }; + this.defaults.settings.uploadImage = config.rendererAvailable; + this.rendererAvailable = config.rendererAvailable; + promiseToDigest(this.$scope)( getBackendSrv() .get(`/api/alert-notifiers`) diff --git a/public/app/features/alerting/partials/notification_edit.html b/public/app/features/alerting/partials/notification_edit.html index 81d52cb2681..77bf2a1e465 100644 --- a/public/app/features/alerting/partials/notification_edit.html +++ b/public/app/features/alerting/partials/notification_edit.html @@ -32,6 +32,16 @@ checked="ctrl.model.settings.uploadImage" tooltip="Captures an image and include it in the notification"> +
+
No image renderer available/installed
+

+ Grafana cannot find an image renderer to capture an image for the notification. + Please make sure the Grafana Image Renderer plugin is installed. +

+

+ Please contact your Grafana administrator to install the plugin. +

+