Fix broken log rendering on importer UI.

This commit is contained in:
Kailash Nadh 2025-03-29 13:10:46 +05:30
parent 1b43e1a013
commit 0be7a79dac
3 changed files with 17 additions and 7 deletions

View file

@ -3,11 +3,13 @@
<b-loading :active="loading" :is-full-page="false" />
<div class="lines" ref="lines">
<template v-for="(l, i) in lines">
<span :set="line = splitLine(l)" :key="i" class="line">
<span class="timestamp">{{ line.timestamp }}&nbsp;</span>
<span class="file">{{ line.file }}:&nbsp;</span>
<span class="log-message">{{ line.message }}</span>
</span>
<template v-if="l">
<span :set="line = splitLine(l)" :key="i" class="line">
<span class="timestamp">{{ line.timestamp }}&nbsp;</span>
<span class="file">{{ line.file }}:&nbsp;</span>
<span class="log-message">{{ line.message }}</span>
</span>
</template>
</template>
</div>
</section>
@ -33,6 +35,14 @@ export default {
methods: {
splitLine: (l) => {
const parts = l.split(reFormatLine);
if (parts.length !== 5) {
return {
timestamp: '',
file: '',
message: l,
};
}
return {
timestamp: parts[1],
file: parts[2],

View file

@ -167,7 +167,7 @@ export default Vue.extend({
isProcessing: false,
status: { status: '' },
logs: '',
logs: [],
pollID: null,
};
},

View file

@ -172,7 +172,7 @@ func (im *Importer) NewSession(opt SessionOpt) (*Session, error) {
s := &Session{
im: im,
log: log.New(im.status.logBuf, "", log.Ldate|log.Ltime|log.Lshortfile),
log: log.New(im.status.logBuf, "", log.Ldate|log.Ltime|log.Lmicroseconds|log.Lshortfile),
subQueue: make(chan SubReq, commitBatchSize),
opt: opt,
}