|
1
|
|
|
"use strict"; |
|
2
|
|
|
|
|
3
|
|
|
app.controller('install01Controller', ['$scope', '$q', '$http', '$interval', '$rootScope', function ($scope, $q, $http, $interval, $rootScope) { |
|
4
|
|
|
$("#download_button").hide(); |
|
5
|
|
|
|
|
6
|
|
|
$scope.mergeContent = function(){ |
|
7
|
|
|
if($scope.releaseInfoStack.length > 0){ |
|
8
|
|
|
var latestRelease = $scope.releaseInfoStack[0]; |
|
9
|
|
|
console.dir(latestRelease) |
|
10
|
|
|
var tag_name = latestRelease.tag_name; |
|
11
|
|
|
var releaseZipDownloadURL = latestRelease.zipball_url; |
|
12
|
|
|
var releaseTarDownloadURL = latestRelease.tarball_url; |
|
13
|
|
|
|
|
14
|
|
|
$("#latest_release_zip").text(tag_name).parent("a").attr("href", releaseZipDownloadURL); |
|
15
|
|
|
$("#latest_release_tar").text(tag_name).parent("a").attr("href", releaseTarDownloadURL); |
|
16
|
|
|
|
|
17
|
|
|
$("#loading_info").hide(); |
|
18
|
|
|
$("#download_button").show(); |
|
19
|
|
|
} |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
$scope.get_information = function(){ |
|
23
|
|
|
$scope.initial_variable(); |
|
24
|
|
|
|
|
25
|
|
|
var getReleaseInfoResule = $scope.get_github_release_info(); |
|
26
|
|
|
getReleaseInfoResule.then(function(infoObjList) { |
|
27
|
|
|
$scope.releaseInfoStack = infoObjList; |
|
28
|
|
|
}, function(reason) { |
|
29
|
|
|
}); |
|
30
|
|
|
|
|
31
|
|
|
$q.all([getReleaseInfoResule]).then(function() { |
|
32
|
|
|
$scope.mergeContent(); |
|
33
|
|
|
}); |
|
34
|
|
|
} |
|
35
|
|
|
$scope.get_github_release_info = function(){ |
|
36
|
|
|
var arrayList = []; |
|
37
|
|
|
|
|
38
|
|
|
var promise = $q(function(resolve, reject) { |
|
39
|
|
|
var array = {text:"commits", amt:"10101", options}; |
|
|
|
|
|
|
40
|
|
|
|
|
41
|
|
|
$http({ |
|
42
|
|
|
method : "GET", |
|
43
|
|
|
url : "https://api.github.com/repos/Otaku-Projects/AngularJS-CRUD-PHP/releases" |
|
44
|
|
|
}).then(function mySuccess(response) { |
|
45
|
|
|
var returnData = response.data; |
|
46
|
|
|
var totalReleasesCount = 0; |
|
|
|
|
|
|
47
|
|
|
returnData.forEach(function(releasesObj){ |
|
48
|
|
|
arrayList.push(releasesObj); |
|
49
|
|
|
}); |
|
50
|
|
|
|
|
51
|
|
|
resolve(arrayList); |
|
52
|
|
|
}, function myError(response) { |
|
53
|
|
|
reject(new Error('get project release info error')); |
|
54
|
|
|
}); |
|
55
|
|
|
|
|
56
|
|
|
}); |
|
57
|
|
|
|
|
58
|
|
|
return promise; |
|
59
|
|
|
} |
|
60
|
|
|
$scope.initial_variable = function(){ |
|
61
|
|
|
$scope.releaseInfoStack = []; |
|
62
|
|
|
} |
|
63
|
|
|
function start_milestones(stackObjectList){ |
|
|
|
|
|
|
64
|
|
|
$("#milestones").html(""); |
|
65
|
|
|
|
|
66
|
|
|
var infoObj = stackObjectList.shift(); |
|
67
|
|
|
var elementContent = infoObj.text; |
|
68
|
|
|
var countUpAmt = infoObj.amt; |
|
69
|
|
|
var options = infoObj.options; |
|
70
|
|
|
$("#milestones").html("<div class='animated'>"+elementContent+"</div>"); |
|
71
|
|
|
$("#milestones div").addClass("fadeInUp"); |
|
72
|
|
|
|
|
73
|
|
|
if(!$scope.countUp){ |
|
74
|
|
|
$scope.countUp = new CountUp("count_up_amt", 0, options); |
|
75
|
|
|
$scope.countUp.start(); |
|
76
|
|
|
$("#count_up_amt").hide(); |
|
77
|
|
|
} |
|
78
|
|
|
$("#count_up_amt").show(); |
|
79
|
|
|
$scope.countUp.update(countUpAmt); |
|
80
|
|
|
|
|
81
|
|
|
stackObjectList.push(infoObj); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
$scope.get_information(); |
|
85
|
|
|
}]); |