summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/api/ipxe.js12
-rw-r--r--webapp/src/components/IpxeBuilderModuleConfig.vue34
2 files changed, 24 insertions, 22 deletions
diff --git a/server/api/ipxe.js b/server/api/ipxe.js
index 6367246..79b3b7f 100644
--- a/server/api/ipxe.js
+++ b/server/api/ipxe.js
@@ -28,12 +28,18 @@ router.get('/:version/console', (req, res) => {
})
router.get('/:version/log', async (req, res) => {
+ const max = req.query.max ? req.query.max : -1
res.setHeader('content-type', 'text/plain')
const filepath = path.join(__appdir, 'ipxe', 'log_' + req.params.version + '.txt')
- res.sendFile(filepath, err => {
- if (err) {
- res.end()
+
+ fs.readFile(filepath, 'utf-8', function (err, content) {
+ if (err) res.end()
+ if (max !== -1 && content) {
+ let c = content.split('\n')
+ c = c.splice(-max)
+ res.send(c.join('\n'))
}
+ else res.send(content)
})
})
diff --git a/webapp/src/components/IpxeBuilderModuleConfig.vue b/webapp/src/components/IpxeBuilderModuleConfig.vue
index e802d13..6454d41 100644
--- a/webapp/src/components/IpxeBuilderModuleConfig.vue
+++ b/webapp/src/components/IpxeBuilderModuleConfig.vue
@@ -45,25 +45,26 @@
<template>
<div>
-
<v-subheader>{{ $t('ipxe') }}</v-subheader>
- <v-card style="height: 588px;" ref="log" v-on:wheel="manualScroll">
- <RecycleScroller :items="log" :item-size="21" style="height: 100%;">
- <div slot-scope="{ item }" style="height: 21px;">
- <pre :class="item.status + '--text'" style="margin-bottom: 0px"><span>{{ item.date }} {{ item.msg }}</span></pre>
- </div>
- </RecycleScroller>
+ <!--
+ <v-card v-on:wheel="manualScroll">
+ <div>
+ <RecycleScroller :items="log" ref="log" :item-size="21" style="height: 588px;">
+ <div slot-scope="{ item }" style="height: 21px;">
+ <pre :class="item.status + '--text'" style="margin-bottom: 0px"><span>{{ item.date }} {{ item.msg }}</span></pre>
+ </div>
+ </RecycleScroller>
+ </div>
</v-card>
+ -->
<!-- Recycle Scroller or not?! One of them ^v has to go! -->
- <!--
- <v-card class="terminal" ref="log" v-on:wheel="manualScroll">
+ <v-card class="terminal" ref="log" v-on:wheel="manualScroll" style="padding-left: 0px">
<template v-for="(entry, index) in log">
- <pre :class="entry.status + '--text'" style="margin-bottom: 0px" :key="index"><span>{{ entry.date }} {{ entry.msg }}</span></pre>
+ <pre :class="entry.status + '--text'" style="margin-bottom: 0px;" :key="index"><span>{{ entry.date }} {{ entry.msg }}</span></pre>
</template>
</v-card>
- -->
<div class="scroll-overlay non-selectable" v-if="!autoscroll">
<div @click="toTheBottom" style="cursor: pointer; height: 100%; display: flex; align-items: center;">
@@ -221,10 +222,8 @@ export default {
})
},
manualScroll (event) {
- console.log(event)
if (event.deltaY < 0) this.autoscroll = false
- // else if (this.$refs.log.$el.scrollTop + 800 >= this.$refs.log.$el.scrollHeight) this.autoscroll = true
- else if (this.$refs.log.$el.firstElementChild.scrollTop + 800 >= this.$refs.log.$el.firstElementChild.scrollHeight) this.autoscroll = true
+ else if (this.$refs.log.$el.scrollTop + 800 >= this.$refs.log.$el.scrollHeight) this.autoscroll = true
},
toTheBottom () {
this.autoscroll = true
@@ -245,10 +244,8 @@ export default {
this.console = result.data
})
- axios.get('/api/ipxe/' + this.ipxeVersion + '/log').then(result => {
+ axios.get('/api/ipxe/' + this.ipxeVersion + '/log?max=500').then(result => {
var lines = result.data.split('\n')
- // Limit the log to 500 lines, to prevent lagging
- lines = lines.slice(-500)
for (var line in lines) {
if (lines[line] === '') continue
var attr = lines[line].split('\t')
@@ -272,9 +269,8 @@ export default {
},
updated () {
if (this.autoscroll) {
- // this.$refs.log.$el.scrollTop = this.$refs.log.$el.scrollHeight
// Use this instead for the virtual scroller
- this.$refs.log.$el.firstElementChild.scrollTop = this.$refs.log.$el.firstElementChild.scrollHeight
+ this.$refs.log.$el.scrollTop = this.$refs.log.$el.scrollHeight
}
}
}