This commit is contained in:
Usman Nasir
2020-08-04 20:18:49 +05:00
parent cfdf9996f0
commit f1b5589cdd
3 changed files with 436 additions and 421 deletions

View File

@@ -36,6 +36,43 @@ function randomPassword(length) {
var app = angular.module('CyberCP', []);
var globalScope;
function GlobalRespSuccess(response) {
globalScope.cyberPanelLoading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success',
text: 'Successfully executed.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function GlobalRespFailed(response) {
globalScope.cyberPanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page',
type: 'error'
});
}
function GLobalAjaxCall(http, url, data, successCallBack, failureCallBack) {
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
http.post(url, data, config).then(successCallBack, failureCallBack);
}
app.config(['$interpolateProvider', function ($interpolateProvider) {
$interpolateProvider.startSymbol('{$');
$interpolateProvider.endSymbol('$}');
@@ -81,7 +118,8 @@ app.controller('systemStatusInfo', function($scope,$http,$timeout) {
}
function cantLoadInitialData(response) {}
function cantLoadInitialData(response) {
}
//$timeout(getStuff, 2000);
@@ -302,7 +340,8 @@ app.controller('adminController', function($scope,$http,$timeout) {
}
}
function cantLoadInitialData(response) {}
function cantLoadInitialData(response) {
}
});
/* Load average */
@@ -373,7 +412,6 @@ app.controller('homePageStatus', function($scope,$http,$timeout) {
$scope.AvailSSL = response.data.AvailSSL;
$("#redcircle").addClass("c100");
$("#redcircle").addClass("p" + $scope.cpuUsage);
$("#redcircle").addClass("red");
@@ -409,9 +447,9 @@ app.controller('homePageStatus', function($scope,$http,$timeout) {
'-o-transform': 'rotate(' + rotationDegrees + 'deg)',
'transform': 'rotate(' + rotationDegrees + 'deg)'
});
}
else if(classList[i].match("^p"+$scope.ramUsage)){
var rotationPercentage = response.data.ramUsage;;
} else if (classList[i].match("^p" + $scope.ramUsage)) {
var rotationPercentage = response.data.ramUsage;
;
var rotationDegrees = rotationMultiplier * rotationPercentage;
$('.c100.p' + rotationPercentage + ' .bar').css({
'-webkit-transform': 'rotate(' + rotationDegrees + 'deg)',
@@ -420,9 +458,9 @@ app.controller('homePageStatus', function($scope,$http,$timeout) {
'-o-transform': 'rotate(' + rotationDegrees + 'deg)',
'transform': 'rotate(' + rotationDegrees + 'deg)'
});
}
else if(classList[i].match("^p"+$scope.diskUsage)){
var rotationPercentage = response.data.diskUsage;;
} else if (classList[i].match("^p" + $scope.diskUsage)) {
var rotationPercentage = response.data.diskUsage;
;
var rotationDegrees = rotationMultiplier * rotationPercentage;
$('.c100.p' + rotationPercentage + ' .bar').css({
'-webkit-transform': 'rotate(' + rotationDegrees + 'deg)',
@@ -436,13 +474,6 @@ app.controller('homePageStatus', function($scope,$http,$timeout) {
});
}
function cantLoadInitialData(response) {
@@ -480,8 +511,6 @@ app.controller('versionManagment', function($scope,$http,$timeout) {
$scope.couldNotConnect = true;
$scope.upgrade = function () {
$scope.upgradeLoading = false;
@@ -505,8 +534,7 @@ app.controller('versionManagment', function($scope,$http,$timeout) {
$scope.updateFinish = true;
$scope.couldNotConnect = true;
getUpgradeStatus();
}
else{
} else {
$scope.updateError = false;
$scope.updateStarted = true;
$scope.updateFinish = true;
@@ -534,8 +562,7 @@ app.controller('versionManagment', function($scope,$http,$timeout) {
url = "/base/UpgradeStatus";
var data = {
};
var data = {};
var config = {
headers: {
@@ -544,7 +571,6 @@ app.controller('versionManagment', function($scope,$http,$timeout) {
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
@@ -563,8 +589,7 @@ app.controller('versionManagment', function($scope,$http,$timeout) {
$scope.updateFinish = false;
$scope.couldNotConnect = true;
}
else{
} else {
$scope.upgradelogBox = false;
$scope.upgradeLog = response.data.upgradeLog;
$timeout(getUpgradeStatus, 2000);
@@ -572,6 +597,7 @@ app.controller('versionManagment', function($scope,$http,$timeout) {
}
}
function cantLoadInitialDatas(response) {
$scope.updateError = true;

14
static/managePHP/managePHP.js Executable file → Normal file
View File

@@ -261,6 +261,7 @@ app.controller('installExtensions', function ($scope, $http, $timeout) {
app.controller('editPHPConfig', function ($scope, $http, $timeout) {
$scope.loadingPHP = true;
$scope.cyberPanelLoading = true;
$scope.canNotFetch = true;
$scope.phpDetailsBox = true;
$scope.couldNotConnect = true;
@@ -377,7 +378,6 @@ app.controller('editPHPConfig', function ($scope, $http, $timeout) {
};
$scope.saveChanges = function () {
$scope.loadingPHP = false;
@@ -439,7 +439,6 @@ app.controller('editPHPConfig', function ($scope, $http, $timeout) {
};
$scope.fetchAdvancePHPDetails = function () {
$scope.loadingPHP = false;
$scope.savebtnAdvance = true;
@@ -501,7 +500,6 @@ app.controller('editPHPConfig', function ($scope, $http, $timeout) {
};
$scope.saveChangesAdvance = function () {
$scope.loadingPHP = false;
@@ -555,6 +553,16 @@ app.controller('editPHPConfig', function ($scope, $http, $timeout) {
};
$scope.restartPHP = function () {
globalScope = $scope;
$scope.cyberPanelLoading = false;
url = "/managephp/restartPHP";
var data = {};
GLobalAjaxCall($http, url, data, GlobalRespSuccess, GlobalRespFailed);
};
});

31
static/manageSSL/manageSSL.js Executable file → Normal file
View File

@@ -51,10 +51,7 @@ app.controller('sslIssueCtrl', function($scope,$http) {
$scope.sslDomain = $scope.virtualHost;
}
else
{
} else {
$scope.sslIssueCtrl = true;
$scope.manageSSLLoading = true;
$scope.issueSSLBtn = false;
@@ -66,8 +63,8 @@ app.controller('sslIssueCtrl', function($scope,$http) {
}
}
function cantLoadInitialDatas(response) {
$scope.sslIssueCtrl = true;
$scope.manageSSLLoading = true;
@@ -79,9 +76,6 @@ app.controller('sslIssueCtrl', function($scope,$http) {
}
};
});
@@ -103,7 +97,6 @@ app.controller('sslIssueForHostNameCtrl', function($scope,$http) {
};
$scope.issueSSL = function () {
$scope.manageSSLLoading = false;
@@ -138,10 +131,7 @@ app.controller('sslIssueForHostNameCtrl', function($scope,$http) {
$scope.sslDomain = $scope.virtualHost;
}
else
{
} else {
$scope.sslIssueCtrl = true;
$scope.manageSSLLoading = true;
$scope.issueSSLBtn = false;
@@ -153,8 +143,8 @@ app.controller('sslIssueForHostNameCtrl', function($scope,$http) {
}
}
function cantLoadInitialDatas(response) {
$scope.sslIssueCtrl = true;
$scope.manageSSLLoading = true;
@@ -166,9 +156,6 @@ app.controller('sslIssueForHostNameCtrl', function($scope,$http) {
}
};
});
@@ -225,10 +212,7 @@ app.controller('sslIssueForMailServer', function($scope,$http) {
$scope.sslDomain = $scope.virtualHost;
}
else
{
} else {
$scope.sslIssueCtrl = true;
$scope.manageSSLLoading = true;
$scope.issueSSLBtn = false;
@@ -240,8 +224,8 @@ app.controller('sslIssueForMailServer', function($scope,$http) {
}
}
function cantLoadInitialDatas(response) {
$scope.sslIssueCtrl = true;
$scope.manageSSLLoading = true;
@@ -253,9 +237,6 @@ app.controller('sslIssueForMailServer', function($scope,$http) {
}
};
});