fix: env hidden and disable input focus
This commit is contained in:
@@ -22,7 +22,24 @@ func (es *EnvService) CreateEnvVar(name, value, remark string, hidden bool, user
|
|||||||
Hidden: hidden,
|
Hidden: hidden,
|
||||||
UserID: uint(userID),
|
UserID: uint(userID),
|
||||||
}
|
}
|
||||||
database.DB.Create(env)
|
data := map[string]interface{}{
|
||||||
|
"name": name,
|
||||||
|
"value": value,
|
||||||
|
"remark": remark,
|
||||||
|
"hidden": hidden,
|
||||||
|
"user_id": userID,
|
||||||
|
}
|
||||||
|
database.DB.Model(&models.EnvironmentVariable{}).Create(data)
|
||||||
|
|
||||||
|
// 将自动生成的 ID 赋值回对象以便返回
|
||||||
|
if id, ok := data["id"].(uint); ok {
|
||||||
|
env.ID = id
|
||||||
|
} else if id, ok := data["id"].(int64); ok {
|
||||||
|
env.ID = uint(id)
|
||||||
|
} else {
|
||||||
|
// 如果 ID 没有自动回填到 map,尝试通过刚才的数据查出来
|
||||||
|
database.DB.Where("name = ? AND user_id = ?", name, userID).Order("id DESC").First(env)
|
||||||
|
}
|
||||||
return env
|
return env
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<!-- 详情对话框 -->
|
<!-- 详情对话框 -->
|
||||||
<Dialog v-model:open="showDetailDialog">
|
<Dialog v-model:open="showDetailDialog">
|
||||||
<DialogContent class="sm:max-w-md md:max-w-lg">
|
<DialogContent class="sm:max-w-md md:max-w-lg" @openAutoFocus.prevent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Agent 详情</DialogTitle>
|
<DialogTitle>Agent 详情</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -492,7 +492,7 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<!-- 编辑对话框 -->
|
<!-- 编辑对话框 -->
|
||||||
<Dialog v-model:open="showEditDialog">
|
<Dialog v-model:open="showEditDialog">
|
||||||
<DialogContent>
|
<DialogContent @openAutoFocus.prevent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>编辑 Agent</DialogTitle>
|
<DialogTitle>编辑 Agent</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -532,7 +532,7 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<!-- 下载对话框 -->
|
<!-- 下载对话框 -->
|
||||||
<Dialog v-model:open="showDownloadDialog">
|
<Dialog v-model:open="showDownloadDialog">
|
||||||
<DialogContent class="sm:max-w-lg">
|
<DialogContent class="sm:max-w-lg" @openAutoFocus.prevent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>下载 Agent</DialogTitle>
|
<DialogTitle>下载 Agent</DialogTitle>
|
||||||
<DialogDescription>当前版本: {{ agentVersion }}</DialogDescription>
|
<DialogDescription>当前版本: {{ agentVersion }}</DialogDescription>
|
||||||
@@ -580,7 +580,7 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<!-- 创建令牌对话框 -->
|
<!-- 创建令牌对话框 -->
|
||||||
<Dialog v-model:open="showTokenDialog">
|
<Dialog v-model:open="showTokenDialog">
|
||||||
<DialogContent>
|
<DialogContent @openAutoFocus.prevent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>生成令牌</DialogTitle>
|
<DialogTitle>生成令牌</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|||||||
@@ -202,8 +202,10 @@ onMounted(loadDeps)
|
|||||||
<Button variant="outline" size="icon" class="h-9 w-9 shrink-0" @click="loadDeps" :disabled="loading">
|
<Button variant="outline" size="icon" class="h-9 w-9 shrink-0" @click="loadDeps" :disabled="loading">
|
||||||
<RefreshCw class="h-4 w-4" :class="{ 'animate-spin': loading }" />
|
<RefreshCw class="h-4 w-4" :class="{ 'animate-spin': loading }" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="outline" size="sm" class="h-9 shrink-0" @click="reinstallAll" :disabled="reinstallingAll || filteredDeps.length === 0">
|
<Button variant="outline" size="sm" class="h-9 shrink-0" @click="reinstallAll"
|
||||||
<RotateCw class="h-4 w-4 sm:mr-1.5" :class="{ 'animate-spin': reinstallingAll }" /> <span class="hidden sm:inline">全部重装</span>
|
:disabled="reinstallingAll || filteredDeps.length === 0">
|
||||||
|
<RotateCw class="h-4 w-4 sm:mr-1.5" :class="{ 'animate-spin': reinstallingAll }" /> <span
|
||||||
|
class="hidden sm:inline">全部重装</span>
|
||||||
</Button>
|
</Button>
|
||||||
<Button size="sm" class="h-9 shrink-0" @click="openInstallDialog">
|
<Button size="sm" class="h-9 shrink-0" @click="openInstallDialog">
|
||||||
<Download class="h-4 w-4 sm:mr-1.5" /> <span class="hidden sm:inline">安装</span>
|
<Download class="h-4 w-4 sm:mr-1.5" /> <span class="hidden sm:inline">安装</span>
|
||||||
@@ -212,7 +214,8 @@ onMounted(loadDeps)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 表头 -->
|
<!-- 表头 -->
|
||||||
<div class="flex items-center gap-4 px-4 py-2 border-b bg-muted/50 text-sm text-muted-foreground font-medium min-w-[400px]">
|
<div
|
||||||
|
class="flex items-center gap-4 px-4 py-2 border-b bg-muted/50 text-sm text-muted-foreground font-medium min-w-[400px]">
|
||||||
<span class="flex-1">包名</span>
|
<span class="flex-1">包名</span>
|
||||||
<span class="w-32">版本</span>
|
<span class="w-32">版本</span>
|
||||||
<span class="w-48 hidden md:block">备注</span>
|
<span class="w-48 hidden md:block">备注</span>
|
||||||
@@ -229,12 +232,8 @@ onMounted(loadDeps)
|
|||||||
<Package class="h-8 w-8 mx-auto mb-2 opacity-50" />
|
<Package class="h-8 w-8 mx-auto mb-2 opacity-50" />
|
||||||
{{ searchQuery ? '无匹配结果' : '暂无依赖包' }}
|
{{ searchQuery ? '无匹配结果' : '暂无依赖包' }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div v-else v-for="dep in filteredDeps" :key="dep.id"
|
||||||
v-else
|
class="flex items-center gap-4 px-4 py-2 hover:bg-muted/50 transition-colors">
|
||||||
v-for="dep in filteredDeps"
|
|
||||||
:key="dep.id"
|
|
||||||
class="flex items-center gap-4 px-4 py-2 hover:bg-muted/50 transition-colors"
|
|
||||||
>
|
|
||||||
<span class="flex-1 font-mono text-sm truncate">
|
<span class="flex-1 font-mono text-sm truncate">
|
||||||
<TextOverflow :text="dep.name" title="包名" />
|
<TextOverflow :text="dep.name" title="包名" />
|
||||||
</span>
|
</span>
|
||||||
@@ -246,7 +245,8 @@ onMounted(loadDeps)
|
|||||||
<Button v-if="dep.log" variant="ghost" size="icon" class="h-7 w-7" @click="showLog(dep)">
|
<Button v-if="dep.log" variant="ghost" size="icon" class="h-7 w-7" @click="showLog(dep)">
|
||||||
<FileText class="h-4 w-4" />
|
<FileText class="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" size="icon" class="h-7 w-7" @click="reinstallPackage(dep)" :disabled="reinstalling === dep.id">
|
<Button variant="ghost" size="icon" class="h-7 w-7" @click="reinstallPackage(dep)"
|
||||||
|
:disabled="reinstalling === dep.id">
|
||||||
<RotateCw class="h-4 w-4" :class="{ 'animate-spin': reinstalling === dep.id }" />
|
<RotateCw class="h-4 w-4" :class="{ 'animate-spin': reinstalling === dep.id }" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" size="icon" class="h-7 w-7 text-destructive" @click="confirmDelete(dep)">
|
<Button variant="ghost" size="icon" class="h-7 w-7 text-destructive" @click="confirmDelete(dep)">
|
||||||
@@ -261,7 +261,7 @@ onMounted(loadDeps)
|
|||||||
|
|
||||||
<!-- 安装对话框 -->
|
<!-- 安装对话框 -->
|
||||||
<Dialog v-model:open="showInstallDialog">
|
<Dialog v-model:open="showInstallDialog">
|
||||||
<DialogContent class="sm:max-w-[400px]">
|
<DialogContent class="sm:max-w-[400px]" @openAutoFocus.prevent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>安装 {{ getTypeLabel(activeTab) }} 包</DialogTitle>
|
<DialogTitle>安装 {{ getTypeLabel(activeTab) }} 包</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -309,7 +309,7 @@ onMounted(loadDeps)
|
|||||||
|
|
||||||
<!-- 日志对话框 -->
|
<!-- 日志对话框 -->
|
||||||
<Dialog v-model:open="showLogDialog">
|
<Dialog v-model:open="showLogDialog">
|
||||||
<DialogContent class="sm:max-w-[600px]">
|
<DialogContent class="sm:max-w-[600px]" @openAutoFocus.prevent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>安装日志 - {{ logPkgName }}</DialogTitle>
|
<DialogTitle>安装日志 - {{ logPkgName }}</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<!-- 新建对话框 -->
|
<!-- 新建对话框 -->
|
||||||
<Dialog v-model:open="showCreateDialog">
|
<Dialog v-model:open="showCreateDialog">
|
||||||
<DialogContent class="max-w-xs">
|
<DialogContent class="max-w-xs" @openAutoFocus.prevent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle class="text-sm">新建</DialogTitle>
|
<DialogTitle class="text-sm">新建</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -570,7 +570,7 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<!-- 重命名对话框 -->
|
<!-- 重命名对话框 -->
|
||||||
<Dialog v-model:open="showRenameDialog">
|
<Dialog v-model:open="showRenameDialog">
|
||||||
<DialogContent class="max-w-xs" @open-auto-focus.prevent>
|
<DialogContent class="max-w-xs" @openAutoFocus.prevent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle class="text-sm">重命名</DialogTitle>
|
<DialogTitle class="text-sm">重命名</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -592,7 +592,7 @@ onUnmounted(() => {
|
|||||||
<Dialog v-model:open="showTerminalDialog">
|
<Dialog v-model:open="showTerminalDialog">
|
||||||
<DialogContent
|
<DialogContent
|
||||||
class="w-[calc(100%-2rem)] sm:max-w-3xl h-[60vh] sm:h-[70vh] flex flex-col p-0 overflow-hidden !bg-[#1e1e1e] border-[#3c3c3c]"
|
class="w-[calc(100%-2rem)] sm:max-w-3xl h-[60vh] sm:h-[70vh] flex flex-col p-0 overflow-hidden !bg-[#1e1e1e] border-[#3c3c3c]"
|
||||||
:show-close-button="false">
|
:show-close-button="false" @openAutoFocus.prevent>
|
||||||
<div class="flex items-center justify-between px-3 sm:px-4 py-2 border-b border-[#3c3c3c]">
|
<div class="flex items-center justify-between px-3 sm:px-4 py-2 border-b border-[#3c3c3c]">
|
||||||
<span class="text-xs sm:text-sm font-medium text-gray-300">运行脚本</span>
|
<span class="text-xs sm:text-sm font-medium text-gray-300">运行脚本</span>
|
||||||
<Button variant="ghost" size="icon" class="h-6 w-6 text-gray-400 hover:text-white hover:bg-white/10"
|
<Button variant="ghost" size="icon" class="h-6 w-6 text-gray-400 hover:text-white hover:bg-white/10"
|
||||||
|
|||||||
@@ -100,16 +100,8 @@ async function deleteEnv() {
|
|||||||
deleteEnvId.value = null
|
deleteEnvId.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleShow(env: EnvVar) {
|
function toggleShow(id: number) {
|
||||||
const newHiddenStatus = !env.hidden
|
showValues.value[id] = !showValues.value[id]
|
||||||
try {
|
|
||||||
await api.env.update(env.id, { ...env, hidden: newHiddenStatus })
|
|
||||||
env.hidden = newHiddenStatus
|
|
||||||
showValues.value[env.id] = !newHiddenStatus
|
|
||||||
toast.success(newHiddenStatus ? '值已隐藏并保存' : '值已显示并保存')
|
|
||||||
} catch {
|
|
||||||
toast.error('保存显示状态失败')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function maskValue(value: string) {
|
function maskValue(value: string) {
|
||||||
@@ -163,7 +155,7 @@ onMounted(loadEnvVars)
|
|||||||
<TextOverflow :text="env.remark || '-'" title="备注" />
|
<TextOverflow :text="env.remark || '-'" title="备注" />
|
||||||
</span>
|
</span>
|
||||||
<span class="w-20 sm:w-24 shrink-0 flex justify-center gap-1">
|
<span class="w-20 sm:w-24 shrink-0 flex justify-center gap-1">
|
||||||
<Button variant="ghost" size="icon" class="h-7 w-7" @click="toggleShow(env)"
|
<Button variant="ghost" size="icon" class="h-7 w-7" @click="toggleShow(env.id)"
|
||||||
:title="showValues[env.id] ? '隐藏' : '显示'">
|
:title="showValues[env.id] ? '隐藏' : '显示'">
|
||||||
<Eye v-if="!showValues[env.id]" class="h-3.5 w-3.5" />
|
<Eye v-if="!showValues[env.id]" class="h-3.5 w-3.5" />
|
||||||
<EyeOff v-else class="h-3.5 w-3.5" />
|
<EyeOff v-else class="h-3.5 w-3.5" />
|
||||||
@@ -183,7 +175,7 @@ onMounted(loadEnvVars)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Dialog v-model:open="showDialog">
|
<Dialog v-model:open="showDialog">
|
||||||
<DialogContent class="max-w-md">
|
<DialogContent class="max-w-md" @openAutoFocus.prevent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>{{ isEdit ? '编辑变量' : '新建变量' }}</DialogTitle>
|
<DialogTitle>{{ isEdit ? '编辑变量' : '新建变量' }}</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|||||||
@@ -168,7 +168,8 @@ async function save() {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Dialog :open="open" @update:open="emit('update:open', $event)">
|
<Dialog :open="open" @update:open="emit('update:open', $event)">
|
||||||
<DialogContent class="sm:max-w-[480px] max-h-[85vh] flex flex-col !gap-0 !p-0" :trap-focus="false" @open-auto-focus.prevent>
|
<DialogContent class="sm:max-w-[480px] max-h-[85vh] flex flex-col !gap-0 !p-0" :trap-focus="false"
|
||||||
|
@openAutoFocus.prevent>
|
||||||
<DialogHeader class="shrink-0 p-6 pb-0">
|
<DialogHeader class="shrink-0 p-6 pb-0">
|
||||||
<DialogTitle>{{ isEdit ? '编辑仓库同步' : '新建仓库同步' }}</DialogTitle>
|
<DialogTitle>{{ isEdit ? '编辑仓库同步' : '新建仓库同步' }}</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -179,7 +180,8 @@ async function save() {
|
|||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
<div class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
||||||
<Label class="sm:text-right text-sm">源类型</Label>
|
<Label class="sm:text-right text-sm">源类型</Label>
|
||||||
<Select :model-value="repoConfig.source_type" @update:model-value="(v) => repoConfig.source_type = String(v || 'git')">
|
<Select :model-value="repoConfig.source_type"
|
||||||
|
@update:model-value="(v) => repoConfig.source_type = String(v || 'git')">
|
||||||
<SelectTrigger class="sm:col-span-3 h-8 text-sm">
|
<SelectTrigger class="sm:col-span-3 h-8 text-sm">
|
||||||
<SelectValue placeholder="选择源类型" />
|
<SelectValue placeholder="选择源类型" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
@@ -191,12 +193,15 @@ async function save() {
|
|||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
<div class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
||||||
<Label class="sm:text-right text-sm">源地址</Label>
|
<Label class="sm:text-right text-sm">源地址</Label>
|
||||||
<Input v-model="repoConfig.source_url" :placeholder="repoConfig.source_type === 'git' ? 'https://github.com/user/repo.git' : 'https://example.com/file.js'" class="sm:col-span-3 h-8 text-xs font-mono" />
|
<Input v-model="repoConfig.source_url"
|
||||||
|
:placeholder="repoConfig.source_type === 'git' ? 'https://github.com/user/repo.git' : 'https://example.com/file.js'"
|
||||||
|
class="sm:col-span-3 h-8 text-xs font-mono" />
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
<div class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
||||||
<Label class="sm:text-right text-sm">目标路径</Label>
|
<Label class="sm:text-right text-sm">目标路径</Label>
|
||||||
<div class="sm:col-span-3">
|
<div class="sm:col-span-3">
|
||||||
<DirTreeSelect v-if="selectedAgentId === 'local'" :model-value="repoConfig.target_path || ''" @update:model-value="v => repoConfig.target_path = v" />
|
<DirTreeSelect v-if="selectedAgentId === 'local'" :model-value="repoConfig.target_path || ''"
|
||||||
|
@update:model-value="v => repoConfig.target_path = v" />
|
||||||
<Input v-else v-model="repoConfig.target_path" placeholder="Agent 上的目标路径" class="h-8 text-sm" />
|
<Input v-else v-model="repoConfig.target_path" placeholder="Agent 上的目标路径" class="h-8 text-sm" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -214,15 +219,20 @@ async function save() {
|
|||||||
<p class="text-xs text-muted-foreground mt-1">仓库同步任务暂时仅支持本地执行</p>
|
<p class="text-xs text-muted-foreground mt-1">仓库同步任务暂时仅支持本地执行</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="repoConfig.source_type === 'git'" class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
<div v-if="repoConfig.source_type === 'git'"
|
||||||
|
class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
||||||
<Label class="sm:text-right text-sm">分支</Label>
|
<Label class="sm:text-right text-sm">分支</Label>
|
||||||
<Input v-model="repoConfig.branch" placeholder="main (可选)" class="sm:col-span-3 h-8 text-sm" autocomplete="off" />
|
<Input v-model="repoConfig.branch" placeholder="main (可选)" class="sm:col-span-3 h-8 text-sm"
|
||||||
|
autocomplete="off" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="repoConfig.source_type === 'git'" class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
<div v-if="repoConfig.source_type === 'git'"
|
||||||
|
class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
||||||
<Label class="sm:text-right text-sm">稀疏路径</Label>
|
<Label class="sm:text-right text-sm">稀疏路径</Label>
|
||||||
<Input v-model="repoConfig.sparse_path" placeholder="仅拉取指定目录或文件 (可选)" class="sm:col-span-3 h-8 text-sm" autocomplete="off" />
|
<Input v-model="repoConfig.sparse_path" placeholder="仅拉取指定目录或文件 (可选)" class="sm:col-span-3 h-8 text-sm"
|
||||||
|
autocomplete="off" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="repoConfig.source_type === 'git' && repoConfig.sparse_path" class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
<div v-if="repoConfig.source_type === 'git' && repoConfig.sparse_path"
|
||||||
|
class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
||||||
<Label class="sm:text-right text-sm">单文件</Label>
|
<Label class="sm:text-right text-sm">单文件</Label>
|
||||||
<div class="sm:col-span-3">
|
<div class="sm:col-span-3">
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
@@ -246,11 +256,13 @@ async function save() {
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="repoConfig.proxy === 'custom'" class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
<div v-if="repoConfig.proxy === 'custom'" class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
||||||
<Label class="sm:text-right text-sm">代理地址</Label>
|
<Label class="sm:text-right text-sm">代理地址</Label>
|
||||||
<Input v-model="repoConfig.proxy_url" placeholder="https://your-proxy.com/" class="sm:col-span-3 h-8 text-xs font-mono" autocomplete="off" />
|
<Input v-model="repoConfig.proxy_url" placeholder="https://your-proxy.com/"
|
||||||
|
class="sm:col-span-3 h-8 text-xs font-mono" autocomplete="off" />
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
<div class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
||||||
<Label class="sm:text-right text-sm">认证Token</Label>
|
<Label class="sm:text-right text-sm">认证Token</Label>
|
||||||
<Input v-model="repoConfig.auth_token" type="text" placeholder="可选,用于私有仓库" class="sm:col-span-3 h-8 text-sm" autocomplete="new-password" />
|
<Input v-model="repoConfig.auth_token" type="text" placeholder="可选,用于私有仓库" class="sm:col-span-3 h-8 text-sm"
|
||||||
|
autocomplete="new-password" />
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
<div class="grid grid-cols-1 sm:grid-cols-4 items-center gap-2 sm:gap-3">
|
||||||
<Label class="sm:text-right text-sm">并发控制</Label>
|
<Label class="sm:text-right text-sm">并发控制</Label>
|
||||||
@@ -269,12 +281,9 @@ async function save() {
|
|||||||
<div class="sm:col-span-3">
|
<div class="sm:col-span-3">
|
||||||
<p class="text-xs text-muted-foreground mb-1.5">格式: 秒 分 时 日 月 周</p>
|
<p class="text-xs text-muted-foreground mb-1.5">格式: 秒 分 时 日 月 周</p>
|
||||||
<div class="flex flex-wrap gap-1">
|
<div class="flex flex-wrap gap-1">
|
||||||
<span
|
<span v-for="preset in cronPresets" :key="preset.value"
|
||||||
v-for="preset in cronPresets"
|
|
||||||
:key="preset.value"
|
|
||||||
class="px-1.5 py-0.5 text-xs rounded bg-muted hover:bg-accent cursor-pointer transition-colors"
|
class="px-1.5 py-0.5 text-xs rounded bg-muted hover:bg-accent cursor-pointer transition-colors"
|
||||||
@click="form.schedule = preset.value"
|
@click="form.schedule = preset.value">
|
||||||
>
|
|
||||||
{{ preset.label }}
|
{{ preset.label }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -298,7 +307,8 @@ async function save() {
|
|||||||
<SelectItem value="count">按条数</SelectItem>
|
<SelectItem value="count">按条数</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
<Input v-if="cleanType && cleanType !== 'none'" v-model.number="cleanKeep" type="number" :placeholder="cleanType === 'day' ? '7' : '100'" class="w-20 h-9 text-sm" />
|
<Input v-if="cleanType && cleanType !== 'none'" v-model.number="cleanKeep" type="number"
|
||||||
|
:placeholder="cleanType === 'day' ? '7' : '100'" class="w-20 h-9 text-sm" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ async function save() {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Dialog :open="open" @update:open="emit('update:open', $event)">
|
<Dialog :open="open" @update:open="emit('update:open', $event)">
|
||||||
<DialogContent class="sm:max-w-[480px]" @open-auto-focus.prevent>
|
<DialogContent class="sm:max-w-[480px]" @openAutoFocus.prevent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>{{ isEdit ? '编辑任务' : '新建任务' }}</DialogTitle>
|
<DialogTitle>{{ isEdit ? '编辑任务' : '新建任务' }}</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
@@ -265,12 +265,9 @@ async function save() {
|
|||||||
<div class="sm:col-span-3">
|
<div class="sm:col-span-3">
|
||||||
<p class="text-xs text-muted-foreground mb-1.5">格式: 秒 分 时 日 月 周</p>
|
<p class="text-xs text-muted-foreground mb-1.5">格式: 秒 分 时 日 月 周</p>
|
||||||
<div class="flex flex-wrap gap-1">
|
<div class="flex flex-wrap gap-1">
|
||||||
<span
|
<span v-for="preset in cronPresets" :key="preset.value"
|
||||||
v-for="preset in cronPresets"
|
|
||||||
:key="preset.value"
|
|
||||||
class="px-1.5 py-0.5 text-xs rounded bg-muted hover:bg-accent cursor-pointer transition-colors"
|
class="px-1.5 py-0.5 text-xs rounded bg-muted hover:bg-accent cursor-pointer transition-colors"
|
||||||
@click="form.schedule = preset.value"
|
@click="form.schedule = preset.value">
|
||||||
>
|
|
||||||
{{ preset.label }}
|
{{ preset.label }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -294,7 +291,8 @@ async function save() {
|
|||||||
<SelectItem value="count">按条数</SelectItem>
|
<SelectItem value="count">按条数</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
<Input v-if="cleanType && cleanType !== 'none'" v-model.number="cleanKeep" type="number" :placeholder="cleanType === 'day' ? '7' : '100'" class="w-20 h-9 text-sm" />
|
<Input v-if="cleanType && cleanType !== 'none'" v-model.number="cleanKeep" type="number"
|
||||||
|
:placeholder="cleanType === 'day' ? '7' : '100'" class="w-20 h-9 text-sm" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -324,12 +322,9 @@ async function save() {
|
|||||||
{{ allEnvVars.length === 0 ? '暂无环境变量' : '无匹配结果' }}
|
{{ allEnvVars.length === 0 ? '暂无环境变量' : '无匹配结果' }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="max-h-[140px] overflow-y-auto space-y-0.5">
|
<div v-else class="max-h-[140px] overflow-y-auto space-y-0.5">
|
||||||
<div
|
<div v-for="env in filteredEnvVars" :key="env.id"
|
||||||
v-for="env in filteredEnvVars"
|
|
||||||
:key="env.id"
|
|
||||||
class="flex items-center gap-2 px-2 py-1 rounded hover:bg-muted cursor-pointer text-xs"
|
class="flex items-center gap-2 px-2 py-1 rounded hover:bg-muted cursor-pointer text-xs"
|
||||||
@click="addEnv(env.id)"
|
@click="addEnv(env.id)">
|
||||||
>
|
|
||||||
<Plus class="h-3 w-3 text-muted-foreground" />
|
<Plus class="h-3 w-3 text-muted-foreground" />
|
||||||
<span class="truncate">{{ env.name }}</span>
|
<span class="truncate">{{ env.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -337,7 +332,8 @@ async function save() {
|
|||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
<div v-if="selectedEnvs.length > 0" class="flex flex-wrap gap-1">
|
<div v-if="selectedEnvs.length > 0" class="flex flex-wrap gap-1">
|
||||||
<div v-for="env in selectedEnvs" :key="env.id" class="inline-flex items-center gap-0.5 px-2 py-0.5 text-xs h-5 rounded-full bg-secondary text-secondary-foreground">
|
<div v-for="env in selectedEnvs" :key="env.id"
|
||||||
|
class="inline-flex items-center gap-0.5 px-2 py-0.5 text-xs h-5 rounded-full bg-secondary text-secondary-foreground">
|
||||||
<span>{{ env.name }}</span>
|
<span>{{ env.name }}</span>
|
||||||
<X class="h-2.5 w-2.5 cursor-pointer hover:text-destructive" @click="removeEnv(env.id)" />
|
<X class="h-2.5 w-2.5 cursor-pointer hover:text-destructive" @click="removeEnv(env.id)" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user