mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
Docker site done
This commit is contained in:
@@ -371,6 +371,36 @@
|
||||
</li>
|
||||
|
||||
|
||||
<!-------------Docker Sites--------------------------->
|
||||
<li id="sidebar-menu-item-dockersite">
|
||||
<a href="#" title="{% trans 'Dockersite' %}">
|
||||
<div class="glyph-icon icon-globe" title="{% trans 'Dockersite' %}"></div>
|
||||
<span>{% trans "Dockersite" %}</span>
|
||||
</a>
|
||||
<div class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
{# {% if admin or createWebsite %}#}
|
||||
<li><a href="{% url 'CreateDockerPackage' %}"
|
||||
><span>{% trans "Create Docker Package" %}</span></a>
|
||||
</li>
|
||||
{# {% endif %}#}
|
||||
<li><a href="{% url 'AssignPackage' %}"
|
||||
><span>{% trans "Assign Package" %}</span></a>
|
||||
</li>
|
||||
<li><a href="{% url 'CreateDockersite' %}"
|
||||
><span>{% trans "Create Docker Site" %}</span></a>
|
||||
</li>
|
||||
<li><a href="{% url 'ListDockerSites' %}"
|
||||
><span>{% trans "List Docker Site" %}</span></a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
|
||||
<li id="sidebar-menu-item-websites">
|
||||
<a href="{% url 'loadWebsitesHome' %}" title="{% trans 'Websites' %}">
|
||||
<div class="glyph-icon icon-globe" title="{% trans 'Websites' %}"></div>
|
||||
|
||||
@@ -1,19 +1,42 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
from plogical import randomPassword
|
||||
from plogical.acl import ACLManager
|
||||
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
import django
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
import argparse
|
||||
import threading as multi
|
||||
|
||||
class DockerSites:
|
||||
class Docker_Sites(multi.Thread):
|
||||
|
||||
def __init__(self, data):
|
||||
|
||||
Wordpress = 1
|
||||
Joomla = 2
|
||||
|
||||
def __init__(self, function_run, data):
|
||||
multi.Thread.__init__(self)
|
||||
self.function_run = function_run
|
||||
self.data = data
|
||||
self.JobID = self.data['JobID'] ##JOBID will be file path where status is being written
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
if self.function_run == 'DeployWPContainer':
|
||||
self.DeployWPContainer()
|
||||
elif self.function_run =='SubmitDockersiteCreation':
|
||||
self.SubmitDockersiteCreation()
|
||||
|
||||
|
||||
except BaseException as msg:
|
||||
logging.writeToFile(str(msg) + ' [Docker_Sites.run]')
|
||||
def InstallDocker(self):
|
||||
|
||||
command = 'apt install docker-compose -y'
|
||||
@@ -335,7 +358,132 @@ services:
|
||||
print(str(msg))
|
||||
pass
|
||||
|
||||
def SubmitDockersiteCreation(self):
|
||||
try:
|
||||
|
||||
from websiteFunctions.models import DockerSites, Websites
|
||||
from websiteFunctions.website import WebsiteManager
|
||||
|
||||
|
||||
tempStatusPath = self.data['JobID']
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines('Creating Website...,10')
|
||||
statusFile.close()
|
||||
|
||||
Domain = self.data['Domain']
|
||||
WPemal = self.data['WPemal']
|
||||
Owner = self.data['Owner']
|
||||
userID = self.data['userID']
|
||||
MysqlCPU = self.data['MysqlCPU']
|
||||
MYsqlRam = self.data['MYsqlRam']
|
||||
SiteCPU = self.data['SiteCPU']
|
||||
SiteRam = self.data['SiteRam']
|
||||
sitename = self.data['sitename']
|
||||
WPusername = self.data['WPusername']
|
||||
WPpasswd = self.data['WPpasswd']
|
||||
externalApp = self.data['externalApp']
|
||||
|
||||
|
||||
currentTemp = tempStatusPath
|
||||
|
||||
|
||||
DataToPass = {}
|
||||
DataToPass['tempStatusPath'] = tempStatusPath
|
||||
DataToPass['domainName'] = Domain
|
||||
DataToPass['adminEmail'] = WPemal
|
||||
DataToPass['phpSelection'] = "PHP 8.1"
|
||||
DataToPass['websiteOwner'] = Owner
|
||||
DataToPass['package'] = 'Default'
|
||||
DataToPass['ssl'] = 1
|
||||
DataToPass['dkimCheck'] = 0
|
||||
DataToPass['openBasedir'] = 0
|
||||
DataToPass['mailDomain'] = 0
|
||||
DataToPass['apacheBackend'] = 0
|
||||
UserID = userID
|
||||
|
||||
try:
|
||||
website = Websites.objects.get(domain=DataToPass['domainName'])
|
||||
|
||||
if website.phpSelection == 'PHP 7.3':
|
||||
website.phpSelection = 'PHP 8.0'
|
||||
website.save()
|
||||
|
||||
if ACLManager.checkOwnership(website.domain, self.data['adminID'],
|
||||
self.data['currentACL']) == 0:
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines('You dont own this site.[404]')
|
||||
statusFile.close()
|
||||
except:
|
||||
|
||||
ab = WebsiteManager()
|
||||
coreResult = ab.submitWebsiteCreation(UserID, DataToPass)
|
||||
coreResult1 = json.loads((coreResult).content)
|
||||
logging.writeToFile("Creating website result....%s" % coreResult1)
|
||||
reutrntempath = coreResult1['tempStatusPath']
|
||||
while (1):
|
||||
lastLine = open(reutrntempath, 'r').read()
|
||||
logging.writeToFile("Error web creating lastline ....... %s" % lastLine)
|
||||
if lastLine.find('[200]') > -1:
|
||||
break
|
||||
elif lastLine.find('[404]') > -1:
|
||||
statusFile = open(currentTemp, 'w')
|
||||
statusFile.writelines('Failed to Create Website: error: %s. [404]' % lastLine)
|
||||
statusFile.close()
|
||||
return 0
|
||||
else:
|
||||
statusFile = open(currentTemp, 'w')
|
||||
statusFile.writelines('Creating Website....,20')
|
||||
statusFile.close()
|
||||
time.sleep(2)
|
||||
|
||||
statusFile = open(tempStatusPath, 'w')
|
||||
statusFile.writelines('Creating DockerSite....,30')
|
||||
statusFile.close()
|
||||
|
||||
|
||||
dbname = randomPassword.generate_pass()
|
||||
dbpasswd = randomPassword.generate_pass()
|
||||
dbusername = randomPassword.generate_pass()
|
||||
MySQLRootPass = randomPassword.generate_pass()
|
||||
f_data = {
|
||||
"JobID": tempStatusPath,
|
||||
"ComposePath": f"/home/{Domain}/docker-compose.yml",
|
||||
"MySQLPath": f'/home/{Domain}/public_html/sqldocker',
|
||||
"MySQLRootPass": MySQLRootPass,
|
||||
"MySQLDBName": dbname,
|
||||
"MySQLDBNUser": dbusername,
|
||||
"MySQLPassword": dbpasswd,
|
||||
"CPUsMySQL": MysqlCPU,
|
||||
"MemoryMySQL": MYsqlRam,
|
||||
"port": '8000',
|
||||
"SitePath": f'/home/{Domain}/public_html/wpdocker',
|
||||
"CPUsSite": SiteCPU,
|
||||
"MemorySite": SiteRam,
|
||||
"SiteName": sitename,
|
||||
"finalURL": Domain,
|
||||
"blogTitle": sitename,
|
||||
"adminUser": WPusername,
|
||||
"adminPassword": WPpasswd,
|
||||
"adminEmail": WPemal,
|
||||
"htaccessPath": f'/home/{Domain}/public_html/.htaccess',
|
||||
"externalApp": externalApp,
|
||||
"docRoot": f"/home/{Domain}"
|
||||
}
|
||||
webobj = Websites.objects.get(domain=Domain)
|
||||
dockersiteobj = DockerSites(
|
||||
admin = webobj, ComposePath=f"/home/{Domain}/docker-compose.yml", SitePath= f'/home/{Domain}/public_html/wpdocker',
|
||||
MySQLPath=f'/home/{Domain}/public_html/sqldocker', SiteType=Docker_Sites.Wordpress, MySQLDBName=dbname,
|
||||
MySQLDBNUser=dbusername, CPUsMySQL=MysqlCPU, MemoryMySQL=MYsqlRam, port=8000, CPUsSite=SiteCPU, MemorySite=SiteRam,
|
||||
SiteName=sitename, finalURL= Domain, blogTitle=sitename, adminUser=WPusername, adminEmail=WPemal
|
||||
)
|
||||
dockersiteobj.save()
|
||||
|
||||
background = Docker_Sites('DeployWPContainer', f_data)
|
||||
background.start()
|
||||
|
||||
except BaseException as msg:
|
||||
logging.writeToFile("Error Submit Docker site Creation ....... %s" % str(msg))
|
||||
return 0
|
||||
|
||||
def Main():
|
||||
try:
|
||||
@@ -382,7 +530,7 @@ def Main():
|
||||
"externalApp": 'docke3339',
|
||||
"docRoot": "/home/docker.cyberpanel.net"
|
||||
}
|
||||
ds = DockerSites(data)
|
||||
ds = Docker_Sites(data)
|
||||
ds.DeployWPContainer()
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ django.setup()
|
||||
from loginSystem.models import Administrator, ACL
|
||||
from django.shortcuts import HttpResponse
|
||||
from packages.models import Package
|
||||
from websiteFunctions.models import Websites, ChildDomains, aliasDomains
|
||||
from websiteFunctions.models import Websites, ChildDomains, aliasDomains, DockerSites
|
||||
import json
|
||||
from subprocess import call, CalledProcessError
|
||||
from shlex import split
|
||||
@@ -620,6 +620,29 @@ class ACLManager:
|
||||
|
||||
return websiteList
|
||||
|
||||
@staticmethod
|
||||
def findDockersiteObjects(currentACL, userID):
|
||||
if currentACL['admin'] == 1:
|
||||
return DockerSites.objects.all()
|
||||
else:
|
||||
|
||||
DockersiteList = []
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
websites = admin.DockerSites_set.all()
|
||||
|
||||
for items in websites:
|
||||
DockersiteList.append(items)
|
||||
|
||||
admins = Administrator.objects.filter(owner=admin.pk)
|
||||
|
||||
for items in admins:
|
||||
webs = items.DockerSites_set.all()
|
||||
for web in webs:
|
||||
DockersiteList.append(web)
|
||||
|
||||
return DockersiteList
|
||||
|
||||
@staticmethod
|
||||
def findAllDomains(currentACL, userID):
|
||||
domainsList = []
|
||||
|
||||
@@ -188,6 +188,7 @@ class DockerSites(models.Model):
|
||||
adminEmail = models.CharField(max_length=100)
|
||||
|
||||
class DockerPackages(models.Model):
|
||||
Name = models.CharField(max_length=100, default='')
|
||||
CPUs = models.IntegerField()
|
||||
Ram = models.IntegerField()
|
||||
Bandwidth = models.TextField()
|
||||
|
||||
@@ -10002,3 +10002,536 @@ app.controller('ApacheManager', function ($scope, $http, $timeout) {
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
|
||||
app.controller('createDockerPackage', function ($scope, $http, $window) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
|
||||
$scope.createdockerpackage = function () {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
var data = {
|
||||
name: $scope.packagesname,
|
||||
cpu: $scope.CPU,
|
||||
Memory: $scope.Memory,
|
||||
Bandwidth: $scope.Bandwidth,
|
||||
disk: $scope.disk
|
||||
};
|
||||
|
||||
|
||||
dataurl = "/websites/AddDockerpackage";
|
||||
|
||||
$http.post(dataurl, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
if (response.data.status === 1) {
|
||||
new PNotify({
|
||||
title: 'Success',
|
||||
text: 'Successfully Saved.',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
} 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'
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$scope.Getpackage = function (packid) {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
var data = {
|
||||
id: packid,
|
||||
};
|
||||
|
||||
|
||||
dataurl = "/websites/Getpackage";
|
||||
|
||||
$http.post(dataurl, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
if (response.data.status === 1) {
|
||||
$scope.U_Name = response.data.error_message.obj.Name
|
||||
$scope.U_CPU = response.data.error_message.obj.CPU
|
||||
$scope.U_Memory = response.data.error_message.obj.Memory
|
||||
$scope.U_Bandwidth = response.data.error_message.obj.Bandwidth
|
||||
$scope.U_DiskSpace = response.data.error_message.obj.DiskSpace
|
||||
|
||||
$scope.EidtID = packid;
|
||||
|
||||
} 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'
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$scope.SaveUpdate = function () {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
var data = {
|
||||
id: $scope.EidtID,
|
||||
CPU: $scope.U_CPU,
|
||||
RAM: $scope.U_Memory,
|
||||
Bandwidth: $scope.U_Bandwidth,
|
||||
DiskSpace: $scope.U_DiskSpace,
|
||||
};
|
||||
|
||||
|
||||
dataurl = "/websites/Updatepackage";
|
||||
|
||||
$http.post(dataurl, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
if (response.data.status === 1) {
|
||||
new PNotify({
|
||||
title: 'Success',
|
||||
text: 'Successfully Updated.',
|
||||
type: 'success'
|
||||
});
|
||||
} 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'
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var FinalDeletepackageURL;
|
||||
$scope.Deletepackage = function (url) {
|
||||
FinalDeletepackageURL = url;
|
||||
// console.log(FinalDeletepackageURL);
|
||||
}
|
||||
|
||||
$scope.ConfirmDelete = function () {
|
||||
window.location.href = FinalDeletepackageURL
|
||||
}
|
||||
|
||||
})
|
||||
app.controller('AssignPackage', function ($scope, $http,) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.AddAssignment = function () {
|
||||
$scope.cyberpanelLoading = false;
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
var data = {
|
||||
package: $('#packageSelection').val(),
|
||||
user: $scope.userSelection,
|
||||
};
|
||||
|
||||
|
||||
dataurl = "/websites/AddAssignment";
|
||||
|
||||
$http.post(dataurl, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
if (response.data.status === 1) {
|
||||
new PNotify({
|
||||
title: 'Success',
|
||||
text: 'Successfully saved.',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
} 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'
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var FinalDeletepackageURL;
|
||||
$scope.Deleteassingment = function (url) {
|
||||
FinalDeletepackageURL = url;
|
||||
// console.log(FinalDeletepackageURL);
|
||||
}
|
||||
|
||||
$scope.ConfirmDelete = function () {
|
||||
window.location.href = FinalDeletepackageURL
|
||||
}
|
||||
|
||||
})
|
||||
app.controller('createDockerSite', function ($scope, $http,$timeout) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.installationDetailsForm = false;
|
||||
$scope.installationProgress = true;
|
||||
$scope.errorMessageBox = true;
|
||||
$scope.success = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.goBackDisable = true;
|
||||
|
||||
var statusFile;
|
||||
|
||||
$scope.createdockersite = function () {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.errorMessageBox = true;
|
||||
$scope.success = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.goBackDisable = true;
|
||||
|
||||
$scope.currentStatus = "Starting creation..";
|
||||
|
||||
|
||||
|
||||
|
||||
url = "/websites/submitDockerSiteCreation";
|
||||
|
||||
var package = $scope.packageForWebsite;
|
||||
|
||||
|
||||
|
||||
|
||||
var data = {
|
||||
sitename: $scope.siteName,
|
||||
Owner: $scope.userSelection,
|
||||
Domain: $scope.domainNameCreate,
|
||||
MysqlCPU: $scope.CPUMysql,
|
||||
MYsqlRam: $scope.rammysql,
|
||||
SiteCPU: $scope.CPUSite,
|
||||
SiteRam: $scope.RamSite,
|
||||
App: $scope.App,
|
||||
WPusername: $scope.WPUsername,
|
||||
WPemal: $scope.wpEmail,
|
||||
WPpasswd: $scope.WPpassword
|
||||
};
|
||||
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
console.log('.........................')
|
||||
if (response.data.installStatus === 1) {
|
||||
console.log(response.data.installsatus)
|
||||
statusFile = response.data.tempStatusPath;
|
||||
getCreationStatus();
|
||||
} else {
|
||||
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.errorMessageBox = false;
|
||||
$scope.success = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.goBackDisable = false;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.errorMessageBox = true;
|
||||
$scope.success = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.goBackDisable = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
$scope.goBack = function () {
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.installationDetailsForm = false;
|
||||
$scope.installationProgress = true;
|
||||
$scope.errorMessageBox = true;
|
||||
$scope.success = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.goBackDisable = true;
|
||||
$("#installProgress").css("width", "0%");
|
||||
};
|
||||
|
||||
function getCreationStatus() {
|
||||
|
||||
url = "/websites/installWordpressStatus";
|
||||
|
||||
var data = {
|
||||
statusFile: statusFile
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
|
||||
if (response.data.abort === 1) {
|
||||
|
||||
if (response.data.installStatus === 1) {
|
||||
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.errorMessageBox = true;
|
||||
$scope.success = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.goBackDisable = false;
|
||||
|
||||
$("#installProgress").css("width", "100%");
|
||||
$scope.installPercentage = "100";
|
||||
$scope.currentStatus = response.data.currentStatus;
|
||||
$timeout.cancel();
|
||||
|
||||
} else {
|
||||
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.errorMessageBox = false;
|
||||
$scope.success = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.goBackDisable = false;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
$("#installProgress").css("width", "0%");
|
||||
$scope.installPercentage = "0";
|
||||
$scope.goBackDisable = false;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
$("#installProgress").css("width", response.data.installationProgress + "%");
|
||||
$scope.installPercentage = response.data.installationProgress;
|
||||
$scope.currentStatus = response.data.currentStatus;
|
||||
$timeout(getCreationStatus, 1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.errorMessageBox = true;
|
||||
$scope.success = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.goBackDisable = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
app.controller('listDockersite', function ($scope, $http) {
|
||||
|
||||
$scope.cyberPanelLoading = true;
|
||||
|
||||
|
||||
$scope.currentPage = 1;
|
||||
$scope.recordsToShow = 10;
|
||||
|
||||
$scope.fetchDockersiteFromDB = function () {
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
var data = {
|
||||
page: $scope.currentPage,
|
||||
recordsToShow: $scope.recordsToShow
|
||||
};
|
||||
|
||||
|
||||
dataurl = "/websites/fetchDockersite";
|
||||
|
||||
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
|
||||
|
||||
function ListInitialData(response) {
|
||||
if (response.data.listWebSiteStatus === 1) {
|
||||
|
||||
$scope.WebSitesList = JSON.parse(response.data.data);
|
||||
$scope.pagination = response.data.pagination;
|
||||
$scope.clients = JSON.parse(response.data.data);
|
||||
$("#listFail").hide();
|
||||
} else {
|
||||
$("#listFail").fadeIn();
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
$scope.fetchDockersiteFromDB();
|
||||
|
||||
$scope.cyberPanelLoading = true;
|
||||
|
||||
|
||||
$scope.cyberPanelLoading = true;
|
||||
|
||||
$scope.searchWebsites = function () {
|
||||
|
||||
$scope.cyberPanelLoading = false;
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
var data = {
|
||||
patternAdded: $scope.patternAdded
|
||||
};
|
||||
|
||||
dataurl = "/websites/searchWebsites";
|
||||
|
||||
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
|
||||
|
||||
function ListInitialData(response) {
|
||||
$scope.cyberPanelLoading = true;
|
||||
if (response.data.listWebSiteStatus === 1) {
|
||||
|
||||
var finalData = JSON.parse(response.data.data);
|
||||
$scope.WebSitesList = finalData;
|
||||
$("#listFail").hide();
|
||||
} 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: 'Connect disrupted, refresh the page.',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
var deletedockersiteurl;
|
||||
$scope.DeleteDockersite = function (url, id){
|
||||
// console.log(url)
|
||||
// console.log(id)
|
||||
deletedockersiteurl= url+id;
|
||||
}
|
||||
|
||||
$scope.ConfirmDelete = function () {
|
||||
window.location.href = deletedockersiteurl;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,336 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create Package - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
<style>
|
||||
.switch {
|
||||
margin-top: 7px;
|
||||
margin-left: 12px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 32px;
|
||||
height: 19px;
|
||||
border-radius: 10%;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
border-radius: 10%;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 11px;
|
||||
width: 12px;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
background-color: white;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
border-radius: 20%;
|
||||
}
|
||||
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #2196F3;
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 2px #2196F3;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(12px);
|
||||
-ms-transform: translateX(12px);
|
||||
transform: translateX(12px);
|
||||
}
|
||||
|
||||
.help_test_domain {
|
||||
background-color: black;
|
||||
padding: 10px;
|
||||
display: none;
|
||||
opacity: 0.7;
|
||||
position: absolute;
|
||||
z-index: 9;
|
||||
text-align: justify;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#help:hover + .help_test_domain {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
color: white;
|
||||
font-weight: lighter;
|
||||
font-size: small;
|
||||
border-radius: 5px;
|
||||
width: 200px;
|
||||
|
||||
{#height: auto;#}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Create Package" %}</h2>
|
||||
<p>{% trans "On this page you can create, list, modify and delete Packages from your server." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-controller="createDockerPackage" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Packages Details" %} <img ng-hide="cyberpanelLoading"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<form name="websiteCreationForm" action="/" id="createPackages"
|
||||
class="form-horizontal bordered-row panel-body">
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Package Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="text" class="form-control" ng-model="packagesname"
|
||||
placeholder="{% trans "Enter Name" %}" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "CPU" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="number" class="form-control" ng-model="CPU"
|
||||
placeholder="{% trans "Enter CPU e.g. 2,3,4" %}" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Memory" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="number" class="form-control" ng-model="Memory"
|
||||
placeholder="{% trans "Enter Memory in MB e.g. 256, 512, 1024" %}" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Bandwidth" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="text" class="form-control" ng-model="Bandwidth"
|
||||
placeholder="{% trans "Enter Bandwidth" %}" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Disk Space" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="text" class="form-control" ng-model="disk"
|
||||
placeholder="{% trans "Enter Disk Space" %}" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button
|
||||
type="button" ng-click="createdockerpackage()"
|
||||
class="btn btn-primary btn-lg">{% trans "Create Docker Package" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<div class="panel panel-body">
|
||||
<h3 class="content-box-header"> Docker Packages</h3>
|
||||
<div class="content-box-header">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Package Name</th>
|
||||
<th>CPUs</th>
|
||||
<th>Memory</th>
|
||||
<th>Bandwidth</th>
|
||||
<th>Disk Space</th>
|
||||
<th>Action</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for pack in packages %}
|
||||
<tr>
|
||||
<td> {{ pack.Name }}</td>
|
||||
<td> {{ pack.CPUs }}</td>
|
||||
<td>{{ pack.Ram }}</td>
|
||||
<td>{{ pack.Bandwidth }}</td>
|
||||
<td> {{ pack.DiskSpace }}</td>
|
||||
<td>
|
||||
<button class="btn btn-warning" ng-click="Getpackage({{ pack.id }})"
|
||||
data-toggle="modal" data-target="#Eidtpackage"> Eidt
|
||||
</button>
|
||||
<button class="btn btn-danger" ng-click="Deletepackage('{% url 'CreateDockerPackage' %}?DeleteID={{ pack.id }}')" data-toggle="modal" data-target="#packagedelete"> Delete</button>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="Eidtpackage" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog modal-lg">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">Eidt Package
|
||||
<img ng-hide="cyberpanelLoading"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<form name="websiteCreationForm" action="/" id="createPackages"
|
||||
class="form-horizontal bordered-row panel-body">
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Package Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="text" class="form-control" ng-model="U_Name"
|
||||
readonly required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "CPU" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="number" class="form-control" ng-model="U_CPU"
|
||||
placeholder="{% trans "Enter CPU e.g. 2,3,4" %}" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Memory" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="number" class="form-control"
|
||||
ng-model="U_Memory"
|
||||
placeholder="{% trans "Enter Memory in MB e.g. 256, 512, 1024" %}"
|
||||
required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Bandwidth" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="text" class="form-control"
|
||||
ng-model="U_Bandwidth"
|
||||
placeholder="{% trans "Enter Bandwidth" %}" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Disk Space" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="text" class="form-control" ng-model="U_DiskSpace"
|
||||
placeholder="{% trans "Enter Disk Space" %}" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button
|
||||
type="button" ng-click="SaveUpdate()"
|
||||
class="btn btn-primary btn-lg">{% trans "Update Package" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn btn-default" data-dismiss="modal">
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="packagedelete" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog modal-sm">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">Delete Package
|
||||
<img ng-hide="cyberpanelLoading"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<h4> Are you sure to delete the packages?</h4>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn btn-default" data-dismiss="modal">
|
||||
Close
|
||||
</button>
|
||||
<button type="button"
|
||||
class="btn btn-warning" ng-click="ConfirmDelete()">
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,261 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Create Docker Site - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
<style>
|
||||
.switch {
|
||||
margin-top: 7px;
|
||||
margin-left: 12px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 32px;
|
||||
height: 19px;
|
||||
border-radius: 10%;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
border-radius: 10%;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 11px;
|
||||
width: 12px;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
background-color: white;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
border-radius: 20%;
|
||||
}
|
||||
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #2196F3;
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 2px #2196F3;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(12px);
|
||||
-ms-transform: translateX(12px);
|
||||
transform: translateX(12px);
|
||||
}
|
||||
|
||||
.help_test_domain {
|
||||
background-color: black;
|
||||
padding: 10px;
|
||||
display: none;
|
||||
opacity: 0.7;
|
||||
position: absolute;
|
||||
z-index: 9;
|
||||
text-align: justify;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#help:hover + .help_test_domain {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
color: white;
|
||||
font-weight: lighter;
|
||||
font-size: small;
|
||||
border-radius: 5px;
|
||||
width: 200px;
|
||||
|
||||
{#height: auto;#}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Create Docker Site" %}</h2>
|
||||
<p>{% trans "On this page you can create docker site on your server." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-controller="createDockerSite" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Docker Site Details" %} <img ng-hide="cyberpanelLoading"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
|
||||
|
||||
<form name="websiteCreationForm" action="/" id="createPackages"
|
||||
class="form-horizontal bordered-row panel-body">
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Site Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" name="email" class="form-control" ng-model="siteName" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Owner" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="userSelection" class="form-control">
|
||||
{% for admin in adminNames %}
|
||||
<option>{{ admin }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="text" class="form-control" ng-model="domainNameCreate"
|
||||
placeholder="{% trans "Do not enter WWW, it will be auto created!" %}" required>
|
||||
</div>
|
||||
<div ng-show="websiteCreationForm.dom.$error.pattern"
|
||||
class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "MySQL CPU" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" name="email" class="form-control" ng-model="CPUMysql" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "MySQL Ram" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" name="email" class="form-control" ng-model="rammysql" required>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "CPU Site" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" name="email" class="form-control" ng-model="CPUSite" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Ram Site" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" name="email" class="form-control" ng-model="RamSite" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select App" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="App" class="form-control">
|
||||
<option>Wordpress</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Admin Username" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" name="email" class="form-control" ng-model="WPUsername" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Admin Email" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="email" name="email" class="form-control" ng-model="wpEmail" required>
|
||||
</div>
|
||||
<div ng-show="websiteCreationForm.email.$error.email"
|
||||
class="current-pack">{% trans "Invalid Email" %}</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Admin Password" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="password" name="email" class="form-control" ng-model="WPpassword" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button ng-disabled="websiteCreationForm.dom.$error.required || websiteCreationForm.email.$invalid"
|
||||
type="button" ng-click="createdockersite()"
|
||||
class="btn btn-primary btn-lg">{% trans "Create Docker Site" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationProgress" class="form-group">
|
||||
<label class="col-sm-2 control-label"></label>
|
||||
<div class="col-sm-7">
|
||||
|
||||
<div class="alert alert-success text-center">
|
||||
<h2>{$ currentStatus $}</h2>
|
||||
</div>
|
||||
|
||||
<div class="progress">
|
||||
<div id="installProgress" class="progress-bar" role="progressbar" aria-valuenow="70"
|
||||
aria-valuemin="0" aria-valuemax="100" style="width:0%">
|
||||
<span class="sr-only">70% Complete</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="errorMessageBox" class="alert alert-danger">
|
||||
<p>{% trans "Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="success" class="alert alert-success">
|
||||
<p>{% trans "Website succesfully created." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationProgress" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-disabled="goBackDisable" ng-click="goBack()"
|
||||
class="btn btn-primary btn-lg">{% trans "Go Back" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,18 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Docker Sites - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
</script>
|
||||
|
||||
<h2> Docker Site Home</h2>
|
||||
|
||||
{% endblock %}
|
||||
164
websiteFunctions/templates/websiteFunctions/ListDockersite.html
Normal file
164
websiteFunctions/templates/websiteFunctions/ListDockersite.html
Normal file
@@ -0,0 +1,164 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Docker Sites - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div ng-controller="listDockersite" class="container">
|
||||
|
||||
<div id="page-title">
|
||||
<h2 id="domainNamePage">{% trans "List Docker Site" %}
|
||||
<a class="pull-right btn btn-primary" href="{% url "CreateDockersite" %}">{% trans "Create Docker Site" %}</a>
|
||||
</h2>
|
||||
<img ng-hide="cyberPanelLoading" src="{% static 'images/loading.gif' %}">
|
||||
<p>{% trans "On this page you can launch, list, modify and delete Dockersite from your server." %}</p>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-10" style="padding: 0px; box-shadow: 0px 0px 1px 0px #888888; margin-bottom: 2%">
|
||||
<input ng-change="searchWebsites()" placeholder="Search..." ng-model="patternAdded" name="dom" type="text"
|
||||
class="form-control" required>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2">
|
||||
<div class="form-group">
|
||||
<select ng-model="recordsToShow" ng-change="getFurtherWebsitesFromDB()"
|
||||
class="form-control" id="example-select">
|
||||
<option>10</option>
|
||||
<option>50</option>
|
||||
<option>100</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-repeat="web in WebSitesList track by $index" class="panel col-md-12"
|
||||
style="padding: 0px; box-shadow: 0px 0px 1px 0px #888888;">
|
||||
<div class="">
|
||||
<div class="table-responsive no-gutter text-nowrap" style="overflow-x: hidden;">
|
||||
|
||||
<div style="border-bottom: 1px solid #888888" class="col-md-12">
|
||||
<div class="col-lg-10 content-box-header" style="text-transform: none;">
|
||||
<a href="http://{$ web.domain $}" target="_blank" title="Visit Site">
|
||||
<h2 style="display: inline; color: #414C59;" ng-bind="web.domain"></h2>
|
||||
</a>
|
||||
<a target="_self" href="/filemanager/{$ web.domain $}" title="Open File Manager"> --
|
||||
{% trans "File Manager" %}</a>
|
||||
</div>
|
||||
<div class="col-md-2 content-box-header" style="text-transform: none;">
|
||||
<a href="/websites/{$ web.domain $}/Dockersitehome" target="_self" title="Manage Website">
|
||||
<i class="p fa fa-external-link btn-icon"> </i>
|
||||
<span>{% trans "Manage" %}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-3 content-box-header">
|
||||
<i class="p fa fa-sticky-note btn-icon text-muted" data-toggle="tooltip"
|
||||
data-placement="right" title="State"> </i>
|
||||
<span ng-bind="web.state" style="text-transform: none"></span>
|
||||
</div>
|
||||
<div class="col-md-3 content-box-header">
|
||||
<i class="p fa fa-map-marker btn-icon text-muted" data-toggle="tooltip"
|
||||
data-placement="right" title="IP Address"> </i>
|
||||
<span ng-bind="web.ipAddress"></span>
|
||||
</div>
|
||||
<div class="col-md-3 content-box-header">
|
||||
<strong>CPU: </strong>
|
||||
<span ng-bind="web.CPU" style="text-transform: none"></span>
|
||||
</div>
|
||||
<div class="col-md-3 content-box-header">
|
||||
|
||||
<span ng-bind="web.phpVersion"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-3 content-box-header">
|
||||
<strong>Ram: </strong>
|
||||
<span ng-bind="web.Ram" style="text-transform: none"></span>
|
||||
</div>
|
||||
<div class="col-md-3 content-box-header">
|
||||
<i class="p fa fa-cubes btn-icon text-muted" data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="Packages"> </i>
|
||||
<span ng-bind="web.package" style="text-transform: none"></span>
|
||||
</div>
|
||||
<div class="col-md-3 content-box-header">
|
||||
<i class="p fa fa-user btn-icon text-muted" data-toggle="tooltip" data-placement="right"
|
||||
title="Owner"> </i>
|
||||
<span ng-bind="web.admin" style="text-transform: none"></span>
|
||||
</div>
|
||||
<div class="col-md-3 content-box-header">
|
||||
<button class="btn btn-danger"
|
||||
ng-click="DeleteDockersite('{% url 'ListDockerSites' %}?DeleteID=', web.id )"
|
||||
data-toggle="modal" data-target="#deleteDockersite"> Delete
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="deleteDockersite" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog modal-sm">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">Delete Package
|
||||
<img ng-hide="cyberpanelLoading"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<h4> Are you sure to delete the Docker Site?</h4>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn btn-default" data-dismiss="modal">
|
||||
Close
|
||||
</button>
|
||||
<button type="button"
|
||||
class="btn btn-warning" ng-click="ConfirmDelete()">
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="listFail" class="alert alert-danger">
|
||||
<p>{% trans "Cannot list websites. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 2%" class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<select ng-model="currentPage" class="form-control"
|
||||
ng-change="getFurtherWebsitesFromDB()">
|
||||
<option ng-repeat="page in pagination">{$ $index + 1 $}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end row -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
224
websiteFunctions/templates/websiteFunctions/assignPackage.html
Normal file
224
websiteFunctions/templates/websiteFunctions/assignPackage.html
Normal file
@@ -0,0 +1,224 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Assign Package - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
<style>
|
||||
.switch {
|
||||
margin-top: 7px;
|
||||
margin-left: 12px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 32px;
|
||||
height: 19px;
|
||||
border-radius: 10%;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
border-radius: 10%;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 11px;
|
||||
width: 12px;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
background-color: white;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
border-radius: 20%;
|
||||
}
|
||||
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #2196F3;
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 2px #2196F3;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(12px);
|
||||
-ms-transform: translateX(12px);
|
||||
transform: translateX(12px);
|
||||
}
|
||||
|
||||
.help_test_domain {
|
||||
background-color: black;
|
||||
padding: 10px;
|
||||
display: none;
|
||||
opacity: 0.7;
|
||||
position: absolute;
|
||||
z-index: 9;
|
||||
text-align: justify;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#help:hover + .help_test_domain {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
color: white;
|
||||
font-weight: lighter;
|
||||
font-size: small;
|
||||
border-radius: 5px;
|
||||
width: 200px;
|
||||
|
||||
{#height: auto;#}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Assign Package" %}</h2>
|
||||
<p>{% trans "On this page you can Assign Packages to user." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-controller="AssignPackage" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Assigning Details" %} <img ng-hide="cyberpanelLoading"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<form name="websiteCreationForm" action="/" id="createPackages"
|
||||
class="form-horizontal bordered-row panel-body">
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "User" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="userSelection" class="form-control">
|
||||
{% for admin in adminNames %}
|
||||
<option>{{ admin }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Package" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="packageSelection" id="packageSelection" class="form-control">
|
||||
{% for package in DockerPackages %}
|
||||
<option value="{{ package.id }}">{{ package.Name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button
|
||||
type="button" ng-click="AddAssignment()"
|
||||
class="btn btn-primary btn-lg">{% trans "Save" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<div class="panel panel-body">
|
||||
<h3 class="content-box-header"> Package Assigned</h3>
|
||||
<div class="content-box-header">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
<th>Package Name</th>
|
||||
<th>Package Details</th>
|
||||
<th>Action</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for pack in assignpackage %}
|
||||
<tr>
|
||||
<td> {{ pack.user.userName }}</td>
|
||||
<td> {{ pack.package.Name }}</td>
|
||||
<td><b>CPUs:</b> {{ pack.package.CPUs }}
|
||||
<b>Memory:</b> {{ pack.package.Ram }}MB <b>DiskSpace:</b> {{ pack.package.DiskSpace }}
|
||||
<b>Bandwidth:</b> {{ pack.package.Bandwidth }}</td>
|
||||
|
||||
<td>
|
||||
{# <button class="btn btn-warning" ng-click="Getpackage({{ pack.id }})"#}
|
||||
{# data-toggle="modal" data-target="#Eidtpackage"> Eidt#}
|
||||
{# </button>#}
|
||||
<button class="btn btn-danger"
|
||||
ng-click="Deleteassingment('{% url 'AssignPackage' %}?DeleteID={{ pack.id }}')"
|
||||
data-toggle="modal" data-target="#packagedelete"> Delete
|
||||
</button>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div id="packagedelete" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog modal-sm">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title">Delete Package
|
||||
<img ng-hide="cyberpanelLoading"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<h4> Are you sure to delete the packages Assignment?</h4>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button"
|
||||
class="btn btn-default" data-dismiss="modal">
|
||||
Close
|
||||
</button>
|
||||
<button type="button"
|
||||
class="btn btn-warning" ng-click="ConfirmDelete()">
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -108,27 +108,6 @@
|
||||
<form name="websiteCreationForm" action="/" id="createPackages"
|
||||
class="form-horizontal bordered-row panel-body">
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Package" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="packageForWebsite" class="form-control">
|
||||
{% for items in packageList %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Owner" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="websiteOwner" class="form-control">
|
||||
{% for items in owernList %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
|
||||
|
||||
@@ -188,6 +188,19 @@ urlpatterns = [
|
||||
url(r'^saveGitConfigurations$', views.saveGitConfigurations, name='saveGitConfigurations'),
|
||||
url(r'^fetchGitLogs$', views.fetchGitLogs, name='fetchGitLogs'),
|
||||
|
||||
# Docker Site & Packages
|
||||
url(r'^CreateDockerPackage$', views.CreateDockerPackage, name='CreateDockerPackage'),
|
||||
url(r'^AssignPackage$', views.AssignPackage, name='AssignPackage'),
|
||||
url(r'^CreateDockersite$', views.CreateDockersite, name='CreateDockersite'),
|
||||
url(r'^AddDockerpackage$', views.AddDockerpackage, name='AddDockerpackage'),
|
||||
url(r'^Getpackage$', views.Getpackage, name='Getpackage'),
|
||||
url(r'^Updatepackage$', views.Updatepackage, name='Updatepackage'),
|
||||
url(r'^AddAssignment$', views.AddAssignment, name='AddAssignment'),
|
||||
url(r'^submitDockerSiteCreation$', views.submitDockerSiteCreation, name='submitDockerSiteCreation'),
|
||||
url(r'^ListDockerSites$', views.ListDockerSites, name='ListDockerSites'),
|
||||
url(r'^fetchDockersite$', views.fetchDockersite, name='fetchDockersite'),
|
||||
url(r'^(?P<domain>(.*))/Dockersitehome', views.Dockersitehome, name='Dockersitehome'),
|
||||
|
||||
### SSH Configs
|
||||
|
||||
url(r'^getSSHConfigs$', views.getSSHConfigs, name='getSSHConfigs'),
|
||||
|
||||
@@ -1750,3 +1750,106 @@ def saveApacheConfigsToFile(request):
|
||||
return wm.saveApacheConfigsToFile(userID, data)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def CreateDockerPackage(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
proc = httpProc(request, 'websiteFunctions/CreateDockerPackage.html',
|
||||
{"type": admin.type})
|
||||
return proc.render()
|
||||
except BaseException as msg:
|
||||
return HttpResponse(msg)
|
||||
|
||||
def CreateDockerPackage(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
DeleteID = request.GET.get('DeleteID')
|
||||
wm = WebsiteManager()
|
||||
return wm.CreateDockerPackage(request, userID, None, DeleteID)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
def AssignPackage(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
DeleteID = request.GET.get('DeleteID')
|
||||
wm = WebsiteManager()
|
||||
return wm.AssignPackage(request, userID, None, DeleteID)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
def CreateDockersite(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
wm = WebsiteManager()
|
||||
return wm.CreateDockersite(request, userID)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def AddDockerpackage(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
data = json.loads(request.body)
|
||||
wm = WebsiteManager()
|
||||
return wm.AddDockerpackage(userID, data)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
def Getpackage(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
data = json.loads(request.body)
|
||||
wm = WebsiteManager()
|
||||
return wm.Getpackage(userID, data)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
def Updatepackage(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
data = json.loads(request.body)
|
||||
wm = WebsiteManager()
|
||||
return wm.Updatepackage(userID, data)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
def AddAssignment(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
data = json.loads(request.body)
|
||||
wm = WebsiteManager()
|
||||
return wm.AddAssignment(userID, data)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def submitDockerSiteCreation(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
data = json.loads(request.body)
|
||||
wm = WebsiteManager()
|
||||
return wm.submitDockerSiteCreation(userID, data)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def ListDockerSites(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
DeleteID = request.GET.get('DeleteID')
|
||||
wm = WebsiteManager()
|
||||
return wm.ListDockerSites(request, userID, None, DeleteID)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def fetchDockersite(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
data = json.loads(request.body)
|
||||
wm = WebsiteManager()
|
||||
return wm.fetchDockersite(userID, data)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def Dockersitehome(request, domain):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
wm = WebsiteManager(domain)
|
||||
return wm.Dockersitehome(request, userID, None)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
@@ -6,6 +6,7 @@ import sys
|
||||
import django
|
||||
|
||||
from databases.models import Databases
|
||||
from plogical.DockerSites import Docker_Sites
|
||||
from plogical.httpProc import httpProc
|
||||
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
@@ -15,7 +16,7 @@ import json
|
||||
from plogical.acl import ACLManager
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
from websiteFunctions.models import Websites, ChildDomains, GitLogs, wpplugins, WPSites, WPStaging, WPSitesBackup, \
|
||||
RemoteBackupConfig, RemoteBackupSchedule, RemoteBackupsites
|
||||
RemoteBackupConfig, RemoteBackupSchedule, RemoteBackupsites, DockerPackages, PackageAssignment, DockerSites
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
import subprocess
|
||||
import shlex
|
||||
@@ -182,7 +183,6 @@ class WebsiteManager:
|
||||
response = requests.post(url, data=json.dumps(data))
|
||||
Status = response.json()['status']
|
||||
|
||||
|
||||
rnpss = randomPassword.generate_pass(10)
|
||||
|
||||
Data['Randam_String'] = rnpss.lower()
|
||||
@@ -713,7 +713,8 @@ class WebsiteManager:
|
||||
|
||||
rnpss = randomPassword.generate_pass(10)
|
||||
proc = httpProc(request, 'websiteFunctions/createDomain.html',
|
||||
{'websiteList': websitesName, 'phps': PHPManager.findPHPVersions(), 'Randam_String': rnpss, 'test_domain_data':test_domain_status})
|
||||
{'websiteList': websitesName, 'phps': PHPManager.findPHPVersions(), 'Randam_String': rnpss,
|
||||
'test_domain_data': test_domain_status})
|
||||
return proc.render()
|
||||
|
||||
def siteState(self, request=None, userID=None, data=None):
|
||||
@@ -1282,7 +1283,7 @@ class WebsiteManager:
|
||||
Rconfig = json.loads(RemoteBackupConfigobj.config)
|
||||
|
||||
try:
|
||||
#This code is only supposed to run if backups are s3, not for SFTP
|
||||
# This code is only supposed to run if backups are s3, not for SFTP
|
||||
provider = Rconfig['Provider']
|
||||
if provider == "Backblaze":
|
||||
EndURl = Rconfig['EndUrl']
|
||||
@@ -1412,7 +1413,6 @@ class WebsiteManager:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
|
||||
allweb = Websites.objects.all()
|
||||
|
||||
childdomain = ChildDomains.objects.all()
|
||||
@@ -1425,7 +1425,6 @@ class WebsiteManager:
|
||||
if os.path.exists(ProcessUtilities.debugPath):
|
||||
logging.CyberCPLogFileWriter.writeToFile(result)
|
||||
|
||||
|
||||
if result.find('No such file or directory') == -1:
|
||||
try:
|
||||
WPSites.objects.get(path=webpath)
|
||||
@@ -2038,8 +2037,6 @@ class WebsiteManager:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
|
||||
|
||||
extraArgs = {}
|
||||
extraArgs['currentACL'] = currentACL
|
||||
extraArgs['adminID'] = admin.pk
|
||||
@@ -2436,8 +2433,6 @@ class WebsiteManager:
|
||||
if os.path.exists(ProcessUtilities.debugPath):
|
||||
logging.CyberCPLogFileWriter.writeToFile(f'findWebsitesListJson 1')
|
||||
|
||||
|
||||
|
||||
for items in websites:
|
||||
if os.path.exists(ProcessUtilities.debugPath):
|
||||
logging.CyberCPLogFileWriter.writeToFile(f'findWebsitesListJson 2')
|
||||
@@ -2456,7 +2451,6 @@ class WebsiteManager:
|
||||
except:
|
||||
PHPVersionActual = 'PHP 8.1'
|
||||
|
||||
|
||||
if os.path.exists(ProcessUtilities.debugPath):
|
||||
logging.CyberCPLogFileWriter.writeToFile(f'findWebsitesListJson 3')
|
||||
|
||||
@@ -2482,6 +2476,52 @@ class WebsiteManager:
|
||||
|
||||
return json_data
|
||||
|
||||
|
||||
|
||||
def findDockersitesListJson(self, Dockersite):
|
||||
|
||||
json_data = "["
|
||||
checker = 0
|
||||
|
||||
try:
|
||||
ipFile = "/etc/cyberpanel/machineIP"
|
||||
f = open(ipFile)
|
||||
ipData = f.read()
|
||||
ipAddress = ipData.split('\n', 1)[0]
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile("Failed to read machine IP, error:" + str(msg))
|
||||
ipAddress = "192.168.100.1"
|
||||
|
||||
from plogical.phpUtilities import phpUtilities
|
||||
for items in Dockersite:
|
||||
website = Websites.objects.get(pk=items.admin.pk)
|
||||
vhFile = f'/usr/local/lsws/conf/vhosts/{website.domain}/vhost.conf'
|
||||
|
||||
try:
|
||||
PHPVersionActual = phpUtilities.WrapGetPHPVersionFromFileToGetVersionWithPHP(website)
|
||||
except:
|
||||
PHPVersionActual = 'PHP 8.1'
|
||||
|
||||
|
||||
if items.state == 0:
|
||||
state = "Suspended"
|
||||
else:
|
||||
state = "Active"
|
||||
|
||||
dic = {'id':items.pk, 'domain': website.domain, 'adminEmail': website.adminEmail, 'ipAddress': ipAddress,
|
||||
'admin': website.admin.userName, 'package': website.package.packageName, 'state': state,
|
||||
'CPU': int(items.CPUsMySQL)+int(items.CPUsSite), 'Ram': int(items.MemorySite)+int(items.MemoryMySQL), 'phpVersion': PHPVersionActual }
|
||||
|
||||
if checker == 0:
|
||||
json_data = json_data + json.dumps(dic)
|
||||
checker = 1
|
||||
else:
|
||||
json_data = json_data + ',' + json.dumps(dic)
|
||||
|
||||
json_data = json_data + ']'
|
||||
|
||||
return json_data
|
||||
|
||||
def findChildsListJson(self, childs):
|
||||
|
||||
json_data = "["
|
||||
@@ -2853,9 +2893,9 @@ class WebsiteManager:
|
||||
|
||||
## Fix https://github.com/usmannasir/cyberpanel/issues/998
|
||||
|
||||
#from plogical.IncScheduler import IncScheduler
|
||||
#isPU = IncScheduler('CalculateAndUpdateDiskUsage', {})
|
||||
#isPU.start()
|
||||
# from plogical.IncScheduler import IncScheduler
|
||||
# isPU = IncScheduler('CalculateAndUpdateDiskUsage', {})
|
||||
# isPU.start()
|
||||
|
||||
command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/IncScheduler.py UpdateDiskUsageForce'
|
||||
ProcessUtilities.outputExecutioner(command)
|
||||
@@ -4295,7 +4335,6 @@ StrictHostKeyChecking no
|
||||
else:
|
||||
return ACLManager.loadErrorJson('installStatus', 0)
|
||||
|
||||
|
||||
#### Before installing mautic change php to 8.0
|
||||
|
||||
completePathToConfigFile = f'/usr/local/lsws/conf/vhosts/{self.domain}/vhost.conf'
|
||||
@@ -4534,6 +4573,24 @@ StrictHostKeyChecking no
|
||||
|
||||
return pagination
|
||||
|
||||
def DockersitePagination(self, currentACL, userID):
|
||||
websites = DockerSites.objects.all()
|
||||
|
||||
pages = float(len(websites)) / float(10)
|
||||
pagination = []
|
||||
|
||||
if pages <= 1.0:
|
||||
pages = 1
|
||||
pagination.append('<li><a href="\#"></a></li>')
|
||||
else:
|
||||
pages = ceil(pages)
|
||||
finalPages = int(pages) + 1
|
||||
|
||||
for i in range(1, finalPages):
|
||||
pagination.append('<li><a href="\#">' + str(i) + '</a></li>')
|
||||
|
||||
return pagination
|
||||
|
||||
def getSwitchStatus(self, userID=None, data=None):
|
||||
try:
|
||||
|
||||
@@ -4708,7 +4765,7 @@ StrictHostKeyChecking no
|
||||
else:
|
||||
phpVersion = f'PHP {phpPath[2]}'
|
||||
|
||||
#php = PHPManager.getPHPString(phpVersion)
|
||||
# php = PHPManager.getPHPString(phpVersion)
|
||||
|
||||
if os.path.exists(ProcessUtilities.debugPath):
|
||||
logging.CyberCPLogFileWriter.writeToFile(f'PHP Version in tune settings {phpVersion}')
|
||||
@@ -6488,7 +6545,6 @@ StrictHostKeyChecking no
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def ApacheManager(self, request=None, userID=None, data=None):
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
@@ -6505,7 +6561,8 @@ StrictHostKeyChecking no
|
||||
else:
|
||||
apachemanager = 0
|
||||
|
||||
proc = httpProc(request, 'websiteFunctions/ApacheManager.html', {'domainName': self.domain, 'phps': phps, 'apachemanager':apachemanager})
|
||||
proc = httpProc(request, 'websiteFunctions/ApacheManager.html',
|
||||
{'domainName': self.domain, 'phps': phps, 'apachemanager': apachemanager})
|
||||
return proc.render()
|
||||
|
||||
def saveApacheConfigsToFile(self, userID=None, data=None):
|
||||
@@ -6547,3 +6604,302 @@ StrictHostKeyChecking no
|
||||
final_dic = {'status': 0, 'error_message': output}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def CreateDockerPackage(self, request=None, userID=None, data=None, DeleteID=None):
|
||||
Data = {}
|
||||
|
||||
try:
|
||||
if DeleteID != None:
|
||||
DockerPackagesDelete = DockerPackages.objects.get(pk=DeleteID)
|
||||
DockerPackagesDelete.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
Data['packages'] = DockerPackages.objects.all()
|
||||
|
||||
proc = httpProc(request, 'websiteFunctions/CreateDockerPackage.html',
|
||||
Data, 'createWebsite')
|
||||
return proc.render()
|
||||
|
||||
def AssignPackage(self, request=None, userID=None, data=None, DeleteID=None):
|
||||
|
||||
try:
|
||||
if DeleteID != None:
|
||||
DockerPackagesDelete = PackageAssignment.objects.get(pk=DeleteID)
|
||||
DockerPackagesDelete.delete()
|
||||
except:
|
||||
pass
|
||||
adminNames = ACLManager.loadAllUsers(userID)
|
||||
dockerpackages = DockerPackages.objects.all()
|
||||
assignpackage = PackageAssignment.objects.all()
|
||||
Data = {'adminNames': adminNames, 'DockerPackages': dockerpackages, 'assignpackage': assignpackage}
|
||||
proc = httpProc(request, 'websiteFunctions/assignPackage.html',
|
||||
Data, 'createWebsite')
|
||||
return proc.render()
|
||||
|
||||
def CreateDockersite(self, request=None, userID=None, data=None):
|
||||
adminNames = ACLManager.loadAllUsers(userID)
|
||||
Data = {'adminNames': adminNames}
|
||||
proc = httpProc(request, 'websiteFunctions/CreateDockerSite.html',
|
||||
Data, 'createWebsite')
|
||||
return proc.render()
|
||||
|
||||
def AddDockerpackage(self, userID=None, data=None):
|
||||
try:
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
name = data['name']
|
||||
cpu = data['cpu']
|
||||
Memory = data['Memory']
|
||||
Bandwidth = data['Bandwidth']
|
||||
disk = data['disk']
|
||||
|
||||
saveobj = DockerPackages(Name=name, CPUs=cpu, Ram=Memory, Bandwidth=Bandwidth, DiskSpace=disk, config='')
|
||||
saveobj.save()
|
||||
|
||||
status = {"status": 1, 'error_message': None}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def Getpackage(self, userID=None, data=None):
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
id = data['id']
|
||||
|
||||
docker_package = DockerPackages.objects.get(pk=id)
|
||||
|
||||
# Convert DockerPackages object to dictionary
|
||||
package_data = {
|
||||
'Name': docker_package.Name,
|
||||
'CPU': docker_package.CPUs,
|
||||
'Memory': docker_package.Ram,
|
||||
'Bandwidth': docker_package.Bandwidth,
|
||||
'DiskSpace': docker_package.DiskSpace,
|
||||
}
|
||||
|
||||
rdata = {'obj': package_data}
|
||||
|
||||
status = {"status": 1, 'error_message': rdata}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def Updatepackage(self, userID=None, data=None):
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
id = data['id']
|
||||
CPU = data['CPU']
|
||||
RAM = data['RAM']
|
||||
Bandwidth = data['Bandwidth']
|
||||
DiskSpace = data['DiskSpace']
|
||||
|
||||
docker_package = DockerPackages.objects.get(pk=id)
|
||||
|
||||
docker_package.CPUs = CPU
|
||||
docker_package.Ram = RAM
|
||||
docker_package.Bandwidth = Bandwidth
|
||||
docker_package.DiskSpace = DiskSpace
|
||||
docker_package.save()
|
||||
|
||||
status = {"status": 1, 'error_message': None}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def AddAssignment(self, userID=None, data=None):
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
package = data['package']
|
||||
user = data['user']
|
||||
|
||||
docker_package = DockerPackages.objects.get(pk=int(package))
|
||||
userobj = Administrator.objects.get(userName=user)
|
||||
|
||||
sv = PackageAssignment(user=userobj, package=docker_package)
|
||||
sv.save()
|
||||
|
||||
status = {"status": 1, 'error_message': None}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def submitDockerSiteCreation(self, userID=None, data=None):
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
sitename = data['sitename']
|
||||
Owner = data['Owner']
|
||||
Domain = data['Domain']
|
||||
MysqlCPU = int(data['MysqlCPU'])
|
||||
MYsqlRam = int(data['MYsqlRam'])
|
||||
SiteCPU = int(data['SiteCPU'])
|
||||
SiteRam = int(data['SiteRam'])
|
||||
App = data['App']
|
||||
WPusername = data['WPusername']
|
||||
WPemal = data['WPemal']
|
||||
WPpasswd = data['WPpasswd']
|
||||
|
||||
loggedUser = Administrator.objects.get(pk=userID)
|
||||
newOwner = Administrator.objects.get(userName=Owner)
|
||||
|
||||
try:
|
||||
pkaobj = PackageAssignment.objects.get(user=newOwner)
|
||||
except:
|
||||
final_dic = {'status': 0, 'error_message': str('Please assign package to selected user')}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
Dpkgobj = DockerPackages.objects.get(pk=pkaobj.package.id)
|
||||
|
||||
pkg_cpu = Dpkgobj.CPUs
|
||||
pkg_Ram = Dpkgobj.Ram
|
||||
|
||||
totalcup = SiteCPU + MysqlCPU
|
||||
totalRam = SiteRam + MYsqlRam
|
||||
|
||||
if (totalcup > pkg_cpu):
|
||||
final_dic = {'status': 0, 'error_message': str(f'You can add {pkg_cpu} or less then {pkg_cpu} CPUs.')}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
if (totalRam > pkg_Ram):
|
||||
final_dic = {'status': 0, 'error_message': str(f'You can add {pkg_Ram} or less then {pkg_Ram} Ram.')}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
if ACLManager.currentContextPermission(currentACL, 'createWebsite') == 0:
|
||||
return ACLManager.loadErrorJson('createWebSiteStatus', 0)
|
||||
|
||||
if ACLManager.checkOwnerProtection(currentACL, loggedUser, newOwner) == 0:
|
||||
return ACLManager.loadErrorJson('createWebSiteStatus', 0)
|
||||
|
||||
if ACLManager.CheckDomainBlackList(Domain) == 0:
|
||||
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': "Blacklisted domain."}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
# extraArgs = {}
|
||||
# extraArgs['admin'] = admin
|
||||
# extraArgs['domainName'] = data['domain']
|
||||
# extraArgs['home'] = data['home']
|
||||
# extraArgs['shopName'] = data['shopName']
|
||||
# extraArgs['firstName'] = data['firstName']
|
||||
# extraArgs['lastName'] = data['lastName']
|
||||
# extraArgs['databasePrefix'] = data['databasePrefix']
|
||||
# extraArgs['email'] = data['email']
|
||||
# extraArgs['password'] = data['passwordByPass']
|
||||
# extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||
#
|
||||
# if data['home'] == '0':
|
||||
# extraArgs['path'] = data['path']
|
||||
#
|
||||
# background = ApplicationInstaller('prestashop', extraArgs)
|
||||
# background.start()
|
||||
tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||
data = {}
|
||||
|
||||
data['JobID'] = tempStatusPath
|
||||
data['Domain'] = Domain
|
||||
data['WPemal'] = WPemal
|
||||
data['Owner'] = Owner
|
||||
data['userID'] = userID
|
||||
data['MysqlCPU'] = MysqlCPU
|
||||
data['MYsqlRam'] = MYsqlRam
|
||||
data['SiteCPU'] = SiteCPU
|
||||
data['SiteRam'] = SiteRam
|
||||
data['sitename'] = sitename
|
||||
data['WPusername'] = WPusername
|
||||
data['WPpasswd'] = WPpasswd
|
||||
data['externalApp'] = "".join(re.findall("[a-zA-Z]+", Domain))[:5] + str(randint(1000, 9999))
|
||||
|
||||
background = Docker_Sites('SubmitDockersiteCreation', data)
|
||||
background.start()
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',
|
||||
'tempStatusPath': tempStatusPath}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def ListDockerSites(self, request=None, userID=None, data=None, DeleteID=None):
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
try:
|
||||
if DeleteID != None:
|
||||
DockerSitesDelete = DockerSites.objects.get(pk=DeleteID)
|
||||
DockerSitesDelete.delete()
|
||||
except:
|
||||
pass
|
||||
pagination = self.DockersitePagination(currentACL, userID)
|
||||
proc = httpProc(request, 'websiteFunctions/ListDockersite.html',
|
||||
{"pagination": pagination})
|
||||
return proc.render()
|
||||
|
||||
def fetchDockersite(self, userID=None, data=None):
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
pageNumber = int(data['page'])
|
||||
recordsToShow = int(data['recordsToShow'])
|
||||
|
||||
|
||||
|
||||
endPageNumber, finalPageNumber = self.recordsPointer(pageNumber, recordsToShow)
|
||||
|
||||
|
||||
|
||||
dockersites = ACLManager.findDockersiteObjects(currentACL, userID)
|
||||
|
||||
|
||||
|
||||
pagination = self.getPagination(len(dockersites), recordsToShow)
|
||||
|
||||
logging.CyberCPLogFileWriter.writeToFile("Our dockersite" + str(dockersites))
|
||||
|
||||
|
||||
|
||||
json_data = self.findDockersitesListJson(dockersites[finalPageNumber:endPageNumber])
|
||||
|
||||
|
||||
final_dic = {'status': 1, 'listWebSiteStatus': 1, 'error_message': "None", "data": json_data,
|
||||
'pagination': pagination}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException as msg:
|
||||
final_dic = {'status': 0, 'listWebSiteStatus': 1, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def Dockersitehome(self, request=None, userID=None, data=None, DeleteID=None):
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
proc = httpProc(request, 'websiteFunctions/DockerSiteHome.html',
|
||||
None)
|
||||
return proc.render()
|
||||
|
||||
Reference in New Issue
Block a user