mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-03 18:43:58 +00:00
filterable messages view
This commit is contained in:
@@ -208,6 +208,7 @@
|
|||||||
'img error-inv': 'mdi mdi-close-circle color-icon-inv-red',
|
'img error-inv': 'mdi mdi-close-circle color-icon-inv-red',
|
||||||
'img warn': 'mdi mdi-alert color-icon-gold',
|
'img warn': 'mdi mdi-alert color-icon-gold',
|
||||||
'img info': 'mdi mdi-information color-icon-blue',
|
'img info': 'mdi mdi-information color-icon-blue',
|
||||||
|
'img debug': 'mdi mdi-monitor color-icon-green',
|
||||||
// 'img statusbar-ok': 'mdi mdi-check-circle color-on-statusbar-green',
|
// 'img statusbar-ok': 'mdi mdi-check-circle color-on-statusbar-green',
|
||||||
'img circular': 'mdi mdi-circular-saw color-icon-red',
|
'img circular': 'mdi mdi-circular-saw color-icon-red',
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { writable } from 'svelte/store';
|
||||||
import MessageViewRow from './MessageViewRow.svelte';
|
import MessageViewRow from './MessageViewRow.svelte';
|
||||||
|
import RowsFilterSwitcher from '../forms/RowsFilterSwitcher.svelte';
|
||||||
|
import SearchInput from '../elements/SearchInput.svelte';
|
||||||
|
import { filterName } from 'dbgate-tools';
|
||||||
|
|
||||||
export let items: any[];
|
export let items: any[];
|
||||||
export let showProcedure = false;
|
export let showProcedure = false;
|
||||||
@@ -7,60 +11,121 @@
|
|||||||
export let showCaller = false;
|
export let showCaller = false;
|
||||||
export let startLine = 0;
|
export let startLine = 0;
|
||||||
|
|
||||||
|
export let filter = '';
|
||||||
|
|
||||||
$: time0 = items[0] && new Date(items[0].time).getTime();
|
$: time0 = items[0] && new Date(items[0].time).getTime();
|
||||||
|
|
||||||
// $: console.log('MESSAGE ROWS', items);
|
// $: console.log('MESSAGE ROWS', items);
|
||||||
|
const values = writable({
|
||||||
|
hideDebug: false,
|
||||||
|
hideInfo: false,
|
||||||
|
hideError: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
function filterRow(row, filter, values) {
|
||||||
|
return (
|
||||||
|
(!filter || filterName(filter, JSON.stringify(row))) &&
|
||||||
|
((!values.hideDebug && row.severity == 'debug') ||
|
||||||
|
(!values.hideInfo && row.severity == 'info') ||
|
||||||
|
(!values.hideError && row.severity == 'error') ||
|
||||||
|
(!values.hideDebug && !values.hideInfo && !values.hideError))
|
||||||
|
);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<table>
|
<div class="topbar">
|
||||||
<tr>
|
<RowsFilterSwitcher
|
||||||
<td class="header">Number</td>
|
icon="img debug"
|
||||||
<td class="header">Message</td>
|
label="Debug"
|
||||||
<td class="header">Time</td>
|
{values}
|
||||||
<td class="header">Delta</td>
|
field="hideDebug"
|
||||||
<td class="header">Duration</td>
|
count={items.filter(x => x.severity == 'debug').length}
|
||||||
{#if showProcedure}
|
/>
|
||||||
<td class="header">Procedure</td>
|
<RowsFilterSwitcher
|
||||||
{/if}
|
icon="img info"
|
||||||
{#if showLine}
|
label="Info"
|
||||||
<td class="header">Line</td>
|
{values}
|
||||||
{/if}
|
field="hideInfo"
|
||||||
{#if showCaller}
|
count={items.filter(x => x.severity == 'info').length}
|
||||||
<td class="header">Caller</td>
|
/>
|
||||||
{/if}
|
<RowsFilterSwitcher
|
||||||
</tr>
|
icon="img error"
|
||||||
{#each items as row, index}
|
label="Error"
|
||||||
<MessageViewRow
|
{values}
|
||||||
{row}
|
field="hideError"
|
||||||
{index}
|
count={items.filter(x => x.severity == 'error').length}
|
||||||
{showProcedure}
|
/>
|
||||||
{showLine}
|
<SearchInput placeholder="Filter log messages" bind:value={filter} />
|
||||||
{showCaller}
|
</div>
|
||||||
{time0}
|
<div class="tablewrap">
|
||||||
{startLine}
|
<table>
|
||||||
previousRow={index > 0 ? items[index - 1] : null}
|
<thead>
|
||||||
on:messageclick
|
<tr>
|
||||||
/>
|
<td class="header">Number</td>
|
||||||
{/each}
|
<td class="header">Message</td>
|
||||||
</table>
|
<td class="header">Time</td>
|
||||||
|
<td class="header">Delta</td>
|
||||||
|
<td class="header">Duration</td>
|
||||||
|
{#if showProcedure}
|
||||||
|
<td class="header">Procedure</td>
|
||||||
|
{/if}
|
||||||
|
{#if showLine}
|
||||||
|
<td class="header">Line</td>
|
||||||
|
{/if}
|
||||||
|
{#if showCaller}
|
||||||
|
<td class="header">Caller</td>
|
||||||
|
{/if}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
{#each items.filter(row => filterRow(row, filter, $values)) as row, index}
|
||||||
|
<MessageViewRow
|
||||||
|
{row}
|
||||||
|
{index}
|
||||||
|
{showProcedure}
|
||||||
|
{showLine}
|
||||||
|
{showCaller}
|
||||||
|
{time0}
|
||||||
|
{startLine}
|
||||||
|
previousRow={index > 0 ? items[index - 1] : null}
|
||||||
|
on:messageclick
|
||||||
|
/>
|
||||||
|
{/each}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.main {
|
.main {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
position: relative;
|
flex-direction: column;
|
||||||
overflow-y: scroll;
|
|
||||||
background-color: var(--theme-bg-0);
|
background-color: var(--theme-bg-0);
|
||||||
}
|
}
|
||||||
|
.tablewrap {
|
||||||
|
flex: 1;
|
||||||
|
position: relative;
|
||||||
|
overflow: scroll;
|
||||||
|
}
|
||||||
table {
|
table {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
|
overflow: scroll;
|
||||||
|
}
|
||||||
|
.topbar {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
table thead {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 100;
|
||||||
|
background: var(--theme-bg-1);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user