From 9e6ab873c0a159911af7ba34cedee5f988299de5 Mon Sep 17 00:00:00 2001 From: Josemi Date: Thu, 9 Jan 2025 18:51:36 +0100 Subject: [PATCH] wc: Refactor render method of jupyter notebook tool #TASK-7216 #TASK-7100 --- .../commons/analysis/jupyter-notebook.js | 87 ++++++++++--------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/src/webcomponents/commons/analysis/jupyter-notebook.js b/src/webcomponents/commons/analysis/jupyter-notebook.js index f89df79ad..7e53b1376 100644 --- a/src/webcomponents/commons/analysis/jupyter-notebook.js +++ b/src/webcomponents/commons/analysis/jupyter-notebook.js @@ -69,56 +69,57 @@ export default class JupyterNotebook extends LitElement { // })); } - renderContent() { - // Check Project exists - if (!this.opencgaSession.study) { - return guardPage("No OpenCGA study available to run an analysis. Please login to continue."); - } - - if (!this.enter) { - return html` -
-
-
- -
-
- Create and execute Jupyter Notebooks to analyze your data on this OpenCGA instance. - Please note that this may involve additional costs. -
-
- -
+ renderWelcomeView() { + return html` +
+
+
+
-
- `; - } else { - const userId = this.opencgaSession.user.id; - const organizationId = this.opencgaSession.organization.id; - const serverUrl = this.opencgaSession.server.host.replace("/opencga", ""); - const jupyterLoginUrl = serverUrl + "/jupyter/hub/login"; - const token = this.opencgaSession.token; - - return html` -
-
- +
+ Create and execute Jupyter Notebooks to analyze your data on this OpenCGA instance. + Please note that this may involve additional costs. +
+
+
- `; - } +
+ `; + } + + renderJupyterFrame() { + const userId = this.opencgaSession.user.id; + const organizationId = this.opencgaSession.organization.id; + const serverUrl = this.opencgaSession.server.host.replace("/opencga", ""); + const jupyterLoginUrl = serverUrl + "/jupyter/hub/login"; + const token = this.opencgaSession.token; + + return html` +
+
+ +
+
+ `; } render() { + if (!this.opencgaSession.study) { + return guardPage("No OpenCGA study available to run an analysis. Please login to continue."); + } + return html` - - ${this.renderContent()} + + + ${this.enter ? this.renderJupyterFrame() : this.renderWelcomeView()} `; }