From 84fb49088a14cff8b453e0e32f6ad7007eb2184a Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 29 Dec 2012 18:11:08 +0100 Subject: o Adding jobs view for jenkins app. --- .../webapp/apps/jenkinsApp/JenkinsResources.js | 8 +++ src/main/webapp/apps/jenkinsApp/jenkinsApp.js | 41 ++++++++------- src/main/webapp/apps/jenkinsApp/job.html | 59 ++++++++++++++++++++++ src/main/webapp/apps/jenkinsApp/server-list.html | 52 ++++++++++--------- src/main/webapp/apps/jenkinsApp/server.html | 1 + 5 files changed, 115 insertions(+), 46 deletions(-) create mode 100644 src/main/webapp/apps/jenkinsApp/job.html (limited to 'src/main/webapp/apps/jenkinsApp') 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 @@ +
+ + + + + +

Overview

+ + + + + + + + + + + + +
URL{{job.displayName}}
Build count{{job.buildCount}}
+ +

Recent Builds

+ + + + + + + + + + + + + + + + + + + + +
BuildResult
{{build.createdDate | date:'medium'}}{{build.result}}
+ +
+
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 @@ - +
+ - + - - - - - - - - - - - - - - - -
URLEnabled
{{server.url}}{{server.enabled}} - Visit - Details -
+ + + + + + + + + + + + + + + + + +
URLEnabled
{{server.url}}{{server.enabled}}Visit +
+
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 @@ {{job.createdDate | date:'medium'}} {{job.displayName}} {{job.uuid}} + -- cgit v1.2.3