diff options
Diffstat (limited to 'src/main/webapp/apps/jenkinsApp/jenkinsApp.js')
-rw-r--r-- | src/main/webapp/apps/jenkinsApp/jenkinsApp.js | 41 |
1 files changed, 20 insertions, 21 deletions
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); }; } |