mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-03-06 12:20:45 +01:00
bug fix: staging create/restore
This commit is contained in:
@@ -444,6 +444,12 @@ function FinalDeleteWPNow() {
|
||||
window.location.href = FurlDeleteWP;
|
||||
}
|
||||
|
||||
var DeploytoProductionID;
|
||||
|
||||
function DeployToProductionInitial(vall) {
|
||||
DeploytoProductionID = vall;
|
||||
}
|
||||
|
||||
app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $window) {
|
||||
|
||||
$scope.wordpresshomeloading = true;
|
||||
@@ -1313,19 +1319,33 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
}
|
||||
};
|
||||
|
||||
var DeploytoProductionID;
|
||||
|
||||
function DeployToProductionInitial(vall) {
|
||||
DeploytoProductionID = vall;
|
||||
function AddStagings(value, index, array) {
|
||||
var FinalMarkup = '<tr>'
|
||||
for (let x in value) {
|
||||
if (x === 'name') {
|
||||
FinalMarkup = FinalMarkup + '<td><a href=/websites/WPHome?ID=' + value.id + '>' + value[x] + '</a></td>';
|
||||
} else if (x !== 'url' && x !== 'deleteURL' && x !== 'id') {
|
||||
FinalMarkup = FinalMarkup + '<td>' + value[x] + "</td>";
|
||||
}
|
||||
}
|
||||
FinalMarkup = FinalMarkup + '<td><button onclick="DeployToProductionInitial(' + value.id + ')" data-toggle="modal" data-target="#DeployToProduction" style="margin-bottom: 2%; display: block" aria-label="" type="button" class="btn btn-outline-primary">Deploy to Production</button>' +
|
||||
'<a href="' + value.deleteURL + '"> <button aria-label="" class="btn btn-danger btn-icon-left m-b-10" type="button">Delete</button></a></td>'
|
||||
FinalMarkup = FinalMarkup + '</tr>'
|
||||
AppendToTable('#StagingBody', FinalMarkup);
|
||||
}
|
||||
|
||||
function FinalDeployToProduction() {
|
||||
alert($('#WPid').html());
|
||||
alert(DeploytoProductionID);
|
||||
return 0;
|
||||
$scope.FinalDeployToProduction = function () {
|
||||
|
||||
$('#wordpresshomeloading').show();
|
||||
$('#DeployToProduction').modal('hide');
|
||||
|
||||
$scope.wordpresshomeloading = false;
|
||||
$scope.stagingDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.errorMessageBox = true;
|
||||
$scope.success = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.goBackDisable = true;
|
||||
|
||||
var data = {
|
||||
WPid: $('#WPid').html(),
|
||||
StagingID: DeploytoProductionID
|
||||
@@ -1375,26 +1395,11 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
|
||||
function AddStagings(value, index, array) {
|
||||
var FinalMarkup = '<tr>'
|
||||
for (let x in value) {
|
||||
if (x === 'name') {
|
||||
FinalMarkup = FinalMarkup + '<td><a href=/websites/WPHome?ID=' + value.id + '>' + value[x] + '</a></td>';
|
||||
} else if (x !== 'url' && x !== 'deleteURL' && x !== 'id') {
|
||||
FinalMarkup = FinalMarkup + '<td>' + value[x] + "</td>";
|
||||
}
|
||||
}
|
||||
FinalMarkup = FinalMarkup + '<td><button onclick="DeployToProductionInitial(' + value.id + ')" data-toggle="modal" data-target="#DeployToProduction" style="margin-bottom: 2%; display: block" aria-label="" type="button" class="btn btn-outline-primary">Deploy to Production</button>' +
|
||||
'<a href="' + value.deleteURL + '"> <button aria-label="" class="btn btn-danger btn-icon-left m-b-10" type="button">Delete</button></a></td>'
|
||||
FinalMarkup = FinalMarkup + '</tr>'
|
||||
AppendToTable('#StagingBody', FinalMarkup);
|
||||
}
|
||||
|
||||
var PluginsList = [];
|
||||
|
||||
|
||||
|
||||
@@ -476,9 +476,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="DeployToProduction" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
@@ -502,7 +499,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary"
|
||||
onclick="FinalDeployToProduction()">Yes
|
||||
ng-click="FinalDeployToProduction()" data-dismiss="modal">Yes
|
||||
</button>
|
||||
<button type="button" ng-disabled="savingSettings"
|
||||
class="btn btn-default" data-dismiss="modal">
|
||||
@@ -512,5 +509,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -56,6 +56,7 @@ def WPHome(request):
|
||||
return wm.WPHome(request, userID, WPid, DeleteID)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def AutoLogin(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
@@ -305,19 +306,19 @@ def DeploytoProduction(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preWebsiteCreation(request)
|
||||
#result = pluginManager.preWebsiteCreation(request)
|
||||
|
||||
if result != 200:
|
||||
return result
|
||||
#if result != 200:
|
||||
# return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
coreResult = wm.DeploytoProduction(userID, json.loads(request.body))
|
||||
return wm.DeploytoProduction(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postWebsiteCreation(request, coreResult)
|
||||
if result != 200:
|
||||
return result
|
||||
#result = pluginManager.postWebsiteCreation(request, coreResult)
|
||||
#if result != 200:
|
||||
# return result
|
||||
|
||||
return coreResult
|
||||
#return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -659,20 +659,27 @@ class WebsiteManager:
|
||||
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()
|
||||
|
||||
if ACLManager.checkOwnership(StagingObj.owner.domain, admin, currentACL) == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
###
|
||||
|
||||
extraArgs = {}
|
||||
extraArgs['adminID'] = admin.pk
|
||||
extraArgs['StagingDomain'] = StagingObj.FinalURL
|
||||
extraArgs['StagingName'] = StagingObj.title
|
||||
extraArgs['statgingID'] = statgingID
|
||||
extraArgs['WPid'] = WPManagerID
|
||||
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999))
|
||||
|
||||
|
||||
background = ApplicationInstaller('CreateStagingNow', extraArgs)
|
||||
background = ApplicationInstaller('DeploytoProduction', extraArgs)
|
||||
background.start()
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
Reference in New Issue
Block a user