diff --git a/.gitignore b/.gitignore index 1c8f378..f2e8045 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .ipynb_checkpoints/ *.log *.pyc -*.egg-info \ No newline at end of file +*.egg-info +build/ \ No newline at end of file diff --git a/README.md b/README.md index d4b6f76..c40cab4 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ It runs a Jupyter notebook in VoilĂ  with the [Materials Cloud VoilĂ  template]( ## Run locally ```bash -pip install . +pip install -e . voila --Voila.config_file_paths=./ OPTIMADE-Client.ipynb ``` diff --git a/tools_optimade_client/upload.py b/tools_optimade_client/upload.py index 6166228..179f7a8 100644 --- a/tools_optimade_client/upload.py +++ b/tools_optimade_client/upload.py @@ -11,6 +11,8 @@ from ipyoptimade.warnings import OptimadeClientWarning from traitlets import traitlets +QE_INPUT_APP_URL_PROD = "https://qeinputgenerator.materialscloud.io" +QE_INPUT_APP_URL_DEV = "https://qeinputgenerator.matcloud.xyz" class QEInputButton(ipw.HTML): """QE Input Generator upload button @@ -39,7 +41,7 @@ class QEInputButton(ipw.HTML): if (XHR.readyState === 4) {{ var response = JSON.parse(XHR.responseText); var link = document.createElement('a'); - link.href = response.redirect; + link.href = '{domain}' + response.redirect; link.target = '_blank'; document.body.appendChild(link); link.click(); @@ -47,7 +49,7 @@ class QEInputButton(ipw.HTML): }} }} -XHR.open('POST', 'https://{subdomain}.materialscloud.org/qeinputgenerator/compute/upload_structure/') +XHR.open('POST', '{domain}/compute/upload_structure/') XHR.send(FD);">Use in QE Input Generator """ @@ -65,7 +67,7 @@ def __init__(self, button_style: Union[ButtonStyle, str] = None, **kwargs) -> No else: self._button_style = ButtonStyle.DEFAULT - self._default_subdomain = "dev-tools" if DEVELOPMENT_MODE else "tools" + self._default_domain = QE_INPUT_APP_URL_DEV if DEVELOPMENT_MODE else QE_INPUT_APP_URL_PROD kwargs.pop("value", None) super().__init__( @@ -88,7 +90,7 @@ def _format_button(self, **kwargs) -> str: button_style=self.style.value, data=kwargs.get("data", ""), disabled=kwargs.get("disabled", "disabled"), - subdomain=kwargs.get("subdomain", self._default_subdomain), + domain=kwargs.get("domain", self._default_domain), ) def format_button(self, disabled: bool = True, data: str = None) -> None: