mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 05:45:59 +01:00
bug fix: web terminal
This commit is contained in:
@@ -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'
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user