aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-01-22 09:57:54 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-01-22 09:57:54 +0100
commit813904f035b612a9c61caba97d54f8a803f5a69c (patch)
tree35a1503cc1af61faa1b78ae0c5e7a5a452f93731 /src/main
parent6e403ab935f36720b3b954afdf3bbefcbf50bb5c (diff)
downloadesper-testing-813904f035b612a9c61caba97d54f8a803f5a69c.tar.gz
esper-testing-813904f035b612a9c61caba97d54f8a803f5a69c.tar.bz2
esper-testing-813904f035b612a9c61caba97d54f8a803f5a69c.tar.xz
esper-testing-813904f035b612a9c61caba97d54f8a803f5a69c.zip
o Showing links to the Jenkins build on the build page.
Diffstat (limited to 'src/main')
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/web/resource/CoreResource.java9
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java18
-rwxr-xr-xsrc/main/resources/webapp/apps/frontPageApp/build.html24
-rwxr-xr-xsrc/main/resources/webapp/apps/frontPageApp/frontPageApp.js8
4 files changed, 43 insertions, 16 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/web/resource/CoreResource.java b/src/main/java/io/trygvis/esper/testing/web/resource/CoreResource.java
index 8ca2521..5b0619a 100755
--- a/src/main/java/io/trygvis/esper/testing/web/resource/CoreResource.java
+++ b/src/main/java/io/trygvis/esper/testing/web/resource/CoreResource.java
@@ -206,7 +206,8 @@ public class CoreResource extends AbstractResource {
protected final SqlF<BuildDto, BuildJson> getBuildJson = new SqlF<BuildDto, BuildJson>() {
public BuildJson apply(BuildDto dto) throws SQLException {
- return new BuildJson(dto.uuid, dto.createdDate, dto.timestamp, dto.success);
+ return new BuildJson(dto.uuid, dto.createdDate, dto.timestamp, dto.success, "jenkins",
+ dto.ref.uuid);
}
};
@@ -252,12 +253,16 @@ class BuildJson {
public final DateTime createdDate;
public final DateTime timestamp;
public final boolean success;
+ public final String serverType;
+ public final UUID buildUuid;
- public BuildJson(UUID uuid, DateTime createdDate, DateTime timestamp, boolean success) {
+ BuildJson(UUID uuid, DateTime createdDate, DateTime timestamp, boolean success, String serverType, UUID buildUuid) {
this.uuid = uuid;
this.createdDate = createdDate;
this.timestamp = timestamp;
this.success = success;
+ this.serverType = serverType;
+ this.buildUuid = buildUuid;
}
}
diff --git a/src/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java b/src/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java
index a6d8e8e..ff6b085 100755
--- a/src/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java
+++ b/src/main/java/io/trygvis/esper/testing/web/resource/JenkinsResource.java
@@ -84,8 +84,10 @@ public class JenkinsResource extends AbstractResource {
return da.inTransaction(new JenkinsDaosCallback<List<JenkinsBuildJson>>() {
protected List<JenkinsBuildJson> run() throws SQLException {
List<JenkinsBuildJson> builds = new ArrayList<>();
- for (JenkinsBuildDto dto : daos.jenkinsDao.selectBuildByJob(job, page)) {
- builds.add(getJenkinsBuildJson.apply(dto));
+ if(job != null) {
+ for (JenkinsBuildDto dto : daos.jenkinsDao.selectBuildByJob(job, page)) {
+ builds.add(getJenkinsBuildJson.apply(dto));
+ }
}
return builds;
}
@@ -122,12 +124,12 @@ public class JenkinsResource extends AbstractResource {
}
}
- abstract class JenkinsDaosCallback<T> implements DatabaseAccess.DaosCallback<T> {
+ public static abstract class JenkinsDaosCallback<T> implements DatabaseAccess.DaosCallback<T> {
protected Daos daos;
protected abstract T run() throws SQLException;
- private final XmlParser xmlParser = new XmlParser();
+ private static final XmlParser xmlParser = new XmlParser();
public T run(Daos daos) throws SQLException {
this.daos = daos;
@@ -168,13 +170,13 @@ public class JenkinsResource extends AbstractResource {
bind(JenkinsBuildXml.parse);
if(xmlO.isNone()) {
- return new JenkinsBuildJson(dto.uuid, dto.createdDate, new DateTime(dto.createdDate),
+ return new JenkinsBuildJson(dto.uuid, dto.createdDate, dto.job, new DateTime(dto.createdDate),
"unknown", 0, 0);
}
JenkinsBuildXml xml = xmlO.some();
- return new JenkinsBuildJson(dto.uuid, dto.createdDate, new DateTime(xml.timestamp),
+ return new JenkinsBuildJson(dto.uuid, dto.createdDate, dto.job, new DateTime(xml.timestamp),
xml.result.orSome("unknown"), xml.number, xml.duration);
}
};
@@ -248,14 +250,16 @@ class JenkinsJobDetailJson {
class JenkinsBuildJson {
public final UUID uuid;
public final DateTime createdDate;
+ public final UUID job;
public final DateTime timestamp;
public final String result;
public final int number;
public final int duration;
- JenkinsBuildJson(UUID uuid, DateTime createdDate, DateTime timestamp, String result, int number, int duration) {
+ JenkinsBuildJson(UUID uuid, DateTime createdDate, UUID job, DateTime timestamp, String result, int number, int duration) {
this.uuid = uuid;
this.createdDate = createdDate;
+ this.job = job;
this.timestamp = timestamp;
this.result = result;
this.number = number;
diff --git a/src/main/resources/webapp/apps/frontPageApp/build.html b/src/main/resources/webapp/apps/frontPageApp/build.html
index 0972758..9fa0991 100755
--- a/src/main/resources/webapp/apps/frontPageApp/build.html
+++ b/src/main/resources/webapp/apps/frontPageApp/build.html
@@ -12,17 +12,35 @@
<tbody>
<tr>
<th>Type</th>
- <td>Jenkins</td>
+ <td>
+ <span ng-hide="build.build.serverType">
+ Loading...
+ </span>
+ <ng-switch on="build.build.serverType" ng-show="build.build.serverType">
+ <span ng-switch-when="jenkins">
+ Jenkins
+
+ <a href="/jenkins/#/server/{{jenkinsBuild.build.serverUuid}}/job/{{jenkinsBuild.build.job}}/build/{{jenkinsBuild.build.uuid}}/">visit build</a>
+ </span>
+ <span ng-switch-default>
+ Unknown server type.
+ </span>
+ </ng-switch>
+ </td>
</tr>
<tr>
- <th>Duration</th>
+ <th>Timestamp</th>
<td>{{build.build.timestamp | date:'medium'}}</td>
</tr>
+ <tr>
+ <th>Result</th>
+ <td>{{{true: 'SUCCESS', false: 'FAILURE'}[build.build.success]}}</td>
+ </tr>
</tbody>
</table>
<h2>Participants</h2>
- <span dogtagxl ng-repeat="p in build.participants" person="p"/>
+ <dogtag-xl ng-repeat="p in build.participants" person="p"></dogtag-xl>
</div>
</div>
diff --git a/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js b/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js
index 1004c6f..4633892 100755
--- a/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js
+++ b/src/main/resources/webapp/apps/frontPageApp/frontPageApp.js
@@ -1,6 +1,6 @@
'use strict';
-var frontPageApp = angular.module('frontPageApp', ['ngGrid', 'person', 'badge', 'build', 'jenkinsUser', 'pagingTableService', 'core.directives']).config(function ($routeProvider) {
+var frontPageApp = angular.module('frontPageApp', ['ngGrid', 'person', 'badge', 'build', 'jenkinsUser', 'jenkinsBuild', 'pagingTableService', 'core.directives']).config(function ($routeProvider) {
$routeProvider.
when('/', {controller: FrontPageCtrl, templateUrl: '/apps/frontPageApp/frontPage.html?noCache=' + noCache}).
when('/badge/', {controller: BadgeListCtrl, templateUrl: '/apps/frontPageApp/badgeList.html?noCache=' + noCache}).
@@ -136,10 +136,10 @@ function BuildListCtrl($scope, Build, PagingTableService) {
{ count: 100, watcher: watcher });
}
-function BuildCtrl($scope, $routeParams, Build, PagingTableService) {
+function BuildCtrl($scope, $routeParams, Build, JenkinsBuild) {
var buildUuid = $routeParams.buildUuid;
- Build.get({uuid: buildUuid}, function (build) {
- $scope.build = build;
+ $scope.build = Build.get({uuid: buildUuid}, function (build) {
+ $scope.jenkinsBuild = JenkinsBuild.get({uuid: build.build.buildUuid});
});
}