diff options
Diffstat (limited to 'src/main/webapp/apps/jenkinsApp')
-rw-r--r-- | src/main/webapp/apps/jenkinsApp/JenkinsResources.js | 17 | ||||
-rw-r--r-- | src/main/webapp/apps/jenkinsApp/JenkinsServerService.js | 9 | ||||
-rw-r--r-- | src/main/webapp/apps/jenkinsApp/jenkinsApp.js | 19 | ||||
-rw-r--r-- | src/main/webapp/apps/jenkinsApp/server.html | 81 |
4 files changed, 86 insertions, 40 deletions
diff --git a/src/main/webapp/apps/jenkinsApp/JenkinsResources.js b/src/main/webapp/apps/jenkinsApp/JenkinsResources.js new file mode 100644 index 0000000..0026932 --- /dev/null +++ b/src/main/webapp/apps/jenkinsApp/JenkinsResources.js @@ -0,0 +1,17 @@ +'use strict'; + +function JenkinsServer($resource) { + return $resource('/resource/jenkins/server/:uuid', {uuid: '@uuid'}); +} + +angular. + module('jenkinsServer', ['ngResource']). + factory('JenkinsServer', JenkinsServer); + +function JenkinsJob($resource) { + return $resource('/resource/jenkins/job/:uuid', {uuid: '@uuid'}); +} + +angular. + module('jenkinsJob', ['ngResource']). + factory('JenkinsJob', JenkinsJob); diff --git a/src/main/webapp/apps/jenkinsApp/JenkinsServerService.js b/src/main/webapp/apps/jenkinsApp/JenkinsServerService.js deleted file mode 100644 index b26c9b1..0000000 --- a/src/main/webapp/apps/jenkinsApp/JenkinsServerService.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -function JenkinsServerService($resource) { - return $resource('/resource/jenkins/server/:uuid', {uuid: '@uuid'}); -} - -angular. - module('jenkinsServerService', ['ngResource']). - factory('JenkinsServerService', JenkinsServerService); diff --git a/src/main/webapp/apps/jenkinsApp/jenkinsApp.js b/src/main/webapp/apps/jenkinsApp/jenkinsApp.js index 5477039..e51c9f3 100644 --- a/src/main/webapp/apps/jenkinsApp/jenkinsApp.js +++ b/src/main/webapp/apps/jenkinsApp/jenkinsApp.js @@ -1,6 +1,6 @@ 'use strict'; -var jenkinsApp = angular.module('jenkinsApp', ['jenkinsServerService']).config(function ($routeProvider, $locationProvider) { +var jenkinsApp = angular.module('jenkinsApp', ['jenkinsServer', 'jenkinsJob', 'pagingTableService']).config(function ($routeProvider) { $routeProvider. when('/', {controller: ServerListCtrl, templateUrl: '/apps/jenkinsApp/server-list.html?noCache=' + noCache}); $routeProvider. @@ -11,12 +11,12 @@ var jenkinsApp = angular.module('jenkinsApp', ['jenkinsServerService']).config(f // $locationProvider.html5Mode(true); }); -function ServerListCtrl($scope, $location, JenkinsServerService) { - JenkinsServerService.query(function (servers) { +function ServerListCtrl($scope, $location, JenkinsServer) { + JenkinsServer.query(function (servers) { $scope.servers = servers; }); - $scope.showServers = function (uuid) { + $scope.showServers = function () { $location.path('/'); }; @@ -25,13 +25,16 @@ function ServerListCtrl($scope, $location, JenkinsServerService) { }; } -function ServerCtrl($scope, $location, $routeParams, JenkinsServerService) { - window.x = $routeParams; - JenkinsServerService.get({uuid: $routeParams.uuid}, function (server) { +function ServerCtrl($scope, $location, $routeParams, JenkinsServer, JenkinsJob, PagingTableService) { + var serverUuid = $routeParams.uuid; + + JenkinsServer.get({uuid: serverUuid}, function (server) { $scope.server = server; }); - $scope.showServers = function (uuid) { + $scope.jobs = PagingTableService.create($scope, PagingTableService.defaultCallback(JenkinsJob, {server: serverUuid})); + + $scope.showServers = function () { $location.path('/'); }; diff --git a/src/main/webapp/apps/jenkinsApp/server.html b/src/main/webapp/apps/jenkinsApp/server.html index 9b27dfe..8a784e8 100644 --- a/src/main/webapp/apps/jenkinsApp/server.html +++ b/src/main/webapp/apps/jenkinsApp/server.html @@ -1,25 +1,60 @@ -<div class="page-header"> - <h1>Jenkins Server</h1> -</div> +<div class="container"> + + <div class="page-header"> + <h1>Jenkins Server</h1> + </div> + + <ul class="breadcrumb"> + <li><a ng-click="showServers()">All Servers</a> <span class="divider">/</span></li> + <li class="active">Server</li> + </ul> -<ul class="breadcrumb"> - <li><a ng-click="showServers()">All Servers</a> <span class="divider">/</span></li> - <li class="active">Server</li> -</ul> + <h3>Overview</h3> + <table class="table"> + <tbody> + <tr> + <th>URL</th> + <td><a href="{{server.url}}">{{server.url}}</a></td> + </tr> + <tr> + <th>Enabled</th> + <td>{{server.enabled}}</td> + </tr> + <tr> + <th>Stats</th> + <td>{{server.jobCount}} jobs, {{server.buildCount}} builds</td> + </tr> + </tbody> + </table> -<table class="table"> - <tbody> - <tr> - <th>URL</th> - <td><a href="{{server.url}}">{{server.url}}</a></td> - </tr> - <tr> - <th>Enabled</th> - <td>{{server.enabled}}</td> - </tr> - <tr> - <th>Stats</th> - <td>{{server.jobCount}} jobs, {{server.buildCount}} builds</td> - </tr> - </tbody> -</table> + <h3>Recent Jobs</h3> + <table class="table"> + <thead> + <tr> + <th>Job</th> + </tr> + </thead> + <tbody> + <tr ng-repeat="job in jobs.rows"> + <td>{{job.createdDate | date:'medium'}}</td> + <td>{{job.displayName}}</td> + <td>{{job.uuid}}</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="3"> + <ul class="pager"> + <li class="previous" ng-class="{disabled: jobs.startIndex == 0}"> + <a ng-click="jobs.prev()">← Older</a> + </li> + <li class="next"> + <a ng-click="jobs.next()">Newer →</a> + </li> + </ul> + </td> + </tr> + </tfoot> + </table> + +</div> |