More changes and development fixes

This commit is contained in:
Jonatan Nilsson 2020-09-13 01:01:16 +00:00
parent 68decbf67d
commit 146a957684
6 changed files with 21 additions and 5 deletions

View file

@ -56,7 +56,7 @@ export async function update(ctx, data, cb) {
ctx.log.event.warn('Invalid update command for app ' + data.name) ctx.log.event.warn('Invalid update command for app ' + data.name)
return return
} }
await ctx.core.updateProgram(data.name) await ctx.core.installLatestVersion(data.name)
} }
/* /*

View file

@ -8,6 +8,8 @@ import onConnection from './routerio.mjs'
export function run(config, db, log, core, http, port) { export function run(config, db, log, core, http, port) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
core.startMonitor()
const __dirname = path.dirname(fileURLToPath(import.meta.url)) const __dirname = path.dirname(fileURLToPath(import.meta.url))
const staticRoot = path.join(__dirname,'../public') const staticRoot = path.join(__dirname,'../public')

View file

@ -6,9 +6,11 @@ const Log = Module({
init: function() { init: function() {
this.connected = socket.connected this.connected = socket.connected
this.loglines = [] this.loglines = []
this.logUpdated = false
this.on('newlog', data => { this.on('newlog', data => {
this.loglines.push(this.formatLine(data)) this.loglines.push(this.formatLine(data))
this.logUpdated = true
m.redraw() m.redraw()
}) })
@ -24,6 +26,7 @@ const Log = Module({
socket.emit('core.listenlogs', {}) socket.emit('core.listenlogs', {})
socket.emit('core.getlastlogs', {}, (res) => { socket.emit('core.getlastlogs', {}, (res) => {
this.loglines = res.map(this.formatLine) this.loglines = res.map(this.formatLine)
this.logUpdated = true
m.redraw() m.redraw()
}) })
}, },
@ -43,7 +46,14 @@ const Log = Module({
view: function() { view: function() {
return [ return [
m('h1.header', 'Log'), 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) => { this.loglines.map((line, i) => {
return m('div', { key: i }, line) return m('div', { key: i }, line)
}), }),

View file

@ -114,12 +114,12 @@ const Updater = Module({
m('div.filler'), m('div.filler'),
m(m.route.Link, { m(m.route.Link, {
hidden: !this.appRepository, hidden: !this.appRepository,
class: 'button' + (this.activeApp === 'app' ? ' active' : ''), class: 'button ' + (this.activeApp === 'app' ? 'active' : 'inactive'),
href: '/updater/app', href: '/updater/app',
}, 'Update App'), }, 'Update App'),
m(m.route.Link, { m(m.route.Link, {
hidden: !this.manageRepository, hidden: !this.manageRepository,
class: 'button' + (this.activeApp === 'manage' ? ' active' : ''), class: 'button ' + (this.activeApp === 'manage' ? 'active' : 'inactive'),
href: '/updater/manage', href: '/updater/manage',
}, 'Update Manager'), }, 'Update Manager'),
]), ]),

View file

@ -1,5 +1,6 @@
{ {
"name": "service-core-manage", "name": "service-core-manage",
"githubAuthToken": null,
"serviceName": "Service-Core Manager", "serviceName": "Service-Core Manager",
"description": "Manager for service core", "description": "Manager for service core",
"port": 4270, "port": 4270,

View file

@ -221,10 +221,13 @@ pre {
#update .actions .filler { #update .actions .filler {
flex-grow: 2; flex-grow: 2;
} }
#update .actions .button.active {
#update .actions .button.inactive {
background: transparent; background: transparent;
color: #ffb843; color: #ffb843;
} }
#update .actions .button.active {
}
@media only screen and (max-device-width: 590px) { @media only screen and (max-device-width: 590px) {
#update .actions .filler { #update .actions .filler {