diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-12-29 18:11:08 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-12-29 18:19:19 +0100 |
commit | 84fb49088a14cff8b453e0e32f6ad7007eb2184a (patch) | |
tree | b306c923570b26501da8df1f6e41ec2404a19faa /src/main/webapp | |
parent | 1b83af30a4e935f2037a6e9153cb438c29adfbfc (diff) | |
download | esper-testing-84fb49088a14cff8b453e0e32f6ad7007eb2184a.tar.gz esper-testing-84fb49088a14cff8b453e0e32f6ad7007eb2184a.tar.bz2 esper-testing-84fb49088a14cff8b453e0e32f6ad7007eb2184a.tar.xz esper-testing-84fb49088a14cff8b453e0e32f6ad7007eb2184a.zip |
o Adding jobs view for jenkins app.
Diffstat (limited to 'src/main/webapp')
-rw-r--r-- | src/main/webapp/apps/jenkinsApp/JenkinsResources.js | 8 | ||||
-rw-r--r-- | src/main/webapp/apps/jenkinsApp/jenkinsApp.js | 41 | ||||
-rw-r--r-- | src/main/webapp/apps/jenkinsApp/job.html | 59 | ||||
-rw-r--r-- | src/main/webapp/apps/jenkinsApp/server-list.html | 52 | ||||
-rw-r--r-- | src/main/webapp/apps/jenkinsApp/server.html | 1 |
5 files changed, 115 insertions, 46 deletions
diff --git a/src/main/webapp/apps/jenkinsApp/JenkinsResources.js b/src/main/webapp/apps/jenkinsApp/JenkinsResources.js index 0026932..89f3139 100644 --- a/src/main/webapp/apps/jenkinsApp/JenkinsResources.js +++ b/src/main/webapp/apps/jenkinsApp/JenkinsResources.js @@ -15,3 +15,11 @@ function JenkinsJob($resource) { angular. module('jenkinsJob', ['ngResource']). factory('JenkinsJob', JenkinsJob); + +function JenkinsBuild($resource) { + return $resource('/resource/jenkins/build/:uuid', {uuid: '@uuid'}); +} + +angular. + module('jenkinsBuild', ['ngResource']). + factory('JenkinsBuild', JenkinsBuild); diff --git a/src/main/webapp/apps/jenkinsApp/jenkinsApp.js b/src/main/webapp/apps/jenkinsApp/jenkinsApp.js index e51c9f3..19d107d 100644 --- a/src/main/webapp/apps/jenkinsApp/jenkinsApp.js +++ b/src/main/webapp/apps/jenkinsApp/jenkinsApp.js @@ -1,14 +1,10 @@ 'use strict'; -var jenkinsApp = angular.module('jenkinsApp', ['jenkinsServer', 'jenkinsJob', 'pagingTableService']).config(function ($routeProvider) { +var jenkinsApp = angular.module('jenkinsApp', ['jenkinsServer', 'jenkinsJob', 'jenkinsBuild', 'pagingTableService']).config(function ($routeProvider) { $routeProvider. - when('/', {controller: ServerListCtrl, templateUrl: '/apps/jenkinsApp/server-list.html?noCache=' + noCache}); - $routeProvider. - when('/server/:uuid', {controller: ServerCtrl, templateUrl: '/apps/jenkinsApp/server.html?noCache=' + noCache}); -// $routeProvider.otherwise({ redirectTo: '/' }); - - // This fucks shit up -// $locationProvider.html5Mode(true); + when('/', {controller: ServerListCtrl, templateUrl: '/apps/jenkinsApp/server-list.html?noCache=' + noCache}). + when('/server/:uuid', {controller: ServerCtrl, templateUrl: '/apps/jenkinsApp/server.html?noCache=' + noCache}). + when('/job/:uuid', {controller: JobCtrl, templateUrl: '/apps/jenkinsApp/job.html?noCache=' + noCache}); }); function ServerListCtrl($scope, $location, JenkinsServer) { @@ -16,13 +12,8 @@ function ServerListCtrl($scope, $location, JenkinsServer) { $scope.servers = servers; }); - $scope.showServers = function () { - $location.path('/'); - }; - - $scope.showServer = function (uuid) { - $location.path('/server/' + uuid); - }; + $scope.showServers = function () { $location.path('/'); }; + $scope.showServer = function (uuid) { $location.path('/server/' + uuid); }; } function ServerCtrl($scope, $location, $routeParams, JenkinsServer, JenkinsJob, PagingTableService) { @@ -34,11 +25,19 @@ function ServerCtrl($scope, $location, $routeParams, JenkinsServer, JenkinsJob, $scope.jobs = PagingTableService.create($scope, PagingTableService.defaultCallback(JenkinsJob, {server: serverUuid})); - $scope.showServers = function () { - $location.path('/'); - }; + $scope.showServers = function () { $location.path('/'); }; + $scope.showJob = function (uuid) { $location.path('/job/' + uuid); }; +} + +function JobCtrl($scope, $location, $routeParams, JenkinsJob, JenkinsBuild, PagingTableService) { + var jobUuid = $routeParams.uuid; + + JenkinsJob.get({uuid: jobUuid}, function (job) { + $scope.job = job; + }); + + $scope.builds = PagingTableService.create($scope, PagingTableService.defaultCallback(JenkinsBuild, {job: jobUuid})); - $scope.showServer = function (uuid) { - $location.path('/server/' + uuid); - }; + $scope.showServers = function () { $location.path('/'); }; + $scope.showServer = function (uuid) { $location.path('/server/' + $scope.job.server); }; } diff --git a/src/main/webapp/apps/jenkinsApp/job.html b/src/main/webapp/apps/jenkinsApp/job.html new file mode 100644 index 0000000..5113d2e --- /dev/null +++ b/src/main/webapp/apps/jenkinsApp/job.html @@ -0,0 +1,59 @@ +<div class="container"> + + <div class="page-header"> + <h1>Jenkins Job</h1> + </div> + + <ul class="breadcrumb"> + <li><a ng-click="showServers()">All Servers</a> <span class="divider">/</span></li> + <li><a ng-click="showServer()">Servers</a> <span class="divider">/</span></li> + <li class="active">Job</li> + </ul> + + <h3>Overview</h3> + + <table class="table"> + <tbody> + <tr> + <th>URL</th> + <td><a href="{{job.displayName}}">{{job.displayName}}</a></td> + </tr> + <tr> + <th>Build count</th> + <td>{{job.buildCount}}</td> + </tr> + </tbody> + </table> + + <h3>Recent Builds</h3> + <table class="table"> + <thead> + <tr> + <th>Build</th> + <th>Result</th> + <th></th> + </tr> + </thead> + <tbody> + <tr ng-repeat="build in builds.rows" class="{{{true: 'success', false: 'error'}[build.success]}}"> + <td>{{build.createdDate | date:'medium'}}</td> + <td>{{build.result}}</td> + <td><a class="btn" ng-click="showBuild(build.uuid)"><i class="icon-chevron-right"></i></a></td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="3"> + <ul class="pager"> + <li class="previous" ng-class="{disabled: builds.startIndex == 0}"> + <a ng-click="builds.prev()">← Older</a> + </li> + <li class="next"> + <a ng-click="builds.next()">Newer →</a> + </li> + </ul> + </td> + </tr> + </tfoot> + </table> +</div> diff --git a/src/main/webapp/apps/jenkinsApp/server-list.html b/src/main/webapp/apps/jenkinsApp/server-list.html index f335c1f..e488186 100644 --- a/src/main/webapp/apps/jenkinsApp/server-list.html +++ b/src/main/webapp/apps/jenkinsApp/server-list.html @@ -1,27 +1,29 @@ -<div class="page-header"> - <h1>Jenkins Servers</h1> -</div> +<div class="container"> + <div class="page-header"> + <h1>Jenkins Servers</h1> + </div> -<ul class="breadcrumb"> - <li class="active">All Servers</li> -</ul> + <ul class="breadcrumb"> + <li class="active">All Servers</li> + </ul> -<table class="table table-condensed"> - <thead> - <tr> - <th class="header">URL</th> - <th class="header">Enabled</th> - <th class=""></th> - </tr> - </thead> - <tbody> - <tr ng-repeat="server in servers"> - <td>{{server.url}}</td> - <td>{{server.enabled}}</td> - <td> - <a href="{{server.url}}">Visit</a> - <a ng-click="showServer(server.uuid)">Details</a> - </td> - </tr> - </tbody> -</table> + <table class="table table-condensed"> + <thead> + <tr> + <th>URL</th> + <th>Enabled</th> + <th></th> + <th></th> + </tr> + </thead> + <tbody> + <tr ng-repeat="server in servers"> + <td>{{server.url}}</td> + <td>{{server.enabled}}</td> + <td><a href="{{server.url}}">Visit</a></td> + <td><a class="btn" ng-click="showServer(server.uuid)"><i class="icon-chevron-right"></i></a> + </td> + </tr> + </tbody> + </table> +</div> diff --git a/src/main/webapp/apps/jenkinsApp/server.html b/src/main/webapp/apps/jenkinsApp/server.html index 8a784e8..03be57e 100644 --- a/src/main/webapp/apps/jenkinsApp/server.html +++ b/src/main/webapp/apps/jenkinsApp/server.html @@ -39,6 +39,7 @@ <td>{{job.createdDate | date:'medium'}}</td> <td>{{job.displayName}}</td> <td>{{job.uuid}}</td> + <td><a class="btn" ng-click="showJob(job.uuid)"><i class="icon-chevron-right"></i></a></td> </tr> </tbody> <tfoot> |