mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
FE cleanup, send missing messages
This commit is contained in:
parent
16081adb30
commit
cb954f0ff8
@ -184,6 +184,7 @@ void Laminar::sendStatus(LaminarClient* client) {
|
||||
j.set("number", run->build);
|
||||
j.set("node", run->node->name);
|
||||
j.set("started", run->startedAt);
|
||||
j.set("reason", run->reason());
|
||||
j.EndObject();
|
||||
}
|
||||
j.EndArray();
|
||||
@ -245,6 +246,11 @@ void Laminar::sendStatus(LaminarClient* client) {
|
||||
j.set("number", run->build);
|
||||
j.set("node", run->node->name);
|
||||
j.set("started", run->startedAt);
|
||||
db->stmt("SELECT completedAt - startedAt FROM builds WHERE name = ? ORDER BY completedAt DESC LIMIT 1")
|
||||
.bind(run->name)
|
||||
.fetch<int>([&](int etc){
|
||||
j.set("etc", time(0) + etc);
|
||||
});
|
||||
j.EndObject();
|
||||
}
|
||||
j.EndArray();
|
||||
@ -585,6 +591,7 @@ void Laminar::assignNewJobs() {
|
||||
.startObject("data")
|
||||
.set("queueIndex", std::distance(it,queuedJobs.begin()))
|
||||
.set("name", run->name)
|
||||
.set("queued", run->startedAt - run->queuedAt)
|
||||
.set("started", run->startedAt)
|
||||
.set("number", run->build)
|
||||
.set("reason", run->reason());
|
||||
@ -644,6 +651,8 @@ void Laminar::runFinished(const Run * r) {
|
||||
.startObject("data")
|
||||
.set("name", r->name)
|
||||
.set("number", r->build)
|
||||
.set("queued", r->startedAt - r->queuedAt)
|
||||
.set("completed", completedAt)
|
||||
.set("duration", completedAt - r->startedAt)
|
||||
.set("started", r->startedAt)
|
||||
.set("result", to_string(r->result))
|
||||
|
@ -5,6 +5,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<link rel="apple-touch-icon-precomposed" href="/favicon-152.png">
|
||||
<title>Laminar</title>
|
||||
<script src="/js/angular.min.js"></script>
|
||||
|
@ -181,6 +181,15 @@ angular.module('laminar',['ngRoute','ngSanitize'])
|
||||
$scope.tags = Object.keys(tags);
|
||||
$scope.$apply();
|
||||
},
|
||||
job_completed: function(data) {
|
||||
for(var i in $scope.jobs) {
|
||||
if($scope.jobs[i].name === data.name) {
|
||||
$scope.jobs[i] = data;
|
||||
$scope.$apply;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
.controller('JobController', function($rootScope, $scope, $routeParams, $ws) {
|
||||
@ -228,16 +237,13 @@ angular.module('laminar',['ngRoute','ngSanitize'])
|
||||
},
|
||||
job_started: function(data) {
|
||||
$scope.nQueued--;
|
||||
if(data.name == $routeParams.name) {
|
||||
$scope.jobsQueued.splice($scope.jobsQueued.length - 1,1);
|
||||
$scope.jobsRunning.splice(0,0,data);
|
||||
$scope.$apply();
|
||||
}
|
||||
},
|
||||
job_completed: function(data) {
|
||||
for(var i = 0; i < $scope.jobsRunning.length; ++i) {
|
||||
var job = $scope.jobsRunning[i];
|
||||
if(job.name == data.name && job.number == data.number) {
|
||||
if(job.number === data.number) {
|
||||
$scope.jobsRunning.splice(i,1);
|
||||
$scope.jobsRecent.splice(0,0,data);
|
||||
$scope.$apply();
|
||||
@ -258,15 +264,17 @@ angular.module('laminar',['ngRoute','ngSanitize'])
|
||||
|
||||
$scope.name = $routeParams.name;
|
||||
$scope.num = parseInt($routeParams.num);
|
||||
|
||||
$ws.statusListener({
|
||||
status: function(data) {
|
||||
$rootScope.title = data.title;
|
||||
$rootScope.updateProgress(data);
|
||||
$scope.job = data;
|
||||
$scope.latestNum = data.latestNum;
|
||||
$scope.$apply();
|
||||
},
|
||||
job_started: function() {
|
||||
$scope.job.latestNum++;
|
||||
$scope.latestNum++;
|
||||
$scope.$apply();
|
||||
},
|
||||
job_completed: function(data) {
|
||||
|
@ -12,7 +12,7 @@
|
||||
<table class="table table-striped" id="joblist">
|
||||
<tr class="animate-repeat" ng-repeat="job in jobs | filter:bytag | filter:search">
|
||||
<td><a href="jobs/{{job.name}}">{{job.name}}</a></td>
|
||||
<td class="text-center"><span ng-bind-html="runIcon(job.result)"></span> <a href="jobs/{{job.name}}/{{job.numberumber}}">#{{job.number}}</a></td>
|
||||
<td class="text-center"><span ng-bind-html="runIcon(job.result)"></span> <a href="jobs/{{job.name}}/{{job.number}}">#{{job.number}}</a></td>
|
||||
<td class="text-center">{{formatDate(job.started)}}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<nav class="pull-left">
|
||||
<ul class="pagination" style="margin:15px 20px">
|
||||
<li><a href="jobs/{{name}}/{{num-1}}">«</a></li>
|
||||
<li ng-show="job.latestNum > num"><a ng-href="jobs/{{name}}/{{num+1}}">»</a></li>
|
||||
<li ng-show="latestNum > num"><a ng-href="jobs/{{name}}/{{num+1}}">»</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div style="clear:both;"></div>
|
||||
@ -13,8 +13,8 @@
|
||||
<dt>Reason</dt><dd>{{job.reason}}</dd>
|
||||
<dt>Queued for</dt><dd>{{job.queued}}s</dd>
|
||||
<dt>Started</dt><dd>{{formatDate(job.started)}}</dd>
|
||||
<dt>Completed</dt><dd>{{formatDate(job.completed)}}</dd>
|
||||
<dt>Duration</dt><dd>{{job.duration}}s</dd>
|
||||
<dt ng-show="job.result">Completed</dt><dd ng-show="job.result">{{formatDate(job.completed)}}</dd>
|
||||
<dt ng-show="job.result">Duration</dt><dd ng-show="job.result">{{job.duration}}s</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="col-sm-7 col-md-6 col-lg-5">
|
||||
|
Loading…
Reference in New Issue
Block a user