Show local time for start time
This commit is contained in:
parent
16e62ff901
commit
d4b357ab20
12
scripts/timezone.js
Normal file
12
scripts/timezone.js
Normal file
@ -0,0 +1,12 @@
|
||||
window.formatTime = function (timeStr) {
|
||||
const date = new Date(timeStr);
|
||||
return date.toLocaleString();
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const elements = document.getElementsByClassName('to-local-time');
|
||||
for (let element of elements) {
|
||||
const innerText = element.innerText;
|
||||
element.replaceChild(document.createTextNode(window.formatTime(innerText)), element.firstChild);
|
||||
}
|
||||
});
|
@ -134,12 +134,13 @@ class DB {
|
||||
await this.logChunk.sync();
|
||||
}
|
||||
|
||||
public async createBuild(repo: string, commit: string, patch: string, distro: string): Promise<number> {
|
||||
public async createBuild(repo: string, commit: string, patch: string, distro: string, dependencies: string): Promise<number> {
|
||||
const buildRec = await this.build.create({
|
||||
repo,
|
||||
commit: commit || null,
|
||||
patch: patch || null,
|
||||
distro
|
||||
distro,
|
||||
dependencies
|
||||
});
|
||||
return buildRec.id;
|
||||
}
|
||||
|
@ -77,7 +77,13 @@ class Web {
|
||||
});
|
||||
|
||||
app.post('/build/?', async (req, res) => {
|
||||
const buildId = await this.db.createBuild(req.body.repo, req.body.commit || null, req.body.patch || null, req.body.distro);
|
||||
const buildId = await this.db.createBuild(
|
||||
req.body.repo,
|
||||
req.body.commit || null,
|
||||
req.body.patch || null,
|
||||
req.body.distro || 'arch',
|
||||
req.body.dependencies || 'stable'
|
||||
);
|
||||
res.redirect(`/build/${buildId}`);
|
||||
this.buildController.triggerBuild();
|
||||
});
|
||||
|
@ -18,6 +18,12 @@
|
||||
<option value="arch">Arch</option>
|
||||
<option value="artix">Artix</option>
|
||||
</select>
|
||||
<label for="dependsTxt">Dependencies</label>
|
||||
<select name="dependencies" id="dependsTxt" required>
|
||||
<option value="stable">Stable</option>
|
||||
<option value="testing">Testing</option>
|
||||
<option value="staging">Staging</option>
|
||||
</select>
|
||||
<div class="span-2"><button type="submit">Build</button></div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<label>Patch</label> <span><% if (build.patch) { %><a href="/build/<%= build.id %>/patch">patch file</a><% } else { %>none<% } %></span>
|
||||
<label>Distro</label> <span><%= build.distro %></span>
|
||||
<label>Dependencies</label> <span><%= build.dependencies %></span>
|
||||
<label>Start time</label> <span><%= build.startTime %></span>
|
||||
<label>Start time</label> <span class="to-local-time"><%= build.startTime %></span>
|
||||
</div>
|
||||
<p><a href="/build/<%= build.id %>/logs">Full logs</a></p>
|
||||
<div class="logs" id="logs">
|
||||
@ -32,6 +32,7 @@
|
||||
<% } %>
|
||||
</div>
|
||||
<%- include("footer", locals) %>
|
||||
<script src="/assets/js/timezone.js?v1" nonce="<%= cspNonce %>"></script>
|
||||
<% if (!ended) { %>
|
||||
<script src="/assets/js/build.js?v1" nonce="<%= cspNonce %>"></script>
|
||||
<% } %>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<tr>
|
||||
<td><a href="/build/<%= build.id %>"><%= build.repo %></a></td>
|
||||
<td><%= build.distro %></td>
|
||||
<td><%= build.startTime %></td>
|
||||
<td class="to-local-time"><%= build.startTime %></td>
|
||||
<td>TODO</td>
|
||||
<td><%= build.status %></td>
|
||||
</tr>
|
||||
@ -29,5 +29,6 @@
|
||||
</table>
|
||||
</div>
|
||||
<%- include("footer", locals) %>
|
||||
<script src="/assets/js/timezone.js?v1" nonce="<%= cspNonce %>"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user