Skip to content

Commit

Permalink
Ability to set ttl (max age) from query string
Browse files Browse the repository at this point in the history
  • Loading branch information
arikfr committed Jan 27, 2015
1 parent b71a2b3 commit 4c73e78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rd_ui/app/scripts/controllers/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@

$scope.query = $scope.widget.getQuery();
var parameters = Query.collectParamsFromQueryString($location, $scope.query);
$scope.queryResult = $scope.query.getQueryResult(undefined, parameters);
var maxAge = $location.search()['maxAge'];
$scope.queryResult = $scope.query.getQueryResult(maxAge, parameters);
$scope.nextUpdateTime = moment(new Date(($scope.query.updated_at + $scope.query.ttl + $scope.query.runtime + 300) * 1000)).fromNow();

$scope.type = 'visualization';
Expand Down
3 changes: 3 additions & 0 deletions rd_ui/app/scripts/controllers/query_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
var getQueryResult = function(ttl) {
// Collect params, and getQueryResult with params; getQueryResult merges it into the query
var parameters = Query.collectParamsFromQueryString($location, $scope.query);
if (ttl == undefined) {
ttl = $location.search()['maxAge'];
}
$scope.queryResult = $scope.query.getQueryResult(ttl, parameters);
}

Expand Down

0 comments on commit 4c73e78

Please sign in to comment.