From 79d28dbbef2672938d5a715622a56e212907aae2 Mon Sep 17 00:00:00 2001 From: Khalah Jones Golden Date: Fri, 3 Jun 2016 09:53:52 -0400 Subject: [PATCH 1/5] [Dashboard] Added refresh interval to the dashboard saved object, also added refresh to save when save with time is checked --- src/plugins/kibana/public/dashboard/index.js | 4 ++++ .../kibana/public/dashboard/services/_saved_dashboard.js | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/plugins/kibana/public/dashboard/index.js b/src/plugins/kibana/public/dashboard/index.js index 1c145cf357c1b..97c63d7ed5378 100644 --- a/src/plugins/kibana/public/dashboard/index.js +++ b/src/plugins/kibana/public/dashboard/index.js @@ -68,6 +68,9 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, if (dash.timeRestore && dash.timeTo && dash.timeFrom && !getAppState.previouslyStored()) { timefilter.time.to = dash.timeTo; timefilter.time.from = dash.timeFrom; + if (dash.refreshInterval) { + timefilter.refreshInterval = dash.refreshInterval; + } } $scope.$on('$destroy', dash.destroy); @@ -208,6 +211,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, dash.uiStateJSON = angular.toJson($uiState.getChanges()); dash.timeFrom = dash.timeRestore ? timefilter.time.from : undefined; dash.timeTo = dash.timeRestore ? timefilter.time.to : undefined; + dash.refreshInterval = dash.timeRestore ? timefilter.refreshInterval : undefined; dash.optionsJSON = angular.toJson($state.options); dash.save() diff --git a/src/plugins/kibana/public/dashboard/services/_saved_dashboard.js b/src/plugins/kibana/public/dashboard/services/_saved_dashboard.js index c4a4ea5fa65c2..c0ba5c9af3266 100644 --- a/src/plugins/kibana/public/dashboard/services/_saved_dashboard.js +++ b/src/plugins/kibana/public/dashboard/services/_saved_dashboard.js @@ -33,6 +33,7 @@ module.factory('SavedDashboard', function (courier, config) { timeRestore: false, timeTo: undefined, timeFrom: undefined, + refreshInterval: undefined }, // if an indexPattern was saved with the searchsource of a SavedDashboard @@ -56,6 +57,7 @@ module.factory('SavedDashboard', function (courier, config) { timeRestore: 'boolean', timeTo: 'string', timeFrom: 'string', + refreshInterval: 'string' }; SavedDashboard.searchsource = true; From c8c1043d0f2a707b86ce98662101b21a28638ace Mon Sep 17 00:00:00 2001 From: Khalah Jones Golden Date: Fri, 3 Jun 2016 13:25:09 -0400 Subject: [PATCH 2/5] [Dashboard] Removing unnecessary check --- src/plugins/kibana/public/dashboard/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/kibana/public/dashboard/index.js b/src/plugins/kibana/public/dashboard/index.js index 97c63d7ed5378..0a72e5eafbfe1 100644 --- a/src/plugins/kibana/public/dashboard/index.js +++ b/src/plugins/kibana/public/dashboard/index.js @@ -68,9 +68,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, if (dash.timeRestore && dash.timeTo && dash.timeFrom && !getAppState.previouslyStored()) { timefilter.time.to = dash.timeTo; timefilter.time.from = dash.timeFrom; - if (dash.refreshInterval) { - timefilter.refreshInterval = dash.refreshInterval; - } + timefilter.refreshInterval = dash.refreshInterval; } $scope.$on('$destroy', dash.destroy); From 3c44b5a78bc9c974183df5cb3ada052b41536d11 Mon Sep 17 00:00:00 2001 From: Khalah Jones Golden Date: Tue, 7 Jun 2016 17:39:41 -0400 Subject: [PATCH 3/5] [Dashboard] Use JSON to stringify, and parse autorefresh object for dashboard time --- src/plugins/kibana/public/dashboard/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/kibana/public/dashboard/index.js b/src/plugins/kibana/public/dashboard/index.js index 0a72e5eafbfe1..c73b896f7a269 100644 --- a/src/plugins/kibana/public/dashboard/index.js +++ b/src/plugins/kibana/public/dashboard/index.js @@ -68,7 +68,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, if (dash.timeRestore && dash.timeTo && dash.timeFrom && !getAppState.previouslyStored()) { timefilter.time.to = dash.timeTo; timefilter.time.from = dash.timeFrom; - timefilter.refreshInterval = dash.refreshInterval; + timefilter.refreshInterval = JSON.parse(dash.refreshInterval); } $scope.$on('$destroy', dash.destroy); @@ -209,7 +209,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, dash.uiStateJSON = angular.toJson($uiState.getChanges()); dash.timeFrom = dash.timeRestore ? timefilter.time.from : undefined; dash.timeTo = dash.timeRestore ? timefilter.time.to : undefined; - dash.refreshInterval = dash.timeRestore ? timefilter.refreshInterval : undefined; + dash.refreshInterval = dash.timeRestore ? JSON.stringify(timefilter.refreshInterval) : undefined; dash.optionsJSON = angular.toJson($state.options); dash.save() From 4c584a681638e5f2d2123d90aff974bb9a41e0e7 Mon Sep 17 00:00:00 2001 From: Khalah Jones Golden Date: Tue, 7 Jun 2016 17:54:51 -0400 Subject: [PATCH 4/5] [Dashboard] Made the refresh interval an object when saved --- src/plugins/kibana/public/dashboard/index.js | 5 +++-- .../kibana/public/dashboard/services/_saved_dashboard.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/kibana/public/dashboard/index.js b/src/plugins/kibana/public/dashboard/index.js index c73b896f7a269..d5fc185b0b468 100644 --- a/src/plugins/kibana/public/dashboard/index.js +++ b/src/plugins/kibana/public/dashboard/index.js @@ -68,7 +68,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, if (dash.timeRestore && dash.timeTo && dash.timeFrom && !getAppState.previouslyStored()) { timefilter.time.to = dash.timeTo; timefilter.time.from = dash.timeFrom; - timefilter.refreshInterval = JSON.parse(dash.refreshInterval); + timefilter.refreshInterval = dash.refreshInterval; } $scope.$on('$destroy', dash.destroy); @@ -205,11 +205,12 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, $state.title = dash.id = dash.title; $state.save(); + const timeRestoreObj = _.pick(timefilter.refreshInterval, ['display', 'pause', 'section', 'value']); dash.panelsJSON = angular.toJson($state.panels); dash.uiStateJSON = angular.toJson($uiState.getChanges()); dash.timeFrom = dash.timeRestore ? timefilter.time.from : undefined; dash.timeTo = dash.timeRestore ? timefilter.time.to : undefined; - dash.refreshInterval = dash.timeRestore ? JSON.stringify(timefilter.refreshInterval) : undefined; + dash.refreshInterval = dash.timeRestore ? timeRestoreObj : undefined; dash.optionsJSON = angular.toJson($state.options); dash.save() diff --git a/src/plugins/kibana/public/dashboard/services/_saved_dashboard.js b/src/plugins/kibana/public/dashboard/services/_saved_dashboard.js index c0ba5c9af3266..49a44105a0758 100644 --- a/src/plugins/kibana/public/dashboard/services/_saved_dashboard.js +++ b/src/plugins/kibana/public/dashboard/services/_saved_dashboard.js @@ -57,7 +57,7 @@ module.factory('SavedDashboard', function (courier, config) { timeRestore: 'boolean', timeTo: 'string', timeFrom: 'string', - refreshInterval: 'string' + refreshInterval: 'object' }; SavedDashboard.searchsource = true; From 8357f258537cd6af7691b3abc9a358b6d61d5d96 Mon Sep 17 00:00:00 2001 From: Khalah Jones Golden Date: Fri, 10 Jun 2016 09:56:15 -0400 Subject: [PATCH 5/5] [Dashboard] Added refresh check for backwards compatibility when loading dashboard, nested mapping for a saved dashboard --- src/plugins/kibana/public/dashboard/index.js | 4 +++- .../public/dashboard/services/_saved_dashboard.js | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plugins/kibana/public/dashboard/index.js b/src/plugins/kibana/public/dashboard/index.js index d5fc185b0b468..e8322ea212c16 100644 --- a/src/plugins/kibana/public/dashboard/index.js +++ b/src/plugins/kibana/public/dashboard/index.js @@ -68,7 +68,9 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, if (dash.timeRestore && dash.timeTo && dash.timeFrom && !getAppState.previouslyStored()) { timefilter.time.to = dash.timeTo; timefilter.time.from = dash.timeFrom; - timefilter.refreshInterval = dash.refreshInterval; + if (dash.refreshInterval) { + timefilter.refreshInterval = dash.refreshInterval; + } } $scope.$on('$destroy', dash.destroy); diff --git a/src/plugins/kibana/public/dashboard/services/_saved_dashboard.js b/src/plugins/kibana/public/dashboard/services/_saved_dashboard.js index 49a44105a0758..5e0ef2f2cb9c0 100644 --- a/src/plugins/kibana/public/dashboard/services/_saved_dashboard.js +++ b/src/plugins/kibana/public/dashboard/services/_saved_dashboard.js @@ -57,7 +57,15 @@ module.factory('SavedDashboard', function (courier, config) { timeRestore: 'boolean', timeTo: 'string', timeFrom: 'string', - refreshInterval: 'object' + refreshInterval: { + type: 'object', + properties: { + display: {type: 'string'}, + pause: { type: 'boolean'}, + section: { type: 'integer'}, + value: { type: 'integer'} + } + } }; SavedDashboard.searchsource = true;