From 350082cd199608a4fa9d14ad325156caac39e32a Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 20 Nov 2024 22:02:59 +0100 Subject: [PATCH] Add count badge to visualize counters in tab title (#4419) --- web/src/assets/locales/en.json | 6 +++--- web/src/components/atomic/CountBadge.vue | 13 +++++++++++++ web/src/components/layout/scaffold/Tab.vue | 2 ++ web/src/components/layout/scaffold/Tabs.vue | 4 +++- web/src/compositions/useTabs.ts | 1 + web/src/views/repo/pipeline/PipelineWrapper.vue | 10 ++++------ 6 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 web/src/components/atomic/CountBadge.vue diff --git a/web/src/assets/locales/en.json b/web/src/assets/locales/en.json index 325731e1b..577325f57 100644 --- a/web/src/assets/locales/en.json +++ b/web/src/assets/locales/en.json @@ -191,7 +191,7 @@ "pipeline": { "tasks": "Tasks", "config": "Config", - "files": "Changed files ({files})", + "files": "Changed files", "no_pipelines": "No pipelines have been started yet.", "no_pipeline_steps": "No pipeline steps available!", "step_not_started": "This step hasn't started yet.", @@ -248,8 +248,8 @@ "failure": "failure", "killed": "killed" }, - "errors": "Errors ({count})", - "warnings": "Warnings ({count})", + "errors": "Errors", + "warnings": "Warnings", "show_errors": "Show errors", "we_got_some_errors": "Oh no, we got some errors!", "duration": "Pipeline duration", diff --git a/web/src/components/atomic/CountBadge.vue b/web/src/components/atomic/CountBadge.vue new file mode 100644 index 000000000..44c96e8b0 --- /dev/null +++ b/web/src/components/atomic/CountBadge.vue @@ -0,0 +1,13 @@ + + + diff --git a/web/src/components/layout/scaffold/Tab.vue b/web/src/components/layout/scaffold/Tab.vue index 3bc833a3e..64ecf1121 100644 --- a/web/src/components/layout/scaffold/Tab.vue +++ b/web/src/components/layout/scaffold/Tab.vue @@ -10,6 +10,7 @@ import { useTabsClient } from '~/compositions/useTabs'; const props = defineProps<{ to: RouteLocationRaw; title: string; + count?: number; icon?: IconNames; iconClass?: string; matchChildren?: boolean; @@ -32,6 +33,7 @@ onMounted(() => { tabs.value.push({ to: props.to, title: props.title, + count: props.count, icon: props.icon, iconClass: props.iconClass, matchChildren: props.matchChildren, diff --git a/web/src/components/layout/scaffold/Tabs.vue b/web/src/components/layout/scaffold/Tabs.vue index 090389800..78f821557 100644 --- a/web/src/components/layout/scaffold/Tabs.vue +++ b/web/src/components/layout/scaffold/Tabs.vue @@ -11,15 +11,17 @@ > - + {{ tab.title }} +