mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 05:45:59 +01:00
wpstagingui
This commit is contained in:
@@ -1321,8 +1321,68 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
FinalDeployToProduction = function () {
|
||||||
|
$('#wordpresshomeloading').show();
|
||||||
|
$('#DeployToProduction').modal('hide');
|
||||||
|
var data = {
|
||||||
|
WPid: $('#WPid').html(),
|
||||||
|
StagingID: DeploytoProductionID
|
||||||
|
}
|
||||||
|
|
||||||
|
var url = "/websites/DeploytoProduction";
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
$('#wordpresshomeloading').hide();
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success!',
|
||||||
|
text: 'Deploy To Production start!.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
statusFile = response.data.tempStatusPath;
|
||||||
|
getCreationStatus();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$('#wordpresshomeloading').hide();
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var DeploytoProductionID;
|
||||||
|
function DeployToProductionInitial(vall){
|
||||||
|
DeploytoProductionID=vall;
|
||||||
|
}
|
||||||
|
|
||||||
function AddStagings(value, index, array) {
|
function AddStagings(value, index, array) {
|
||||||
var FinalMarkup = '<tr>'
|
var FinalMarkup = '<tr>'
|
||||||
for (let x in value) {
|
for (let x in value) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
src="{% static 'images/loading.gif' %}"></p>
|
src="{% static 'images/loading.gif' %}"></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel" >
|
<div class="panel">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h3 class="content-box-header">
|
<h3 class="content-box-header">
|
||||||
{% trans "WordPress Manager" %}
|
{% trans "WordPress Manager" %}
|
||||||
@@ -338,18 +338,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-hide="installationProgress" class="form-group">
|
<div ng-hide="installationProgress" class="form-group center-div">
|
||||||
<label class="col-sm-3 control-label"></label>
|
<div class="col-sm-12">
|
||||||
<div class="col-sm-4">
|
|
||||||
<button type="button" ng-disabled="goBackDisable"
|
<button type="button" ng-disabled="goBackDisable"
|
||||||
ng-click="goBack()"
|
ng-click="goBack()"
|
||||||
class="btn btn-primary btn-lg center-div">{% trans "Go Back" %}</button>
|
class="btn btn-primary btn-lg center-div">{% trans "Go Back" %}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<h3>List staging site</h3>
|
|
||||||
<table class="table table-condensed">
|
<table class="table table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -362,6 +358,9 @@
|
|||||||
<tbody id="StagingBody">
|
<tbody id="StagingBody">
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -479,4 +478,39 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="DeployToProduction" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<!-- Modal content-->
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">DeployToProduction
|
||||||
|
<img ng-hide="$parent.cyberPanelLoading"
|
||||||
|
src="/static/images/loading.gif"
|
||||||
|
style="display: none;">
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p class="no-margin">When you deploy a
|
||||||
|
staging site to production, the main
|
||||||
|
site is completely restored with the
|
||||||
|
staging site, so if you have made
|
||||||
|
any changes to main site they will
|
||||||
|
be lost.</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-primary"
|
||||||
|
onclick="FinalDeployToProduction()">Yes
|
||||||
|
</button>
|
||||||
|
<button type="button" ng-disabled="savingSettings"
|
||||||
|
class="btn btn-default" data-dismiss="modal">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -34,7 +34,8 @@
|
|||||||
/* Opera 10.5, IE 9, Safari 5, Chrome, Firefox 4, iOS 4, Android 2.1+ */
|
/* Opera 10.5, IE 9, Safari 5, Chrome, Firefox 4, iOS 4, Android 2.1+ */
|
||||||
border-radius: 3px 0px 0px 3px;
|
border-radius: 3px 0px 0px 3px;
|
||||||
}
|
}
|
||||||
table th:nth-child(1){
|
|
||||||
|
table th:nth-child(1) {
|
||||||
|
|
||||||
/* Safari 3-4, iOS 1-3.2, Android 1.6- */
|
/* Safari 3-4, iOS 1-3.2, Android 1.6- */
|
||||||
-webkit-border-radius: 20px 0px 0px 20px;
|
-webkit-border-radius: 20px 0px 0px 20px;
|
||||||
@@ -54,9 +55,10 @@
|
|||||||
-moz-border-radius: 0px 20px 20px 0px;
|
-moz-border-radius: 0px 20px 20px 0px;
|
||||||
|
|
||||||
/* Opera 10.5, IE 9, Safari 5, Chrome, Firefox 4, iOS 4, Android 2.1+ */
|
/* Opera 10.5, IE 9, Safari 5, Chrome, Firefox 4, iOS 4, Android 2.1+ */
|
||||||
border-radius:0px 20px 20px 0px;
|
border-radius: 0px 20px 20px 0px;
|
||||||
}
|
}
|
||||||
table td:nth-child(1){
|
|
||||||
|
table td:nth-child(1) {
|
||||||
|
|
||||||
/* Safari 3-4, iOS 1-3.2, Android 1.6- */
|
/* Safari 3-4, iOS 1-3.2, Android 1.6- */
|
||||||
-webkit-border-radius: 20px 0px 0px 20px;
|
-webkit-border-radius: 20px 0px 0px 20px;
|
||||||
@@ -79,7 +81,7 @@
|
|||||||
border-radius: 0px 20px 20px 0px;
|
border-radius: 0px 20px 20px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<div ng-controller="listWebsites" class="container">
|
<div ng-controller="listWebsites" class="container">
|
||||||
@@ -94,8 +96,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<table class="table-spacing" style="width: 100%">
|
<table class="table-spacing" style="width: 100%">
|
||||||
<thead style="color: white; background-color: #0a6ebd">
|
<thead style="color: white; background-color: #0a6ebd">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -113,9 +113,9 @@
|
|||||||
<tbody style="background-color: #d9eefa">
|
<tbody style="background-color: #d9eefa">
|
||||||
{% for sub in wpsite %}
|
{% for sub in wpsite %}
|
||||||
|
|
||||||
<tr >
|
<tr>
|
||||||
<td style="padding: 13px;">
|
<td style="padding: 13px;">
|
||||||
<a href="{% url 'WPHome'%}?ID={{sub.id}}">
|
<a href="{% url 'WPHome' %}?ID={{ sub.id }}">
|
||||||
<p style="font-weight: bold; text-transform: uppercase; ">{{ sub.title }}</p>
|
<p style="font-weight: bold; text-transform: uppercase; ">{{ sub.title }}</p>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
@@ -148,7 +148,8 @@
|
|||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form name="DeleteDocumentRootForm" action="/" class="form-horizontal">
|
<form name="DeleteDocumentRootForm" action="/"
|
||||||
|
class="form-horizontal">
|
||||||
|
|
||||||
<span>Do you want to delete the site?</span>
|
<span>Do you want to delete the site?</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ urlpatterns = [
|
|||||||
url(r'^CreateStagingNow', views.CreateStagingNow, name='CreateStagingNow'),
|
url(r'^CreateStagingNow', views.CreateStagingNow, name='CreateStagingNow'),
|
||||||
url(r'^fetchstaging', views.fetchstaging, name='fetchstaging'),
|
url(r'^fetchstaging', views.fetchstaging, name='fetchstaging'),
|
||||||
url(r'^SaveUpdateConfig', views.SaveUpdateConfig, name='SaveUpdateConfig'),
|
url(r'^SaveUpdateConfig', views.SaveUpdateConfig, name='SaveUpdateConfig'),
|
||||||
|
url(r'^DeploytoProduction', views.DeploytoProduction, name='DeploytoProduction'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -301,6 +301,27 @@ def SaveUpdateConfig(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
def DeploytoProduction(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
|
||||||
|
result = pluginManager.preWebsiteCreation(request)
|
||||||
|
|
||||||
|
if result != 200:
|
||||||
|
return result
|
||||||
|
|
||||||
|
wm = WebsiteManager()
|
||||||
|
coreResult = wm.DeploytoProduction(userID, json.loads(request.body))
|
||||||
|
|
||||||
|
result = pluginManager.postWebsiteCreation(request, coreResult)
|
||||||
|
if result != 200:
|
||||||
|
return result
|
||||||
|
|
||||||
|
return coreResult
|
||||||
|
|
||||||
|
except KeyError:
|
||||||
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def GetCurrentThemes(request):
|
def GetCurrentThemes(request):
|
||||||
|
|||||||
@@ -647,6 +647,51 @@ class WebsiteManager:
|
|||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
|
def DeploytoProduction(self, userID=None, data=None):
|
||||||
|
try:
|
||||||
|
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
|
WPManagerID = data['WPid']
|
||||||
|
statgingID = data['StagingID']
|
||||||
|
wpsite = WPSites.objects.get(pk=WPManagerID)
|
||||||
|
StagingObj = WPSites.objects.get(pk=statgingID)
|
||||||
|
|
||||||
|
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadError()
|
||||||
|
|
||||||
|
extraArgs = {}
|
||||||
|
extraArgs['adminID'] = admin.pk
|
||||||
|
extraArgs['StagingDomain'] = StagingObj.FinalURL
|
||||||
|
extraArgs['StagingName'] = StagingObj.title
|
||||||
|
extraArgs['WPid'] = WPManagerID
|
||||||
|
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||||
|
|
||||||
|
|
||||||
|
if ACLManager.checkOwnership(wpsite.owner.domain, admin, currentACL) == 1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadError()
|
||||||
|
|
||||||
|
background = ApplicationInstaller('CreateStagingNow', extraArgs)
|
||||||
|
background.start()
|
||||||
|
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',
|
||||||
|
'tempStatusPath': extraArgs['tempStatusPath']}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
def UpdatePlugins(self, userID=None, data=None):
|
def UpdatePlugins(self, userID=None, data=None):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user