From 00667ef0808c0d524b2bca3c5792401e677445dc Mon Sep 17 00:00:00 2001 From: Yang Qi <60582494+YangQi007@users.noreply.github.com> Date: Fri, 27 Sep 2024 17:50:58 -0600 Subject: [PATCH 1/3] Updated the home page --- home_page.js | 12 ++++++++++++ lib/iobio-charts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/home_page.js b/home_page.js index d37e921..48afa79 100644 --- a/home_page.js +++ b/home_page.js @@ -166,6 +166,8 @@ class HomePage extends HTMLElement { this.attachShadow({ mode: 'open' }); this.shadowRoot.appendChild(homePageTemplate.content.cloneNode(true)); this.initDOMElements(); + + this.currentAlignmentUrl = null; } initDOMElements() { @@ -229,6 +231,16 @@ class HomePage extends HTMLElement { // Navigate to the main content page with the URLs navigateToMainContent(url1, url2) { + if (url1 !== this.currentAlignmentUrl) { + this.currentAlignmentUrl = url1; + this.dispatchEvent(new CustomEvent('alignment-data-request', + { + bubbles: true, + composed: true + } + )); + } + const queryParams = new URLSearchParams({ 'alignment-url': url1, }); diff --git a/lib/iobio-charts b/lib/iobio-charts index 50c7a64..f95e051 160000 --- a/lib/iobio-charts +++ b/lib/iobio-charts @@ -1 +1 @@ -Subproject commit 50c7a648d5f27e7f61034b689f10121203d1ebc2 +Subproject commit f95e051bb590ce414014e15ca6b72af585b3178c From f2ac87380489faa87c3d730c430110c4f6c2c86b Mon Sep 17 00:00:00 2001 From: Yang Qi <60582494+YangQi007@users.noreply.github.com> Date: Tue, 1 Oct 2024 11:39:10 -0600 Subject: [PATCH 2/3] Renamed the event --- home_page.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home_page.js b/home_page.js index 48afa79..b849b08 100644 --- a/home_page.js +++ b/home_page.js @@ -233,7 +233,7 @@ class HomePage extends HTMLElement { navigateToMainContent(url1, url2) { if (url1 !== this.currentAlignmentUrl) { this.currentAlignmentUrl = url1; - this.dispatchEvent(new CustomEvent('alignment-data-request', + this.dispatchEvent(new CustomEvent('toggle-loading-indicator-bamview', { bubbles: true, composed: true From ace3cd705282a6184c11b9dc7bd1f5cfeb9af122 Mon Sep 17 00:00:00 2001 From: Yang Qi <60582494+YangQi007@users.noreply.github.com> Date: Tue, 1 Oct 2024 23:22:22 -0600 Subject: [PATCH 3/3] Created reset func in data broker --- home_page.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/home_page.js b/home_page.js index b849b08..77bc4b6 100644 --- a/home_page.js +++ b/home_page.js @@ -1,4 +1,4 @@ -import { commonCss } from './lib/iobio-charts/common.js'; +import { commonCss, getDataBroker } from './lib/iobio-charts/common.js'; import { navigateTo } from './router.js'; import { URLInputModal } from './url_input_modal.js'; import { LocalFileInputModal } from './local_file_input_modal.js'; @@ -180,6 +180,8 @@ class HomePage extends HTMLElement { } connectedCallback() { + this.broker = getDataBroker(this); + this.localFileButton.addEventListener('click', () => this.localFileInputModal.showModal()); // Handle the custom event from the local-file-input-modal this.localFileInputModal.addEventListener('local-file-loaded', async (event) => this.handleLocalFileLoaded(event)); @@ -233,12 +235,8 @@ class HomePage extends HTMLElement { navigateToMainContent(url1, url2) { if (url1 !== this.currentAlignmentUrl) { this.currentAlignmentUrl = url1; - this.dispatchEvent(new CustomEvent('toggle-loading-indicator-bamview', - { - bubbles: true, - composed: true - } - )); + // reset the state + this.broker.reset(); } const queryParams = new URLSearchParams({