From 42de27a2cb2cb99ccb08a73fd7cb76c1cffcfed2 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Tue, 6 Dec 2016 03:54:44 -0800 Subject: [PATCH 01/10] Added help text for users --- public/app/features/panel/panel_menu.js | 1 + public/app/partials/panelgeneral.html | 7 +++++++ public/sass/components/_gf-form.scss | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/public/app/features/panel/panel_menu.js b/public/app/features/panel/panel_menu.js index bf420f7dc15..cb6f74fb89d 100644 --- a/public/app/features/panel/panel_menu.js +++ b/public/app/features/panel/panel_menu.js @@ -14,6 +14,7 @@ function (angular, $, _, Tether) { '' + '' + '{{ctrl.panel.title | interpolateTemplateVars:this}}' + + '{{ctrl.panel.helpText}}' + '' + ' {{ctrl.timeInfo}}' + ''; diff --git a/public/app/partials/panelgeneral.html b/public/app/partials/panelgeneral.html index 99e56cc27de..077660302e9 100644 --- a/public/app/partials/panelgeneral.html +++ b/public/app/partials/panelgeneral.html @@ -27,6 +27,13 @@ +
+
+ Help Text + + +
+
diff --git a/public/sass/components/_gf-form.scss b/public/sass/components/_gf-form.scss index 42498c47ac3..877276b674b 100644 --- a/public/sass/components/_gf-form.scss +++ b/public/sass/components/_gf-form.scss @@ -244,6 +244,10 @@ $gf-form-margin: 0.25rem; padding-left: $spacer; color: $text-color-weak; + &--bold { + color: $text-color-emphasis; + } + &--right-absolute { position: absolute; right: $spacer; From 034d84354ea474e472165e6880b8ee94c1e5c7a9 Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Tue, 6 Dec 2016 03:58:38 -0800 Subject: [PATCH 02/10] Fixed HelpText input box --- public/app/partials/panelgeneral.html | 1 - 1 file changed, 1 deletion(-) diff --git a/public/app/partials/panelgeneral.html b/public/app/partials/panelgeneral.html index 077660302e9..d86ae54c0de 100644 --- a/public/app/partials/panelgeneral.html +++ b/public/app/partials/panelgeneral.html @@ -30,7 +30,6 @@
Help Text -
From 13f0b32a8ff43f394c270ed8f3afb9d30bf7ccda Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Tue, 6 Dec 2016 05:24:03 -0800 Subject: [PATCH 03/10] Added sanitizer to help text --- public/app/features/panel/panel_menu.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/public/app/features/panel/panel_menu.js b/public/app/features/panel/panel_menu.js index cb6f74fb89d..3524a0c019f 100644 --- a/public/app/features/panel/panel_menu.js +++ b/public/app/features/panel/panel_menu.js @@ -9,7 +9,7 @@ function (angular, $, _, Tether) { angular .module('grafana.directives') - .directive('panelMenu', function($compile, linkSrv) { + .directive('panelMenu', function($sanitize, $compile, linkSrv) { var linkTemplate = '' + '' + @@ -19,6 +19,16 @@ function (angular, $, _, Tether) { ' {{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 += '
'; @@ -79,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; @@ -93,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; From 6b26a0f91d1a9c3ca7f9c8594b8f5b277b74825e Mon Sep 17 00:00:00 2001 From: utkarshcmu Date: Tue, 6 Dec 2016 05:53:33 -0800 Subject: [PATCH 04/10] Fixed hover position --- public/sass/components/_gf-form.scss | 1 + public/sass/pages/_dashboard.scss | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/public/sass/components/_gf-form.scss b/public/sass/components/_gf-form.scss index 877276b674b..004ab86fb76 100644 --- a/public/sass/components/_gf-form.scss +++ b/public/sass/components/_gf-form.scss @@ -246,6 +246,7 @@ $gf-form-margin: 0.25rem; &--bold { color: $text-color-emphasis; + padding-left: 0; } &--right-absolute { 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; From 467ddc19c3f1f6dd767e904230f748b2bb18a5aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 14 Dec 2016 17:22:19 +0100 Subject: [PATCH 05/10] feat(panel): worked on panel description tooltip, #6847 --- public/app/features/panel/panel_menu.js | 8 +-- public/app/features/panellinks/module.html | 78 +++++++++------------- public/app/partials/panelgeneral.html | 54 ++++++++------- 3 files changed, 64 insertions(+), 76 deletions(-) diff --git a/public/app/features/panel/panel_menu.js b/public/app/features/panel/panel_menu.js index 3524a0c019f..a6a3fa9ae78 100644 --- a/public/app/features/panel/panel_menu.js +++ b/public/app/features/panel/panel_menu.js @@ -14,7 +14,7 @@ function (angular, $, _, Tether) { '' + '' + '{{ctrl.panel.title | interpolateTemplateVars:this}}' + - '{{ctrl.panel.helpText}}' + + '{{ctrl.panel.description}}' + '' + ' {{ctrl.timeInfo}}' + ''; @@ -104,9 +104,9 @@ 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 !== ''; + $scope.$watch('ctrl.panel.description', function(description) { + description = sanitizeString(description); + var showIcon = (description ? description.length > 0 : false) && ctrl.panel.title !== ''; $panelHelpDrop.css({display: showIcon ? 'inline' : 'none'}); }); diff --git a/public/app/features/panellinks/module.html b/public/app/features/panellinks/module.html index 0cc977f7a9b..96d9b785a1b 100644 --- a/public/app/features/panellinks/module.html +++ b/public/app/features/panellinks/module.html @@ -3,60 +3,44 @@ Drilldown / detail linkThese links appear in the dropdown menu in the panel menu. -
-
- -
-
- -
- -
- Type -
- -
-
- -
- Dashboard - - - Url - -
- -
- +
+
+
+ Type +
+
-
-
- -
+
+ Dashboard + -
-
Title
- -
- -
- Url params - -
+ Url +
-
-
- -
+
+
Title
+ +
-
- - - -
+
+ +
+
+ Url params + +
+ + + + +
+ +
+
+
diff --git a/public/app/partials/panelgeneral.html b/public/app/partials/panelgeneral.html index d86ae54c0de..a69884dc5cc 100644 --- a/public/app/partials/panelgeneral.html +++ b/public/app/partials/panelgeneral.html @@ -1,40 +1,44 @@ -
-
-
- Title - -
+
+
+
Info
- Span - + Title +
-
- Height - +
+ Description +
-
-
-
- Repeat Panel - +
+
Dimensions
+
+ Span +
- Min span + Height + +
+ +
+ +
+
Templating
+
+ Repeat Panel + +
+
+ Min span
-
-
- Help Text - -
-
-
+
- + From ca7bc25c83c24515761eb75c97774624962a127a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 16 Dec 2016 10:34:00 +0100 Subject: [PATCH 06/10] feat(panel): working on panel help text, #4079 , #6847 --- public/app/features/dashboard/model.ts | 4 +- .../dashboard}/partials/inspector.html | 3 +- .../dashboard/partials/panel_info.html | 18 +++++++ .../app/features/panel/metrics_panel_ctrl.ts | 1 - public/app/features/panel/panel_ctrl.ts | 20 +++++--- public/app/features/panel/panel_directive.ts | 51 +++++++++++++++++-- public/app/features/panel/panel_menu.js | 20 +------- public/sass/components/_alerts.scss | 4 +- public/sass/components/_drop.scss | 2 +- public/sass/components/_view_states.scss | 1 + public/sass/pages/_dashboard.scss | 28 ++++++++-- 11 files changed, 111 insertions(+), 41 deletions(-) rename public/app/{ => features/dashboard}/partials/inspector.html (95%) create mode 100644 public/app/features/dashboard/partials/panel_info.html diff --git a/public/app/features/dashboard/model.ts b/public/app/features/dashboard/model.ts index 6b8b2ed36d7..cff82d1ffb0 100644 --- a/public/app/features/dashboard/model.ts +++ b/public/app/features/dashboard/model.ts @@ -51,7 +51,7 @@ export class DashboardModel { this.style = data.style || "dark"; this.timezone = data.timezone || ''; this.editable = data.editable !== false; - this.graphTooltip = data.graphTooltip || false; + this.graphTooltip = data.graphTooltip || 0; this.hideControls = data.hideControls || false; this.time = data.time || { from: 'now-6h', to: 'now' }; this.timepicker = data.timepicker || {}; @@ -272,7 +272,7 @@ export class DashboardModel { } sharedTooltipModeEnabled() { - return this.graphTooltip !== 0; + return this.graphTooltip > 0; } sharedCrosshairModeOnly() { diff --git a/public/app/partials/inspector.html b/public/app/features/dashboard/partials/inspector.html similarity index 95% rename from public/app/partials/inspector.html rename to public/app/features/dashboard/partials/inspector.html index 228dfc7041e..37a1516c0b9 100644 --- a/public/app/partials/inspector.html +++ b/public/app/features/dashboard/partials/inspector.html @@ -1,7 +1,8 @@