From bd7f6bc88621f6043134838fbe7bb4db4e2a7efe Mon Sep 17 00:00:00 2001 From: Amir Raminfar Date: Tue, 19 Nov 2024 08:46:20 -0800 Subject: [PATCH] feat: adds show hostname and container name to dropdown in mutli log mode (#3406) --- assets/components.d.ts | 1 + .../components/ContainerViewer/ContainerLog.vue | 6 ++++-- assets/components/GroupedViewer/GroupedLog.vue | 6 ++++-- assets/components/LogViewer/ComplexLogItem.vue | 4 ++-- assets/components/LogViewer/LogItem.vue | 17 ++++++++++++----- assets/components/LogViewer/LogList.vue | 3 +-- assets/components/LogViewer/LogViewer.vue | 3 +-- .../LogViewer/MultiContainerActionToolbar.vue | 17 ++++++++++++++++- .../{ContainerName.vue => RandomColorTag.vue} | 11 ++++------- assets/components/LogViewer/SimpleLogItem.vue | 5 ++--- .../components/LogViewer/ViewerWithSource.vue | 5 ++--- .../__snapshots__/EventSource.spec.ts.snap | 15 +++++++++------ .../MultiContainerViewer/MultiContainerLog.vue | 3 +-- assets/components/ServiceViewer/ServiceLog.vue | 6 ++++-- assets/components/StackViewer/StackLog.vue | 6 ++++-- assets/composable/logContext.ts | 11 ++++++++++- locales/en.yml | 2 ++ 17 files changed, 79 insertions(+), 42 deletions(-) rename assets/components/LogViewer/{ContainerName.vue => RandomColorTag.vue} (70%) diff --git a/assets/components.d.ts b/assets/components.d.ts index b272a2a5..1523e1f1 100644 --- a/assets/components.d.ts +++ b/assets/components.d.ts @@ -95,6 +95,7 @@ declare module 'vue' { 'Ph:stack': typeof import('~icons/ph/stack')['default'] 'Ph:stackSimple': typeof import('~icons/ph/stack-simple')['default'] Popup: typeof import('./components/Popup.vue')['default'] + RandomColorTag: typeof import('./components/LogViewer/RandomColorTag.vue')['default'] Releases: typeof import('./components/Releases.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] diff --git a/assets/components/ContainerViewer/ContainerLog.vue b/assets/components/ContainerViewer/ContainerLog.vue index bf4c5da5..4e3b67e1 100644 --- a/assets/components/ContainerViewer/ContainerLog.vue +++ b/assets/components/ContainerViewer/ContainerLog.vue @@ -17,7 +17,6 @@ :stream-source="useContainerStream" :entity="container" :visible-keys="visibleKeys" - :show-container-name="false" /> @@ -46,5 +45,8 @@ const container = store.currentContainer(toRef(() => id)); const visibleKeys = persistentVisibleKeysForContainer(container); const viewer = useTemplateRef>("viewer"); -provideLoggingContext(toRef(() => [container.value])); +provideLoggingContext( + toRef(() => [container.value]), + { showContainerName: false, showHostname: false }, +); diff --git a/assets/components/GroupedViewer/GroupedLog.vue b/assets/components/GroupedViewer/GroupedLog.vue index c5132f70..f3415669 100644 --- a/assets/components/GroupedViewer/GroupedLog.vue +++ b/assets/components/GroupedViewer/GroupedLog.vue @@ -17,7 +17,6 @@ :stream-source="useGroupedStream" :entity="group" :visible-keys="new Map()" - :show-container-name="true" /> @@ -43,5 +42,8 @@ const { customGroups } = storeToRefs(swarmStore); const group = computed(() => customGroups.value.find((g) => g.name === name) ?? new GroupedContainers("", [])); -provideLoggingContext(toRef(() => group.value.containers)); +provideLoggingContext( + toRef(() => group.value.containers), + { showContainerName: true, showHostname: false }, +); diff --git a/assets/components/LogViewer/ComplexLogItem.vue b/assets/components/LogViewer/ComplexLogItem.vue index 456e238b..aa35420f 100644 --- a/assets/components/LogViewer/ComplexLogItem.vue +++ b/assets/components/LogViewer/ComplexLogItem.vue @@ -1,5 +1,5 @@