diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-22 23:39:51 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-22 23:39:51 +0100 |
commit | e0433a61af4e1b9796cee8f095486fec85eb136f (patch) | |
tree | e7ba14d6da8ef93100a4b5b0c8b2c0d4031bd9be /src/main/resources | |
parent | b83c4eed1a75e9e68279ab6f84cd7b5eb602abec (diff) | |
download | esper-testing-e0433a61af4e1b9796cee8f095486fec85eb136f.tar.gz esper-testing-e0433a61af4e1b9796cee8f095486fec85eb136f.tar.bz2 esper-testing-e0433a61af4e1b9796cee8f095486fec85eb136f.tar.xz esper-testing-e0433a61af4e1b9796cee8f095486fec85eb136f.zip |
NavbarService:
o Renamed to NavTabService.
o Listing builds per server, with paging.
Diffstat (limited to 'src/main/resources')
-rwxr-xr-x | src/main/resources/webapp/apps/app.js | 11 | ||||
-rw-r--r-- | src/main/resources/webapp/apps/core/pager.html | 12 | ||||
-rwxr-xr-x | src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js | 19 | ||||
-rwxr-xr-x | src/main/resources/webapp/apps/jenkinsApp/server.html | 32 |
4 files changed, 52 insertions, 22 deletions
diff --git a/src/main/resources/webapp/apps/app.js b/src/main/resources/webapp/apps/app.js index 69106aa..f3fca90 100755 --- a/src/main/resources/webapp/apps/app.js +++ b/src/main/resources/webapp/apps/app.js @@ -110,6 +110,17 @@ directives.directive('dogtagXl', function () { } }); +directives.directive('pager', function () { + return { + restrict: 'A', + scope: { + pager: '=x', + colspan: '=colspan' + }, + templateUrl: '/apps/core/pager.html' + } +}); + directives.directive('spinner', function () { return function($scope, element, attr) { var opts = { diff --git a/src/main/resources/webapp/apps/core/pager.html b/src/main/resources/webapp/apps/core/pager.html new file mode 100644 index 0000000..7a141b4 --- /dev/null +++ b/src/main/resources/webapp/apps/core/pager.html @@ -0,0 +1,12 @@ +<tr> + <td colspan="{{colspan}}"> + <ul class="pager"> + <li class="previous" ng-class="{disabled: pager.startIndex == 0}"> + <a ng-click="pager.prev()">← Older</a> + </li> + <li class="next"> + <a ng-click="pager.next()">Newer →</a> + </li> + </ul> + </td> +</tr> diff --git a/src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js b/src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js index d31b81c..f59c107 100755 --- a/src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js +++ b/src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js @@ -1,13 +1,14 @@ 'use strict'; -function NavbarService($location) { +function NavTabsService($location) { var create = function(name, tabs) { var keys = _.map(tabs, function(element) { return element.toLowerCase().replace(' ', '-'); }); var currentKey = $location.search()[name] || ""; - var currentIndex = _.indexOf(keys, currentKey) || 0; + var currentIndex = _.indexOf(keys, currentKey); + currentIndex = currentIndex != -1 ? currentIndex : 0; var currentTab = tabs[currentIndex]; var onClick = function(tab) { @@ -38,13 +39,13 @@ function NavbarService($location) { } angular. - module('navbarService', ['ngResource']). - factory('NavbarService', NavbarService); + module('navTabsService', ['ngResource']). + factory('NavTabsService', NavTabsService); -var jenkinsApp = angular.module('jenkinsApp', ['jenkinsServer', 'jenkinsJob', 'jenkinsBuild', 'core.directives', 'navbarService', 'pagingTableService']).config(function ($routeProvider) { +var jenkinsApp = angular.module('jenkinsApp', ['jenkinsServer', 'jenkinsJob', 'jenkinsBuild', 'core.directives', 'navTabsService', 'pagingTableService']).config(function ($routeProvider) { $routeProvider. when('/', {controller: ServerListCtrl, templateUrl: '/apps/jenkinsApp/server-list.html?noCache=' + noCache}). - when('/server/:serverUuid', {controller: ServerCtrl, templateUrl: '/apps/jenkinsApp/server.html?noCache=' + noCache}). + when('/server/:serverUuid', {controller: ServerCtrl, templateUrl: '/apps/jenkinsApp/server.html?noCache=' + noCache, reloadOnSearch: false}). when('/server/:serverUuid/job/:jobUuid', {controller: JobCtrl, templateUrl: '/apps/jenkinsApp/job.html?noCache=' + noCache}). when('/server/:serverUuid/job/:jobUuid/build/:buildUuid', {controller: BuildCtrl, templateUrl: '/apps/jenkinsApp/build.html?noCache=' + noCache}); }); @@ -55,16 +56,18 @@ function ServerListCtrl($scope, $location, JenkinsServer) { }); } -function ServerCtrl($scope, $routeParams, JenkinsServer, JenkinsJob, PagingTableService, NavbarService) { +function ServerCtrl($scope, $routeParams, JenkinsServer, JenkinsJob, JenkinsBuild, PagingTableService, NavTabsService) { $scope.serverUuid = $routeParams.serverUuid; + $scope.navTabs = NavTabsService.create("view", ["Overview", "Jobs", "Recent Builds"]); + JenkinsServer.get({uuid: $scope.serverUuid}, function (server) { $scope.server = server; }); $scope.jobs = PagingTableService.create($scope, PagingTableService.defaultCallback(JenkinsJob, {server: $scope.serverUuid, orderBy: "display_name"})); - $scope.navbar = NavbarService.create("view", ["Overview", "Jobs", "Recent Builds"]); + $scope.builds = PagingTableService.create($scope, PagingTableService.defaultCallback(JenkinsBuild, {server: $scope.serverUuid, orderBy: "created_date-"})); } function JobCtrl($scope, $location, $routeParams, JenkinsJob, JenkinsBuild, PagingTableService) { diff --git a/src/main/resources/webapp/apps/jenkinsApp/server.html b/src/main/resources/webapp/apps/jenkinsApp/server.html index 80544b0..bf54bb8 100755 --- a/src/main/resources/webapp/apps/jenkinsApp/server.html +++ b/src/main/resources/webapp/apps/jenkinsApp/server.html @@ -2,7 +2,6 @@ <navbar/> - <div class="page-header"> <h1>Jenkins Server: {{server.name}}</h1> </div> @@ -12,20 +11,13 @@ <li class="active">Server</li> </ul> -<!-- - <ul class="nav nav-tabs"> - <li ng-class="{active: mode == 'overview'}"><a ng-click="setMode('overview')">Overview</a></li> - <li ng-class="{active: mode == 'jobs'}"><a ng-click="setMode('jobs')">Jobs</a></li> - <li ng-class="{active: mode == 'recentBuilds'}"><a ng-click="setMode('recentBuilds')">Recent Builds</a></li> - </ul> ---> <ul class="nav nav-tabs"> - <li ng-repeat="tab in navbar.tabs" ng-class="{active: navbar.selected() == tab}"> - <a ng-click="navbar.onClick(tab)">{{tab}}</a> + <li ng-repeat="tab in navTabs.tabs" ng-class="{active: navTabs.selected() == tab}"> + <a ng-click="navTabs.onClick(tab)">{{tab}}</a> </li> </ul> - <div ng-show="navbar.selectedIndex() == 0" class="row"> + <div ng-show="navTabs.selectedIndex() == 0" class="row"> <div class="span12"> <h3>Overview</h3> <table class="table"> @@ -55,7 +47,7 @@ </div> </div> - <div ng-show="navbar.selectedIndex() == 1" class="row"> + <div ng-show="navTabs.selectedIndex() == 1" class="row"> <div class="span12"> <form class="form-search form-inline well"> <div class="input-append"> @@ -91,9 +83,21 @@ </div> </div> - <div ng-show="navbar.selectedIndex() == 2" class="row"> + <div ng-show="navTabs.selectedIndex() == 2" class="row"> <div class="span12"> - <h3>Recent builds</h3> + <table class="table table-striped"> + <tbody> + <tr ng-repeat="b in builds.rows"> + <td>{{b.timestamp | date:'medium'}}</td> + <td class="span6">{{b.result}}</td> + <td class="span1"><a class="btn" href="/jenkins/#/server/{{server.uuid}}/job/{{b.job}}">Job</a></td> + <td class="span1"> + <a class="btn" href="/jenkins/#/server/{{server.uuid}}/job/{{b.job}}/build/{{b.uuid}}"><i class="icon-chevron-right"></i></a> + </td> + </tr> + </tbody> + <tfoot pager colspan="4" x="builds"/> + </table> </div> </div> |