Skip to content

Commit

Permalink
Revert "feat: add sorting by label, metric (wip), year"
Browse files Browse the repository at this point in the history
This reverts commit b6dd235.
  • Loading branch information
jfrer committed Jul 2, 2024
1 parent b6dd235 commit a518af8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 152 deletions.
18 changes: 5 additions & 13 deletions src/components/workflows/WorkflowsTimeline.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import TimelineItem from "@/components/workflows/timeline/TimelineItem.vue"
import Dropdown from 'primevue/dropdown'
import { computed, onBeforeMount, onMounted, ref, watch} from "vue"
import { computed, onMounted, ref, watch} from "vue"
import { EvaluationMetrics, getMaxValueByMetric} from '@/helpers/metrics'
import { useI18n } from "vue-i18n"
import type { DropdownOption, EvaluationResultsDocumentWide, Workflow, GroundTruth } from "@/types"
Expand All @@ -11,26 +11,19 @@ import filtersStore from '@/store/filters-store'
import timelineStore from "@/store/timeline-store"
import TrendLegend from "@/components/workflows/TrendLegend.vue";
import TimelineFilters from "./timeline/TimelineFilters.vue"
import TimelineSorting from "./timeline/TimelineSorting.vue"
const { t } = useI18n()
const gtList = computed<GroundTruth[]>(() => workflowsStore.gt.filter(({ id }) => filtersStore.gtTimeline.findIndex(({ value }) => value === id) > -1))
const workflows = ref<Workflow[]>([])
const selectedMetric = ref<DropdownOption | null>(null)
const metrics = computed<DropdownOption[]>(() => Object.keys(EvaluationMetrics).map(key => ({ value: EvaluationMetrics[key], label: t(EvaluationMetrics[key]) })))
const selectedMetricValue = computed<keyof EvaluationResultsDocumentWide>(() => <keyof EvaluationResultsDocumentWide>selectedMetric.value?.value || EvaluationMetrics.CER_MEAN)
const sortedGtList = ref<GroundTruth[]>([])
onMounted(async () => {
selectedMetric.value = metrics.value[0]
workflows.value = workflowsStore.workflows
})
watch(gtList, () => {
sortedGtList.value = gtList.value
})
watch(selectedMetric,
() => timelineStore.setMaxValue(
selectedMetricValue.value,
Expand All @@ -42,23 +35,22 @@ watch(selectedMetric,

<template>
<div class="flex flex-col">
<div class="flex mb-4 space-x-4 items-end justify-between">
<TimelineSorting v-model="sortedGtList" :selectedMetric="selectedMetricValue"/>
<div class="flex w-full mb-4">
<Dropdown
v-model="selectedMetric"
:options="metrics"
:pt="DropdownPassThroughStyles"
optionLabel="label"
placeholder="Select a metric"
class="grow-0"
class="ml-auto md:w-14rem"
unstyled
/>
</div>
<TrendLegend class="ml-auto mb-4"/>
<TimelineFilters></TimelineFilters>
<div class="flex flex-col space-y-6">
<template v-if="sortedGtList.length > 0">
<TimelineItem v-for="gt in sortedGtList" :key="gt.id" :gt="gt" :metric="selectedMetricValue" />
<template v-if="gtList.length > 0">
<TimelineItem v-for="gt in gtList" :key="gt.id" :gt="gt" :metric="selectedMetricValue" />
</template>
<template v-else-if="workflowsStore.gt.length > 0 ">
<div class="my-6">{{ $t('no_documents_selected') }}</div>
Expand Down
55 changes: 0 additions & 55 deletions src/components/workflows/timeline/TimelineSorting.vue

This file was deleted.

64 changes: 0 additions & 64 deletions src/helpers/sorting.ts

This file was deleted.

8 changes: 1 addition & 7 deletions src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,5 @@
"filter_by_processor": "Nach Prozessor filtern",
"select_a_date_range": "Zeitraum auswählen",
"select_a_workflow": "Workflow auswählen",
"select_a_processor": "Prozessor auswählen",
"label_asc": "Titel (a - z)",
"label_desc": "Titel (z - a)",
"metric_desc": "Ausgewählte Metrik (absteigend)",
"metric_asc": "Ausgewählte Metrik (aufsteigend)",
"year_asc": "Zeitraum (ältester - neuster)",
"year_desc": "Zeitraum (neuster - ältester)"
"select_a_processor": "Prozessor auswählen"
}
8 changes: 1 addition & 7 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,5 @@
"filter_by_processor": "Filter by processor",
"select_a_date_range": "Select a date range",
"select_a_workflow": "Select a workflow",
"select_a_processor": "Select a processor",
"label_asc": "Label (a - z)",
"label_desc": "Label (z - a)",
"metric_desc": "Selected metric (descending)",
"metric_asc": "Selected metric (ascending)",
"year_asc": "Time period (oldest - latest)",
"year_desc": "Time period (latest - oldest)"
"select_a_processor": "Select a processor"
}
10 changes: 4 additions & 6 deletions src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export interface GroundTruthMetadata {
reference: string,
link: string
}[],
time: TimeSpan
time: {
notBefore: string,
notAfter: string
},
title: string,
'transcription-guidelines': string,
url: string,
Expand All @@ -51,11 +54,6 @@ export interface GroundTruthMetadata {
}[],
}

export interface TimeSpan {
notBefore: string,
notAfter: string
}

export interface Workflow {
id: string,
label: string,
Expand Down

0 comments on commit a518af8

Please sign in to comment.