feat: add more opt feature
This commit is contained in:
@@ -39,6 +39,7 @@ const cronPresets = [
|
||||
]
|
||||
|
||||
const form = ref<Partial<Task>>({})
|
||||
const tagInput = ref('')
|
||||
const cleanType = ref('none')
|
||||
const cleanKeep = ref(30)
|
||||
const allEnvVars = ref<EnvVar[]>([])
|
||||
@@ -57,6 +58,22 @@ watch(concurrencyEnabled, (val) => {
|
||||
concurrency.value = val ? 1 : 0
|
||||
})
|
||||
|
||||
function addTag() {
|
||||
const val = tagInput.value.trim()
|
||||
if (!val) return
|
||||
const currentTags = form.value.tags ? form.value.tags.split(',').filter(Boolean) : []
|
||||
if (!currentTags.includes(val)) {
|
||||
currentTags.push(val)
|
||||
form.value.tags = currentTags.join(',')
|
||||
}
|
||||
tagInput.value = ''
|
||||
}
|
||||
|
||||
function removeTag(tagToRemove: string) {
|
||||
const currentTags = form.value.tags ? form.value.tags.split(',').filter(Boolean) : []
|
||||
form.value.tags = currentTags.filter(t => t !== tagToRemove).join(',')
|
||||
}
|
||||
|
||||
// 当前显示的工作目录(根据选择的执行位置)
|
||||
const currentWorkDir = computed({
|
||||
get: () => workDirCache.value[selectedAgentId.value] || '',
|
||||
@@ -362,6 +379,26 @@ async function save() {
|
||||
<Input v-model="form.name" placeholder="我的任务" class="sm:col-span-3 h-8 text-sm" />
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 sm:grid-cols-4 items-start gap-2 sm:gap-3">
|
||||
<Label class="sm:text-right text-sm pt-1.5">任务标签</Label>
|
||||
<div class="sm:col-span-3 space-y-2">
|
||||
<div class="flex gap-2">
|
||||
<Input v-model="tagInput" placeholder="输入标签名称后点击增加或回车键添加" class="flex-1 h-8 text-sm" @keydown.enter.prevent="addTag" />
|
||||
<Button type="button" variant="outline" size="sm" class="h-8" @click="addTag">
|
||||
增加
|
||||
</Button>
|
||||
</div>
|
||||
<div v-if="form.tags" class="flex flex-wrap gap-2">
|
||||
<span v-for="tag in form.tags.split(',').filter(Boolean)" :key="tag" class="flex items-center gap-1 bg-secondary text-secondary-foreground px-2 py-0.5 rounded-md text-xs border">
|
||||
{{ tag }}
|
||||
<button type="button" class="text-muted-foreground hover:text-foreground outline-none" @click.prevent="removeTag(tag)">
|
||||
<X class="h-3 w-3" />
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<div class="sm:col-span-3">
|
||||
|
||||
Reference in New Issue
Block a user