Build steps fix

This commit is contained in:
Alexander Simonov 2015-07-13 22:24:52 +03:00
parent 63408147b2
commit 13b1ab9fd0
No known key found for this signature in database
GPG key ID: 5CCFFED829314C35
7 changed files with 41 additions and 41 deletions

BIN
cmd/drone-server/drone-server Executable file

Binary file not shown.

View file

@ -98,7 +98,6 @@
}); });
$scope.restart = function () { $scope.restart = function () {
console.log('restart');
builds.restart(fullName, number).then(function (payload) { builds.restart(fullName, number).then(function (payload) {
$scope.build = payload.data; $scope.build = payload.data;
}).catch(function (err) { }).catch(function (err) {
@ -191,8 +190,26 @@
$scope.error = err; $scope.error = err;
}); });
repos.subscribe(fullName, function (event) {
if (event.number !== parseInt(number)) {
return; // ignore
}
// update the build
$scope.build = event;
console.log(event.builds);
$scope.task = event.builds[step - 1];
$scope.$apply();
// start streaming the current build
if ($scope.task.status === 'running') {
stream();
} else {
// resets our streaming state
streaming = false;
}
});
$scope.restart = function () { $scope.restart = function () {
console.log('restart');
builds.restart(fullName, number).then(function (payload) { builds.restart(fullName, number).then(function (payload) {
$scope.build = payload.data; $scope.build = payload.data;
$scope.task = payload.data.builds[step - 1]; $scope.task = payload.data.builds[step - 1];
@ -213,24 +230,6 @@
$scope.tail = function () { $scope.tail = function () {
tail = !tail; tail = !tail;
}; };
repos.subscribe(fullName, function (event) {
if (event.number !== parseInt(number)) {
return; // ignore
}
// update the build
$scope.build = event;
$scope.task = event.builds[step - 1];
$scope.$apply();
// start streaming the current build
if ($scope.task.status === 'running') {
stream();
} else {
// resets our streaming state
streaming = false;
}
});
} }
angular angular

View file

@ -188,7 +188,7 @@
}, },
title: 'Build' title: 'Build'
}) })
.state('app.build_step', { .state('app.job', {
url: '/:owner/:name/:number/:step', url: '/:owner/:name/:number/:step',
views: { views: {
'toolbar': { 'toolbar': {
@ -200,7 +200,8 @@
templateUrl: '/static/scripts/views/builds/step/content.html', templateUrl: '/static/scripts/views/builds/step/content.html',
controller: 'BuildOutCtrl', controller: 'BuildOutCtrl',
resolve: resolveUser resolve: resolveUser
} },
title: 'Build Job'
} }
}); });

View file

@ -1,15 +1,15 @@
<article> <article>
<section> <section>
<a class="row build-row" ng-repeat="build in builds | orderBy:'-number'" <a class="row build-row" ng-repeat="build in builds | orderBy:'-number'" ng-href="/{{ repo.full_name }}/{{ build.number }}">
ng-href="/{{ repo.full_name }}/{{ build.number }}">
<div> <div>
<div ng-class="[ 'build-num', build.status ]"></div> <div ng-class="[ 'build-num', build.status ]"></div>
</div> </div>
<div> <div>
<h3>{{ build.head_commit.message }}</h3> <h3>{{ build.head_commit.message }}</h3>
<p><strong>{{ build.head_commit.author.login }}</strong> pushed to <strong>{{ build.head_commit.branch <p>
}}</strong> {{ build.started_at | fromNow }}</p> <strong>{{ build.head_commit.author.login }}</strong> pushed to <strong>{{ build.head_commit.branch}}</strong> {{ build.started_at | fromNow }}
</p>
<div style="position:absolute;top:30px;right:30px;color:#CCC;"># {{build.number}}</div> <div style="position:absolute;top:30px;right:30px;color:#CCC;"># {{build.number}}</div>
</div> </div>

View file

@ -8,17 +8,17 @@
<div> <div>
<h3>{{ build.head_commit.message }}</h3> <h3>{{ build.head_commit.message }}</h3>
<p><strong>{{ build.head_commit.author.login }}</strong> pushed to <strong>{{ build.head_commit.branch <p><strong>{{ build.head_commit.author.login }}</strong> pushed to <strong>{{ build.head_commit.branch}}</strong> {{ build.started_at | fromNow }}</p>
}}</strong> {{ build.started_at | fromNow }}</p>
<div style="position:absolute;top:30px;right:30px;color:#CCC;"># {{build.number}}</div> <div style="position:absolute;top:30px;right:30px;color:#CCC;"># {{build.number}}</div>
</div> </div>
</div> </div>
</section> </section>
<p style="padding-top: 20px;">
<h3><strong>Build jobs</strong></h3>
</p>
<section> <section>
<a class="row build-row sub-build-row" ng-repeat="job in build.jobs" <a class="row build-row sub-build-row" ng-repeat="job in build.jobs" ng-href="{{ repo.full_name }}/{{ build.number }}/{{ job.number }}">
ng-href="{{ repo.full_name }}/{{ build.number }}/{{ job.number }}">
<div> <div>
<div ng-class="[ 'build-num', build.status ]"></div> <div ng-class="[ 'build-num', build.status ]"></div>
</div> </div>
@ -34,6 +34,7 @@
</section> </section>
</article> </article>
<div style="padding-left: 20px;">
<button ng-if="build.status !== 'pending' && build.status !== 'running'" ng-click="restart()">Restart</button> <button ng-if="build.status !== 'pending' && build.status !== 'running'" ng-click="restart()">Restart</button>
<button ng-if="build.status === 'pending' || build.status === 'running'" ng-click="cancel()">Cancel</button> <button ng-if="build.status === 'pending' || build.status === 'running'" ng-click="cancel()">Cancel</button>
</div>

View file

@ -9,8 +9,7 @@
<div> <div>
<h3>{{ build.head_commit.message }}</h3> <h3>{{ build.head_commit.message }}</h3>
<p><strong>{{ build.head_commit.author.login }}</strong> pushed to <strong>{{ build.head_commit.branch <p><strong>{{ build.head_commit.author.login }}</strong> pushed to <strong>{{ build.head_commit.branch}}</strong> {{ build.started_at | fromNow }}</p>
}}</strong> {{ build.started_at | fromNow }}</p>
</div> </div>
</div> </div>

View file

@ -3,10 +3,10 @@
<i class="material-icons md-18">home</i> <i class="material-icons md-18">home</i>
</a> </a>
<a ng-href="/{{ repo.full_name }}">{{ repo.owner }} / {{ repo.name }}</a> <a ng-href="/{{ repo.full_name }}">{{ repo.owner }} / {{ repo.name }}</a>
<span class="spacer">&nbsp;</span>
<a ng-href="/{{ repo.full_name }}/{{ build.number }}">Build # {{ build.number }}</a>
<span class="spacer"></span> <span class="spacer"></span>
<a ng-href="/{{ repo.full_name }}/{{ build.sequence }}">{{ build.sequence }}</a> <a href="#">Job #{{ task.number }}</a>
<span class="spacer"></span>
<a href="#">{{ task.sequence }}</a>
</div> </div>
<div class="menu"> <div class="menu">