diff --git a/cmd/drone-server/static/scripts/controllers/builds.js b/cmd/drone-server/static/scripts/controllers/builds.js index 6a28a17b..d37ad76c 100644 --- a/cmd/drone-server/static/scripts/controllers/builds.js +++ b/cmd/drone-server/static/scripts/controllers/builds.js @@ -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) diff --git a/cmd/drone-server/static/scripts/drone.js b/cmd/drone-server/static/scripts/drone.js index 3c85fcf7..cf8e8c58 100644 --- a/cmd/drone-server/static/scripts/drone.js +++ b/cmd/drone-server/static/scripts/drone.js @@ -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) { diff --git a/cmd/drone-server/static/scripts/views/builds/index/content.html b/cmd/drone-server/static/scripts/views/builds/index/content.html index c469202b..e55d239c 100644 --- a/cmd/drone-server/static/scripts/views/builds/index/content.html +++ b/cmd/drone-server/static/scripts/views/builds/index/content.html @@ -1,14 +1,18 @@
-
- -
-
-
-
-

{{ build.head_commit.message }}

-

{{ build.head_commit.author.login }} pushed to {{ build.head_commit.branch }} {{ build.started_at | fromNow }}

-
# {{build.number}}
-
-
-
+
+ +
+
+
+
+

{{ build.head_commit.message }}

+ +

{{ build.head_commit.author.login }} pushed to {{ build.head_commit.branch + }} {{ build.started_at | fromNow }}

+ +
# {{build.number}}
+
+
+
\ No newline at end of file diff --git a/cmd/drone-server/static/scripts/views/builds/index/toolbar.html b/cmd/drone-server/static/scripts/views/builds/index/toolbar.html index 968a7f4b..c79f647e 100644 --- a/cmd/drone-server/static/scripts/views/builds/index/toolbar.html +++ b/cmd/drone-server/static/scripts/views/builds/index/toolbar.html @@ -1,18 +1,18 @@ -