diff --git a/public/app/features/panel/panel_menu.js b/public/app/features/panel/panel_menu.js index bf420f7dc15..3524a0c019f 100644 --- a/public/app/features/panel/panel_menu.js +++ b/public/app/features/panel/panel_menu.js @@ -9,15 +9,26 @@ function (angular, $, _, Tether) { angular .module('grafana.directives') - .directive('panelMenu', function($compile, linkSrv) { + .directive('panelMenu', function($sanitize, $compile, linkSrv) { var linkTemplate = '' + '' + '{{ctrl.panel.title | interpolateTemplateVars:this}}' + + '{{ctrl.panel.helpText}}' + '' + ' {{ctrl.timeInfo}}' + ''; + function sanitizeString(str) { + try { + return $sanitize(str); + } + catch(err) { + console.log('Could not sanitize annotation string, html escaping instead'); + return _.escape(str); + } + } + function createExternalLinkMenu(ctrl) { var template = '
'; template += '
'; @@ -78,6 +89,7 @@ function (angular, $, _, Tether) { var $link = $(linkTemplate); var $panelLinksBtn = $link.find(".panel-links-btn"); var $panelContainer = elem.parents(".panel-container"); + var $panelHelpDrop = $link.find(".panel-help-text"); var menuScope = null; var ctrl = $scope.ctrl; var timeout = null; @@ -92,6 +104,12 @@ function (angular, $, _, Tether) { $panelLinksBtn.css({display: showIcon ? 'inline' : 'none'}); }); + $scope.$watch('ctrl.panel.helpText', function(helpText) { + helpText = sanitizeString(helpText); + var showIcon = (helpText ? helpText.length > 0 : false) && ctrl.panel.title !== ''; + $panelHelpDrop.css({display: showIcon ? 'inline' : 'none'}); + }); + function dismiss(time, force) { clearTimeout(timeout); timeout = null; diff --git a/public/app/partials/panelgeneral.html b/public/app/partials/panelgeneral.html index 99e56cc27de..d86ae54c0de 100644 --- a/public/app/partials/panelgeneral.html +++ b/public/app/partials/panelgeneral.html @@ -27,6 +27,12 @@
+
+
+ Help Text + +
+
diff --git a/public/sass/components/_gf-form.scss b/public/sass/components/_gf-form.scss index 42498c47ac3..004ab86fb76 100644 --- a/public/sass/components/_gf-form.scss +++ b/public/sass/components/_gf-form.scss @@ -244,6 +244,11 @@ $gf-form-margin: 0.25rem; padding-left: $spacer; color: $text-color-weak; + &--bold { + color: $text-color-emphasis; + padding-left: 0; + } + &--right-absolute { position: absolute; right: $spacer; diff --git a/public/sass/pages/_dashboard.scss b/public/sass/pages/_dashboard.scss index 11933e0d76b..59875673982 100644 --- a/public/sass/pages/_dashboard.scss +++ b/public/sass/pages/_dashboard.scss @@ -73,6 +73,11 @@ div.flot-text { display: none; } +.panel-help-text { + margin-left: 10px; + display: none; +} + .panel-loading { position:absolute; top: -3px;