mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
gitPull and git push
This commit is contained in:
@@ -533,7 +533,7 @@ app.controller('listChildDomainsMain', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.initConvert = function(virtualHost){
|
$scope.initConvert = function (virtualHost) {
|
||||||
$scope.domainName = virtualHost;
|
$scope.domainName = virtualHost;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5784,4 +5784,548 @@ app.controller('installMagentoCTRL', function ($scope, $http, $timeout) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* Java script code to git tracking */
|
||||||
|
app.controller('manageGIT', function ($scope, $http, $timeout, $window) {
|
||||||
|
|
||||||
|
$scope.cyberpanelLoading = true;
|
||||||
|
$scope.loadingSticks = true;
|
||||||
|
$scope.gitTracking = true;
|
||||||
|
$scope.gitEnable = true;
|
||||||
|
$scope.statusBox = true;
|
||||||
|
|
||||||
|
var statusFile;
|
||||||
|
|
||||||
|
$scope.fetchFolderDetails = function () {
|
||||||
|
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
|
||||||
|
url = "/websites/fetchFolderDetails";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
domain: $("#domain").text(),
|
||||||
|
folder: $scope.folder
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
if (response.data.repo === 1) {
|
||||||
|
$scope.gitTracking = true;
|
||||||
|
$scope.gitEnable = false;
|
||||||
|
$scope.branches = response.data.finalBranches;
|
||||||
|
$scope.deploymentKey = response.data.deploymentKey;
|
||||||
|
$scope.remote = response.data.remote;
|
||||||
|
$scope.remoteResult = response.data.remoteResult;
|
||||||
|
$scope.totalCommits = response.data.totalCommits;
|
||||||
|
} else {
|
||||||
|
$scope.gitTracking = false;
|
||||||
|
$scope.gitEnable = true;
|
||||||
|
}
|
||||||
|
} 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.initRepo = function () {
|
||||||
|
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
|
||||||
|
url = "/websites/initRepo";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
domain: $("#domain").text(),
|
||||||
|
folder: $scope.folder
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Repo initiated.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.fetchFolderDetails();
|
||||||
|
} 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.setupRemote = function () {
|
||||||
|
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
|
||||||
|
url = "/websites/setupRemote";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
domain: $("#domain").text(),
|
||||||
|
folder: $scope.folder,
|
||||||
|
gitHost: $scope.gitHost,
|
||||||
|
gitUsername: $scope.gitUsername,
|
||||||
|
gitReponame: $scope.gitReponame,
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Remote successfully set.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.fetchFolderDetails();
|
||||||
|
} 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.changeBranch = function () {
|
||||||
|
|
||||||
|
$scope.loadingSticks = false;
|
||||||
|
$("#showStatus").modal();
|
||||||
|
|
||||||
|
url = "/websites/changeGitBranch";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
domain: $("#domain").text(),
|
||||||
|
folder: $scope.folder,
|
||||||
|
branchName: $scope.branchName
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.loadingSticks = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Changes applied.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
$timeout(function () {
|
||||||
|
$window.location.reload();
|
||||||
|
}, 3000);
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.loadingSticks = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page.',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.createNewBranch = function () {
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
$scope.commandStatus = "";
|
||||||
|
$scope.statusBox = false;
|
||||||
|
|
||||||
|
url = "/websites/createNewBranch";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
domain: $("#domain").text(),
|
||||||
|
folder: $scope.folder,
|
||||||
|
newBranchName: $scope.newBranchName
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Changes applied.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
$scope.fetchFolderDetails();
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page.',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.commitChanges = function () {
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
$scope.commandStatus = "";
|
||||||
|
$scope.statusBox = false;
|
||||||
|
|
||||||
|
url = "/websites/commitChanges";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
domain: $("#domain").text(),
|
||||||
|
folder: $scope.folder,
|
||||||
|
commitMessage: $scope.commitMessage
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Changes applied.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
$scope.fetchFolderDetails();
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page.',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.gitPull = function () {
|
||||||
|
|
||||||
|
$scope.loadingSticks = false;
|
||||||
|
$("#showStatus").modal();
|
||||||
|
|
||||||
|
url = "/websites/gitPull";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
domain: $("#domain").text(),
|
||||||
|
folder: $scope.folder,
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.loadingSticks = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Changes applied.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.loadingSticks = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page.',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.gitPush = function () {
|
||||||
|
|
||||||
|
$scope.loadingSticks = false;
|
||||||
|
$("#showStatus").modal();
|
||||||
|
|
||||||
|
url = "/websites/gitPush";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
domain: $("#domain").text(),
|
||||||
|
folder: $scope.folder,
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.loadingSticks = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Changes applied.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.loadingSticks = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page.',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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.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.goBackDisable = false;
|
||||||
|
|
||||||
|
$scope.currentStatus = 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.goBackDisable = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
/* Java script code to git tracking ends here */
|
||||||
|
|||||||
@@ -6146,6 +6146,116 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.gitPull = function () {
|
||||||
|
|
||||||
|
$scope.loadingSticks = false;
|
||||||
|
$("#showStatus").modal();
|
||||||
|
|
||||||
|
url = "/websites/gitPull";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
domain: $("#domain").text(),
|
||||||
|
folder: $scope.folder,
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.loadingSticks = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Changes applied.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.loadingSticks = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page.',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.gitPush = function () {
|
||||||
|
|
||||||
|
$scope.loadingSticks = false;
|
||||||
|
$("#showStatus").modal();
|
||||||
|
|
||||||
|
url = "/websites/gitPush";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
domain: $("#domain").text(),
|
||||||
|
folder: $scope.folder,
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.loadingSticks = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Changes applied.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
$scope.commandStatus = response.data.commandStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.loadingSticks = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page.',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function getCreationStatus() {
|
function getCreationStatus() {
|
||||||
|
|
||||||
url = "/websites/installWordpressStatus";
|
url = "/websites/installWordpressStatus";
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
ng-click="createNewBranch()">Commit<img id="cyberpanelLoading"
|
ng-click="createNewBranch()">Create New Branch<img id="cyberpanelLoading"
|
||||||
src="/static/images/loading.gif"
|
src="/static/images/loading.gif"
|
||||||
style="display: none;">
|
style="display: none;">
|
||||||
</button>
|
</button>
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
ng-click="commitChanges()">Create New Branch<img id="cyberpanelLoading"
|
ng-click="commitChanges()">Commit<img id="cyberpanelLoading"
|
||||||
src="/static/images/loading.gif"
|
src="/static/images/loading.gif"
|
||||||
style="display: none;">
|
style="display: none;">
|
||||||
</button>
|
</button>
|
||||||
@@ -151,11 +151,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a href="#" class="btn btn-info">
|
<a ng-click="gitPull()" ng-disabled="remote==0" href="#" class="btn btn-info">
|
||||||
<input name="radio-toggle-1" type="radio">
|
<input name="radio-toggle-1" type="radio">
|
||||||
Pull From Remote
|
Pull From Remote
|
||||||
</a>
|
</a>
|
||||||
<a href="#" class="btn btn-info">
|
<a ng-click="gitPush()" ng-disabled="remote==0" href="#" class="btn btn-info">
|
||||||
<input name="radio-toggle-1" type="radio">
|
<input name="radio-toggle-1" type="radio">
|
||||||
Push To Remote
|
Push To Remote
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -126,6 +126,10 @@ urlpatterns = [
|
|||||||
url(r'^changeGitBranch$', views.changeGitBranch, name='changeGitBranch'),
|
url(r'^changeGitBranch$', views.changeGitBranch, name='changeGitBranch'),
|
||||||
url(r'^createNewBranch$', views.createNewBranch, name='createNewBranch'),
|
url(r'^createNewBranch$', views.createNewBranch, name='createNewBranch'),
|
||||||
url(r'^commitChanges$', views.commitChanges, name='commitChanges'),
|
url(r'^commitChanges$', views.commitChanges, name='commitChanges'),
|
||||||
|
url(r'^gitPull$', views.gitPull, name='gitPull'),
|
||||||
|
url(r'^gitPush$', views.gitPush, name='gitPush'),
|
||||||
|
|
||||||
|
|
||||||
## Catch all for domains
|
## Catch all for domains
|
||||||
url(r'^(?P<domain>(.*))/(?P<childDomain>(.*))$', views.launchChild, name='launchChild'),
|
url(r'^(?P<domain>(.*))/(?P<childDomain>(.*))$', views.launchChild, name='launchChild'),
|
||||||
url(r'^(?P<domain>(.*))$', views.domain, name='domain'),
|
url(r'^(?P<domain>(.*))$', views.domain, name='domain'),
|
||||||
|
|||||||
@@ -771,5 +771,21 @@ def commitChanges(request):
|
|||||||
userID = request.session['userID']
|
userID = request.session['userID']
|
||||||
wm = WebsiteManager()
|
wm = WebsiteManager()
|
||||||
return wm.commitChanges(userID, json.loads(request.body))
|
return wm.commitChanges(userID, json.loads(request.body))
|
||||||
|
except KeyError:
|
||||||
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
def gitPull(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
wm = WebsiteManager()
|
||||||
|
return wm.gitPull(userID, json.loads(request.body))
|
||||||
|
except KeyError:
|
||||||
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
def gitPush(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
wm = WebsiteManager()
|
||||||
|
return wm.gitPush(userID, json.loads(request.body))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
@@ -3068,6 +3068,13 @@ StrictHostKeyChecking no
|
|||||||
else:
|
else:
|
||||||
return ACLManager.loadErrorJson()
|
return ACLManager.loadErrorJson()
|
||||||
|
|
||||||
|
### set default ssh key
|
||||||
|
|
||||||
|
externalApp = Websites.objects.get(domain=self.domain).externalApp
|
||||||
|
|
||||||
|
command = 'git -C %s config --local core.sshCommand "ssh -i /home/%s/.ssh/%s"' % (self.folder, self.domain, externalApp)
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
## Check if remote exists
|
## Check if remote exists
|
||||||
|
|
||||||
command = 'git -C %s remote -v' % (self.folder)
|
command = 'git -C %s remote -v' % (self.folder)
|
||||||
@@ -3221,3 +3228,79 @@ StrictHostKeyChecking no
|
|||||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
def gitPull(self, userID=None, data=None):
|
||||||
|
try:
|
||||||
|
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
|
self.domain = data['domain']
|
||||||
|
self.folder = data['folder']
|
||||||
|
|
||||||
|
|
||||||
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadErrorJson('status', 0)
|
||||||
|
|
||||||
|
if self.folderCheck():
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadErrorJson()
|
||||||
|
|
||||||
|
## Check if remote exists
|
||||||
|
|
||||||
|
command = 'git -C %s pull' % (self.folder)
|
||||||
|
commandStatus = ProcessUtilities.outputExecutioner(command)
|
||||||
|
|
||||||
|
if commandStatus.find('Already up to date') == -1:
|
||||||
|
data_ret = {'status': 1, 'commandStatus': commandStatus}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
else:
|
||||||
|
data_ret = {'status': 0, 'error_message': 'Pull not required.', 'commandStatus': commandStatus}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
def gitPush(self, userID=None, data=None):
|
||||||
|
try:
|
||||||
|
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
admin = Administrator.objects.get(pk=userID)
|
||||||
|
|
||||||
|
self.domain = data['domain']
|
||||||
|
self.folder = data['folder']
|
||||||
|
|
||||||
|
|
||||||
|
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadErrorJson('status', 0)
|
||||||
|
|
||||||
|
if self.folderCheck():
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadErrorJson()
|
||||||
|
|
||||||
|
command = 'git -C %s push -u origin master' % (self.folder)
|
||||||
|
commandStatus = ProcessUtilities.outputExecutioner(command)
|
||||||
|
|
||||||
|
if commandStatus.find('Everything up-to-date') == -1 and commandStatus.find('rejected') == -1:
|
||||||
|
data_ret = {'status': 1, 'commandStatus': commandStatus}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
else:
|
||||||
|
data_ret = {'status': 0, 'error_message': 'Push not required.', 'commandStatus': commandStatus}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|||||||
Reference in New Issue
Block a user