fix: frontend type definitions match actual backend API responses
- AlertsPage: template fields alert_type/value/is_recovery (was type/message/recovered) - CommandsPage: remove non-existent is_dangerous/duration/admin_name; use admin_username - ScriptsPage: ExecHistoryItem matches /scripts/executions response shape - types/api.ts: CommandLogItem + SshSessionItem + ScriptExecItem aligned to backend - Remove unused PaginatedResponse imports from CommandsPage/ScriptsPage Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -60,12 +60,12 @@
|
||||
density="comfortable"
|
||||
@update:page="page = $event; loadAlerts()"
|
||||
>
|
||||
<template #item.type="{ item }">
|
||||
<v-chip :color="typeColor(item.type)" size="small" variant="tonal" label>
|
||||
<template #item.alert_type="{ item }">
|
||||
<v-chip :color="typeColor(item.alert_type)" size="small" variant="tonal" label>
|
||||
<template #prepend>
|
||||
<v-icon size="12">{{ typeIcon(item.type) }}</v-icon>
|
||||
<v-icon size="12">{{ typeIcon(item.alert_type) }}</v-icon>
|
||||
</template>
|
||||
{{ item.type }}
|
||||
{{ item.alert_type }}
|
||||
</v-chip>
|
||||
</template>
|
||||
|
||||
@@ -73,22 +73,18 @@
|
||||
<span class="font-weight-medium">{{ item.server_name }}</span>
|
||||
</template>
|
||||
|
||||
<template #item.message="{ item }">
|
||||
<span class="text-body-2">{{ item.message }}</span>
|
||||
<template #item.value="{ item }">
|
||||
<span class="text-body-2">{{ item.value }}</span>
|
||||
</template>
|
||||
|
||||
<template #item.recovered="{ item }">
|
||||
<v-chip v-if="item.recovered" color="success" size="small" variant="tonal" label>已恢复</v-chip>
|
||||
<template #item.is_recovery="{ item }">
|
||||
<v-chip v-if="item.is_recovery" color="success" size="small" variant="tonal" label>已恢复</v-chip>
|
||||
<v-chip v-else color="error" size="small" variant="tonal" label>告警中</v-chip>
|
||||
</template>
|
||||
|
||||
<template #item.created_at="{ item }">
|
||||
<span class="text-caption text-medium-emphasis">{{ item.created_at }}</span>
|
||||
</template>
|
||||
|
||||
<template #item.recovered_at="{ item }">
|
||||
<span class="text-caption text-medium-emphasis">{{ item.recovered_at || '—' }}</span>
|
||||
</template>
|
||||
<template #no-data>
|
||||
<div class="text-center text-medium-emphasis py-6">暂无数据</div>
|
||||
</template>
|
||||
@@ -133,12 +129,11 @@ const statusOptions = [
|
||||
]
|
||||
|
||||
const headers = [
|
||||
{ title: '类型', key: 'type', width: 100 },
|
||||
{ title: '类型', key: 'alert_type', width: 100 },
|
||||
{ title: '服务器', key: 'server_name' },
|
||||
{ title: '消息', key: 'message' },
|
||||
{ title: '状态', key: 'recovered', width: 100 },
|
||||
{ title: '告警时间', key: 'created_at', width: 160 },
|
||||
{ title: '恢复时间', key: 'recovered_at', width: 160 },
|
||||
{ title: '详情', key: 'value' },
|
||||
{ title: '状态', key: 'is_recovery', width: 100 },
|
||||
{ title: '时间', key: 'created_at', width: 160 },
|
||||
]
|
||||
|
||||
// ── Data loading ──
|
||||
|
||||
Reference in New Issue
Block a user