From 02627c69c9b2490bddd6a6e1b2578280c9405305 Mon Sep 17 00:00:00 2001 From: jfrer <76432831+jfrer@users.noreply.github.com> Date: Wed, 4 Sep 2024 13:49:22 +0200 Subject: [PATCH] feat: show processor versions in detailed view (#107) * feat: show processor versions in detailed view * refactor: use optional chaining --- .../workflows/timeline/TimelineItem.vue | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/workflows/timeline/TimelineItem.vue b/src/components/workflows/timeline/TimelineItem.vue index 41d8025..7e47e98 100644 --- a/src/components/workflows/timeline/TimelineItem.vue +++ b/src/components/workflows/timeline/TimelineItem.vue @@ -23,6 +23,7 @@ const op = ref() const isOpVisible = ref(false) const selectedStep = ref(null) const selectedStepUrl = computed(() => selectedStep.value ? getStepUrl(selectedStep.value) : null) +const selectedStepVersion = computed(() => selectedStep.value ? getStepVersion(selectedStep.value) : null) const startDate = ref(new Date('2023-10-01')) const endDate = ref(new Date()) @@ -56,11 +57,18 @@ function toggleParameterOverlay(step: WorkflowStep, event: Event) { function getStepUrl(step: WorkflowStep) { const repo = projectsStore.repos.find(({ ocrd_tool }) => { - return ocrd_tool && ocrd_tool.tools[step.id] + return ocrd_tool?.tools[step.id] }) return repo?.url ?? null } +function getStepVersion(step: WorkflowStep) { + const repo = projectsStore.repos.find(({ ocrd_tool }) => { + return ocrd_tool?.tools[step.id] + }) + return repo?.ocrd_tool?.version ?? null +} +