From 0dd9f26747399f13c792bfc3b1235ded0d2852be Mon Sep 17 00:00:00 2001
From: Paul Pestov <10750176+paulpestov@users.noreply.github.com>
Date: Tue, 5 Dec 2023 23:16:40 +0100
Subject: [PATCH] feat: add workflow name to metric detail charts

---
 src/components/Workflows.vue                             | 2 +-
 src/components/workflows/timeline/MetricAverageChart.vue | 4 +++-
 src/components/workflows/timeline/MetricChart.vue        | 4 +++-
 src/components/workflows/timeline/TimelineItem.vue       | 2 ++
 src/locales/de.json                                      | 3 ++-
 src/locales/en.json                                      | 3 ++-
 6 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/components/Workflows.vue b/src/components/Workflows.vue
index 3f4875b..eafff1e 100644
--- a/src/components/Workflows.vue
+++ b/src/components/Workflows.vue
@@ -74,7 +74,7 @@
     </div>
     <div class="flex mb-3">
       <SelectButton v-model="selectedOption" :options="options" optionLabel="name"></SelectButton>
-      <Filters class="ml-auto w-1/3"/>
+      <Filters class="ml-auto"/>
     </div>
     <div v-if="selectedOption">
       <WorkflowsTimeline v-if="selectedOption.value === 'timeline'" />
diff --git a/src/components/workflows/timeline/MetricAverageChart.vue b/src/components/workflows/timeline/MetricAverageChart.vue
index 195a564..37b98e0 100644
--- a/src/components/workflows/timeline/MetricAverageChart.vue
+++ b/src/components/workflows/timeline/MetricAverageChart.vue
@@ -15,7 +15,8 @@ const props = defineProps<{
   runs: EvaluationRun[],
   metric: keyof EvaluationResultsDocumentWide,
   startDate: Date,
-  endDate: Date
+  endDate: Date,
+  workflowName: string
 }>()
 
 const data = ref<TimelineChartDataPoint[]>([])
@@ -82,6 +83,7 @@ function tooltipContent(d: TimelineChartDataPoint) {
       }
     }"
   >
+    <h3 class="font-semibold">{{ workflowName }}</h3>
     <BaseTimelineDetailedChart
       :data="data"
       :max-y="maxY"
diff --git a/src/components/workflows/timeline/MetricChart.vue b/src/components/workflows/timeline/MetricChart.vue
index fee613b..3385654 100644
--- a/src/components/workflows/timeline/MetricChart.vue
+++ b/src/components/workflows/timeline/MetricChart.vue
@@ -11,7 +11,8 @@ const props = defineProps<{
   runs: EvaluationRun[],
   metric: keyof EvaluationResultsDocumentWide,
   startDate: Date,
-  endDate: Date
+  endDate: Date,
+  workflowName: string
 }>()
 
 const data = ref([])
@@ -64,6 +65,7 @@ function tooltipContent(d: TimelineChartDataPoint) {
       }
     }"
   >
+    <h3 class="font-semibold">{{ workflowName }}</h3>
     <BaseTimelineDetailedChart
       :data="data"
       :max-y="maxY"
diff --git a/src/components/workflows/timeline/TimelineItem.vue b/src/components/workflows/timeline/TimelineItem.vue
index 90445af..287a6cd 100644
--- a/src/components/workflows/timeline/TimelineItem.vue
+++ b/src/components/workflows/timeline/TimelineItem.vue
@@ -60,6 +60,7 @@ function hideParametersOverlay() {
         <div class="w-1/2 flex justify-end">
           <div class="flex overflow-x-auto">
             <MetricAverageChart
+              :workflow-name="$t('average')"
               :runs="workflowsStore.getRuns(gt.id)"
               :metric="metric"
               class=""
@@ -90,6 +91,7 @@ function hideParametersOverlay() {
             <td class="overflow-x-auto">
               <MetricChart
                 :runs="workflowsStore.getRuns(gt.id, workflow.id)"
+                :workflow-name="workflow.label"
                 :metric="metric"
                 :width="400"
                 :start-date="startDate"
diff --git a/src/locales/de.json b/src/locales/de.json
index af15e77..2ff3614 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -53,5 +53,6 @@
   "pages_per_minute": "Seiten pro Minute",
   "cpu_standard_deviation": "CPU Standardabweichung",
   "date": "Datum",
-  "ground_truth": "Ground Truth"
+  "ground_truth": "Ground Truth",
+  "average": "Durchschnitt"
 }
diff --git a/src/locales/en.json b/src/locales/en.json
index fdc9a9c..a25f2a3 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -47,5 +47,6 @@
   "pages_per_minute": "Pages per minute",
   "cpu_standard_deviation": "CPU Standard Deviation",
   "date": "Date",
-  "ground_truth": "Ground Truth"
+  "ground_truth": "Ground Truth",
+  "average": "Average"
 }
-- 
GitLab