feat: 定时任务关联脚本库 + 脚本库精简为shell/python
定时任务:
- 执行类型改为 Shell脚本/Python脚本/自定义命令 三选一
- Shell/Python 类型下拉关联脚本库, 选择后预览脚本内容
- 卡片显示关联脚本名 (Preload Script 已就绪)
- 去掉 playbook 类型
脚本库:
- 去掉 powershell/yaml, 只保留 shell + python
- 后端 validation 同步 oneof=shell python
涉及文件:
- script-helpers.tsx: scriptTypes 去掉 powershell/yaml
- CronJobFormDialog.tsx: 完整重写, 脚本库下拉+预览
- CronJobManager.tsx: type 标签对齐, 脚本名展示
- automation.go: CronJob type oneof 改 shell/python/command
Script type oneof 改 shell/python
This commit is contained in:
1 parent
f05cf71121
commit
2d02d63806
4 files changed
+178
-22
No files matched your search
@@ -15,6 +15,7 @@ import {
|
||||
History,
|
||||
Loader2,
|
||||
Terminal,
|
||||
FileCode,
|
||||
RefreshCw,
|
||||
PackageOpen,
|
||||
} from 'lucide-react';
|
||||
@@ -306,7 +307,7 @@ export function CronJobManager() {
|
||||
</Badge>
|
||||
{getStatusBadge(job.last_status)}
|
||||
<Badge variant="outline" className="border-[var(--dg-border)] text-[var(--dg-text-secondary)]">
|
||||
{job.type === 'script' ? '脚本' : job.type === 'playbook' ? 'Playbook' : '命令'}
|
||||
{job.type === 'shell' ? 'Shell' : job.type === 'python' ? 'Python' : '命令'}
|
||||
</Badge>
|
||||
</div>
|
||||
<p className="text-sm text-[var(--dg-text-secondary)] mt-1">{job.description || '—'}</p>
|
||||
@@ -315,7 +316,12 @@ export function CronJobManager() {
|
||||
<Clock className="h-3 w-3" />
|
||||
{parseCron(job.cron_expr)}
|
||||
</span>
|
||||
{job.content && (
|
||||
{(job.type === 'shell' || job.type === 'python') && job.script?.name ? (
|
||||
<span className="flex items-center gap-1 text-[var(--dg-text-secondary)]">
|
||||
<FileCode className="h-3 w-3" />
|
||||
<span className="text-xs">{job.script.name}</span>
|
||||
</span>
|
||||
) : job.content && (
|
||||
<span className="flex items-center gap-1 text-[var(--dg-text-secondary)]">
|
||||
<Terminal className="h-3 w-3" />
|
||||
<code className="text-xs bg-[var(--dg-bg-tertiary)] px-2 py-0.5 rounded truncate max-w-xs">
|
||||
|
||||
Reference in new issue
Block a user