diff --git a/serverStatus/templates/serverStatus/packageManager.html b/serverStatus/templates/serverStatus/packageManager.html
index 2ea788726..adb189cbd 100755
--- a/serverStatus/templates/serverStatus/packageManager.html
+++ b/serverStatus/templates/serverStatus/packageManager.html
@@ -25,7 +25,7 @@
Updates
All Packages
- Settings
+ CyberPanel Packages
@@ -368,7 +368,214 @@
diff --git a/serverStatus/views.py b/serverStatus/views.py
index 14ea17504..fa3598713 100755
--- a/serverStatus/views.py
+++ b/serverStatus/views.py
@@ -735,18 +735,24 @@ def fetchPackages(request):
command = 'apt-mark showhold'
locked = ProcessUtilities.outputExecutioner(command).split('\n')
- command = 'apt list --installed'
- packages = ProcessUtilities.outputExecutioner(command).split('\n')
- packages = packages[4:]
+ if type == 'CyberPanel':
- upgradePackages = []
+ command = 'cat /usr/local/CyberCP/AllCPUbuntu.json'
+ packages = json.loads(ProcessUtilities.outputExecutioner(command))
- if type == 'upgrade':
- for pack in packages:
- if pack.find('upgradable') > -1:
- upgradePackages.append(pack)
+ else:
+ command = 'apt list --installed'
+ packages = ProcessUtilities.outputExecutioner(command).split('\n')
+ packages = packages[4:]
- packages = upgradePackages
+ upgradePackages = []
+
+ if type == 'upgrade':
+ for pack in packages:
+ if pack.find('upgradable') > -1:
+ upgradePackages.append(pack)
+
+ packages = upgradePackages
#if os.path.exists(ProcessUtilities.debugPath):
@@ -768,27 +774,47 @@ def fetchPackages(request):
import re
for items in finalPackages:
try:
- nowSplitted = items.split('now')
+ if type == 'CyberPanel':
- upgrade = 'Not Needed'
+ packageName = items['Package'].split('/')[0]
- if nowSplitted[1].split(' ')[3].find('upgradable') > -1:
- current = nowSplitted[1].split(' ')
- upgrade = '%s %s %s' % (current[3], current[4], current[5])
+ if packageName in locked:
+ lock = 1
+ else:
+ lock = 0
+
+ dic = {'package': packageName,
+ 'version': items['Version'], 'lock': lock}
+
+ counter = counter + 1
+ if checker == 0:
+ json_data = json_data + json.dumps(dic)
+ checker = 1
+ else:
+ json_data = json_data + ',' + json.dumps(dic)
- if nowSplitted[0].split('/')[0] in locked:
- lock = 1
else:
- lock = 0
+ nowSplitted = items.split('now')
- dic = {'package': nowSplitted[0].split('/')[0], 'version': '%s %s' % (nowSplitted[1].split(' ')[1], nowSplitted[1].split(' ')[2]), 'upgrade': upgrade, 'lock': lock}
+ upgrade = 'Not Needed'
- counter = counter + 1
- if checker == 0:
- json_data = json_data + json.dumps(dic)
- checker = 1
- else:
- json_data = json_data + ',' + json.dumps(dic)
+ if nowSplitted[1].split(' ')[3].find('upgradable') > -1:
+ current = nowSplitted[1].split(' ')
+ upgrade = '%s %s %s' % (current[3], current[4], current[5])
+
+ if nowSplitted[0].split('/')[0] in locked:
+ lock = 1
+ else:
+ lock = 0
+
+ dic = {'package': nowSplitted[0].split('/')[0], 'version': '%s %s' % (nowSplitted[1].split(' ')[1], nowSplitted[1].split(' ')[2]), 'upgrade': upgrade, 'lock': lock}
+
+ counter = counter + 1
+ if checker == 0:
+ json_data = json_data + json.dumps(dic)
+ checker = 1
+ else:
+ json_data = json_data + ',' + json.dumps(dic)
except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile('[ERROR] %s. [fetchPackages:773]' % (str(msg)))
diff --git a/static/firewall/firewall.js b/static/firewall/firewall.js
index a0acd1f53..eaa372adb 100644
--- a/static/firewall/firewall.js
+++ b/static/firewall/firewall.js
@@ -2171,8 +2171,6 @@ app.controller('installImunify', function ($scope, $http, $timeout, $window) {
text: 'Could not connect to server, please refresh this page',
type: 'error'
});
-
-
}
}
diff --git a/static/serverStatus/serverStatus.js b/static/serverStatus/serverStatus.js
index f8b6c11fb..8a89159d6 100644
--- a/static/serverStatus/serverStatus.js
+++ b/static/serverStatus/serverStatus.js
@@ -788,10 +788,11 @@ app.controller('listOSPackages', function ($scope, $http, $timeout) {
$scope.currentPage = 1;
$scope.recordsToShow = 10;
+ var globalType;
$scope.fetchPackages = function (type = 'installed') {
$scope.cyberpanelLoading = false;
-
+ globalType = type;
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
@@ -836,16 +837,98 @@ app.controller('listOSPackages', function ($scope, $http, $timeout) {
};
$scope.fetchPackages('upgrade');
- $scope.killProcess = function (pid) {
+ $scope.fetchPackageDetails = function (packageFetch) {
+ $scope.cyberpanelLoading = false;
+ $scope.package = packageFetch;
- $scope.cyberPanelLoading = false;
-
- url = "/serverstatus/killProcess";
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
var data = {
- pid: pid
+ package: packageFetch
};
+ dataurl = "/serverstatus/fetchPackageDetails";
+
+ $http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
+
+ function ListInitialData(response) {
+ $scope.cyberpanelLoading = true;
+ if (response.data.status === 1) {
+ $scope.packageDetails = response.data.packageDetails;
+ } else {
+ new PNotify({
+ title: 'Error!',
+ text: response.data.error_message,
+ type: 'error'
+ });
+ }
+ }
+ function cantLoadInitialData(response) {
+ $scope.cyberpanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type: 'error'
+ });
+ }
+
+
+ };
+
+ $scope.updatePackage = function (packageToUpgrade = 'all') {
+ $scope.cyberpanelLoading = false;
+ $scope.package = packageToUpgrade;
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ var data = {
+ package: packageToUpgrade
+ };
+
+ dataurl = "/serverstatus/updatePackage";
+
+ $http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
+
+ function ListInitialData(response) {
+ $scope.cyberpanelLoading = true;
+ if (response.data.status === 1) {
+ getRequestStatus();
+ } else {
+ new PNotify({
+ title: 'Error!',
+ text: response.data.error_message,
+ type: 'error'
+ });
+ }
+ }
+ function cantLoadInitialData(response) {
+ $scope.cyberpanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type: 'error'
+ });
+ }
+
+
+ };
+
+ function getRequestStatus() {
+
+ $scope.cyberpanelLoading = false;
+
+ url = "/serverstatus/switchTOLSWSStatus";
+
+ var data = {};
+
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
@@ -857,25 +940,19 @@ app.controller('listOSPackages', function ($scope, $http, $timeout) {
function ListInitialDatas(response) {
- $scope.cyberPanelLoading = true;
- if (response.data.status === 1) {
- new PNotify({
- title: 'Success',
- text: 'Process successfully killed.',
- type: 'success'
- });
+ if (response.data.abort === 0) {
+ $scope.requestData = response.data.requestStatus;
+ $timeout(getRequestStatus, 1000);
} else {
- new PNotify({
- title: 'Operation Failed!',
- text: response.data.error_message,
- type: 'error'
- });
+ // Notifications
+ $timeout.cancel();
+ $scope.cyberpanelLoading = true;
+ $scope.requestData = response.data.requestStatus;
}
-
}
function cantLoadInitialDatas(response) {
- $scope.cyberPanelLoading = true;
+ $scope.cyberpanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page',
@@ -883,6 +960,53 @@ app.controller('listOSPackages', function ($scope, $http, $timeout) {
});
}
+ }
+
+ $scope.lockStatus = function (lockPackage, type) {
+ $scope.cyberpanelLoading = false;
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ var data = {
+ package: lockPackage,
+ type: type,
+ };
+
+ dataurl = "/serverstatus/lockStatus";
+
+ $http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
+
+ function ListInitialData(response) {
+ $scope.cyberpanelLoading = true;
+ if (response.data.status === 1) {
+ new PNotify({
+ title: 'Success!',
+ text: 'Status updated.',
+ type: 'success'
+ });
+ $scope.fetchPackages(globalType);
+ } else {
+ new PNotify({
+ title: 'Error!',
+ text: response.data.error_message,
+ type: 'error'
+ });
+ }
+ }
+ function cantLoadInitialData(response) {
+ $scope.cyberpanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type: 'error'
+ });
+ }
+
+
};
});
\ No newline at end of file