app: add cron section

part of cloudron/box#793
This commit is contained in:
Girish Ramakrishnan
2021-09-27 15:32:44 -07:00
parent e1801b7a99
commit ce323ca60a
3 changed files with 63 additions and 1 deletions

View File

@@ -899,6 +899,38 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
}
};
$scope.cron = {
busy: false,
error: {},
crontab: '',
show: function () {
$scope.cronForm.$setPristine();
$scope.cron.error = {};
$scope.cron.crontab = $scope.app.crontab;
},
submit: function () {
$scope.cron.error = {};
$scope.cron.busy = true;
Client.configureApp($scope.app.id, 'cron', { crontab: $scope.cron.crontab }, function (error) {
if (error && error.statusCode === 400) {
$scope.cron.busy = false;
$scope.cron.error.crontab = error.message;
$scope.cronForm.$setPristine();
return;
}
if (error) return Client.error(error);
$scope.cronForm.$setPristine();
$timeout(function () { $scope.cron.busy = false; }, 1000);
});
}
};
$scope.security = {
busy: false,
error: {},