From ed0652a32840e050f121ecf46160efca7f796e60 Mon Sep 17 00:00:00 2001 From: Oliver Stolpe Date: Fri, 8 Sep 2023 10:55:08 +0200 Subject: [PATCH] feat: adapt filter frontend to case detail variant annotations (#1104) (#1122) --- cases/tests/test_serializers.py | 11 +- cases/tests/test_views_ajax.py | 2 + .../src/components/CaseDetail/Content.vue | 64 +- .../components/CaseDetail/PaneAnnotations.vue | 65 +- cases/vueapp/src/components/CaseDetailApp.vue | 79 +- cases/vueapp/src/main.js | 46 +- .../unit/cases/CaseDetail/Content.spec.js | 78 +- .../commands/generate_result_set.py | 40 +- svs/serializers/queries.py | 3 + svs/tests/factories.py | 1 + svs/views/ajax/queries.py | 4 + svs/views/ajax/user_annos.py | 105 +- svs/vueapp/src/components/SvFilterApp.vue | 37 +- .../src/components/SvFilterApp/Header.vue | 2 +- .../src/components/SvFilterResultsTable.vue | 139 ++- svs/vueapp/src/stores/svDetails.ts | 11 +- svs/vueapp/src/stores/svQuery.js | 34 +- svs/vueapp/src/stores/svResultSet.ts | 43 + variants/plugins.py | 26 +- variants/serializers/__init__.py | 3 + variants/tasks.py | 4 +- .../templates/variants/_details_card.html | 10 - variants/tests/factories.py | 1 + variants/tests/test_utils.py | 898 ++++++++++++++++++ variants/tests/test_views_api.py | 2 + variants/utils.py | 180 +++- variants/views/api/__init__.py | 199 +++- variants/vueapp/src/api/variantClient.ts | 4 +- variants/vueapp/src/components/FilterApp.vue | 51 +- .../src/components/FilterApp/Header.vue | 2 +- .../src/components/FilterResultsTable.vue | 379 +++----- variants/vueapp/src/enums.ts | 27 + variants/vueapp/src/stores/variantQuery.js | 25 +- .../vueapp/src/stores/variantResultSet.ts | 54 ++ 34 files changed, 2094 insertions(+), 535 deletions(-) create mode 100644 variants/tests/test_utils.py diff --git a/cases/tests/test_serializers.py b/cases/tests/test_serializers.py index 230f0daa1..7b1adfbf5 100644 --- a/cases/tests/test_serializers.py +++ b/cases/tests/test_serializers.py @@ -56,9 +56,12 @@ def testSerializeExisting(self): class TestCaseSerializer(TestCase): def setUp(self): super().setUp() + self.maxDiff = None self.case = CaseFactory() - self.smallvariantqueryresultset = SmallVariantQueryResultSetFactory(case=self.case) - self.svqueryresultset = SvQueryResultSetFactory(case=self.case) + self.smallvariantqueryresultset = SmallVariantQueryResultSetFactory( + case=self.case, smallvariantquery=None + ) + self.svqueryresultset = SvQueryResultSetFactory(case=self.case, svquery=None) self.maxDiff = None def testSerializeExisting(self): @@ -96,9 +99,9 @@ def testSerializeExisting(self): "date_modified": self.smallvariantqueryresultset.date_modified.strftime(TIMEF), "end_time": self.smallvariantqueryresultset.end_time.strftime(TIMEF), "start_time": self.smallvariantqueryresultset.start_time.strftime(TIMEF), - "smallvariantquery": self.smallvariantqueryresultset.smallvariantquery.sodar_uuid, "elapsed_seconds": self.smallvariantqueryresultset.elapsed_seconds, "result_row_count": self.smallvariantqueryresultset.result_row_count, + "case": self.smallvariantqueryresultset.case.sodar_uuid, } expected["svqueryresultset"] = { "sodar_uuid": str(self.svqueryresultset.sodar_uuid), @@ -106,9 +109,9 @@ def testSerializeExisting(self): "date_modified": self.svqueryresultset.date_modified.strftime(TIMEF), "end_time": self.svqueryresultset.end_time.strftime(TIMEF), "start_time": self.svqueryresultset.start_time.strftime(TIMEF), - "svquery": self.svqueryresultset.svquery.sodar_uuid, "elapsed_seconds": self.svqueryresultset.elapsed_seconds, "result_row_count": self.svqueryresultset.result_row_count, + "case": self.svqueryresultset.case.sodar_uuid, } self.assertDictEqual(serializer.data, expected) diff --git a/cases/tests/test_views_ajax.py b/cases/tests/test_views_ajax.py index 1f2052967..967b09e79 100644 --- a/cases/tests/test_views_ajax.py +++ b/cases/tests/test_views_ajax.py @@ -58,6 +58,7 @@ def test_get(self): "smallvariantquery": str(self.smallvariantqueryresultset.smallvariantquery.sodar_uuid), "elapsed_seconds": self.smallvariantqueryresultset.elapsed_seconds, "result_row_count": self.smallvariantqueryresultset.result_row_count, + "case": str(self.case.sodar_uuid), } expected0_svqueryresultset = { "sodar_uuid": str(self.svqueryresultset.sodar_uuid), @@ -68,6 +69,7 @@ def test_get(self): "svquery": str(self.svqueryresultset.svquery.sodar_uuid), "elapsed_seconds": self.svqueryresultset.elapsed_seconds, "result_row_count": self.svqueryresultset.result_row_count, + "case": str(self.case.sodar_uuid), } expected0 = jsonmatch.compile( { diff --git a/cases/vueapp/src/components/CaseDetail/Content.vue b/cases/vueapp/src/components/CaseDetail/Content.vue index f12144151..ce1a06828 100644 --- a/cases/vueapp/src/components/CaseDetail/Content.vue +++ b/cases/vueapp/src/components/CaseDetail/Content.vue @@ -4,9 +4,21 @@ import { computed, ref } from 'vue' import PaneCase from '@cases/components/CaseDetail/PaneCase.vue' import PaneQc from '@cases/components/CaseDetail/PaneQc.vue' import PaneAnnotations from '@cases/components/CaseDetail/PaneAnnotations.vue' +import { useRouter } from 'vue-router' import { useCaseDetailsStore } from '@cases/stores/caseDetails' import GenomeBrowser from '@svs/components/GenomeBrowser.vue' +const router = useRouter() + +const props = defineProps({ + /** The case UUID. */ + caseUuid: String, + currentTab: { + type: String, + default: 'overview', // keep in sync with Tabs.caseList + }, +}) + /** Define emits. */ const emit = defineEmits([ 'addCaseCommentClick', @@ -26,8 +38,6 @@ const Tabs = Object.freeze({ browser: 'browser', }) -const currentTab = ref('overview') - const caseDetailsStore = useCaseDetailsStore() const annosLoading = computed( @@ -45,28 +55,25 @@ const annoCount = computed(() => { /** Update the current tab. */ const updateCurrentTab = (newValue) => { - currentTab.value = newValue + router.push({ + name: 'case-detail-' + newValue, + params: { case: caseDetailsStore.caseObj.sodar_uuid }, + }) } - -defineExpose({ - currentTab, -})