Skip to content

Commit 3a159cb

Browse files
authored
fix: only truncate right the container name and not hostname (#3567)
1 parent 84ec46c commit 3a159cb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

assets/components/LogViewer/LogItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="relative flex w-full items-start gap-x-2 group-[.compact]:items-stretch">
33
<LogStd :std="logEntry.std" class="shrink-0 select-none" v-if="showStd" />
44
<RandomColorTag class="shrink-0 select-none" :value="host.name" v-if="showHostname" />
5-
<RandomColorTag class="shrink-0 select-none" :value="container.name" v-if="showContainerName" />
5+
<RandomColorTag class="shrink-0 select-none" :value="container.name" v-if="showContainerName" truncateRight />
66
<LogDate :date="logEntry.date" v-if="showTimestamp" class="shrink-0 select-none" />
77
<LogLevel
88
class="flex select-none"

assets/components/LogViewer/RandomColorTag.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<template>
22
<div class="tag grid w-40 overflow-hidden rounded-sm text-center text-sm text-white">
33
<div class="random-color col-start-1 row-start-1 brightness-75"></div>
4-
<div class="col-start-1 row-start-1 truncate px-2 brightness-100 [direction:rtl]">{{ value }}</div>
4+
<div class="col-start-1 row-start-1 truncate px-2 brightness-100" :class="truncateRight ? '[direction:rtl]' : ''">
5+
{{ value }}
6+
</div>
57
</div>
68
</template>
79
<script lang="ts">
@@ -29,8 +31,9 @@ const colors = [
2931
] as const;
3032
</script>
3133
<script lang="ts" setup>
32-
const { value } = defineProps<{
34+
const { value, truncateRight = false } = defineProps<{
3335
value: string;
36+
truncateRight?: boolean;
3437
}>();
3538
3639
const color = computed(() => colors[Math.abs(hashCode(value)) % colors.length]);

0 commit comments

Comments
 (0)