arch-repo-manager/srv/static/js/log.js

28 lines
990 B
JavaScript
Raw Permalink Normal View History

2022-01-23 01:56:17 +01:00
import * as Terminal from './terminal.js';
import * as Utils from './utils.js';
2021-01-25 00:24:31 +01:00
function initLog()
{
2022-01-23 01:56:17 +01:00
const hashParts = Utils.hashAsObject();
2021-01-25 00:24:31 +01:00
const id = hashParts.id;
const name = hashParts.name;
2022-01-23 01:56:17 +01:00
const mainElement = Utils.getAndEmptyElement('log-container');
2021-01-25 00:24:31 +01:00
if (id === undefined || id === '' || name === undefined || name === '') {
document.title += ' - logfile';
mainElement.appendChild(document.createTextNode('id or name invalid'));
return;
}
const path = '/build-action/logfile?id=' + encodeURIComponent(id) + '&name=' + encodeURIComponent(name);
2022-01-23 01:56:17 +01:00
const terminal = Terminal.makeTerminal();
const ajaxRequest = Terminal.streamRouteIntoTerminal('GET', path, terminal);
2021-01-25 00:24:31 +01:00
document.title += ' - ' + name;
terminal.resize(180, 500);
window.setTimeout(function() {
2022-01-23 01:56:17 +01:00
Terminal.addSearchToTerminal(terminal, mainElement);
2021-01-25 00:24:31 +01:00
terminal.open(mainElement);
});
}
2022-01-23 01:56:17 +01:00
document.body.onhashchange = initLog;
initLog();