Merge pull request #1368 from getredash/rand

Change: added ability to disable auto update in admin views
This commit is contained in:
Arik Fraimovich
2016-10-27 19:32:16 +03:00
committed by GitHub
4 changed files with 22 additions and 12 deletions

View File

@@ -43,6 +43,7 @@
var AdminTasksCtrl = function ($scope, $location, Events, $http, $timeout, $filter) {
Events.record(currentUser, "view", "page", "admin/tasks");
$scope.$parent.pageTitle = "Running Queries";
$scope.autoUpdate = true;
$scope.gridConfig = {
isPaginationEnabled: true,
@@ -121,11 +122,13 @@
$scope.setTab($location.hash() || 'in_progress');
var refresh = function () {
$scope.refresh_time = moment().add(1, 'minutes');
$http.get('/api/admin/queries/tasks').success(function (data) {
$scope.tasks = data;
$scope.showingTasks = $scope.tasks[$scope.selectedTab];
});
if ($scope.autoUpdate) {
$scope.refresh_time = moment().add(1, 'minutes');
$http.get('/api/admin/queries/tasks').success(function (data) {
$scope.tasks = data;
$scope.showingTasks = $scope.tasks[$scope.selectedTab];
});
}
var timer = $timeout(refresh, 5 * 1000);
@@ -142,6 +145,7 @@
var AdminOutdatedQueriesCtrl = function ($scope, Events, $http, $timeout, $filter) {
Events.record(currentUser, "view", "page", "admin/outdated_queries");
$scope.$parent.pageTitle = "Outdated Queries";
$scope.autoUpdate = true;
$scope.gridConfig = {
isPaginationEnabled: true,
@@ -190,13 +194,16 @@
];
var refresh = function () {
$scope.refresh_time = moment().add(1, 'minutes');
$http.get('/api/admin/queries/outdated').success(function (data) {
$scope.queries = data.queries;
$scope.updatedAt = data.updated_at * 1000.0;
});
if ($scope.autoUpdate) {
$scope.refresh_time = moment().add(1, 'minutes');
$http.get('/api/admin/queries/outdated').success(function (data) {
$scope.queries = data.queries;
$scope.updatedAt = data.updated_at * 1000.0;
});
}
var timer = $timeout(refresh, 59 * 1000);
// var timer = $timeout(refresh, 59 * 1000);
var timer = $timeout(refresh, 10 * 1000);
$scope.$on("$destroy", function () {
if (timer) {

View File

@@ -15,5 +15,6 @@
<div class="badge">
Last update: <span am-time-ago="updatedAt"></span>
</div>
(<label><input type="checkbox" ng-model="autoUpdate"> Auto Update</label>)
</div>
</div>

View File

@@ -18,6 +18,8 @@
<smart-table rows="showingTasks" columns="gridColumns"
config="gridConfig"
class="table table-condensed table-hover"></smart-table>
<label><input type="checkbox" ng-model="autoUpdate"> Auto Update</label>
</div>
</div>

View File

@@ -39,7 +39,7 @@
<li class="list-group-item active">Queues</li>
<li class="list-group-item" ng-repeat="(name, value) in manager.queues">
<span class="badge">{{value.size}}</span>
{{name}} ({{value.data_sources}})
{{name}} <span popover="{{value.data_sources}}" popover-trigger="mouseenter"><i class="fa fa-question-circle"></i></span>
</li>
</ul>
</div>