bug fix: web terminal

This commit is contained in:
Usman Nasir
2019-11-03 19:31:21 +05:00
parent 1d4e588a73
commit a80d7456f6
11 changed files with 586 additions and 391 deletions

View File

@@ -91,4 +91,57 @@ function connect() {
openTerminal(options)
}
connect();
app.controller('webTerminal', function ($scope, $http, $window) {
$scope.cyberpanelLoading = true;
connect();
$scope.restartSSH = function (name) {
$scope.cyberpanelLoading = false;
url = "/Terminal/restart";
var data = {
name: name
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Successfully restarted SSH server, refreshing the page now..',
type: 'success'
});
$window.location.href = '/Terminal/';
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page',
type: 'error'
});
}
};
});