Attach GIT repositories to websites!

This commit is contained in:
usmannasir
2018-07-26 04:11:10 +05:00
parent e62c9f7d1c
commit 0af4297788
12 changed files with 743 additions and 12 deletions

View File

@@ -458,6 +458,7 @@ app.controller('websitePages', function($scope,$http) {
$scope.fileManagerURL = "/filemanager/"+$("#domainNamePage").text();
$scope.wordPressInstallURL = $("#domainNamePage").text() + "/wordpressInstall";
$scope.joomlaInstallURL = $("#domainNamePage").text() + "/joomlaInstall";
$scope.setupGit = $("#domainNamePage").text() + "/setupGit";
$scope.domainAliasURL = "/websites/"+$("#domainNamePage").text()+"/domainAlias";
$scope.previewUrl = "/preview/"+$("#domainNamePage").text()+"/";
@@ -4048,7 +4049,7 @@ app.controller('installJoomlaCTRL', function($scope, $http, $timeout) {
$scope.wpInstallLoading = true;
$scope.goBackDisable = true;
$scope.databasePrefix = 'jm_'
$scope.databasePrefix = 'jm_';
var statusFile;
var domain = $("#domainNamePage").text();
@@ -4226,6 +4227,168 @@ app.controller('installJoomlaCTRL', function($scope, $http, $timeout) {
}
};
});
app.controller('setupGit', function($scope, $http, $timeout) {
$scope.installationDetailsForm = false;
$scope.installationProgress = true;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.gitLoading = true;
$scope.githubBranch = 'master';
$scope.installProg = true;
var statusFile;
var domain = $("#domainNamePage").text();
function getInstallStatus(){
url = "/websites/installWordpressStatus";
var data = {
statusFile: statusFile,
domainName: domain
};
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.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = true;
$scope.installationSuccessfull = false;
$scope.couldNotConnect = true;
$scope.gitLoading = true;
$scope.goBackDisable = false;
$scope.installationURL = domain;
$("#installProgress").css("width", "100%");
$scope.installPercentage = "100";
$scope.currentStatus = response.data.currentStatus;
$timeout.cancel();
}
else{
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.gitLoading = true;
$scope.goBackDisable = false;
$scope.errorMessage = response.data.error_message;
$("#installProgress").css("width", "0%");
$scope.installPercentage = "0";
}
}
else{
$("#installProgress").css("width", response.data.installationProgress + "%");
$scope.installPercentage = response.data.installationProgress;
$scope.currentStatus = response.data.currentStatus;
$timeout(getInstallStatus,1000);
}
}
function cantLoadInitialDatas(response) {
$scope.canNotFetch = true;
$scope.couldNotConnect = false;
}
}
$scope.attachRepo = function(){
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = true;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.gitLoading = false;
$scope.installProg = false;
$scope.currentStatus = "Starting installation..";
url = "/websites/setupGitRepo";
var data = {
domain: domain,
username: $scope.githubUserName,
reponame: $scope.githubRepo,
branch: $scope.githubBranch
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.installStatus === 1)
{
statusFile = response.data.tempStatusPath;
getInstallStatus();
}
else{
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.installationFailed = false;
$scope.installationSuccessfull = true;
$scope.couldNotConnect = true;
$scope.gitLoading = true;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
}
};