Skip to content

Commit

Permalink
Adding fixes for making conda-store-ui configurable from conda-store (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
costrouc authored Apr 7, 2023
1 parent 5f7adfb commit 13e7685
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
<meta charset="utf-8">
<title>conda-store</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
var GLOBAL_CONDA_STORE_STATE = {
NODE_DEBUG: null,
REACT_APP_CONTEXT: "single-page-app", // not a true setting
REACT_APP_AUTH_METHOD: "cookie",
REACT_APP_AUTH_TOKEN: "",
REACT_APP_STYLE_TYPE: "grayscale",
REACT_APP_SHOW_LOGIN_ICON: "true",
REACT_APP_API_URL: "{{ url_for('get_conda_store_ui') }}",
REACT_APP_LOGIN_PAGE_URL: "{{ url_for('get_login_method') }}?next=",
};
</script>
<script defer src="static/conda-store-ui/main.js"></script>
<link href="static/conda-store-ui/main.css" rel="stylesheet">
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="card m-2">
<div class="card-body">
<h5 class="card-title">User</h5>
<form class="m-2" action="{{ url_for('ui_list_environments') }}logout/" method="POST">
<form class="m-2" action="{{ url_for('post_logout_method') }}" method="POST">
<button type="submit" class="btn btn-outline-success my-2 my-sm-0 mr-2">Logout</button>
</form>
</div>
Expand Down
13 changes: 13 additions & 0 deletions conda-store-server/hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pathlib
import urllib.request
import shutil
import re

from hatchling.builders.hooks.plugin.interface import BuildHookInterface

Expand Down Expand Up @@ -56,3 +57,15 @@ def initialize(self, version: str, build_data: Dict[str, Any]) -> None:
source_directory / filename,
destination_directory / filename,
)

# dirty modifications (bound to break eventually!) to
# main.js to enable easy configuration see
# conda_store_server/server/templates/conda-store-ui.html
# for global variable set
with (source_directory / "main.js").open("r") as source_f:
content = source_f.read()
content = re.sub(
'"MISSING_ENV_VAR"', "GLOBAL_CONDA_STORE_STATE", content
)
with (destination_directory / "main.js").open("w") as dest_f:
dest_f.write(content)

0 comments on commit 13e7685

Please sign in to comment.