Add log details popup (#3160)
Closes #2961. This adds a click handler to the log entries, and then displays a popup with the details of this entry. This allows long entries to be viewed, as well as (finally) multi-line stack traces. --------- Also-by: Florian Hotze <dev@florianhotze.com> Signed-off-by: Chris Jackson <chris@cd-jackson.com>pull/3170/head
parent
afe96e1c4a
commit
efe3fefd4f
|
@ -111,6 +111,50 @@
|
||||||
</f7-block>
|
</f7-block>
|
||||||
</f7-popover>
|
</f7-popover>
|
||||||
|
|
||||||
|
<!-- Log Details Popup -->
|
||||||
|
<f7-popup id="logdetails-popup" close-on-escape close-by-backdrop-click>
|
||||||
|
<f7-page>
|
||||||
|
<f7-navbar title="Log Details">
|
||||||
|
<f7-nav-right>
|
||||||
|
<f7-link class="popup-close">
|
||||||
|
Close
|
||||||
|
</f7-link>
|
||||||
|
</f7-nav-right>
|
||||||
|
</f7-navbar>
|
||||||
|
|
||||||
|
<f7-list class="col wide">
|
||||||
|
<f7-list-item header="Time" :title="selectedLog.time + selectedLog.milliseconds" />
|
||||||
|
<f7-list-item header="Timestamp" :title="selectedLog.timestamp" />
|
||||||
|
<f7-list-item header="Level" :title="selectedLog.level" />
|
||||||
|
<f7-list-item header="Logger Class" :title="selectedLog.loggerName" />
|
||||||
|
<f7-list-item>
|
||||||
|
<template #title>
|
||||||
|
<div class="item-title">
|
||||||
|
<div class="item-header">
|
||||||
|
Message
|
||||||
|
</div>
|
||||||
|
<div class="log-message">
|
||||||
|
{{ selectedLog.message }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</f7-list-item>
|
||||||
|
<f7-list-item v-if="selectedLog.stackTrace">
|
||||||
|
<template #title>
|
||||||
|
<div class="item-title">
|
||||||
|
<div class="item-header">
|
||||||
|
Stack Trace
|
||||||
|
</div>
|
||||||
|
<div class="stack-trace">
|
||||||
|
{{ selectedLog.stackTrace }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</f7-list-item>
|
||||||
|
</f7-list>
|
||||||
|
</f7-page>
|
||||||
|
</f7-popup>
|
||||||
|
|
||||||
<!-- Main Display -->
|
<!-- Main Display -->
|
||||||
<f7-navbar title="Log Viewer" back-link="Developer Tools" back-link-url="/developer/" back-link-force>
|
<f7-navbar title="Log Viewer" back-link="Developer Tools" back-link-url="/developer/" back-link-force>
|
||||||
<f7-nav-right>
|
<f7-nav-right>
|
||||||
|
@ -221,6 +265,9 @@
|
||||||
padding 5px
|
padding 5px
|
||||||
text-align left
|
text-align left
|
||||||
white-space nowrap
|
white-space nowrap
|
||||||
|
overflow hidden
|
||||||
|
text-overflow ellipsis
|
||||||
|
max-width 100dvw
|
||||||
|
|
||||||
td.sticky
|
td.sticky
|
||||||
position sticky
|
position sticky
|
||||||
|
@ -304,6 +351,14 @@
|
||||||
.log-period
|
.log-period
|
||||||
white-space nowrap !important
|
white-space nowrap !important
|
||||||
|
|
||||||
|
#logdetails-popup
|
||||||
|
.log-message
|
||||||
|
white-space normal
|
||||||
|
word-break break-word
|
||||||
|
.stack-trace
|
||||||
|
white-space pre-line
|
||||||
|
word-break break-word
|
||||||
|
|
||||||
#color-picker-popover
|
#color-picker-popover
|
||||||
.color-palette
|
.color-palette
|
||||||
display flex
|
display flex
|
||||||
|
@ -356,6 +411,7 @@ export default {
|
||||||
currentHighlightColorItemIndex: null,
|
currentHighlightColorItemIndex: null,
|
||||||
currentHighlightColor: '#FF5252',
|
currentHighlightColor: '#FF5252',
|
||||||
lastSequence: 0,
|
lastSequence: 0,
|
||||||
|
selectedLog: {},
|
||||||
colors: [
|
colors: [
|
||||||
'#FF0000', // Red
|
'#FF0000', // Red
|
||||||
'#00FF00', // Green
|
'#00FF00', // Green
|
||||||
|
@ -495,8 +551,15 @@ export default {
|
||||||
`<td class="level">${entity.level}</td>` +
|
`<td class="level">${entity.level}</td>` +
|
||||||
`<td class="logger"><span class="logger">${entity.loggerName}</span></td>` +
|
`<td class="logger"><span class="logger">${entity.loggerName}</span></td>` +
|
||||||
`<td class="nowrap">${this.highlightText(entity.message)}</td>`
|
`<td class="nowrap">${this.highlightText(entity.message)}</td>`
|
||||||
|
tr.addEventListener('click', () => {
|
||||||
|
this.onRowClick(entity.id)
|
||||||
|
})
|
||||||
return tr
|
return tr
|
||||||
},
|
},
|
||||||
|
onRowClick (entityId) {
|
||||||
|
this.selectedLog = this.filteredTableData[entityId]
|
||||||
|
this.$f7.popup.open('#logdetails-popup')
|
||||||
|
},
|
||||||
addLogEntry (logEntry) {
|
addLogEntry (logEntry) {
|
||||||
this.lastSequence = Math.max(this.lastSequence, logEntry.sequence)
|
this.lastSequence = Math.max(this.lastSequence, logEntry.sequence)
|
||||||
const date = new Date(logEntry.unixtime)
|
const date = new Date(logEntry.unixtime)
|
||||||
|
@ -526,10 +589,12 @@ export default {
|
||||||
id: this.nextId++,
|
id: this.nextId++,
|
||||||
visible: vis,
|
visible: vis,
|
||||||
time: formattedTime,
|
time: formattedTime,
|
||||||
|
timestamp: logEntry.timestamp,
|
||||||
milliseconds: ms,
|
milliseconds: ms,
|
||||||
level: logEntry.level.toUpperCase(),
|
level: logEntry.level.toUpperCase(),
|
||||||
loggerName: logEntry.loggerName,
|
loggerName: logEntry.loggerName,
|
||||||
message: logEntry.message
|
message: logEntry.message,
|
||||||
|
stackTrace: logEntry.stackTrace
|
||||||
}
|
}
|
||||||
|
|
||||||
this.batchLogs.push(entry)
|
this.batchLogs.push(entry)
|
||||||
|
@ -615,6 +680,7 @@ export default {
|
||||||
},
|
},
|
||||||
redrawPartOfTable () {
|
redrawPartOfTable () {
|
||||||
const LINE_HEIGHT = 31
|
const LINE_HEIGHT = 31
|
||||||
|
|
||||||
const tableContainer = this.$refs.tableContainer
|
const tableContainer = this.$refs.tableContainer
|
||||||
const tableBody = this.$refs.dataTable.firstChild
|
const tableBody = this.$refs.dataTable.firstChild
|
||||||
const filteredItemsCount = this.filteredTableData.length
|
const filteredItemsCount = this.filteredTableData.length
|
||||||
|
|
Loading…
Reference in New Issue