-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
222 lines (178 loc) · 8.94 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<style type="text/css">
.form-section {
margin-bottom: 20px;
}
@media (min-width: 750px) {
.form {
border-right: solid 1px #DDD;
}
}
@media (max-width: 749px) {
.form {
border-bottom: solid 1px #DDD;
padding-bottom: 20px;
}
}
.status {
border: solid 1px #DDD;
}
</style>
<section class="container">
<h1>gecko-ci</h1>
<span class="text-muted">A lightweight build monitor that handles IoT gadgets and brings CI feedbacks to the real world.</span>
<hr />
<p class="lead" style="background-color:#F7F7F7; padding:10px;">
Live demo
</p>
<div class="row" ng-controller="GeckoCIController">
<form class="col-sm-6 form">
<h4>TFS arguments</h4>
<div class="form-section">
<div class="form-group">
<label for="emailcollection">Collection :</label>
<input type="text" class="form-control" name="collection" ng-model="config.tfsCollection" required />
</div>
<div class="form-group">
<label for="server">Server :</label>
<input type="url" class="form-control" name="server" id="server" placeholder="https://<account>.visualstudio.com/" ng-model="config.tfsServer" required />
</div>
<div class="form-group">
<label for="user">User :</label>
<input type="text" class="form-control" name="user" id="user" placeholder="[email protected]" ng-model="config.tfsUser" required />
</div>
<div class="form-group">
<label for="personalToken">Personal token :</label> <b><small class="pull-right">Only the scope Build (read) is required.</small></b>
<input type="text" class="form-control" name="personalToken" id="personalToken" placeholder="xxxXXXxxXXXXxxXXXXxxxXXXXxxXXXXxxxxxXXXXxxx" autocomplete="off" ng-model="config.tfsPersonalToken" required />
<small class="text-muted">Please create tokens giving only the bare minimum permissions required by the client.</small>
</div>
<div class="form-group">
<label for="teamProject">Team project :</label>
<input type="text" class="form-control" name="teamProject" id="teamProject" ng-model="config.tfsTeamProject" required />
</div>
</div>
<input type="checkbox" ng-model="config.lifxActive" id="lifx-active" /> <label for="lifx-active" class="h4">LIFX arguments (optional)</label>
<div class="form-section">
<div class="form-group">
<label for="pwdlifx-selector">Selector :</label>
<input type="text" ng-disabled="!config.lifxActive" class="form-control" name="lifx-selector" id="lifx-selector" ng-model="config.lifxSelector" required />
</div>
<div class="form-group">
<label for="lifx-personalToken">Personal token :</label>
<input type="text" ng-disabled="!config.lifxActive" class="form-control" name="lifx-personalToken" id="lifx-personalToken" placeholder="xxxXXXxxXXXXxxXXXXxxxXXXXxxXXXXxxxxxXXXXxxx" autocomplete="off" ng-model="config.lifxPersonalToken" required />
</div>
</div>
<button type="submit" class="btn btn-success btn-lg" ng-click="start(config)" ng-hide="isRunning()" style="width:120px">Start</button>
<button type="button" class="btn btn-default btn-lg ng-hide" ng-click="stop()" ng-hide="!isRunning()" style="width:120px">Stop</button>
</form>
<div class="col-sm-6 result-section">
<h4>Build Status</h4>
<div class="status text-center" ng-class="textStatusClass">
<span class="h1" ng-bind="textStatus"></span>
</div>
<div id="console" class="text-danger"></div>
</div>
</div>
</section>
<script type="text/javascript" src="bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="bower_components/angularjs/angular.min.js"></script>
<script type="text/javascript" src="bower_components/gecko-ci/dist/gecko-ci.js"></script>
<script type="text/javascript">
let gecko = window.$gecko;
angular.module('app', [])
.controller('GeckoCIController', ['$scope', function ($scope) {
$scope.textStatus = "Not running"
$scope.messages = {}
$scope.config = {
tfsCollection: "DefaultCollection",
lifxSelector: "all",
lifxActive: false
}
$scope.start = function (config) {
$("#console").html("");
let options = {
connections: [
{
name: "default connection",
technology: "tfs",
collection: config.tfsCollection,
server: config.tfsServer,
user: config.tfsUser,
personalToken: config.tfsPersonalToken
}
],
buildMonitors: [
{
name: "default monitor",
teamProject: config.tfsTeamProject,
connectionName: "default connection"
}
],
lightBulbs: [
{
name: "local",
technology: "browser",
buildMonitorsNames: ["default monitor"]
}
],
lightBulbfactories: {
"browser": function (connection) {
return {
buildSucceeded: () => {
changeStatus("Success", "text-success");
$scope.$apply();
},
buildPartiallySucceeded: () => {
changeStatus("Partial success", "text-warning");
$scope.$apply();
},
buildFailed: () => {
changeStatus("Fail", "text-danger");
$scope.$apply();
}
}
}
}
}
if (config.lifxActive) {
options.lightBulbs.push({
name: "default bulb",
technology: "lifx",
buildMonitorsNames: ["default monitor"],
selector: config.lifxSelector,
personalToken: config.lifxPersonalToken
})
}
$scope.monitor = gecko.watchBuilds(options);
$scope.textStatus = "Connecting..."
};
$scope.stop = function () {
if ($scope.monitor) {
$scope.monitor.stopWatchingBuilds();
$scope.monitor = undefined;
changeStatus("Not running")
}
}
$scope.isRunning = function () {
return $scope.monitor != undefined
}
let changeStatus = (newStatus, newTextStatusClass) => {
$scope.textStatus = newStatus;
$scope.textStatusClass = newTextStatusClass;
}
}]);
let handleConsole = function () {
if (typeof console != "undefined")
if (typeof console.log != 'undefined')
console.olog = console.log;
else
console.olog = function () { };
console.log = function (message) {
console.olog(message);
$('#console').append('<p>' + message + '</p>');
};
console.error = console.debug = console.info = console.log
}
handleConsole();
</script>