summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam@sotk.co.uk>2015-10-03 18:19:36 +0100
committerAdam Coldrick <adam@sotk.co.uk>2015-10-03 18:48:16 +0100
commitf41238f252e6e4bb5f1a0cf9f74e9255fc46edaf (patch)
tree8a253d262a3ce3e2bdc00b30f58b5cfb5b8a3552
parent1a393265d60cc43c888947e87ff483e15ab65ee0 (diff)
downloadciat-ui-f41238f252e6e4bb5f1a0cf9f74e9255fc46edaf.tar.gz
Add a link to the build log in the recent builds table
Take a guess at the most useful log by trying to work out which step failed (if failure), or just using the last log otherwise.
-rw-r--r--js/main.js16
-rw-r--r--partials/builder_detail.html2
2 files changed, 18 insertions, 0 deletions
diff --git a/js/main.js b/js/main.js
index 8afcf2a..bd5afb3 100644
--- a/js/main.js
+++ b/js/main.js
@@ -186,6 +186,21 @@ app.controller('BuilderDetailController',
function($scope, $http, $routeParams) {
var builderUrl = apiBase + '/builders/' + $routeParams.name;
+ function getImportantLog(data) {
+ // Default to last entry in logs array
+ var logLink = data.logs[data.logs.length - 1][1];
+ if (!checkInArray(data.text, 'successful') && !!data.times[1]) {
+ // Build failed, so important log is the one with the failure
+ for (var i = 0; i < data.steps.length; i++) {
+ var step = data.steps[i];
+ if (checkInArray(step.text, 'failed')) {
+ logLink = step.logs[step.logs.length - 1][1];
+ }
+ }
+ }
+ return logLink;
+ }
+
// GET details of the builder
$http.get(builderUrl).then(function(builder) {
$scope.builder = {
@@ -204,6 +219,7 @@ app.controller('BuilderDetailController',
number: n,
startTime: build_data.times[0],
finishTime: build_data.times[1],
+ logLink: getImportantLog(build_data),
data: build_data
});
}
diff --git a/partials/builder_detail.html b/partials/builder_detail.html
index f4b694e..14d2397 100644
--- a/partials/builder_detail.html
+++ b/partials/builder_detail.html
@@ -14,6 +14,7 @@
<td><strong>Elapsed Time</strong></td>
<!-- TODO <td><strong>Definitions SHA</strong></td> -->
<td><strong>Result</strong></td>
+ <td></td>
</thead>
<tbody>
<tr ng-repeat="build in builds">
@@ -37,6 +38,7 @@
In progress
</span>
</td>
+ <td><a ng-href="{{build.logLink}}">Log</a></td>
</tr>
</tbody>
</table>