Skip to content

Commit

Permalink
update qeinputgenerator url
Browse files Browse the repository at this point in the history
  • Loading branch information
eimrek committed Oct 8, 2024
1 parent bb252df commit b6fe976
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.ipynb_checkpoints/
*.log
*.pyc
*.egg-info
*.egg-info
build/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
10 changes: 6 additions & 4 deletions tools_optimade_client/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -39,15 +41,15 @@ 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();
document.body.removeChild(link);
}}
}}
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</button>
"""

Expand All @@ -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__(
Expand All @@ -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:
Expand Down

0 comments on commit b6fe976

Please sign in to comment.