Merge pull request #7365 from panda01/feature/dashboard-refresh-interval

Dashboard Refresh Interval
This commit is contained in:
Khalah Jones Golden 2016-06-10 14:47:45 -04:00 committed by GitHub
commit 761f3d9d9a
2 changed files with 15 additions and 0 deletions

View file

@ -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);
@ -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()

View file

@ -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,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;