Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: uses better colors for different container names #2979

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions assets/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ declare module 'vue' {
readonly computedInject: UnwrapRef<typeof import('@vueuse/core')['computedInject']>
readonly computedWithControl: UnwrapRef<typeof import('@vueuse/core')['computedWithControl']>
readonly config: UnwrapRef<typeof import('./stores/config')['default']>
readonly containerContext: UnwrapRef<typeof import('./composable/containerContext')['containerContext']>
readonly controlledComputed: UnwrapRef<typeof import('@vueuse/core')['controlledComputed']>
readonly controlledRef: UnwrapRef<typeof import('@vueuse/core')['controlledRef']>
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
Expand Down Expand Up @@ -473,7 +472,6 @@ declare module 'vue' {
readonly persistentVisibleKeysForContainer: UnwrapRef<typeof import('./composable/storage')['persistentVisibleKeysForContainer']>
readonly pinnedContainers: UnwrapRef<typeof import('./composable/storage')['pinnedContainers']>
readonly provide: UnwrapRef<typeof import('vue')['provide']>
readonly provideContainerContext: UnwrapRef<typeof import('./composable/containerContext')['provideContainerContext']>
readonly provideLocal: UnwrapRef<typeof import('@vueuse/core')['provideLocal']>
readonly provideLoggingContext: UnwrapRef<typeof import('./composable/logContext')['provideLoggingContext']>
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
Expand Down Expand Up @@ -558,7 +556,6 @@ declare module 'vue' {
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
readonly useContainerActions: UnwrapRef<typeof import('./composable/containerActions')['useContainerActions']>
readonly useContainerContext: UnwrapRef<typeof import('./composable/containerContext')['useContainerContext']>
readonly useContainerStore: UnwrapRef<typeof import('./stores/container')['useContainerStore']>
readonly useContainerStream: UnwrapRef<typeof import('./composable/eventStreams')['useContainerStream']>
readonly useCounter: UnwrapRef<typeof import('@vueuse/core')['useCounter']>
Expand Down Expand Up @@ -756,7 +753,6 @@ declare module '@vue/runtime-core' {
readonly computedInject: UnwrapRef<typeof import('@vueuse/core')['computedInject']>
readonly computedWithControl: UnwrapRef<typeof import('@vueuse/core')['computedWithControl']>
readonly config: UnwrapRef<typeof import('./stores/config')['default']>
readonly containerContext: UnwrapRef<typeof import('./composable/containerContext')['containerContext']>
readonly controlledComputed: UnwrapRef<typeof import('@vueuse/core')['controlledComputed']>
readonly controlledRef: UnwrapRef<typeof import('@vueuse/core')['controlledRef']>
readonly createApp: UnwrapRef<typeof import('vue')['createApp']>
Expand Down Expand Up @@ -834,7 +830,6 @@ declare module '@vue/runtime-core' {
readonly persistentVisibleKeysForContainer: UnwrapRef<typeof import('./composable/storage')['persistentVisibleKeysForContainer']>
readonly pinnedContainers: UnwrapRef<typeof import('./composable/storage')['pinnedContainers']>
readonly provide: UnwrapRef<typeof import('vue')['provide']>
readonly provideContainerContext: UnwrapRef<typeof import('./composable/containerContext')['provideContainerContext']>
readonly provideLocal: UnwrapRef<typeof import('@vueuse/core')['provideLocal']>
readonly provideLoggingContext: UnwrapRef<typeof import('./composable/logContext')['provideLoggingContext']>
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
Expand Down Expand Up @@ -919,7 +914,6 @@ declare module '@vue/runtime-core' {
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
readonly useContainerActions: UnwrapRef<typeof import('./composable/containerActions')['useContainerActions']>
readonly useContainerContext: UnwrapRef<typeof import('./composable/containerContext')['useContainerContext']>
readonly useContainerStore: UnwrapRef<typeof import('./stores/container')['useContainerStore']>
readonly useContainerStream: UnwrapRef<typeof import('./composable/eventStreams')['useContainerStream']>
readonly useCounter: UnwrapRef<typeof import('@vueuse/core')['useCounter']>
Expand Down
2 changes: 0 additions & 2 deletions assets/components/ContainerViewer/ContainerLog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,5 @@ const visibleKeys = persistentVisibleKeysForContainer(container);

const viewer = ref<ComponentExposed<typeof ViewerWithSource>>();

provideContainerContext(container); // TODO remove

provideLoggingContext(toRef(() => [container.value]));
</script>
18 changes: 11 additions & 7 deletions assets/components/LogViewer/ContainerName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,30 @@ const { id } = defineProps<{
id: string;
}>();

const { containers } = useLoggingContext();

const colors = [
"#FF0000",
"#4B0082",
"#FF00FF",
"#FF7F00",
"#FFFF00",
"#00FF00",
"#00FFFF",
"#FF0000",
"#0000FF",
"#FF00FF",
"#FF007F",
"#32CD32",
"#40E0D0",
"#E6E6FA",
"#800080",
"#FFD700",
"#FF4040",
"#4B0082",
"#008080",
"#E6E6FA",
];
] as const;

const color = computed(() => colors[Math.abs(hashCode(id)) % colors.length]);
const color = computed(() => {
const index = containers.value.findIndex((container) => container.id === id);
return colors[index % colors.length];
});
</script>

<style lang="postcss" scoped>
Expand Down
21 changes: 0 additions & 21 deletions assets/composable/containerContext.ts

This file was deleted.

Loading