chore: better cli params for ui configs
Deploy bin / deploy (push) Successful in 1s
Deploy agebd python package / deploy (push) Successful in 3s

This commit is contained in:
Benjamin Labrecque
2026-07-09 15:28:18 +02:00
parent 2194f65fe7
commit 89434d24a0
5 changed files with 27 additions and 17 deletions
+8 -6
View File
@@ -190,13 +190,15 @@ class ServiceManagerUI(BaseModel):
tree = ET.parse(cls.config_path)
return ServiceManagerUI(tree=tree)
def update_xml(self, service: Service, ui_name: str, panelcmd: str) -> None:
num_macro_elements = self._update_macro(service=service, ui_name=ui_name, panelcmd=panelcmd)
def update_xml(self, service: Service, ui_name: str, ui_filename: str) -> None:
num_macro_elements = self._update_macro(
service=service, ui_name=ui_name, ui_filename=ui_filename
)
self._update_heights(num_macro_elements=num_macro_elements)
def _update_macro(self, service: Service, ui_name: str, panelcmd: str) -> int:
def _update_macro(self, service: Service, ui_name: str, ui_filename: str) -> int:
new_macro_element = _ServiceManagerUIMacroElement(
service_name_upper=service.name_upper, ui_name=ui_name, panelcmd=panelcmd
service_name_upper=service.name_upper, ui_name=ui_name, ui_filename=ui_filename
)
num_macro_elements = None
@@ -294,7 +296,7 @@ class _ServiceManagerUIMacroElement(BaseModel):
ui_name: str
panel: int = 1
svc_exist: int = 1
panelcmd: str
ui_filename: str
def to_string(self) -> str:
return (
@@ -303,5 +305,5 @@ class _ServiceManagerUIMacroElement(BaseModel):
f"name={self.ui_name},"
f"panel={self.panel},"
f"svc_exist={self.svc_exist},"
f"panelcmd={self.panelcmd}"
f"panelcmd=A_BD_{self.ui_filename}.ui"
)
+6 -4
View File
@@ -1,5 +1,4 @@
import logging
import re
import shutil
import subprocess
from pathlib import Path
@@ -35,11 +34,11 @@ SERVICE_DEST_DIR = REPO_ROOT / "services"
class ServiceCreator:
def __init__(self, user: str, ioc_description: str, ui_name: str, panelcmd: str) -> None:
def __init__(self, user: str, ioc_description: str, ui_name: str, ui_filename: str) -> None:
self.user = user
self.ioc_description = ioc_description
self.ui_name = ui_name
self.panelcmd = panelcmd
self.ui_filename = ui_filename
def add_service(self, name: str):
repo = git.Repo(REPO_ROOT)
@@ -61,7 +60,9 @@ class ServiceCreator:
master_ioc_subs.update_content(service_name=service.name_upper)
service_manager_old = ServiceManagerUI.read_from_file()
service_manager = ServiceManagerUI.read_from_file()
service_manager.update_xml(service=service, ui_name=self.ui_name, panelcmd=self.panelcmd)
service_manager.update_xml(
service=service, ui_name=self.ui_name, ui_filename=self.ui_filename
)
branch_name = f"feature/add-service-{service.dir_name}"
delete_local_branch(repo, branch_name)
@@ -118,6 +119,7 @@ class ServiceCreator:
"service_name_upper": service.name_upper,
"service_name_lower": service.name_lower,
"user": user,
"ui_filename": self.ui_filename,
},
)
+12 -6
View File
@@ -9,7 +9,7 @@ service = typer.Typer(no_args_is_help=True)
REPO_ROOT = get_git_root(__file__)
@service.command()
@service.command(no_args_is_help=True)
def add(
name: str = typer.Option(..., "--name", "-n"),
user: str = typer.Option(..., "--user", "-u"),
@@ -17,10 +17,16 @@ def add(
..., "--ioc-description", "-d", help="See <repo-root>/docs/ioc/ioc_overview.md for examples"
),
ui_name: str = typer.Option(
..., "--ui-name", help="See <repo-root>/qt/A_BD_ServiceManager.ui for examples"
...,
"--ui-name",
help="This is the name that will be used for the service in the UI."
"See <repo-root>/qt/A_BD_ServiceManager.ui for examples",
),
panelcmd: str = typer.Option(
..., "--panelcmd", "-p", help="See <repo-root>/qt/A_BD_ServiceManager.ui for examples"
ui_filename: str = typer.Option(
...,
"--ui-filename",
"-f",
help="The <ui-filename> in 'A_BD_<ui-filename>.ui'; See <repo-root>/qt/A_BD_ServiceManager.ui for examples",
),
):
init_logging()
@@ -28,12 +34,12 @@ def add(
user=user, # TODO: read from 'whoami'?
ioc_description=ioc_description,
ui_name=ui_name, # TODO: make this standard?
panelcmd=panelcmd, # TODO: make this standard?
ui_filename=ui_filename, # TODO: make this standard?
)
service_creator.add_service(name=name)
@service.command()
@service.command(no_args_is_help=True)
def list():
registry = ServiceRegistry.read_from_config()
services = registry.get_services()
+1 -1
View File
@@ -49,7 +49,7 @@
- systemctl --user daemon-reload
- systemctl --user enable /sls/bd/bin/systemd/AGEBD-SERVICE-TUNEFBX.service
- systemctl --user start AGEBD-SERVICE-TUNEFBX.service
- [ ] Add to Service overview GUI
- [x] Add to Service overview GUI
- In git repo gitea/sls_bd_qt https://gitea.psi.ch/autodeploy_config/sls_bd_qt
- Add lines to service management gui for new service >> caqtdm_designer A_BD_ServiceManager.ui
- Test updated GUI: >> caqtdm A_BD_ServiceManager.ui