From edcef7d078524774131cd3f0135b0d71bfbdb14b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 18 Jan 2016 12:12:05 +0100 Subject: [PATCH] fix(graph): fixed for graph series color selector popover, broken in recent 3.0-pre1 build, fixes #3774 --- public/app/core/components/grafana_app.ts | 14 +++++++++++--- public/app/plugins/panel/graph/legend.js | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/public/app/core/components/grafana_app.ts b/public/app/core/components/grafana_app.ts index 35ea141d03c..07799de518b 100644 --- a/public/app/core/components/grafana_app.ts +++ b/public/app/core/components/grafana_app.ts @@ -165,22 +165,30 @@ export function grafanaAppDirective() { // handle document clicks that should hide things elem.click(function(evt) { - if ($(evt.target).parents().length === 0) { + var target = $(evt.target); + if (target.parents().length === 0) { return; } // hide search if (elem.find('.search-container').length > 0) { - if ($(evt.target).parents('.search-container').length === 0) { + if (target.parents('.search-container').length === 0) { scope.appEvent('hide-dash-search'); } } // hide sidemenu if (!ignoreSideMenuHide && elem.find('.sidemenu').length > 0) { - if ($(evt.target).parents('.sidemenu').length === 0) { + if (target.parents('.sidemenu').length === 0) { scope.$apply(() => scope.contextSrv.toggleSideMenu()); } } + + // hide popovers + var popover = elem.find('.popover'); + console.log(target.parents('.graph-legend').length); + if (popover.length > 0 && target.parents('.graph-legend').length === 0) { + popover.hide(); + } }); } }; diff --git a/public/app/plugins/panel/graph/legend.js b/public/app/plugins/panel/graph/legend.js index 2d3f8ac3b90..cf64d90414b 100644 --- a/public/app/plugins/panel/graph/legend.js +++ b/public/app/plugins/panel/graph/legend.js @@ -45,7 +45,7 @@ function (angular, _, $) { popoverScope.series = seriesInfo; popoverSrv.show({ element: el, - templateUrl: 'app/plugins/panels/graph/legend.popover.html', + templateUrl: 'app/plugins/panel/graph/legend.popover.html', scope: popoverScope }); }