add time to visualization status (#15856) (#15894)

* add time to visualization status

* account for custom time on visualization

* update docs
This commit is contained in:
Nathan Reese 2018-01-08 10:55:00 -07:00 committed by GitHub
parent d288d2ddac
commit 45ce09c05c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -91,7 +91,7 @@ options or data change, and a destroy method which will be called to cleanup.
The render function receives the data object and status object which tells what actually changed.
Render function needs to return a promise, which should be resolved once the visualization is done rendering.
Status object has the following properties: `vis`, `aggs`, `resize`, `data`. Each of them is set to true if the matching
Status object has the following properties: `aggs`, `data`, `params`, `resize`, `time`, `uiState`. Each of them is set to true if the matching
object changed since last call to the render function or set to false otherwise. You can use it to make your
visualization rendering more efficient.

View file

@ -50,11 +50,14 @@ const getUpdateStatus = ($scope) => {
return false;
}
const time = $scope.vis.params.timeRange ? $scope.vis.params.timeRange : $scope.vis.API.timeFilter.getBounds();
return {
aggs: hasChangedUsingGenericHashComparison('aggs', $scope.vis.aggs),
data: hasChangedUsingGenericHashComparison('data', $scope.visData),
params: hasChangedUsingGenericHashComparison('param', $scope.vis.params),
resize: hasSizeChanged($scope.vis.size),
time: hasChangedUsingGenericHashComparison('time', time),
uiState: hasChangedUsingGenericHashComparison('uiState', $scope.uiState)
};
};