Skip to content

Commit b8aea48

Browse files
amir20claude
andauthored
fix(ui): move log severity off the row and onto the rail (#5112)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 772c335 commit b8aea48

31 files changed

Lines changed: 83 additions & 27 deletions

assets/auto-imports.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ declare global {
9191
const hasIcon: typeof import('./utils/index').hasIcon
9292
const hasViewContext: typeof import('./composable/logs/viewContext').hasViewContext
9393
const hashCode: typeof import('./utils/index').hashCode
94+
const highlightErrors: typeof import('./stores/settings').highlightErrors
9495
const highlightSubstringInHtml: typeof import('./utils/index').highlightSubstringInHtml
9596
const hourStyle: typeof import('./stores/settings').hourStyle
9697
const iconSlugForImage: typeof import('./utils/index').iconSlugForImage
@@ -628,6 +629,7 @@ declare module 'vue' {
628629
readonly hasIcon: UnwrapRef<typeof import('./utils/index')['hasIcon']>
629630
readonly hasViewContext: UnwrapRef<typeof import('./composable/logs/viewContext')['hasViewContext']>
630631
readonly hashCode: UnwrapRef<typeof import('./utils/index')['hashCode']>
632+
readonly highlightErrors: UnwrapRef<typeof import('./stores/settings')['highlightErrors']>
631633
readonly hourStyle: UnwrapRef<typeof import('./stores/settings')['hourStyle']>
632634
readonly iconSlugForImage: UnwrapRef<typeof import('./utils/index')['iconSlugForImage']>
633635
readonly iconUrl: UnwrapRef<typeof import('./utils/index')['iconUrl']>

assets/components/logs/LogList.vue

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<template>
2-
<ul class="group pt-4" :class="{ 'disable-wrap': !softWrap, [size]: true, compact }" data-logs>
2+
<ul
3+
class="group pt-4"
4+
:class="{ 'disable-wrap': !softWrap, [size]: true, compact, 'highlight-errors': highlightErrors }"
5+
data-logs
6+
>
37
<li
48
v-for="item in messages"
59
ref="list"
@@ -83,37 +87,35 @@ ul {
8387
}
8488
8589
/* Written long-hand rather than as odd:/hover: utilities because the order
86-
below is the whole point: hover beats the zebra, and a level tint beats
87-
both, with its own (stronger) hover on top. */
90+
below is the whole point: hover has to beat the zebra, and the error tint
91+
has to beat both. */
8892
&:nth-child(odd) {
89-
background-color: color-mix(in oklab, var(--color-base-content) 4%, transparent);
93+
background-color: color-mix(in oklab, var(--color-base-content) 2.5%, transparent);
9094
}
9195
9296
&:hover {
9397
background-color: color-mix(in oklab, var(--color-base-content) 8%, transparent);
9498
}
9599
100+
&.log-permalink-target {
101+
@apply bg-secondary/15;
102+
animation: log-permalink-pulse 1.4s ease-out;
103+
}
104+
}
105+
106+
/* Severity primarily rides on the level rail in LogLevel.vue, so this is a
107+
hint rather than the signal, and warn does not get one at all: an orange
108+
wash on a routine retry line was the noisiest thing in the stream. Off by
109+
choice for anyone who wants the field completely flat. */
110+
&.highlight-errors > li {
96111
&[data-log-level="error"],
97112
&[data-log-level="fatal"] {
98-
background-color: color-mix(in oklab, var(--color-red) 9%, transparent);
113+
background-color: color-mix(in oklab, var(--color-red) 5%, transparent);
99114
}
100115
101116
&[data-log-level="error"]:hover,
102117
&[data-log-level="fatal"]:hover {
103-
background-color: color-mix(in oklab, var(--color-red) 15%, transparent);
104-
}
105-
106-
&[data-log-level="warn"] {
107-
background-color: color-mix(in oklab, var(--color-orange) 8%, transparent);
108-
}
109-
110-
&[data-log-level="warn"]:hover {
111-
background-color: color-mix(in oklab, var(--color-orange) 14%, transparent);
112-
}
113-
114-
&.log-permalink-target {
115-
@apply bg-secondary/15;
116-
animation: log-permalink-pulse 1.4s ease-out;
118+
background-color: color-mix(in oklab, var(--color-red) 12%, transparent);
117119
}
118120
}
119121

assets/components/logs/__snapshots__/EventSource.spec.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

33
exports[`<ContainerEventSource /> > render html correctly > should render dates with 12 hour style 1`] = `
4-
"<ul data-v-8dc5da81="" class="group pt-4 medium" data-logs="" show-container-name="false">
4+
"<ul data-v-8dc5da81="" class="group pt-4 medium highlight-errors" data-logs="" show-container-name="false">
55
<li data-v-8dc5da81="" id="1560336942509" data-time="1560336942509" class="group/entry">
66
<div data-v-8dc5da81="" class="flex min-h-px flex-1 content-center justify-center"><span class="loading loading-bars loading-md text-primary m-2" style="display: none;"></span></div>
77
</li>
@@ -56,7 +56,7 @@ exports[`<ContainerEventSource /> > render html correctly > should render dates
5656
`;
5757

5858
exports[`<ContainerEventSource /> > render html correctly > should render dates with 24 hour style 1`] = `
59-
"<ul data-v-8dc5da81="" class="group pt-4 medium" data-logs="" show-container-name="false">
59+
"<ul data-v-8dc5da81="" class="group pt-4 medium highlight-errors" data-logs="" show-container-name="false">
6060
<li data-v-8dc5da81="" id="1560336942509" data-time="1560336942509" class="group/entry">
6161
<div data-v-8dc5da81="" class="flex min-h-px flex-1 content-center justify-center"><span class="loading loading-bars loading-md text-primary m-2" style="display: none;"></span></div>
6262
</li>
@@ -111,7 +111,7 @@ exports[`<ContainerEventSource /> > render html correctly > should render dates
111111
`;
112112

113113
exports[`<ContainerEventSource /> > render html correctly > should render messages 1`] = `
114-
"<ul data-v-8dc5da81="" class="group pt-4 medium" data-logs="" show-container-name="false">
114+
"<ul data-v-8dc5da81="" class="group pt-4 medium highlight-errors" data-logs="" show-container-name="false">
115115
<li data-v-8dc5da81="" id="1560336942509" data-time="1560336942509" class="group/entry">
116116
<div data-v-8dc5da81="" class="flex min-h-px flex-1 content-center justify-center"><span class="loading loading-bars loading-md text-primary m-2" style="display: none;"></span></div>
117117
</li>

assets/components/logs/entries/LogLevel.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<div
2525
:data-level="level"
2626
class="rounded-full"
27-
:class="[position ? 'h-full w-[3px]' : 'size-[0.45em] min-h-1 min-w-1', { 'show-unknown': showUnknown }]"
27+
:class="[rail ? 'h-full w-[3px]' : 'size-[0.45em] min-h-1 min-w-1', { 'show-unknown': showUnknown }]"
2828
></div>
2929
</div>
3030
</template>
@@ -42,6 +42,11 @@ const {
4242
event?: MatchedEvent;
4343
showUnknown?: boolean;
4444
}>();
45+
46+
// A single error line gets the rail a grouped entry gets rather than a 4px dot:
47+
// with the row background left neutral, this marker is the only thing carrying
48+
// severity, so it has to be visible from a scroll.
49+
const rail = computed(() => !!position || level === "error" || level === "fatal");
4550
</script>
4651

4752
<style scoped>

assets/components/nav/HostMenu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<NavHeader :title="$t('label.hosts')" :back="selectedHost ? $t('label.hosts') : undefined" @back="setHost(null)">
33
<template #title v-if="selectedHost">
44
<HostIcon :type="selectedHost.type" class="text-base-content/50 size-4 shrink-0" />
5-
<span class="truncate text-sm font-medium">{{ selectedHost.name }}</span>
5+
<span class="truncate text-[0.9375rem] font-medium">{{ selectedHost.name }}</span>
66
</template>
77

88
<template #actions>

assets/components/nav/K8sMenu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
>
77
<template #title v-if="selectedNamespace && selectedNamespace !== 'all'">
88
<ph:circles-four class="text-base-content/50 size-4 shrink-0" />
9-
<span class="truncate text-sm font-medium">{{ selectedNamespace }}</span>
9+
<span class="truncate text-[0.9375rem] font-medium">{{ selectedNamespace }}</span>
1010
</template>
1111

1212
<template #actions>

assets/components/nav/NavHeader.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<div class="flex min-w-0 flex-1 items-center gap-1.5">
88
<slot name="title">
9-
<span class="truncate text-sm font-medium">{{ title }}</span>
9+
<span class="truncate text-[0.9375rem] font-medium">{{ title }}</span>
1010
</slot>
1111
</div>
1212

assets/components/nav/NavItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const bindings = computed(() => (to ? { to, activeClass: "is-active" } : { type:
4848
@reference "@/main.css";
4949
5050
.nav-item {
51-
@apply text-base-content/85 hover:text-base-content hover:bg-base-content/8 relative flex h-8 w-full cursor-pointer items-center gap-2 rounded-md px-2 text-left text-sm transition-colors;
51+
@apply text-base-content/85 hover:text-base-content hover:bg-base-content/8 relative flex h-8 w-full cursor-pointer items-center gap-2 rounded-md px-2 text-left text-[0.9375rem] transition-colors;
5252
}
5353
5454
/* Tinted rather than filled: a solid primary block on the selected row shouted

assets/pages/settings.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@
111111
<SettingRow tag="label" :label="$t('settings.soft-wrap')" :description="$t('settings.soft-wrap-desc')">
112112
<input type="checkbox" class="toggle toggle-primary toggle-sm" v-model="softWrap" />
113113
</SettingRow>
114+
<SettingRow
115+
tag="label"
116+
:label="$t('settings.highlight-errors')"
117+
:description="$t('settings.highlight-errors-desc')"
118+
>
119+
<input type="checkbox" class="toggle toggle-primary toggle-sm" v-model="highlightErrors" />
120+
</SettingRow>
114121
<SettingRow :label="$t('settings.datetime-format')" :description="$t('settings.datetime-format-desc')">
115122
<DropdownMenu
116123
v-model="dateLocale"
@@ -264,6 +271,7 @@ import {
264271
groupContainers,
265272
showImageUpdateAlert,
266273
showAppIcons,
274+
highlightErrors,
267275
} from "@/stores/settings";
268276
269277
import { availableLocales, i18n } from "@/modules/i18n";

assets/stores/settings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export type Settings = {
2020
groupContainers: "always" | "at-least-2" | "never";
2121
showImageUpdateAlert: boolean;
2222
showAppIcons: boolean;
23+
highlightErrors: boolean;
2324
terminalFontSize: number;
2425
};
2526
export const DEFAULT_SETTINGS: Settings = {
@@ -42,6 +43,7 @@ export const DEFAULT_SETTINGS: Settings = {
4243
groupContainers: "at-least-2",
4344
showImageUpdateAlert: false,
4445
showAppIcons: true,
46+
highlightErrors: true,
4547
terminalFontSize: 13,
4648
};
4749

@@ -75,5 +77,6 @@ export const {
7577
automaticRedirect,
7678
groupContainers,
7779
showAppIcons,
80+
highlightErrors,
7881
terminalFontSize,
7982
} = toRefs(settings.value);

0 commit comments

Comments
 (0)