diff --git a/src/components/base/MultiSelect.vue b/src/components/base/MultiSelect.vue
new file mode 100644
index 0000000..f9efbf8
--- /dev/null
+++ b/src/components/base/MultiSelect.vue
@@ -0,0 +1,48 @@
+
+
+
+
+
+ {{ t('select_all') }}
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/workflows/timeline/TimelineFilters.vue b/src/components/workflows/timeline/TimelineFilters.vue
index 94bf00a..51ed372 100644
--- a/src/components/workflows/timeline/TimelineFilters.vue
+++ b/src/components/workflows/timeline/TimelineFilters.vue
@@ -2,10 +2,10 @@
import filtersStore from "@/store/filters-store"
import workflowsStore from "@/store/workflows-store"
import { computed, onMounted, ref, watch } from "vue"
-import MultiSelect from "primevue/multiselect"
import type { DropdownOption, GroundTruth } from "@/types"
import { deduplicateStepIds, mapGtId } from '@/helpers/utils'
import { useI18n } from "vue-i18n"
+import BaseMultiSelect from "@/components/base/MultiSelect.vue"
const { t } = useI18n()
@@ -25,26 +25,44 @@ const selectedWorkflows = ref([])
const workflowStepOptions = ref([])
const selectedWorkflowSteps = ref([])
-const dateRangeDropdownLabel = computed(() => {
- if (dateRangeOptions.value.length === selectedDateRange.value.length) {
- return t('filter_by_date_range')
- }
- return null
+/*
+Compiles the DropdownOption[] for the labelling filter.
+
+Each gt can have a list of labels, while some have no labelling at all.
+The DropdownOption[] is computed by adding all labelling options to a flat list, then making them unique and sorting them.
+*/
+const labellingOptions = computed(() => {
+ return [
+ ...new Set(workflowsStore.gt.map(gt =>
+ Array.isArray(gt.metadata.labelling) && gt.metadata.labelling.length > 0 ? gt.metadata.labelling : [t('no_labelling')]
+ ).flat(1)
+ )
+ ]
+ .sort()
+ .map(value => ({ value, label: value }))
})
-
-const workflowDropdownLabel = computed(() => {
- if (workflowOptions.value.length === selectedWorkflows.value.length) {
- return t('filter_by_workflow')
- }
- return null
+const selectedLabelling = ref([])
+
+const scriptTypeOptions = computed(() => {
+ return [
+ ...new Set(workflowsStore.gt.map(gt =>
+ gt.metadata["script-type"]
+ ))
+ ]
+ .sort()
+ .map(value => ({ value, label: value }))
})
+const selectedScriptTypes = ref([])
-const workflowStepDropdownLabel = computed(() => {
- if (workflowStepOptions.value.length === selectedWorkflowSteps.value.length) {
- return t('filter_by_processor')
- }
- return null
-})
+const onLabellingChange = (event: any) => {
+ selectedLabelling.value = event
+ selectGTs()
+}
+
+const onScriptTypeChange = (event: any) => {
+ selectedScriptTypes.value = event
+ selectGTs()
+}
const onDateRangeChange = (event: any) => {
selectedDateRange.value = event
@@ -67,13 +85,29 @@ const selectGTs = () => {
filtersStore.gtTimeline = filtersStore.gt.filter(({ value }) => {
const gt = workflowsStore.getGtById(value)
if(!gt) return false
- return hasSomeSelectedProcessor(gt) && hasSomeSelectedDateRange(gt) && hasSomeSelectedWorkflow(gt)
+ return (
+ hasSomeSelectedLabelling(gt) &&
+ hasSomeSelectedScriptType(gt) &&
+ hasSomeSelectedProcessor(gt) &&
+ hasSomeSelectedDateRange(gt) &&
+ hasSomeSelectedWorkflow(gt)
+ )
})
}
const selectWorkflows = () => {
filtersStore.workflow = selectedWorkflows.value.filter(({ value }) => (workflowhasSomeSelectedWorkflowStep(value)))
}
+const hasSomeSelectedLabelling = (gt: GroundTruth) => {
+ return selectedLabelling.value.some(({ value }) => {
+ if(!Array.isArray(gt.metadata.labelling) || gt.metadata.labelling.length <= 0) return value === t('no_labelling')
+ return gt.metadata.labelling?.some(labelling => labelling === value)
+ })
+}
+
+const hasSomeSelectedScriptType = (gt: GroundTruth) => {
+ return selectedScriptTypes.value.some(({ value }) => value === gt.metadata["script-type"])
+}
const hasSomeSelectedProcessor = (gt: GroundTruth) => {
const gtRuns = workflowsStore.getRuns(gt.id)
@@ -96,7 +130,7 @@ const hasSomeSelectedDateRange = (gt: GroundTruth) => {
const hasSomeSelectedWorkflow = (gt: GroundTruth) => {
const gtRuns = workflowsStore.getRuns(gt.id)
return gtRuns.some((gtRun) => {
- return selectedWorkflows.value.findIndex(({ value }) => (value === mapGtId(gtRun.metadata.ocr_workflow.id))) > -1
+ return selectedWorkflows.value.findIndex(({ value }) => (value === mapGtId(gtRun.metadata.ocr_workflow.id))) > -1
})
}
@@ -116,44 +150,57 @@ onMounted(() => {
selectedDateRange.value = dateRangeOptions.value
selectedWorkflows.value = workflowOptions.value
selectedWorkflowSteps.value = workflowStepOptions.value
-
+ selectedLabelling.value = labellingOptions.value
+ selectedScriptTypes.value = scriptTypeOptions.value
+
selectGTs()
selectWorkflows()
})
-
-
+
+
+
-
-
diff --git a/src/locales/de.json b/src/locales/de.json
index 48c3995..040cedd 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -84,6 +84,8 @@
"filter_by_date_range": "Nach Zeitspanne filtern",
"filter_by_workflow": "Nach Workflow filtern",
"filter_by_processor": "Nach Prozessor filtern",
+ "filter_by_labelling": "Nach Kennzeichnungen filtern",
+ "filter_by_script_type": "Nach Skript-Typ filtern",
"select_a_date_range": "Zeitraum auswählen",
"select_a_workflow": "Workflow auswählen",
"select_a_processor": "Prozessor auswählen",
@@ -93,5 +95,8 @@
"metric_desc": "Ausgewählte Metrik (absteigend)",
"metric_asc": "Ausgewählte Metrik (aufsteigend)",
"year_asc": "Zeitraum (ältester - neuster)",
- "year_desc": "Zeitraum (neuster - ältester)"
+ "year_desc": "Zeitraum (neuster - ältester)",
+ "select_a_label": "Kennzeichnung auswählen",
+ "select_a_script_type": "Skript-Typ auswählen",
+ "no_labelling": "Keine Kennzeichnung"
}
diff --git a/src/locales/en.json b/src/locales/en.json
index d7ea8bd..9fce08a 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -79,6 +79,8 @@
"filter_by_date_range": "Filter by date range",
"filter_by_workflow": "Filter by workflow",
"filter_by_processor": "Filter by processor",
+ "filter_by_labelling": "Filter by labelling",
+ "filter_by_script_type": "Filter by script-type",
"select_a_date_range": "Select a date range",
"select_a_workflow": "Select a workflow",
"select_a_processor": "Select a processor",
@@ -88,5 +90,8 @@
"metric_desc": "Selected metric (descending)",
"metric_asc": "Selected metric (ascending)",
"year_asc": "Time period (oldest - latest)",
- "year_desc": "Time period (latest - oldest)"
+ "year_desc": "Time period (latest - oldest)",
+ "select_a_label": "Select a label",
+ "select_a_script_type": "Select a script-type",
+ "no_labelling": "No labelling"
}
diff --git a/src/types/index.d.ts b/src/types/index.d.ts
index dac4931..67a625e 100644
--- a/src/types/index.d.ts
+++ b/src/types/index.d.ts
@@ -17,7 +17,7 @@ export interface GroundTruthMetadata {
count: string,
level: string
},
- labelling: string[],
+ labelling?: string[],
language: string[],
license: {
name: string,