show elapsed time
This commit is contained in:
parent
c3554afde9
commit
40f04162d0
14
src/Web.ts
14
src/Web.ts
@ -18,6 +18,17 @@ function notStupidParseInt(v: string | undefined): number {
|
|||||||
return v === undefined ? NaN : parseInt(v);
|
return v === undefined ? NaN : parseInt(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function timeElapsed(date1: Date, date2: Date) {
|
||||||
|
if (!date2 || ! date1) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
const ms = Math.abs(date2.getTime() - date1.getTime());
|
||||||
|
const seconds = Math.floor(ms / 1000) % 60;
|
||||||
|
const minutes = Math.floor(ms / (1000 * 60)) % 60;
|
||||||
|
const hours = Math.floor(ms / (1000 * 60 * 60));
|
||||||
|
return `${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
||||||
|
|
||||||
class Web {
|
class Web {
|
||||||
private _webserver: http.Server | null = null;
|
private _webserver: http.Server | null = null;
|
||||||
private db: DB;
|
private db: DB;
|
||||||
@ -57,7 +68,8 @@ class Web {
|
|||||||
titlesuffix: 'Dashboard',
|
titlesuffix: 'Dashboard',
|
||||||
description: 'PKGBUILD central'
|
description: 'PKGBUILD central'
|
||||||
},
|
},
|
||||||
builds
|
builds,
|
||||||
|
timeElapsed
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<td><a href="/build/<%= build.id %>"><%= build.repo %></a></td>
|
<td><a href="/build/<%= build.id %>"><%= build.repo %></a></td>
|
||||||
<td><%= build.distro %></td>
|
<td><%= build.distro %></td>
|
||||||
<td class="to-local-time"><%= build.startTime %></td>
|
<td class="to-local-time"><%= build.startTime %></td>
|
||||||
<td>TODO</td>
|
<td><%= timeElapsed(build.startTime, build.endTime) %></td>
|
||||||
<td><%= build.status %></td>
|
<td><%= build.status %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user