diff --git a/src/views/backups.html b/src/views/backups.html
index 6d6308d35..720330292 100644
--- a/src/views/backups.html
+++ b/src/views/backups.html
@@ -220,7 +220,7 @@
{{ createBackup.message }}
-
{{ createBackup.errorMessage }}
+
{{ createBackup.errorMessage }}
diff --git a/src/views/domains.html b/src/views/domains.html
index 2dea5c113..083073578 100644
--- a/src/views/domains.html
+++ b/src/views/domains.html
@@ -198,25 +198,6 @@
-
-
-
-
-
-
-
This will renew certs of all apps installed. Only certs that are expiring in next 30 days will be renewed. It can take ~5 minutes to renew and install the certificates. Check the activity log for renewal status.
-
-
-
-
-
-
-
@@ -303,9 +284,31 @@
Cloudron renews Let's Encrypt certificates automatically. Use this options to trigger a renewal immediately.
-
Renew Certs
+
+
+
+
+
+
{{ renewCerts.message }}
+
+
{{ renewCerts.errorMessage }}
+
+
+
+
Renew All Certs
+
Show Logs
+
+
+
diff --git a/src/views/domains.js b/src/views/domains.js
index eac546e39..281389f2a 100644
--- a/src/views/domains.js
+++ b/src/views/domains.js
@@ -354,32 +354,59 @@ angular.module('Application').controller('DomainsController', ['$scope', '$locat
$scope.renewCerts = {
busy: false,
- error: null,
+ percent: 0,
+ message: '',
+ errorMessage: '',
+ taskId: '',
- show: function () {
- $scope.renewCerts.reset();
- $('#renewCertsModal').modal('show');
- },
+ checkStatus: function () {
+ Client.getLatestTaskByType('renewcerts', function (error, task) {
+ if (error) return console.error(error);
- submit: function () {
- $scope.renewCerts.busy = true;
- $scope.renewCerts.error = null;
+ if (!task) return;
- Client.renewCerts(null /* all domains */, function (error) {
- if (error) {
- Client.error(error);
- } else {
- $('#renewCertsModal').modal('hide');
- $scope.renewCerts.reset();
- }
-
- $scope.renewCerts.busy = false;
+ $scope.renewCerts.taskId = task.id;
+ $scope.renewCerts.updateStatus();
});
},
- reset: function () {
- $scope.renewCerts.busy = false;
- $scope.renewCerts.error = null;
+ updateStatus: function () {
+ Client.getTask($scope.renewCerts.taskId, function (error, data) {
+ if (error) return window.setTimeout($scope.renewCerts.updateStatus, 5000);
+
+ if (!data.active) {
+ $scope.renewCerts.busy = false;
+ $scope.renewCerts.message = '';
+ $scope.renewCerts.percent = 100; // indicates that 'result' is valid
+ $scope.renewCerts.errorMessage = data.errorMessage;
+
+ return;
+ }
+
+ $scope.renewCerts.busy = true;
+ $scope.renewCerts.percent = data.percent;
+ $scope.renewCerts.message = data.message;
+ window.setTimeout($scope.renewCerts.updateStatus, 500);
+ });
+ },
+
+ renew: function () {
+ $scope.renewCerts.busy = true;
+ $scope.renewCerts.percent = 0;
+ $scope.renewCerts.message = '';
+ $scope.renewCerts.errorMessage = '';
+
+ Client.renewCerts(null /* all domains */, function (error, taskId) {
+ if (error) {
+ console.error(error);
+ $scope.renewCerts.errorMessage = error.message;
+
+ $scope.renewCerts.busy = false;
+ } else {
+ $scope.renewCerts.taskId = taskId;
+ $scope.renewCerts.updateStatus();
+ }
+ });
}
};
@@ -478,6 +505,8 @@ angular.module('Application').controller('DomainsController', ['$scope', '$locat
$scope.dyndnsConfigure.refresh();
}
});
+
+ $scope.renewCerts.checkStatus();
});
document.getElementById('gcdnsKeyFileInput').onchange = readFileLocally($scope.domainConfigure.gcdnsKey, 'content', 'keyFileName');