Skip to content

Commit

Permalink
Merge pull request #7365 from panda01/feature/dashboard-refresh-interval
Browse files Browse the repository at this point in the history
Dashboard Refresh Interval
  • Loading branch information
panda01 authored Jun 10, 2016
2 parents 14f3bf0 + 8357f25 commit 761f3d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/plugins/kibana/public/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -204,10 +207,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 ? timeRestoreObj : undefined;
dash.optionsJSON = angular.toJson($state.options);

dash.save()
Expand Down
10 changes: 10 additions & 0 deletions src/plugins/kibana/public/dashboard/services/_saved_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -56,6 +57,15 @@ module.factory('SavedDashboard', function (courier, config) {
timeRestore: 'boolean',
timeTo: 'string',
timeFrom: 'string',
refreshInterval: {
type: 'object',
properties: {
display: {type: 'string'},
pause: { type: 'boolean'},
section: { type: 'integer'},
value: { type: 'integer'}
}
}
};

SavedDashboard.searchsource = true;
Expand Down

0 comments on commit 761f3d9

Please sign in to comment.