Skip to content

Commit 2eadbd3

Browse files
committed
show packs on packages manager
1 parent 1e7ffe6 commit 2eadbd3

File tree

5 files changed

+246
-73
lines changed

5 files changed

+246
-73
lines changed

serverStatus/static/serverStatus/serverStatus.js

Lines changed: 120 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44

55

6-
76
/* Java script code to start/stop litespeed */
87
app.controller('litespeedStatus', function ($scope, $http) {
98

@@ -49,8 +48,7 @@ app.controller('litespeedStatus', function ($scope, $http) {
4948
$scope.actionResultBad = true;
5049
$scope.serverStatusCouldNotConnect = true;
5150

52-
}
53-
else {
51+
} else {
5452

5553
$scope.restartorStopLoading = true;
5654
$scope.actionResult = true;
@@ -109,8 +107,7 @@ app.controller('litespeedStatus', function ($scope, $http) {
109107
$scope.actionResultBad = true;
110108
$scope.serverStatusCouldNotConnect = true;
111109

112-
}
113-
else {
110+
} else {
114111

115112
$scope.restartorStopLoading = true;
116113
$scope.actionResult = true;
@@ -174,8 +171,7 @@ app.controller('litespeedStatus', function ($scope, $http) {
174171
});
175172
$scope.lsSerial = response.data.lsSerial;
176173
$scope.lsexpiration = response.data.lsexpiration;
177-
}
178-
else {
174+
} else {
179175
$scope.cpLoading = true;
180176
new PNotify({
181177
title: 'Operation Failed!',
@@ -229,8 +225,7 @@ app.controller('litespeedStatus', function ($scope, $http) {
229225
text: 'License successfully Updated',
230226
type: 'success'
231227
});
232-
}
233-
else {
228+
} else {
234229
$scope.cpLoading = true;
235230
new PNotify({
236231
title: 'Operation Failed!',
@@ -292,8 +287,7 @@ app.controller('readCyberCPLogFile', function ($scope, $http) {
292287
$scope.logsData = response.data.logsdata;
293288

294289

295-
}
296-
else {
290+
} else {
297291

298292
$scope.logFileLoading = true;
299293
$scope.logsFeteched = true;
@@ -347,8 +341,7 @@ app.controller('readCyberCPLogFile', function ($scope, $http) {
347341
$scope.logsData = response.data.logsdata;
348342

349343

350-
}
351-
else {
344+
} else {
352345

353346
$scope.logFileLoading = true;
354347
$scope.logsFeteched = true;
@@ -409,8 +402,7 @@ app.controller('servicesManager', function ($scope, $http) {
409402
$scope.olsStart = false;
410403
$scope.olsStop = true;
411404
$scope.olsMem = Math.round(parseInt(response.data.memUsage.litespeed) / 1048576) + " MB";
412-
}
413-
else {
405+
} else {
414406
$scope.olsStatus = "Stopped";
415407
$scope.olsStats = false;
416408
$scope.olsStart = true;
@@ -421,8 +413,7 @@ app.controller('servicesManager', function ($scope, $http) {
421413
$scope.dockerStatus = "Running";
422414
$scope.dockerStart = false;
423415
$scope.dockerStop = true;
424-
}
425-
else {
416+
} else {
426417
$scope.dockerStatus = "Stopped";
427418
$scope.dockerStart = true;
428419
$scope.dockerStop = false;
@@ -435,8 +426,7 @@ app.controller('servicesManager', function ($scope, $http) {
435426
$scope.sqlStart = false;
436427
$scope.sqlStop = true;
437428
$scope.sqlMem = Math.round(parseInt(response.data.memUsage.mysql) / 1048576) + " MB";
438-
}
439-
else {
429+
} else {
440430
$scope.sqlStatus = "Stopped";
441431
$scope.sqlStats = false;
442432
$scope.sqlStart = true;
@@ -451,8 +441,7 @@ app.controller('servicesManager', function ($scope, $http) {
451441
$scope.dnsStart = false;
452442
$scope.dnsStop = true;
453443
$scope.dnsMem = Math.round(parseInt(response.data.memUsage.powerdns) / 1048576) + " MB";
454-
}
455-
else {
444+
} else {
456445
$scope.dnsStatus = "Stopped";
457446
$scope.dnsStats = false;
458447
$scope.dnsStart = true;
@@ -467,8 +456,7 @@ app.controller('servicesManager', function ($scope, $http) {
467456
$scope.ftpStart = false;
468457
$scope.ftpStop = true;
469458
$scope.ftpMem = Math.round(parseInt(response.data.memUsage.pureftp) / 1048576) + " MB";
470-
}
471-
else {
459+
} else {
472460
$scope.ftpStatus = "Stopped";
473461
$scope.ftpStats = false;
474462
$scope.ftpStart = true;
@@ -487,6 +475,7 @@ app.controller('servicesManager', function ($scope, $http) {
487475
}
488476

489477
}
478+
490479
getServiceStatus();
491480

492481
$scope.serviceAction = function (serviceName, action) {
@@ -524,8 +513,7 @@ app.controller('servicesManager', function ($scope, $http) {
524513
$scope.actionLoader = false;
525514
$scope.btnDisable = false;
526515
}, 3000);
527-
}
528-
else {
516+
} else {
529517
setTimeout(function () {
530518
getServiceStatus();
531519
$scope.ActionSuccessfull = false;
@@ -583,8 +571,7 @@ app.controller('lswsSwitch', function ($scope, $http, $timeout, $window) {
583571
if (response.data.status === 1) {
584572
$scope.installBoxGen = false;
585573
getRequestStatus();
586-
}
587-
else {
574+
} else {
588575
new PNotify({
589576
title: 'Operation Failed!',
590577
text: response.data.error_message,
@@ -626,8 +613,7 @@ app.controller('lswsSwitch', function ($scope, $http, $timeout, $window) {
626613
if (response.data.abort === 0) {
627614
$scope.requestData = response.data.requestStatus;
628615
$timeout(getRequestStatus, 1000);
629-
}
630-
else {
616+
} else {
631617
// Notifications
632618
$scope.cyberPanelLoading = true;
633619
$timeout.cancel();
@@ -720,8 +706,7 @@ app.controller('topProcesses', function ($scope, $http, $timeout) {
720706
$scope.zombieProcesses = response.data.zombieProcesses;
721707

722708
$timeout($scope.topProcessesStatus, 3000);
723-
}
724-
else {
709+
} else {
725710
new PNotify({
726711
title: 'Operation Failed!',
727712
text: response.data.error_message,
@@ -771,8 +756,111 @@ app.controller('topProcesses', function ($scope, $http, $timeout) {
771756
text: 'Process successfully killed.',
772757
type: 'success'
773758
});
759+
} else {
760+
new PNotify({
761+
title: 'Operation Failed!',
762+
text: response.data.error_message,
763+
type: 'error'
764+
});
765+
}
766+
767+
}
768+
769+
function cantLoadInitialDatas(response) {
770+
$scope.cyberPanelLoading = true;
771+
new PNotify({
772+
title: 'Operation Failed!',
773+
text: 'Could not connect to server, please refresh this page',
774+
type: 'error'
775+
});
776+
}
777+
778+
};
779+
780+
});
781+
782+
///
783+
784+
785+
app.controller('listOSPackages', function ($scope, $http, $timeout) {
786+
787+
$scope.cyberpanelLoading = true;
788+
789+
$scope.currentPage = 1;
790+
$scope.recordsToShow = 10;
791+
792+
$scope.fetchPackages = function () {
793+
$scope.cyberpanelLoading = false;
794+
795+
var config = {
796+
headers: {
797+
'X-CSRFToken': getCookie('csrftoken')
798+
}
799+
};
800+
801+
var data = {
802+
page: $scope.currentPage,
803+
recordsToShow: $scope.recordsToShow
804+
};
805+
806+
dataurl = "/serverstatus/fetchPackages";
807+
808+
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
809+
810+
function ListInitialData(response) {
811+
$scope.cyberpanelLoading = true;
812+
if (response.data.status === 1) {
813+
$scope.allPackages = JSON.parse(response.data.packages);
814+
$scope.pagination = response.data.pagination;
815+
} else {
816+
new PNotify({
817+
title: 'Error!',
818+
text: response.data.error_message,
819+
type: 'error'
820+
});
821+
}
822+
}
823+
function cantLoadInitialData(response) {
824+
$scope.cyberpanelLoading = true;
825+
new PNotify({
826+
title: 'Operation Failed!',
827+
text: 'Could not connect to server, please refresh this page',
828+
type: 'error'
829+
});
830+
}
831+
832+
833+
};
834+
835+
$scope.killProcess = function (pid) {
836+
837+
$scope.cyberPanelLoading = false;
838+
839+
url = "/serverstatus/killProcess";
840+
841+
var data = {
842+
pid: pid
843+
};
844+
845+
var config = {
846+
headers: {
847+
'X-CSRFToken': getCookie('csrftoken')
774848
}
775-
else {
849+
};
850+
851+
852+
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
853+
854+
855+
function ListInitialDatas(response) {
856+
$scope.cyberPanelLoading = true;
857+
if (response.data.status === 1) {
858+
new PNotify({
859+
title: 'Success',
860+
text: 'Process successfully killed.',
861+
type: 'success'
862+
});
863+
} else {
776864
new PNotify({
777865
title: 'Operation Failed!',
778866
text: response.data.error_message,

0 commit comments

Comments
 (0)