Skip to content

Commit

Permalink
webdash: fix nextPage button; cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
adamstruck authored and buchanae committed Mar 27, 2018
1 parent 6bac6bb commit dbe8730
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
23 changes: 9 additions & 14 deletions webdash/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ app.controller('TaskListController', function($rootScope, $scope, $http, $timeou

TaskFilters.$watch("tags", function() {
refresh();
})
}, true)

function listTasks() {
var url = "/v1/tasks?view=BASIC";
Expand All @@ -125,30 +125,25 @@ app.controller('TaskListController', function($rootScope, $scope, $http, $timeou
return $http.get(url);
}

function refresh() {
function refresh(callback) {
listTasks().then(function(response) {
$scope.$applyAsync(function() {
$scope.tasks = response.data.tasks;
if (response.data.next_page_token) {
$scope.nextPage = $scope.serverURL + "/v1/tasks?page_token=" + response.data.next_page_token;
$rootScope.nextPage = $scope.serverURL + "/v1/tasks?page_token=" + response.data.next_page_token;
} else {
$scope.nextPage = "";
$rootScope.nextPage = "";
}
if (callback) {
callback();
}
});
});
}

function autoRefresh() {
listTasks().then(function(response) {
$scope.$applyAsync(function() {
$scope.tasks = response.data.tasks;
if (response.data.next_page_token) {
$scope.nextPage = $scope.serverURL + "/v1/tasks?page_token=" + response.data.next_page_token;
} else {
$scope.nextPage = "";
}
stop = $timeout(autoRefresh, 2000);
});
refresh(function() {
stop = $timeout(autoRefresh, 2000);
});
}

Expand Down
24 changes: 12 additions & 12 deletions webdash/web.go

Large diffs are not rendered by default.

0 comments on commit dbe8730

Please sign in to comment.