Builds UI fixes

This commit is contained in:
Alexander Simonov 2015-07-13 08:23:50 +03:00
parent 229e88a438
commit 63408147b2
No known key found for this signature in database
GPG key ID: 5CCFFED829314C35
9 changed files with 189 additions and 124 deletions

View file

@ -64,7 +64,6 @@
* BuildCtrl responsible for rendering a build.
*/
function BuildCtrl($scope, $stateParams, $window, logs, builds, repos, users) {
var number = $stateParams.number;
var owner = $stateParams.owner;
var name = $stateParams.name;
@ -97,6 +96,27 @@
$scope.build = event;
$scope.$apply();
});
$scope.restart = function () {
console.log('restart');
builds.restart(fullName, number).then(function (payload) {
$scope.build = payload.data;
}).catch(function (err) {
$scope.error = err;
});
};
$scope.cancel = function () {
builds.cancel(fullName, number).then(function (payload) {
$scope.build = payload.data;
}).catch(function (err) {
$scope.error = err;
});
};
$scope.tail = function () {
tail = !tail;
};
}
@ -172,6 +192,7 @@
});
$scope.restart = function () {
console.log('restart');
builds.restart(fullName, number).then(function (payload) {
$scope.build = payload.data;
$scope.task = payload.data.builds[step - 1];
@ -212,7 +233,6 @@
});
}
angular
.module('drone')
.controller('BuildOutCtrl', BuildOutCtrl)

View file

@ -78,9 +78,14 @@
})
.state('login', {
url: '/login',
templateUrl: '/static/scripts/views/login.html',
title: 'Login',
controller: 'UserLoginCtrl'
views: {
'layout': {
templateUrl: '/static/scripts/views/login.html',
controller: 'UserLoginCtrl',
resolve: resolveUser
}
},
title: 'Login'
})
.state('app.profile', {
url: '/profile',
@ -123,13 +128,15 @@
views: {
'toolbar': {
templateUrl: '/static/scripts/views/builds/index/toolbar.html',
controller: 'BuildsCtrl'
controller: 'RepoEditCtrl',
resolve: resolveUser
},
'content': {
templateUrl: '/static/scripts/views/builds/index/content.html',
controller: 'BuildsCtrl'
}
}
},
title: 'Builds'
})
.state('app.repo_edit', {
url: '/:owner/:name/edit',
@ -168,20 +175,33 @@
.state('app.build', {
url: '/:owner/:name/:number',
views: {
'toolbar': {templateUrl: '/static/scripts/views/builds/show/toolbar.html'},
'content': {templateUrl: '/static/scripts/views/builds/show/content.html'}
'toolbar': {
templateUrl: '/static/scripts/views/builds/show/toolbar.html',
controller: 'BuildCtrl',
resolve: resolveUser
},
'content': {
templateUrl: '/static/scripts/views/builds/show/content.html',
controller: 'BuildCtrl',
resolve: resolveUser
}
},
controller: 'BuildCtrl',
resolve: resolveUser
title: 'Build'
})
.state('app.build_step', {
url: '/:owner/:name/:number/:step',
views: {
'toolbar': {templateUrl: '/static/scripts/views/builds/step/toolbar.html'},
'content': {templateUrl: '/static/scripts/views/builds/step/content.html'}
},
controller: 'BuildOutCtrl',
resolve: resolveUser
'toolbar': {
templateUrl: '/static/scripts/views/builds/step/toolbar.html',
controller: 'BuildOutCtrl',
resolve: resolveUser
},
'content': {
templateUrl: '/static/scripts/views/builds/step/content.html',
controller: 'BuildOutCtrl',
resolve: resolveUser
}
}
});
// Enables html5 mode
@ -211,8 +231,8 @@
function RouteChange($rootScope, repos, logs) {
$rootScope.$on('$stateChangeStart', function () {
// repos.unsubscribe();
// logs.unsubscribe();
repos.unsubscribe();
logs.unsubscribe();
});
$rootScope.$on('$stateChangeSuccess', function (event, current) {

View file

@ -1,14 +1,18 @@
<article>
<section>
<a class="row build-row" ng-repeat="build in builds | orderBy:'-number'" ng-href="/{{ repo.full_name }}/{{ build.number }}">
<div>
<div ng-class="[ 'build-num', build.status ]"></div>
</div>
<div>
<h3>{{ build.head_commit.message }}</h3>
<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>
</a>
</section>
<section>
<a class="row build-row" ng-repeat="build in builds | orderBy:'-number'"
ng-href="/{{ repo.full_name }}/{{ build.number }}">
<div>
<div ng-class="[ 'build-num', build.status ]"></div>
</div>
<div>
<h3>{{ build.head_commit.message }}</h3>
<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>
</a>
</section>
</article>

View file

@ -1,18 +1,18 @@
<div class="breadcrumb" style="position:relative;top:0px;">
<a href="/" class="icon icon-home">
<i class="material-icons md-18">home</i>
</a>
<a href="#">{{ repo.owner }} / {{ repo.name }}</a>
<div class="breadcrumb" style="position:relative;top:0px;">
<a href="/" class="icon icon-home">
<i class="material-icons md-18">home</i>
</a>
<a href="#">{{ repo.owner }} / {{ repo.name }}</a>
</div>
<div class="menu">
<a ng-href="/{{ repo.full_name }}/edit" class="nav-item settings float-right" ng-if="repo.permissions.pull">
<i class="material-icons md-18">edit</i>
</a>
<button ng-click="watch(repo)" ng-if="!repo.starred && user" class="nav-item star float-right">
<i class="material-icons md-18">star_border</i>
</button>
<button ng-click="unwatch(repo)" ng-if="repo.starred && user" class="nav-item unstar float-right">
<i class="material-icons md-18">star</i>
</button>
<a ng-href="/{{ repo.full_name }}/edit" class="nav-item settings float-right" ng-if="repo.permissions.pull">
<i class="material-icons md-18">edit</i>
</a>
<button ng-click="watch(repo)" ng-if="!repo.starred && user" class="nav-item star float-right">
<i class="material-icons md-18">star_border</i>
</button>
<button ng-click="unwatch(repo)" ng-if="repo.starred && user" class="nav-item unstar float-right">
<i class="material-icons md-18">star</i>
</button>
</div>

View file

@ -1,36 +1,39 @@
<article>
<section class="commit-section">
<div class="row build-row">
<div>
<div ng-class="[ 'build-num', build.status ]"></div>
</div>
<div>
<h3>{{ build.head_commit.message }}</h3>
<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>
</div>
</section>
<section class="commit-section">
<div class="row build-row">
<div>
<div ng-class="[ 'build-num', build.status ]"></div>
</div>
<div>
<h3>{{ build.head_commit.message }}</h3>
<section>
<a class="row build-row sub-build-row" ng-repeat="job in build.jobs" ng-href="{{ repo.full_name }}/{{ build.number }}/{{ job.number }}">
<div>
<div ng-class="[ 'build-num', build.status ]"></div>
</div>
<div>
<h3>
<div ng-repeat="(key, value) in job.environment">
{{ key.toUpperCase() }}={{ value }}
</div>
</h3>
<div style="position:absolute;top:30px;right:30px;color:#CCC;"># {{job.number}}</div>
</div>
</a>
</section>
<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>
</div>
</section>
<section>
<a class="row build-row sub-build-row" ng-repeat="job in build.jobs"
ng-href="{{ repo.full_name }}/{{ build.number }}/{{ job.number }}">
<div>
<div ng-class="[ 'build-num', build.status ]"></div>
</div>
<div>
<h3>
<div ng-repeat="(key, value) in job.environment">
{{ key.toUpperCase() }}={{ value }}
</div>
</h3>
<div style="position:absolute;top:30px;right:30px;color:#CCC;"># {{job.number}}</div>
</div>
</a>
</section>
</article>
<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>

View file

@ -1,15 +1,20 @@
<div class="breadcrumb" style="position:relative;top:0px;">
<a ng-href="/{{ repo.full_name }}" class="icon icon-home">
<i class="material-icons md-18">home</i>
</a>
<a ng-href="/{{ repo.full_name }}">{{ repo.owner }} / {{ repo.name }}</a>
<span class="spacer"></span>
<a ng-href="#">{{ build.number }}</a>
<div class="breadcrumb" style="position:relative;top:0px;">
<a ng-href="/{{ repo.full_name }}" class="icon icon-home">
<i class="material-icons md-18">home</i>
</a>
<a ng-href="/{{ repo.full_name }}">{{ repo.owner }} / {{ repo.name }}</a>
<span class="spacer"></span>
<a ng-href="#">#{{ build.number }}</a>
</div>
<div class="menu">
<a href="settings.html" class="icon icon-settings"></a>
<a ng-href="/{{ repo.full_name }}/edit" class="nav-item settings float-right"></a>
<button ng-click="watch(repo)" ng-if="!repo.starred" class="nav-item star float-right"></button>
<button ng-click="unwatch(repo)" ng-if="repo.starred" class="nav-item unstar float-right"></button>
<a ng-href="/{{ repo.full_name }}/edit" class="nav-item settings float-right" ng-if="repo.permissions.pull">
<i class="material-icons md-18">edit</i>
</a>
<button ng-click="watch(repo)" ng-if="!repo.starred && user" class="nav-item star float-right">
<i class="material-icons md-18">star_border</i>
</button>
<button ng-click="unwatch(repo)" ng-if="repo.starred && user" class="nav-item unstar float-right">
<i class="material-icons md-18">star</i>
</button>
</div>

View file

@ -1,39 +1,38 @@
<article>
<section class="commit-section">
<div class="row build-row">
<div>
<div ng-class="[ 'build-num', task.status ]" ng-if="task"></div>
<div ng-class="[ 'build-num', build.status ]" ng-if="!task"></div>
</div>
<div>
<h3>{{ build.head_commit.message }}</h3>
<p><strong>{{ build.head_commit.author.login }}</strong> pushed to <strong>{{ build.head_commit.branch }}</strong> {{ build.started_at | fromNow }}</p>
</div>
</div>
<section class="commit-section">
<div class="row build-row">
<div>
<div ng-class="[ 'build-num', task.status ]" ng-if="task"></div>
<div ng-class="[ 'build-num', build.status ]" ng-if="!task"></div>
</div>
<div>
<h3>{{ build.head_commit.message }}</h3>
<div class="row build-row sub-build-row" ng-if="build.jobs.length > 1">
<div>
<p><strong>{{ build.head_commit.author.login }}</strong> pushed to <strong>{{ build.head_commit.branch
}}</strong> {{ build.started_at | fromNow }}</p>
</div>
</div>
</div>
<div>
<h3 style="margin-top:0px">
<div ng-repeat="(key, value) in task.environment">
{{ key.toUpperCase() }}={{ value }}
</div>
</h3>
</div>
</div>
</section>
<div class="row build-row sub-build-row" ng-if="build.jobs.length > 1">
<div>
</div>
<div>
<h3 style="margin-top:0px">
<div ng-repeat="(key, value) in task.environment">
{{ key.toUpperCase() }}={{ value }}
</div>
</h3>
</div>
</div>
</section>
<pre id="term" ng-if="task && task.status !== 'pending'"></pre>
<button class="fab" ng-if="build.status === 'running'" ng-click="tail()"></button>
<pre id="term" ng-if="task && task.status !== 'pending'"></pre>
<button class="fab" ng-if="build.status === 'running'" ng-click="tail()"></button>
</article>
<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>

View file

@ -1,14 +1,22 @@
<div class="breadcrumb" style="position:relative;top:0px;">
<a ng-href="/{{ repo.full_name }}/{{ build.sequence }}" class="icon icon-home"></a>
<a ng-href="/{{ repo.full_name }}">{{ repo.owner }} / {{ repo.name }}</a>
<span class="spacer"></span>
<a ng-href="/{{ repo.full_name }}/{{ build.sequence }}">{{ build.sequence }}</a>
<span class="spacer"></span>
<a href="#">{{ task.sequence }}</a>
<div class="breadcrumb" style="position:relative;top:0px;">
<a ng-href="/{{ repo.full_name }}/{{ build.sequence }}" class="icon icon-home">
<i class="material-icons md-18">home</i>
</a>
<a ng-href="/{{ repo.full_name }}">{{ repo.owner }} / {{ repo.name }}</a>
<span class="spacer"></span>
<a ng-href="/{{ repo.full_name }}/{{ build.sequence }}">{{ build.sequence }}</a>
<span class="spacer"></span>
<a href="#">{{ task.sequence }}</a>
</div>
<div class="menu">
<a ng-href="/{{ repo.full_name }}/edit" class="nav-item settings float-right"></a>
<button ng-click="watch(repo)" ng-if="!repo.starred" class="nav-item star float-right"></button>
<button ng-click="unwatch(repo)" ng-if="repo.starred" class="nav-item unstar float-right"></button>
<a ng-href="/{{ repo.full_name }}/edit" class="nav-item settings float-right" ng-if="repo.permissions.pull">
<i class="material-icons md-18">edit</i>
</a>
<button ng-click="watch(repo)" ng-if="!repo.starred && user" class="nav-item star float-right">
<i class="material-icons md-18">star_border</i>
</button>
<button ng-click="unwatch(repo)" ng-if="repo.starred && user" class="nav-item unstar float-right">
<i class="material-icons md-18">star</i>
</button>
</div>

View file

@ -6,7 +6,13 @@
</div>
<div class="menu">
<a ng-href="/{{ repo.full_name }}/edit" class="nav-item settings float-right"></a>
<button ng-click="watch(repo)" ng-if="!repo.starred" class="nav-item star float-right"></button>
<button ng-click="unwatch(repo)" ng-if="repo.starred" class="nav-item unstar float-right"></button>
<a ng-href="/{{ repo.full_name }}/edit" class="nav-item settings float-right" ng-if="repo.permissions.pull">
<i class="material-icons md-18">edit</i>
</a>
<button ng-click="watch(repo)" ng-if="!repo.starred && user" class="nav-item star float-right">
<i class="material-icons md-18">star_border</i>
</button>
<button ng-click="unwatch(repo)" ng-if="repo.starred && user" class="nav-item unstar float-right">
<i class="material-icons md-18">star</i>
</button>
</div>