feat: add exec env point
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { api } from '@/api'
|
||||
import { toast } from 'vue-sonner'
|
||||
|
||||
const cleanDays = ref(30)
|
||||
const cleanResult = ref<number | null>(null)
|
||||
|
||||
async function cleanLogs() {
|
||||
if (cleanDays.value < 1) {
|
||||
toast.error('天数必须大于0')
|
||||
return
|
||||
}
|
||||
try {
|
||||
const res = await api.settings.cleanLogs(cleanDays.value)
|
||||
cleanResult.value = res.deleted
|
||||
toast.success(`已清理 ${res.deleted} 条日志`)
|
||||
} catch {
|
||||
toast.error('清理失败')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-4">
|
||||
<div class="space-y-2">
|
||||
<Label>清理多少天前的日志</Label>
|
||||
<Input v-model.number="cleanDays" type="number" class="w-32" min="1" />
|
||||
</div>
|
||||
<Button variant="destructive" @click="cleanLogs">清理日志</Button>
|
||||
<p v-if="cleanResult !== null" class="text-sm text-muted-foreground">
|
||||
上次清理了 {{ cleanResult }} 条日志
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -3,7 +3,6 @@ import { ref } from 'vue'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
||||
import PasswordSettings from './PasswordSettings.vue'
|
||||
import LogsSettings from './LogsSettings.vue'
|
||||
import SiteSettings from './SiteSettings.vue'
|
||||
import AboutSettings from './AboutSettings.vue'
|
||||
|
||||
@@ -20,7 +19,6 @@ const activeTab = ref('password')
|
||||
<Tabs v-model="activeTab" class="w-full">
|
||||
<TabsList>
|
||||
<TabsTrigger value="password">密码修改</TabsTrigger>
|
||||
<TabsTrigger value="logs">日志清理</TabsTrigger>
|
||||
<TabsTrigger value="site">站点设置</TabsTrigger>
|
||||
<TabsTrigger value="about">关于</TabsTrigger>
|
||||
</TabsList>
|
||||
@@ -37,18 +35,6 @@ const activeTab = ref('password')
|
||||
</Card>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="logs" class="mt-6">
|
||||
<Card class="max-w-lg">
|
||||
<CardHeader>
|
||||
<CardTitle>日志清理</CardTitle>
|
||||
<CardDescription>清理历史执行日志以释放存储空间</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<LogsSettings />
|
||||
</CardContent>
|
||||
</Card>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="site" class="mt-6">
|
||||
<Card class="max-w-xl">
|
||||
<CardHeader>
|
||||
|
||||
@@ -64,7 +64,7 @@ onMounted(loadSettings)
|
||||
<Label class="text-right">站点图标</Label>
|
||||
<div class="col-span-3 flex items-center gap-2">
|
||||
<Input v-model="form.icon" placeholder="<svg>...</svg>" class="flex-1 font-mono text-xs" />
|
||||
<div v-if="iconPreview" class="p-1.5 border rounded bg-muted/50 w-8 h-8 flex items-center justify-center shrink-0 [&>svg]:w-5 [&>svg]:h-5" v-html="iconPreview" />
|
||||
<div v-if="iconPreview" class="p-1.5 border rounded bg-white dark:bg-white w-8 h-8 flex items-center justify-center shrink-0 [&>svg]:w-5 [&>svg]:h-5" v-html="iconPreview" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-4 items-center gap-4">
|
||||
|
||||
Reference in New Issue
Block a user