From f66ed22a088ac5d67ff42049978441f0f04cc643 Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 27 Nov 2024 12:42:06 +0100 Subject: [PATCH 1/6] wc: Fix condition to set an app as active in the sidebar #TASK-7216 #TASK-7100 --- src/webcomponents/commons/layout/layout-sidebar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webcomponents/commons/layout/layout-sidebar.js b/src/webcomponents/commons/layout/layout-sidebar.js index aaa1000f5..def64bde4 100644 --- a/src/webcomponents/commons/layout/layout-sidebar.js +++ b/src/webcomponents/commons/layout/layout-sidebar.js @@ -44,7 +44,7 @@ export default class LayoutSidebar extends LitElement { } renderButton(app) { - const active = this.currentUrl.startsWith(`#${app.id}`); // url always start with the app ID + const active = this.currentUrl.startsWith(`#${app.id}/`); // url always start with the app ID return html` Date: Wed, 27 Nov 2024 14:04:57 +0100 Subject: [PATCH 2/6] iva-app: Fix issue when the last active study is different from the study in the URL #TASK-7216 #TASK-7100 --- src/sites/iva/iva-app.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sites/iva/iva-app.js b/src/sites/iva/iva-app.js index fd43256ce..47a3c6686 100644 --- a/src/sites/iva/iva-app.js +++ b/src/sites/iva/iva-app.js @@ -302,6 +302,7 @@ class IvaApp extends LitElement { if (changedProperties.has("opencgaSession")) { this.opencgaSessionObserver(); } + super.update(changedProperties); } @@ -706,7 +707,7 @@ class IvaApp extends LitElement { // 4. parse project and study if (hashProject !== this.opencgaSession?.project?.id || hashStudy !== this.opencgaSession?.study?.id) { - return this.changeActiveStudy(`${this.opencgaSession.user.id}@${hashProject}:${hashStudy}`); + this.changeActiveStudy(`${this.opencgaSession.user.id}@${hashProject}:${hashStudy}`); } // 5. save app and tool From 1ca5ac29202498625a114af96b04e02d0f12c3dc Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 27 Nov 2024 14:41:51 +0100 Subject: [PATCH 3/6] wc: Fix link to interpreter tool from grid #TASK-7216 #TASK-7100 --- src/webcomponents/clinical/clinical-analysis-grid.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/webcomponents/clinical/clinical-analysis-grid.js b/src/webcomponents/clinical/clinical-analysis-grid.js index 801b7fd76..8b0fa810a 100644 --- a/src/webcomponents/clinical/clinical-analysis-grid.js +++ b/src/webcomponents/clinical/clinical-analysis-grid.js @@ -216,7 +216,9 @@ export default class ClinicalAnalysisGrid extends LitElement { caseFormatter(value, row) { if (row?.id) { - const url = `#interpreter/${this.opencgaSession.project.id}/${this.opencgaSession.study.id}/${row.id}`; + // Note: we have to maintain the URL structure, so if we are inside an app we have to maintain the app + const hashItems = window.location.hash.replace("#", "").split("/"); + const url = `#${[...hashItems.slice(0, -3), "interpreter", this.opencgaSession.project.id, this.opencgaSession.study.id].join("/")}?id=${row.id}`; return `
From 811d8161a4bb2c91d09047b4b42667961bd5e18e Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 27 Nov 2024 14:42:29 +0100 Subject: [PATCH 4/6] wc: Fix link to exit from interpreter tool #TASK-7216 #TASK-7100 --- .../variant/interpretation/variant-interpreter.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/webcomponents/variant/interpretation/variant-interpreter.js b/src/webcomponents/variant/interpretation/variant-interpreter.js index 4767717ee..9da5f181d 100644 --- a/src/webcomponents/variant/interpretation/variant-interpreter.js +++ b/src/webcomponents/variant/interpretation/variant-interpreter.js @@ -425,6 +425,10 @@ class VariantInterpreter extends LitElement { } renderToolbarRightContent() { + // Note: we have to maintain the URL structure, so if we are inside an app we have to maintain the app + const hashItems = window.location.hash.replace("#", "").split("/"); + const exitUrl = "#" + [...hashItems.slice(0, -3), "clinical-analysis-portal", this.opencgaSession.project.id, this.opencgaSession.study.id].join("/"); + return html`
${this.clinicalAnalysis?.interpretation ? html` @@ -492,7 +496,7 @@ class VariantInterpreter extends LitElement {
  • - + Exit Interpreter
  • From 4a70a800939b7c5faf2b96015b378aaca4d55396 Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 27 Nov 2024 19:27:47 +0100 Subject: [PATCH 5/6] wc: Initial implementation of analysis-tools component #TASK-7216 #TASK-7100 --- src/webcomponents/analysis/analysis-tools.js | 93 ++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 src/webcomponents/analysis/analysis-tools.js diff --git a/src/webcomponents/analysis/analysis-tools.js b/src/webcomponents/analysis/analysis-tools.js new file mode 100644 index 000000000..a69ff6922 --- /dev/null +++ b/src/webcomponents/analysis/analysis-tools.js @@ -0,0 +1,93 @@ +import {LitElement, html, nothing} from "lit"; +import "../commons/tool-header.js"; +import "../variant/analysis/sample-variant-stats-analysis.js"; + +export default class AnalysisTools extends LitElement { + + constructor() { + super(); + this.#init(); + } + + createRenderRoot() { + return this; + } + + static get properties() { + return { + opencgaSession: { + type: Object, + }, + }; + } + + #init() { + this._tool = "sample-variant-stats"; + this._config = this.getDefaultConfig(); + } + + renderSidebarItems() { + return this._config.availableTools.map(tool => { + if (tool.category) { + return html` +
    + ${tool.name} +
    + ` + } else { + const active = this._tool === tool.id; + return html` + + ${tool.name} + + `; + } + }); + } + + renderTool() { + let content = nothing; + switch (this._tool) { + case "sample-variant-stats": + content = html` + + + `; + break; + } + return content; + } + + render() { + return html` + + +
    +
    + ${this.renderSidebarItems()} +
    +
    +
    + ${this.renderTool()} +
    +
    +
    + `; + } + + getDefaultConfig() { + return { + availableTools: [ + {name: "Summary Stats", category: true}, + {id: "sample-variant-stats", name: "Sample Variant Stats"}, + {id: "cohort-variant-stats", name: "Cohort Variant Stats"}, + ], + }; + } + +} + +customElements.define("analysis-tools", AnalysisTools); From e2dc2ef26afe0ca13ea7750c326a86057fc9d667 Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 27 Nov 2024 19:28:12 +0100 Subject: [PATCH 6/6] iva-app: Add analysis-tools as a new tool #TASK-7216 #TASK-7100 --- src/sites/iva/iva-app.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sites/iva/iva-app.js b/src/sites/iva/iva-app.js index 47a3c6686..b8291fc01 100644 --- a/src/sites/iva/iva-app.js +++ b/src/sites/iva/iva-app.js @@ -96,6 +96,7 @@ import "../../webcomponents/study/admin/variant/operations-admin.js"; import "../../webcomponents/user/user-profile.js"; import "../../webcomponents/api/rest-api.js"; import "../../webcomponents/note/note-browser.js"; +import "../../webcomponents/analysis/analysis-tools.js"; import "../../webcomponents/commons/layouts/custom-footer.js"; import "../../webcomponents/commons/layouts/custom-navbar.js"; @@ -1877,6 +1878,13 @@ class IvaApp extends LitElement {
    `; break; + case "analysis-tools": + content = html` + + + `; + break; default: // TODO: check for extensions // ExtensionsManager.getTools().map(tool => html`