diff options
Diffstat (limited to 'src/main/resources/webapp/apps/jenkinsApp')
6 files changed, 282 insertions, 0 deletions
diff --git a/src/main/resources/webapp/apps/jenkinsApp/JenkinsResources.js b/src/main/resources/webapp/apps/jenkinsApp/JenkinsResources.js new file mode 100644 index 0000000..89f3139 --- /dev/null +++ b/src/main/resources/webapp/apps/jenkinsApp/JenkinsResources.js @@ -0,0 +1,25 @@ +'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); + +function JenkinsBuild($resource) { + return $resource('/resource/jenkins/build/:uuid', {uuid: '@uuid'}); +} + +angular. + module('jenkinsBuild', ['ngResource']). + factory('JenkinsBuild', JenkinsBuild); diff --git a/src/main/resources/webapp/apps/jenkinsApp/build.html b/src/main/resources/webapp/apps/jenkinsApp/build.html new file mode 100644 index 0000000..7239c90 --- /dev/null +++ b/src/main/resources/webapp/apps/jenkinsApp/build.html @@ -0,0 +1,43 @@ +<div class="container"> + + <navbar/> + + <div class="page-header"> + <h1>Jenkins Build</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><a ng-click="showJob()">Job</a> <span class="divider">/</span></li> + <li class="active">Build</li> + </ul> + + <h3>Overview</h3> + <table class="table"> + <tbody> + <tr> + <th>Timestamp</th> + <td>{{details.build.timestamp | date:'medium'}}</td> + </tr> + <tr> + <th>Number</th> + <td>{{details.build.number}}</td> + </tr> + <tr> + <th>Duration</th> + <td>{{details.build.duration / 1000 | number:0}}s</td> + </tr> + </tbody> + </table> + + <h3>Users</h3> + <table> + <tbody> + <tr ng-repeat="user in details.participants"> + <td>{{user.uuid}}</td> + </tr> + </tbody> + </table> + +</div> diff --git a/src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js b/src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js new file mode 100644 index 0000000..e42c67b --- /dev/null +++ b/src/main/resources/webapp/apps/jenkinsApp/jenkinsApp.js @@ -0,0 +1,57 @@ +'use strict'; + +var jenkinsApp = angular.module('jenkinsApp', ['jenkinsServer', 'jenkinsJob', 'jenkinsBuild', 'core.directives', 'pagingTableService']).config(function ($routeProvider) { + $routeProvider. + 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}). + when('/build/:uuid', {controller: BuildCtrl, templateUrl: '/apps/jenkinsApp/build.html?noCache=' + noCache}); +}); + +function ServerListCtrl($scope, $location, JenkinsServer) { + JenkinsServer.query(function (servers) { + $scope.servers = servers; + }); + + $scope.showServers = function () { $location.path('/'); }; + $scope.showServer = function (uuid) { $location.path('/server/' + uuid); }; +} + +function ServerCtrl($scope, $location, $routeParams, JenkinsServer, JenkinsJob, PagingTableService) { + var serverUuid = $routeParams.uuid; + + JenkinsServer.get({uuid: serverUuid}, function (server) { + $scope.server = server; + }); + + $scope.jobs = PagingTableService.create($scope, PagingTableService.defaultCallback(JenkinsJob, {server: serverUuid})); + + $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 (details) { + $scope.details = details; + }); + + $scope.builds = PagingTableService.create($scope, PagingTableService.defaultCallback(JenkinsBuild, {job: jobUuid})); + + $scope.showServers = function () { $location.path('/'); }; + $scope.showServer = function () { $location.path('/server/' + $scope.job.server); }; + $scope.showBuild = function (uuid) { $location.path('/build/' + uuid); }; +} + +function BuildCtrl($scope, $location, $routeParams, JenkinsBuild) { + var buildUuid = $routeParams.uuid; + + JenkinsBuild.get({uuid: buildUuid}, function (details) { + $scope.details = details; + }); + + $scope.showServers = function () { $location.path('/'); }; + $scope.showServer = function (uuid) { $location.path('/server/' + $scope.server.uuid); }; + $scope.showJob = function (uuid) { $location.path('/job/' + $scope.build.job); }; +} diff --git a/src/main/resources/webapp/apps/jenkinsApp/job.html b/src/main/resources/webapp/apps/jenkinsApp/job.html new file mode 100755 index 0000000..8942ab7 --- /dev/null +++ b/src/main/resources/webapp/apps/jenkinsApp/job.html @@ -0,0 +1,61 @@ +<div class="container"> + + <navbar/> + + <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="{{details.job.displayName}}">{{details.job.displayName}}</a></td> + </tr> + <tr> + <th>Build count</th> + <td>{{details.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.timestamp | 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/resources/webapp/apps/jenkinsApp/server-list.html b/src/main/resources/webapp/apps/jenkinsApp/server-list.html new file mode 100644 index 0000000..9e297e6 --- /dev/null +++ b/src/main/resources/webapp/apps/jenkinsApp/server-list.html @@ -0,0 +1,32 @@ +<div class="container"> + + <navbar/> + + <div class="page-header"> + <h1>Jenkins Servers</h1> + </div> + + <ul class="breadcrumb"> + <li class="active">All Servers</li> + </ul> + + <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/resources/webapp/apps/jenkinsApp/server.html b/src/main/resources/webapp/apps/jenkinsApp/server.html new file mode 100644 index 0000000..7fbd9f5 --- /dev/null +++ b/src/main/resources/webapp/apps/jenkinsApp/server.html @@ -0,0 +1,64 @@ +<div class="container"> + + <navbar/> + + + <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> + + <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> + + <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> + <td><a class="btn" ng-click="showJob(job.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: 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> |