Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use ui.menu_blocklist to hide and ui.menu_inactivelist to disable menu items #1733

Merged
merged 4 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/1733.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use `ui.menu_blocklist` to hide and `ui.menu_inactivelist` to disable menu items.
6 changes: 4 additions & 2 deletions configs/webserver/sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ brand = "Lablup Cloud"
# default_environment = 'index.docker.io/lablup/python-tensorflow'
# Default environment to import GitHub repositories / notebooks
# default_import_environment = 'index.docker.io/lablup/python:3.6-ubuntu18.04'
# Comma-separated sidebar menu pages
#menu_blocklist = "statistics,pipeline"
# Comma-separated sidebar menu pages to hide
#menu_blocklist = "pipeline"
# Comma-separated sidebar menu pages to disable
#menu_inactivelist = "statistics"

[api]
domain = "default"
Expand Down
7 changes: 5 additions & 2 deletions src/ai/backend/install/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ async def configure_webserver(self) -> None:
redis_table["password"] = halfstack.redis_password
data["session"]["redis"] = redis_table # type: ignore
data["ui"]["menu_blocklist"] = ",".join(service.webui_menu_blocklist) # type: ignore
data["ui"]["menu_inactivelist"] = ",".join(service.webui_menu_inactivelist) # type: ignore
with conf_path.open("w") as fp:
tomlkit.dump(data, fp)

Expand Down Expand Up @@ -749,7 +750,8 @@ def hydrate_install_info(self) -> InstallInfo:
webserver_addr=ServerAddr(HostPortPair("127.0.0.1", 8090)),
webserver_ipc_base_path="ipc/webserver",
webserver_var_base_path="var/webserver",
webui_menu_blocklist=["statistics", "pipeline"],
webui_menu_blocklist=["pipeline"],
webui_menu_inactivelist=["statistics"],
manager_addr=ServerAddr(HostPortPair("127.0.0.1", 8091)),
storage_proxy_manager_auth_key=secrets.token_hex(32),
manager_ipc_base_path="ipc/manager",
Expand Down Expand Up @@ -835,7 +837,8 @@ def hydrate_install_info(self) -> InstallInfo:
webserver_addr=ServerAddr(HostPortPair("127.0.0.1", 8090)),
webserver_ipc_base_path="ipc/webserver",
webserver_var_base_path="var/webserver",
webui_menu_blocklist=["statistics", "pipeline"],
webui_menu_blocklist=["pipeline"],
webui_menu_inactivelist=["statistics"],
manager_addr=ServerAddr(HostPortPair("127.0.0.1", 8091)),
storage_proxy_manager_auth_key=secrets.token_urlsafe(32),
manager_ipc_base_path="ipc/manager",
Expand Down
1 change: 1 addition & 0 deletions src/ai/backend/install/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class ServiceConfig:
webserver_ipc_base_path: str
webserver_var_base_path: str
webui_menu_blocklist: list[str]
webui_menu_inactivelist: list[str]
local_proxy_addr: ServerAddr
agent_rpc_addr: ServerAddr
agent_watcher_addr: ServerAddr
Expand Down
2 changes: 2 additions & 0 deletions src/ai/backend/web/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
t.Key("default_environment", default=None): t.Null | t.String,
t.Key("default_import_environment", default=None): t.Null | t.String,
t.Key("menu_blocklist", default=None): t.Null | tx.StringList(empty_str_as_empty_list=True),
t.Key("menu_inactivelist", default=None): t.Null
| tx.StringList(empty_str_as_empty_list=True),
}).allow_extra("*"),
t.Key("api"): t.Dict({
t.Key("domain"): t.String,
Expand Down
1 change: 1 addition & 0 deletions src/ai/backend/web/templates/config.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ connectionMode = "SESSION"

[menu]
{% toml_strlist_field "blocklist" config["ui"]["menu_blocklist"] %}
{% toml_strlist_field "inactivelist" config["ui"]["menu_inactivelist"] %}

[plugin]
{% toml_strlist_field "page" config["plugin"]["page"] %}
Expand Down
Loading