fix(ui): sticky log table header and bounded stage and service columns
This commit is contained in:
3 files changed
+7
-5
No files matched your search
@@ -38,13 +38,13 @@ const details = (entry: LogEntry) =>
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DataTable :columns="columns" :rows="entries" :row-key="rowKey" :storage-key="storageKey" :row-class="(e) => rowClass(e.level)">
|
||||
<DataTable :columns="columns" :rows="entries" :row-key="rowKey" :storage-key="storageKey" :row-class="(e) => rowClass(e.level)" sticky-header>
|
||||
<template #cell-time="{ row }"><span class="font-mono text-xs text-fg-subtle">{{ shortTime(row.time) }}</span></template>
|
||||
<template #cell-level="{ row }">
|
||||
<span class="text-micro font-semibold tracking-[0.04em]" :class="LEVEL_COLOR[levelKind(row.level)]">{{ (row.level || "info").toUpperCase() }}</span>
|
||||
</template>
|
||||
<template #cell-service="{ row }"><span class="font-mono text-xs text-fg-muted">{{ field(row, "service") }}</span></template>
|
||||
<template #cell-stage="{ row }"><span class="font-mono text-xs text-fg-muted">{{ field(row, "stage") }}</span></template>
|
||||
<template #cell-service="{ row }"><span class="block max-w-40 truncate font-mono text-xs text-fg-muted">{{ field(row, "service") }}</span></template>
|
||||
<template #cell-stage="{ row }"><span class="block max-w-48 truncate font-mono text-xs text-fg-muted" :title="field(row, 'stage')">{{ field(row, "stage") }}</span></template>
|
||||
<template #cell-message="{ row }">
|
||||
<span class="font-mono text-xs [overflow-wrap:anywhere]">{{ row.message || row.msg || "" }}</span>
|
||||
<span v-if="details(row).length" class="ml-2 text-xs text-fg-subtle">{{ details(row).length }} field{{ details(row).length === 1 ? "" : "s" }}</span>
|
||||
|
||||
@@ -30,6 +30,8 @@ const props = defineProps<{
|
||||
rowLink?: (row: Row) => string;
|
||||
rowLabel?: (row: Row) => string;
|
||||
rowClass?: (row: Row) => string;
|
||||
/** Keeps the header in view inside a scrolling container. */
|
||||
stickyHeader?: boolean;
|
||||
}>();
|
||||
const slots = defineSlots<Record<string, (props: { row: Row }) => unknown> & { empty?: () => unknown; actions?: (props: { row: Row }) => unknown; detail?: (props: { row: Row }) => unknown }>();
|
||||
|
||||
@@ -81,7 +83,7 @@ function open(row: Row): void {
|
||||
|
||||
<template>
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableHeader :class="stickyHeader && 'sticky top-0 z-10 bg-card'">
|
||||
<TableRow>
|
||||
<TableHead
|
||||
v-for="column in shown"
|
||||
|
||||
Reference in new issue
Block a user