Skip to content

Commit f436a3c

Browse files
authored
Merge pull request #2 from AuScalableDroneCloud/matt/tracker-97
Clean up JupyterHub links for Tracker#97
2 parents 8c46881 + f413386 commit f436a3c

File tree

3 files changed

+26
-20
lines changed

3 files changed

+26
-20
lines changed

pipelines.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,6 @@ def get_fullurl(pipeline, username, use_mounts=True, encode_again=True, image='b
113113
fullurl = urllib.parse.quote_plus(fullurl)
114114
return fullurl
115115

116+
def get_baseurl():
117+
host = os.environ.get('WO_HOST')
118+
return f'https://jupyter.{host}/'

plugin.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import os
1616
host = os.environ.get('WO_HOST')
17-
from .pipelines import get_json, get_fullurl
17+
from .pipelines import get_json, get_fullurl, get_baseurl
1818
import requests
1919
import urllib.parse
2020

@@ -29,20 +29,20 @@ def main_menu_user(self, user):
2929
submenu = []
3030
if not user.is_authenticated:
3131
return []
32-
pipelines = get_json(user)
33-
for p in pipelines:
34-
#Set the open function, will alert and abort if inputs not available
35-
function = 'pipeline_run';
36-
if "inputs" in p and "task" in p["inputs"]:
37-
function = 'pipeline_task';
38-
elif "inputs" in p and "project" in p["inputs"]:
39-
function = 'pipeline_project';
32+
# pipelines = get_json(user)
33+
# for p in pipelines:
34+
# #Set the open function, will alert and abort if inputs not available
35+
# function = 'pipeline_run';
36+
# if "inputs" in p and "task" in p["inputs"]:
37+
# function = 'pipeline_task';
38+
# elif "inputs" in p and "project" in p["inputs"]:
39+
# function = 'pipeline_project';
4040

41-
#Construct the next= url
42-
tag = p["tag"]
43-
image = p["image"]
44-
fullurl = get_fullurl(p, user.email)
45-
submenu += [Menu(p["name"], f"javascript:{function}('{fullurl}');", p["icon"])]
41+
# #Construct the next= url
42+
# tag = p["tag"]
43+
# image = p["image"]
44+
# fullurl = get_fullurl(p, user.email)
45+
# submenu += [Menu(p["name"], f"javascript:{function}('{fullurl}');", p["icon"])]
4646

4747
prjmenu = [Menu("Add To Saved", f"javascript:save_open_projects();", "fas fa-project-diagram"),
4848
Menu("Clear Saved", f"javascript:clear_open_projects();", "fas fa-trash-alt")]
@@ -52,18 +52,20 @@ def main_menu_user(self, user):
5252
#Icons: https://fontawesome.com/v5/search?m=free
5353
def_pipeline = None
5454
#def_pipeline = pipelines[0] #Use a default pipeline instead
55-
base_url = get_fullurl(def_pipeline, user.email, image="base")
56-
gpu_url = get_fullurl(def_pipeline, user.email, image="gpu")
57-
ml_url = get_fullurl(def_pipeline, user.email, image="ml")
55+
all_url = get_baseurl()
56+
# base_url = get_fullurl(def_pipeline, user.email, image="base")
57+
# gpu_url = get_fullurl(def_pipeline, user.email, image="gpu")
58+
# ml_url = get_fullurl(def_pipeline, user.email, image="ml")
5859
return [#Menu("ASDC", self.public_url(""), "fas fa-road"),
5960
Menu("ASDC Tools", "#", "fas fa-tools", submenu=[
6061
Menu("Settings", self.public_url(""), "fas fa-cog"),
6162
#Menu("JupyterHub - base", f"javascript:open_url('https://jupyter.{host}/hub/spawn/{user.email}/base?profile=base');", "fab fa-python"),
6263
#Menu("JupyterHub - gpu", f"javascript:open_url('https://jupyter.{host}/hub/spawn/{user.email}/gpu?profile=gpu');", "fab fa-python"),
6364
#Menu("JupyterHub - ml", f"javascript:open_url('https://jupyter.{host}/hub/spawn/{user.email}/ml?profile=ml');", "fab fa-python"),
64-
Menu("JupyterHub - base", f"javascript:open_url('{base_url}');", "fab fa-python"),
65-
Menu("JupyterHub - gpu", f"javascript:open_url('{gpu_url}');", "fab fa-python"),
66-
Menu("JupyterHub - ml", f"javascript:open_url('{ml_url}');", "fab fa-python"),
65+
# Menu("JupyterHub - base", f"javascript:open_url('{base_url}');", "fab fa-python"),
66+
# Menu("JupyterHub - gpu", f"javascript:open_url('{gpu_url}');", "fab fa-python"),
67+
# Menu("JupyterHub - ml", f"javascript:open_url('{ml_url}');", "fab fa-python"),
68+
Menu("JupyterHub", f"javascript:open_url('{all_url}');", "fab fa-python"),
6769
Menu("Project Files", f"javascript:file_browser('{host}', '{user.email}');", "fas fa-folder-open icon"),
6870
#Menu("Cesium", self.public_url("cesium/"), "fas fa-globe-asia"),
6971
#Menu("Terria", self.public_url("terria/"), "fas fa-map"),

public/OpenButton.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export default class OpenButton extends Component {
4646
render() {
4747
return (
4848
<Fragment>
49+
{/* Opens JupyterHub from the generated URI */}
4950
<Button href={`${this.base}&next=${encodeURIComponent(this.nextbase)}`}
5051
variant="secondary"
5152
><i className={"fab fa-python"} /> Open notebook</Button>

0 commit comments

Comments
 (0)