From 146a957684f9deebad52f82432f652094ffd915d Mon Sep 17 00:00:00 2001 From: Jonatan Nilsson Date: Sun, 13 Sep 2020 01:01:16 +0000 Subject: [PATCH] More changes and development fixes --- api/core/ioroutes.mjs | 2 +- api/server.mjs | 2 ++ client/log/log.js | 12 +++++++++++- client/updater/updater.js | 4 ++-- config.json | 1 + public/main.css | 5 ++++- 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/api/core/ioroutes.mjs b/api/core/ioroutes.mjs index 9781537..8c1855d 100644 --- a/api/core/ioroutes.mjs +++ b/api/core/ioroutes.mjs @@ -56,7 +56,7 @@ export async function update(ctx, data, cb) { ctx.log.event.warn('Invalid update command for app ' + data.name) return } - await ctx.core.updateProgram(data.name) + await ctx.core.installLatestVersion(data.name) } /* diff --git a/api/server.mjs b/api/server.mjs index a5aa13b..cdd1ef9 100644 --- a/api/server.mjs +++ b/api/server.mjs @@ -8,6 +8,8 @@ import onConnection from './routerio.mjs' export function run(config, db, log, core, http, port) { return new Promise(function(resolve, reject) { + core.startMonitor() + const __dirname = path.dirname(fileURLToPath(import.meta.url)) const staticRoot = path.join(__dirname,'../public') diff --git a/client/log/log.js b/client/log/log.js index bf9c903..2017bd4 100644 --- a/client/log/log.js +++ b/client/log/log.js @@ -6,9 +6,11 @@ const Log = Module({ init: function() { this.connected = socket.connected this.loglines = [] + this.logUpdated = false this.on('newlog', data => { this.loglines.push(this.formatLine(data)) + this.logUpdated = true m.redraw() }) @@ -24,6 +26,7 @@ const Log = Module({ socket.emit('core.listenlogs', {}) socket.emit('core.getlastlogs', {}, (res) => { this.loglines = res.map(this.formatLine) + this.logUpdated = true m.redraw() }) }, @@ -43,7 +46,14 @@ const Log = Module({ view: function() { return [ m('h1.header', 'Log'), - m('div#logger', [ + m('div#logger', { + onupdate: (vnode) => { + if (this.logUpdated) { + vnode.dom.scrollTop = vnode.dom.scrollHeight + this.logUpdated = false + } + } + }, [ this.loglines.map((line, i) => { return m('div', { key: i }, line) }), diff --git a/client/updater/updater.js b/client/updater/updater.js index 1c563ed..4bffd54 100644 --- a/client/updater/updater.js +++ b/client/updater/updater.js @@ -114,12 +114,12 @@ const Updater = Module({ m('div.filler'), m(m.route.Link, { hidden: !this.appRepository, - class: 'button' + (this.activeApp === 'app' ? ' active' : ''), + class: 'button ' + (this.activeApp === 'app' ? 'active' : 'inactive'), href: '/updater/app', }, 'Update App'), m(m.route.Link, { hidden: !this.manageRepository, - class: 'button' + (this.activeApp === 'manage' ? ' active' : ''), + class: 'button ' + (this.activeApp === 'manage' ? 'active' : 'inactive'), href: '/updater/manage', }, 'Update Manager'), ]), diff --git a/config.json b/config.json index 72d3aa8..b29670d 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,6 @@ { "name": "service-core-manage", + "githubAuthToken": null, "serviceName": "Service-Core Manager", "description": "Manager for service core", "port": 4270, diff --git a/public/main.css b/public/main.css index d73104d..20355d4 100644 --- a/public/main.css +++ b/public/main.css @@ -221,10 +221,13 @@ pre { #update .actions .filler { flex-grow: 2; } -#update .actions .button.active { + +#update .actions .button.inactive { background: transparent; color: #ffb843; } +#update .actions .button.active { +} @media only screen and (max-device-width: 590px) { #update .actions .filler {