Add build version

This commit is contained in:
2020-03-29 17:53:16 +03:00
parent 4eaff4e6b9
commit c980abfc63
7 changed files with 21 additions and 10 deletions

View File

@ -7,9 +7,11 @@ import { Command } from './Common';
import TaskQueueRenderer from './TaskQueueRenderer';
export default class Dashboard {
private readonly version: string;
private scheduler: Scheduler;
constructor(scheduler: Scheduler) {
constructor(version: string, scheduler: Scheduler) {
this.version = version;
this.scheduler = scheduler;
}
@ -19,7 +21,7 @@ export default class Dashboard {
await sleepShort();
markPage('Dashboard');
markPage('Dashboard', this.version);
new TaskQueueRenderer().render(this.scheduler.taskState());
if (p.pathname === '/build.php') {

View File

@ -9,17 +9,19 @@ import { Args, Command } from './Common';
import TaskQueueRenderer from './TaskQueueRenderer';
export default class Scheduler {
private readonly version: string;
private taskQueue: TaskQueue;
private actionQueue: ActionQueue;
constructor() {
constructor(version: string) {
this.version = version;
this.taskQueue = new TaskQueue();
this.actionQueue = new ActionQueue();
}
async run() {
await sleepShort();
markPage('Executor');
markPage('Executor', this.version);
new TaskQueueRenderer().render(this.taskQueue.state());
while (true) {
await sleepLong();

View File

@ -1,15 +1,16 @@
import ModeDetector from './ModeDetector';
import Scheduler from './Scheduler';
import Dashboard from './Dashboard';
import TxtVersion from '!!raw-loader!./version.txt';
const md = new ModeDetector();
if (md.isAuto()) {
md.setAuto();
console.log('AUTO MANAGEMENT ON');
const scheduler = new Scheduler();
const scheduler = new Scheduler(TxtVersion);
scheduler.run();
} else {
console.log('NORMAL MODE');
const dashboard = new Dashboard(new Scheduler());
const dashboard = new Dashboard(TxtVersion, new Scheduler());
dashboard.run();
}

View File

@ -14,7 +14,7 @@ export async function sleepLong() {
return await sleep(ms);
}
export function markPage(text: string) {
export function markPage(text: string, version: string) {
jQuery('body').append(
'<div style="' +
'position: absolute; ' +
@ -25,6 +25,8 @@ export function markPage(text: string) {
'padding: 8px 6px; ' +
'color: black">' +
text +
' ' +
version +
'</div>'
);
}