Add initial task popup for apptasks

This commit is contained in:
Johannes Zellner
2019-09-11 21:24:25 +02:00
parent 62b392e555
commit 758b32a61c
3 changed files with 59 additions and 4 deletions
+32 -4
View File
@@ -10,6 +10,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
var appId = $location.path().slice('/app/'.length);
$scope.app = null;
$scope.activeTask = null;
$scope.ready = false;
$scope.HOST_PORT_MIN = 1024;
$scope.HOST_PORT_MAX = 65535;
@@ -21,6 +22,12 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.backupsEnabled = true;
$scope.disableIndexingTemplate = '# Disable search engine indexing\n\nUser-agent: *\nDisallow: /';
$scope.stopAppTask = function (taskId) {
Client.stopTask(taskId, function (error) {
if (error) return Client.error(error);
});
};
$scope.display = {
busy: false,
error: {},
@@ -178,6 +185,8 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.location.success = true;
$scope.location.busy = false;
trackAppTask();
});
}
};
@@ -269,15 +278,16 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.resources.busy = true;
$scope.resources.error = {};
var memoryLimit = $scope.resources.memoryLimit === $scope.resources.memoryTicks[0] ? 0 : $scope.resources.memoryLimit;
// TODO handle data dir once we show it
var memoryLimit = $scope.resources.memoryLimit === $scope.resources.memoryTicks[0] ? 0 : $scope.resources.memoryLimit;
Client.configureApp($scope.app.id, 'memory_limit', { memoryLimit: memoryLimit }, function (error) {
if (error) return Client.error(error);
$scope.resources.success = true;
$scope.resources.busy = false;
// TODO handle data dir once we show it
trackAppTask();
});
}
};
@@ -301,6 +311,13 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
submit: function () {
$scope.email.busy = true;
// TODO
$scope.email.success = true;
$scope.email.busy = false;
trackAppTask();
}
};
@@ -321,7 +338,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.security.busy = true;
$scope.security.error = {};
Client.configureApp($scope.app.id, 'robots_txt', { robotsTxt: $scope.security.robotsTxt }, function (error) {
Client.configureApp($scope.app.id, 'robots_txt', { robotsTxt: $scope.security.robotsTxt }, function (error,) {
if (error) return Client.error(error);
$scope.security.success = true;
@@ -425,12 +442,23 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
});
}
function trackAppTask() {
Client.getApp(appId, function (error, app) {
if (error) Client.error(error);
else $scope.app = app;
if ($scope.app.taskId) $timeout(trackAppTask, 2000); // not yet done
});
}
Client.onReady(function () {
$scope.app = Client.getApp(appId, function (error, app) {
Client.getApp(appId, function (error, app) {
if (error) return Client.error(error);
$scope.app = app;
if (app.taskId) trackAppTask();
asyncSeries([
fetchUsers,
fetchGroups,