instant ui launch

This commit is contained in:
Marsway 2026-03-24 13:00:40 +08:00
parent 527ef78d36
commit b4a832ae69
2 changed files with 28 additions and 1 deletions

View File

@ -203,6 +203,12 @@
currentUIOptions = await res.json();
renderSelect('dept_ou', currentUIOptions.ou_list, '请选择部门 OU...');
renderSelect('base_group', currentUIOptions.base_group_list, '请选择基础组...');
// 如果列表包含 staff设置为默认选项
if (currentUIOptions.base_group_list && currentUIOptions.base_group_list.includes('staff')) {
document.getElementById('base_group').value = 'staff';
}
renderCheckboxes('project_groups_container', 'project_groups_input', currentUIOptions.project_group_list);
renderCheckboxes('resource_groups_container', 'resource_groups_input', currentUIOptions.resource_group_list);
}

23
run.sh
View File

@ -1,15 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail
PYTHON_BIN="/opt/homebrew/Caskroom/miniconda/base/bin/python"
PYTHON_BIN="python3"
CONFIG_PATH="config/config.yaml"
INPUT_FILE=""
DRY_RUN="false"
CONTINUE_ON_ERROR="true"
COMMAND=""
usage() {
cat <<'EOF'
Usage:
./run.sh ui
./run.sh
./run.sh -f users.csv
./run.sh -f users.xlsx
@ -17,6 +19,9 @@ Usage:
./run.sh -f users.xlsx --continue-on-error false
./run.sh -c config/config.yaml
Commands:
ui Start the Web UI in the background on port 9999
Options:
-f <file> Batch input file (.csv/.xlsx). If omitted, interactive mode is used.
-c <path> YAML config path (default: config/config.yaml)
@ -26,6 +31,12 @@ Options:
EOF
}
# 检查是否为独立的 ui 命令
if [[ "${1:-}" == "ui" ]]; then
COMMAND="ui"
shift
fi
while [[ $# -gt 0 ]]; do
case "$1" in
-f)
@ -60,6 +71,16 @@ while [[ $# -gt 0 ]]; do
esac
done
if [[ "${COMMAND}" == "ui" ]]; then
mkdir -p state
LOG_FILE="state/web.log"
nohup "${PYTHON_BIN}" -m ad_user_creator.main --config "${CONFIG_PATH}" web --port 9999 > "${LOG_FILE}" 2>&1 &
echo "UI 服务已在后台启动,监听 http://0.0.0.0:9999"
echo "PID: $!"
echo "日志: ${LOG_FILE}"
exit 0
fi
if [[ -z "${INPUT_FILE}" ]]; then
CMD=("${PYTHON_BIN}" -m ad_user_creator.main --config "${CONFIG_PATH}" interactive)
if [[ "${DRY_RUN}" == "true" ]]; then