From 400ca26d39534fcede8d2bf09356be93b8ef509d Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Wed, 9 Nov 2016 07:31:51 -0800 Subject: [PATCH] Remove dark theme when leaving the Dashboard app. --- src/core_plugins/kibana/public/dashboard/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core_plugins/kibana/public/dashboard/index.js b/src/core_plugins/kibana/public/dashboard/index.js index e928e00c3c16b..a309c5275180f 100644 --- a/src/core_plugins/kibana/public/dashboard/index.js +++ b/src/core_plugins/kibana/public/dashboard/index.js @@ -75,8 +75,6 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, } } - $scope.$on('$destroy', dash.destroy); - const matchQueryFilter = function (filter) { return filter.query && filter.query.query_string && !filter.meta; }; @@ -103,6 +101,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, $scope.$watchCollection('state.options', function (newVal, oldVal) { if (!angular.equals(newVal, oldVal)) $state.save(); }); + $scope.$watch('state.options.darkTheme', setDarkTheme); $scope.topNavMenu = [{ @@ -154,7 +153,14 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, stateMonitor.onChange((status) => { $appStatus.dirty = status.dirty; }); - $scope.$on('$destroy', () => stateMonitor.destroy()); + + $scope.$on('$destroy', () => { + stateMonitor.destroy(); + dash.destroy(); + + // Remove dark theme to keep it from affecting the appearance of other apps. + setDarkTheme(false); + }); $scope.$emit('application.load'); }