Improve app overview and add restart action

This commit is contained in:
Johannes Zellner
2019-09-12 17:42:33 +02:00
parent 96bb293c1f
commit 2027f8052b
4 changed files with 75 additions and 31 deletions

View File

@@ -500,6 +500,29 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
});
};
Client.prototype.restartApp = function (id, callback) {
var that = this;
function waitUntilStopped(callback) {
that.getApp(id, function (error, result) {
if (error) return callback(error);
if (result.runState === 'stopped') return callback();
setTimeout(waitUntilStopped.bind(null, callback), 2000);
});
}
that.stopApp(id, function (error) {
if (error) return callback(error);
waitUntilStopped(function (error) {
if (error) return callback(error);
that.startApp(id, callback);
});
});
};
Client.prototype.debugApp = function (id, state, callback) {
var data = {
appId: id,