filebrowser: add mail restart button

This commit is contained in:
Girish Ramakrishnan
2021-09-27 11:38:28 -07:00
parent 8c3e369599
commit 0d6abb9850
2 changed files with 33 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
"use strict";
'use strict';
require.config({ paths: { 'vs': '3rdparty/vs' }});
@@ -650,9 +650,9 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
$('#uploadFolderInput').on('change', function (e ) { uploadFiles(e.target.files || [], $scope.cwd, false); });
$scope.onUploadFolder = function () { $('#uploadFolderInput').click(); };
$scope.restartAppBusy = false;
$scope.restartBusy = false;
$scope.onRestartApp = function () {
$scope.restartAppBusy = true;
$scope.restartBusy = true;
function waitUntilRestarted(callback) {
Client.getApp($scope.id, function (error, result) {
@@ -669,7 +669,30 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl
waitUntilRestarted(function (error) {
if (error) console.error('Failed wait for restart.', error);
$scope.restartAppBusy = false;
$scope.restartBusy = false;
});
});
};
$scope.onRestartMail = function () {
$scope.restartBusy = true;
function waitUntilRestarted(callback) {
Client.getService('mail', function (error, result) {
if (error) return callback(error);
if (result.status === 'active') return callback();
setTimeout(waitUntilRestarted.bind(null, callback), 2000);
});
}
Client.restartService('mail', function (error) {
if (error) console.error('Failed to restart mail.', error);
waitUntilRestarted(function (error) {
if (error) console.error('Failed wait for restart.', error);
$scope.restartBusy = false;
});
});
};