mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-13 00:36:10 +01:00
apache manager
This commit is contained in:
@@ -4518,7 +4518,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
$scope.currentStatus = "Starting creation..";
|
||||
$scope.DomainCreateForm = true;
|
||||
|
||||
var ssl, dkimCheck, openBasedir;
|
||||
var ssl, dkimCheck, openBasedir, apacheBackend;
|
||||
|
||||
if ($scope.sslCheck === true) {
|
||||
ssl = 1;
|
||||
@@ -4539,6 +4539,13 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
|
||||
if ($scope.apacheBackend === true) {
|
||||
apacheBackend = 1;
|
||||
} else {
|
||||
apacheBackend = 0
|
||||
}
|
||||
|
||||
|
||||
url = "/websites/submitDomainCreation";
|
||||
var domainName = $scope.domainNameCreate;
|
||||
var phpSelection = $scope.phpSelection;
|
||||
@@ -4567,7 +4574,8 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
path: path,
|
||||
masterDomain: $scope.masterDomain,
|
||||
dkimCheck: dkimCheck,
|
||||
openBasedir: openBasedir
|
||||
openBasedir: openBasedir,
|
||||
apacheBackend: apacheBackend
|
||||
};
|
||||
|
||||
var config = {
|
||||
@@ -9694,3 +9702,284 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) {
|
||||
});
|
||||
|
||||
/* Java script code to git tracking ends here */
|
||||
|
||||
|
||||
app.controller('ApacheManager', function ($scope, $http, $timeout) {
|
||||
$scope.cyberpanelloading = true;
|
||||
$scope.apacheOLS = true;
|
||||
$scope.pureOLS = true;
|
||||
$scope.lswsEnt = true;
|
||||
|
||||
var apache = 1, ols = 2, lsws = 3;
|
||||
var statusFile;
|
||||
|
||||
$scope.getSwitchStatus = function () {
|
||||
$scope.cyberpanelloading = false;
|
||||
url = "/websites/getSwitchStatus";
|
||||
|
||||
var data = {
|
||||
domainName: $("#domainNamePage").text()
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
|
||||
|
||||
function ListInitialData(response) {
|
||||
$scope.cyberpanelloading = true;
|
||||
if (response.data.status === 1) {
|
||||
if (response.data.server === apache) {
|
||||
$scope.apacheOLS = false;
|
||||
$scope.pureOLS = true;
|
||||
$scope.lswsEnt = true;
|
||||
$scope.configData = response.data.configData;
|
||||
|
||||
$scope.pmMaxChildren = response.data.pmMaxChildren;
|
||||
$scope.pmStartServers = response.data.pmStartServers;
|
||||
$scope.pmMinSpareServers = response.data.pmMinSpareServers;
|
||||
$scope.pmMaxSpareServers = response.data.pmMaxSpareServers;
|
||||
$scope.phpPath = response.data.phpPath;
|
||||
|
||||
|
||||
} else if (response.data.server === ols) {
|
||||
$scope.apacheOLS = true;
|
||||
$scope.pureOLS = false;
|
||||
$scope.lswsEnt = true;
|
||||
} else {
|
||||
$scope.apacheOLS = true;
|
||||
$scope.pureOLS = true;
|
||||
$scope.lswsEnt = false;
|
||||
}
|
||||
//$scope.records = JSON.parse(response.data.data);
|
||||
} else {
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
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.getSwitchStatus();
|
||||
|
||||
$scope.switchServer = function (server) {
|
||||
$scope.cyberpanelloading = false;
|
||||
$scope.functionProgress = {"width": "0%"};
|
||||
$scope.functionStatus = 'Starting conversion..';
|
||||
|
||||
url = "/websites/switchServer";
|
||||
|
||||
var data = {
|
||||
domainName: $("#domainNamePage").text(),
|
||||
phpSelection: $scope.phpSelection,
|
||||
server: server
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
|
||||
function ListInitialData(response) {
|
||||
if (response.data.status === 1) {
|
||||
statusFile = response.data.tempStatusPath;
|
||||
statusFunc();
|
||||
|
||||
} else {
|
||||
$scope.cyberpanelloading = true;
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
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 statusFunc() {
|
||||
$scope.cyberpanelloading = false;
|
||||
url = "/websites/statusFunc";
|
||||
|
||||
var data = {
|
||||
statusFile: statusFile
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
|
||||
|
||||
function ListInitialData(response) {
|
||||
if (response.data.status === 1) {
|
||||
if (response.data.abort === 1) {
|
||||
$scope.functionProgress = {"width": "100%"};
|
||||
$scope.functionStatus = response.data.currentStatus;
|
||||
$scope.cyberpanelloading = true;
|
||||
$timeout.cancel();
|
||||
$scope.getSwitchStatus();
|
||||
} else {
|
||||
$scope.functionProgress = {"width": response.data.installationProgress + "%"};
|
||||
$scope.functionStatus = response.data.currentStatus;
|
||||
$timeout(statusFunc, 3000);
|
||||
}
|
||||
|
||||
} else {
|
||||
$scope.cyberpanelloading = true;
|
||||
$scope.functionStatus = response.data.error_message;
|
||||
$scope.functionProgress = {"width": response.data.installationProgress + "%"};
|
||||
$timeout.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
$scope.functionProgress = {"width": response.data.installationProgress + "%"};
|
||||
$scope.functionStatus = 'Could not connect to server, please refresh this page.';
|
||||
$timeout.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$scope.tuneSettings = function () {
|
||||
$scope.cyberpanelloading = false;
|
||||
|
||||
url = "/websites/tuneSettings";
|
||||
|
||||
var data = {
|
||||
domainName: $("#domainNamePage").text(),
|
||||
pmMaxChildren: $scope.pmMaxChildren,
|
||||
pmStartServers: $scope.pmStartServers,
|
||||
pmMinSpareServers: $scope.pmMinSpareServers,
|
||||
pmMaxSpareServers: $scope.pmMaxSpareServers,
|
||||
phpPath: $scope.phpPath
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
|
||||
function ListInitialData(response) {
|
||||
$scope.cyberpanelloading = true;
|
||||
if (response.data.status === 1) {
|
||||
|
||||
new PNotify({
|
||||
title: 'Success',
|
||||
text: 'Changes successfully applied.',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
} else {
|
||||
$scope.cyberpanelloading = true;
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
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.saveApacheConfig = function () {
|
||||
$scope.cyberpanelloading = false;
|
||||
|
||||
url = "/websites/saveApacheConfigsToFile";
|
||||
|
||||
var data = {
|
||||
domainName: $("#domainNamePage").text(),
|
||||
configData: $scope.configData
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
|
||||
function ListInitialData(response) {
|
||||
$scope.cyberpanelloading = true;
|
||||
if (response.data.status === 1) {
|
||||
|
||||
new PNotify({
|
||||
title: 'Success',
|
||||
text: 'Changes successfully applied.',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
} else {
|
||||
$scope.cyberpanelloading = true;
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
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'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user