diff --git a/report-viewer/src/components/TabbedContainer.vue b/report-viewer/src/components/TabbedContainer.vue new file mode 100644 index 000000000..d40f52232 --- /dev/null +++ b/report-viewer/src/components/TabbedContainer.vue @@ -0,0 +1,75 @@ + + + diff --git a/report-viewer/src/views/ClusterView.vue b/report-viewer/src/views/ClusterView.vue index 9add25029..06044eca3 100644 --- a/report-viewer/src/views/ClusterView.vue +++ b/report-viewer/src/views/ClusterView.vue @@ -16,25 +16,12 @@ >
- -
- - - - - + + + + + + + + + @@ -78,12 +95,11 @@ import Container from '@/components/ContainerComponent.vue' import TextInformation from '@/components/TextInformation.vue' import type { Cluster } from '@/model/Cluster' import type { ClusterListElement, ClusterListElementMember } from '@/model/ClusterListElement' -import type { ComparisonListElement } from '@/model/ComparisonListElement' import { MetricType } from '@/model/MetricType' import type { Overview } from '@/model/Overview' import { computed, ref, onErrorCaptured, type PropType, type Ref } from 'vue' -import OptionsSelectorComponent from '@/components/optionsSelectors/OptionsSelectorComponent.vue' import { redirectOnError } from '@/router' +import TabbedContainer from '@/components/TabbedContainer.vue' const props = defineProps({ overview: { @@ -96,7 +112,6 @@ const props = defineProps({ } }) -const comparisons = [] as Array const clusterMemberList = new Map() as ClusterListElementMember const selectedClusterVisualization: Ref<'Graph' | 'Radar'> = ref('Graph') const clusterVisualizationOptions = [ @@ -110,26 +125,45 @@ const clusterVisualizationOptions = [ 'A radar chart showing the he other submissions in the cluster, relative one submission.' } ] +const comparisonTableOptions = [ + { + displayValue: 'Members', + tooltip: 'Comparisons between the cluster members.' + }, + { + displayValue: 'Related Comparisons', + tooltip: 'Comparisons between the cluster members\nand other submissions.' + } +] const usedMetric = MetricType.AVERAGE -function getComparisonFor(id1: string, id2: string) { - return props.overview.topComparisons.find( +const comparisons = computed(() => + props.overview.topComparisons.filter( (c) => - (c.firstSubmissionId === id1 && c.secondSubmissionId === id2) || - (c.firstSubmissionId === id2 && c.secondSubmissionId === id1) + props.cluster.members.includes(c.firstSubmissionId) && + props.cluster.members.includes(c.secondSubmissionId) ) -} +) -for (let i = 0; i < props.cluster.members.length; i++) { - for (let j = i + 1; j < props.cluster.members.length; j++) { - const comparison = getComparisonFor(props.cluster.members[i], props.cluster.members[j]) - if (comparison) { - comparisons.push(comparison) - } - } -} let counter = 0 -comparisons +comparisons.value + .sort((a, b) => b.similarities[usedMetric] - a.similarities[usedMetric]) + .forEach((c) => { + c.sortingPlace = counter++ + c.id = counter + }) + +const relatedComparisons = computed(() => + props.overview.topComparisons.filter( + (c) => + (props.cluster.members.includes(c.firstSubmissionId) && + !props.cluster.members.includes(c.secondSubmissionId)) || + (!props.cluster.members.includes(c.firstSubmissionId) && + props.cluster.members.includes(c.secondSubmissionId)) + ) +) +counter = 0 +relatedComparisons.value .sort((a, b) => b.similarities[usedMetric] - a.similarities[usedMetric]) .forEach((c) => { c.sortingPlace = counter++ @@ -138,7 +172,7 @@ comparisons for (const member of props.cluster.members) { const membersComparisons: { matchedWith: string; similarity: number }[] = [] - comparisons + comparisons.value .filter((c) => c.firstSubmissionId === member || c.secondSubmissionId === member) .forEach((c) => { membersComparisons.push({