style(frontend): 精简脚本语言提示并移除解释器输入框
- 脚本语言提示从大块灰色卡片改成下拉框右侧的一行说明 - Python 表单不再显示解释器输入框,固定使用 .venv 里的 Python - 虚拟环境目录字段改为全宽并明确自动探测语义 - 非 Python 语言仍由语言自动设置 cmd.exe/node.exe/lua.exe,API 仍可传自定义 interpreter
This commit is contained in:
@@ -228,8 +228,9 @@ queued ──► running ──► succeeded / failed / timed_out / cancelled
|
||||
- 没装 uv:必须手动准备虚拟环境;Python 任务缺少 `.venv` 时运行失败并给出提示。
|
||||
- 既没有虚拟环境、也没有 pyproject/requirements:编辑器显示错误,Python 任务运行失败。
|
||||
Python 任务不再静默回退到系统解释器。
|
||||
- 解释器字段只对 Python 显示:留空会自动使用虚拟环境里的 `python.exe`;
|
||||
选择 Shell / Node / Lua 时不需要手填解释器,分别固定使用 `cmd.exe` / `node.exe` / `lua.exe`。
|
||||
- 解释器由语言自动决定,界面不再显示解释器输入框:
|
||||
Python 始终使用虚拟环境里的 Python,Shell 使用 `cmd.exe`,Node 使用 `node.exe`,Lua 使用 `lua.exe`。
|
||||
自定义解释器仍可通过 API 的 `action.interpreter` 字段传入。
|
||||
|
||||
命中虚拟环境后注入:
|
||||
|
||||
@@ -253,7 +254,7 @@ queued ──► running ──► succeeded / failed / timed_out / cancelled
|
||||
- **编辑器**:先选任务类型(脚本 / HTTP / 二进制),脚本类型再选语言(Python / Shell / Node / Lua),
|
||||
非 Python 语言会自动隐藏虚拟环境字段并调整脚本占位符;Cron 预览(实时计算未来 3/5/8/10 次)、
|
||||
时区下拉、虚拟环境状态条、调用预览;探测到虚拟环境会自动回填「虚拟环境目录」,仍可手动修改;
|
||||
缺少虚拟环境但项目有依赖文件时可直接用 uv 创建。解释器字段只在 Python 下显示,留空自动使用虚拟环境 Python。
|
||||
缺少虚拟环境但项目有依赖文件时可直接用 uv 创建。解释器由语言自动选择,界面不再要求手填。
|
||||
- **目录选择**:页面内目录浏览器(盘符 → 逐级进入 → 使用此目录),同时保留手动输入。
|
||||
- **日志弹窗**:运行历史筛选、SSE 实时日志、取消运行、下载日志、Escape/焦点陷阱。
|
||||
- **Python 镜像**:内置清华 TUNA / 阿里云 / 中科大 / PyPI 官方;可新增、编辑、启用停用、设为默认。
|
||||
|
||||
+25
-18
@@ -292,23 +292,21 @@
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
/* 虚拟环境目录通常是一条完整路径,给它更多宽度;解释器名很短 */
|
||||
.venv-grid {
|
||||
grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr);
|
||||
}
|
||||
|
||||
.language-grid {
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.language-hint {
|
||||
.script-language-row {
|
||||
display: flex;
|
||||
min-height: 36px;
|
||||
align-items: center;
|
||||
border: 1px solid var(--su-border);
|
||||
border-radius: var(--su-radius-md);
|
||||
padding: 8px 12px;
|
||||
background-color: var(--su-bg-subtle);
|
||||
align-items: flex-end;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.script-language-field {
|
||||
min-width: 0;
|
||||
flex: 0 0 260px;
|
||||
}
|
||||
|
||||
.script-language-hint {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.form-select {
|
||||
@@ -1118,8 +1116,17 @@
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.venv-grid {
|
||||
grid-template-columns: 1fr;
|
||||
.script-language-row {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.script-language-field {
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.script-language-hint {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.cron-run-grid {
|
||||
|
||||
@@ -526,28 +526,28 @@ export function TaskEditorModal({
|
||||
</div>
|
||||
|
||||
{actionType === 'script' ? (
|
||||
<div className="form-grid language-grid">
|
||||
<FormField label="脚本语言">
|
||||
<Controller
|
||||
control={control}
|
||||
name="script.language"
|
||||
render={({ field }) => (
|
||||
<Select
|
||||
className="form-select"
|
||||
options={SCRIPT_LANGUAGE_OPTIONS}
|
||||
value={field.value}
|
||||
onChange={(value) =>
|
||||
applyScriptLanguage(value as ScriptLanguage)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</FormField>
|
||||
<div className="language-hint">
|
||||
<Text size="sm" tone="sub">
|
||||
{scriptMeta.hint}
|
||||
</Text>
|
||||
<div className="script-language-row">
|
||||
<div className="script-language-field">
|
||||
<FormField label="脚本语言">
|
||||
<Controller
|
||||
control={control}
|
||||
name="script.language"
|
||||
render={({ field }) => (
|
||||
<Select
|
||||
className="form-select"
|
||||
options={SCRIPT_LANGUAGE_OPTIONS}
|
||||
value={field.value}
|
||||
onChange={(value) =>
|
||||
applyScriptLanguage(value as ScriptLanguage)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</FormField>
|
||||
</div>
|
||||
<Text className="script-language-hint" size="sm" tone="sub">
|
||||
{scriptMeta.hint}
|
||||
</Text>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
@@ -580,34 +580,19 @@ export function TaskEditorModal({
|
||||
|
||||
{isPythonScript ? (
|
||||
<>
|
||||
<div className="form-grid venv-grid">
|
||||
<FormField
|
||||
label="虚拟环境目录 (可选)"
|
||||
htmlFor="task-venv"
|
||||
hint="检测到虚拟环境会自动填入,可直接修改;留空则按工作目录自动探测"
|
||||
error={errors.script?.venv?.message}
|
||||
>
|
||||
<Input
|
||||
id="task-venv"
|
||||
{...register('script.venv')}
|
||||
className="mono-input"
|
||||
placeholder="例如:.venv"
|
||||
/>
|
||||
</FormField>
|
||||
<FormField
|
||||
label="解释器(可选)"
|
||||
htmlFor="task-interpreter"
|
||||
hint="留空自动使用虚拟环境 Python;也可以填自定义 Python 路径"
|
||||
error={errors.script?.interpreter?.message}
|
||||
>
|
||||
<Input
|
||||
id="task-interpreter"
|
||||
{...register('script.interpreter')}
|
||||
className="mono-input"
|
||||
placeholder="留空自动使用虚拟环境 Python"
|
||||
/>
|
||||
</FormField>
|
||||
</div>
|
||||
<FormField
|
||||
label="虚拟环境目录"
|
||||
htmlFor="task-venv"
|
||||
hint="自动探测项目里的 .venv;需要时也可以手动指定。Python 任务始终使用 .venv 里的 Python"
|
||||
error={errors.script?.venv?.message}
|
||||
>
|
||||
<Input
|
||||
id="task-venv"
|
||||
{...register('script.venv')}
|
||||
className="mono-input"
|
||||
placeholder="留空自动探测,例如 .venv"
|
||||
/>
|
||||
</FormField>
|
||||
|
||||
<VenvDetectorBar
|
||||
workingDir={debouncedWorkingDir}
|
||||
|
||||
@@ -31,7 +31,7 @@ export const SCRIPT_LANGUAGE_META: Record<
|
||||
defaultScript: 'main.py',
|
||||
scriptLabel: '脚本文件或相对路径',
|
||||
scriptPlaceholder: 'main.py 或 scripts\\sync.py',
|
||||
hint: '优先复用项目 .venv;没有环境时可用 uv 从 pyproject.toml / requirements.txt 创建,运行时会注入虚拟环境变量。',
|
||||
hint: '自动使用项目 .venv;没有环境时可在下方用 uv 创建。',
|
||||
},
|
||||
shell: {
|
||||
label: 'Shell (cmd)',
|
||||
@@ -47,7 +47,7 @@ export const SCRIPT_LANGUAGE_META: Record<
|
||||
defaultScript: 'index.js',
|
||||
scriptLabel: 'JavaScript 文件或相对路径',
|
||||
scriptPlaceholder: 'index.js 或 scripts\\worker.js',
|
||||
hint: '通过 node.exe 执行脚本,不需要虚拟环境;需要本机 PATH 中已安装 Node.js。',
|
||||
hint: '通过 node.exe 执行,不需要虚拟环境;需已安装 Node.js。',
|
||||
},
|
||||
lua: {
|
||||
label: 'Lua',
|
||||
@@ -55,7 +55,7 @@ export const SCRIPT_LANGUAGE_META: Record<
|
||||
defaultScript: 'main.lua',
|
||||
scriptLabel: 'Lua 文件或相对路径',
|
||||
scriptPlaceholder: 'main.lua 或 scripts\\task.lua',
|
||||
hint: '通过 lua.exe 执行脚本,不需要虚拟环境;需要本机 PATH 中已安装 Lua。',
|
||||
hint: '通过 lua.exe 执行,不需要虚拟环境;需已安装 Lua。',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user