feat(electron-shell): 补录壳子源码(排除运行环境与构建产物)

This commit is contained in:
2026-09-24 16:14:24 +08:00
parent 7e0838de64
commit 3214305dea
56 changed files with 17858 additions and 0 deletions
@@ -0,0 +1,685 @@
<template>
<div v-if="plugin" class="plugin-page">
<!-- Hero:场景身份 + 大执行按钮 -->
<section class="hero card">
<div class="hero-main">
<span class="avatar" :style="{ background: avatarBg }">{{ plugin.name.slice(0, 1) }}</span>
<div class="hero-meta">
<h2 class="p-name">{{ plugin.name }}
<span class="ver-tag">v{{ plugin.version }}</span>
</h2>
<p class="p-desc">{{ plugin.description || '暂无描述' }}</p>
<div class="p-badges">
<span v-if="plugin.platform" class="badge" :class="platformOnline ? 'on' : 'off'">
<i class="bdot"></i>{{ platformLabel }} {{ platformOnline ? '已登录' : '未登录' }}
</span>
<span v-if="plugin.uses_month" class="badge">
<el-select v-model="month" size="small" class="month-sel" :disabled="store.running">
<el-option v-for="m in months" :key="m" :value="m" :label="m" />
</el-select>
</span>
</div>
</div>
</div>
<div class="hero-actions">
<button class="run-btn" :class="{ running: store.running }" :disabled="store.running" @click="run">
<template v-if="store.running">
<span class="ring">
<svg viewBox="0 0 36 36" width="26" height="26">
<circle class="ring-bg" cx="18" cy="18" r="15.5" fill="none" stroke-width="3.5" />
<circle class="ring-fg" cx="18" cy="18" r="15.5" fill="none" stroke-width="3.5"
stroke-linecap="round" :stroke-dasharray="ringDash" transform="rotate(-90 18 18)" />
</svg>
</span>
<span>执行中 {{ store.progress }}%</span>
</template>
<template v-else>
<span class="play-ic">▶</span>
<span>一键执行</span>
</template>
</button>
<el-button v-if="rollbackVer" size="small" text type="warning" class="rollback-btn"
:disabled="store.running" @click="doRollback">回滚 v{{ rollbackVer }}</el-button>
<span class="hero-tip">配置与运行日志都在下方运行台</span>
</div>
</section>
<!-- 结果横幅 -->
<section v-if="store.lastResult" class="banner" :class="store.lastResult.ok ? 'ok' : 'err'">
<span class="b-ic">{{ store.lastResult.ok ? '✓' : '✕' }}</span>
<div class="b-body">
<b>{{ store.lastResult.ok ? (store.lastSummary || '执行完成') : '执行失败' }}</b>
<span v-if="!store.lastResult.ok">{{ store.lastResult.error }}</span>
</div>
<button class="b-close" @click="closeBanner" title="关闭">✕</button>
</section>
<!-- 运行台:参数 / 插件界面 / 运行日志
日志归属"本次运行"(不再是全局面板);带专属界面的插件用界面本身配置,故不并列参数表单 -->
<div class="run-tabs card">
<div class="rt-head">
<div class="rt-tabs">
<button v-for="t in tabs" :key="t.k" class="rt-tab" :class="{ on: tab === t.k }" @click="tab = t.k">
{{ t.label }}
<span v-if="t.k === 'log' && store.logs.length" class="rt-n">{{ store.logs.length }}</span>
<i v-if="t.k === 'log' && store.running" class="rt-live"></i>
</button>
</div>
<el-button v-if="tab === 'params' && fieldCount" size="small" text :disabled="store.running" :icon="RefreshLeft"
@click="resetForm">恢复默认</el-button>
</div>
<div class="rt-body">
<!-- 参数配置 -->
<section v-show="tab === 'params'" class="params">
<div class="cfg-bar">
<el-select v-model="curCfg" size="small" class="cfg-sel" placeholder="默认配置" @change="onCfgChange">
<el-option label="默认配置" value="" />
<el-option v-for="c in configs" :key="c.id" :value="c.id" :label="c.name" />
</el-select>
<el-button size="small" text :icon="FolderAdd" :disabled="store.running" @click="saveAsCfg">存为配置</el-button>
<el-button v-if="curCfg" size="small" text type="danger" :icon="Delete" :disabled="store.running" @click="delCfg">删除</el-button>
<span v-if="curCfgLabel" class="cfg-note">已套用「{{ curCfgLabel }}」,定时任务可引用</span>
</div>
<el-form label-width="auto" class="form-card">
<div class="fields">
<el-form-item v-for="f in plugin.fields" :key="f.key" :label="f.label">
<template v-if="f.type === 'int'">
<el-input-number v-model="form[f.key]" :controls="false" placeholder="0" :disabled="store.running" />
</template>
<el-input v-else-if="f.type === 'password'" v-model="form[f.key]" type="password" show-password
:placeholder="String(f.default ?? '')" :disabled="store.running">
<template v-if="f.help || f.description" #suffix>
<el-tooltip :content="f.help || f.description" placement="bottom"><el-icon class="help-ic">
<QuestionFilled />
</el-icon></el-tooltip>
</template>
</el-input>
<el-input v-else-if="f.type === 'text'" v-model="form[f.key]" :placeholder="String(f.default ?? '')"
:disabled="store.running">
<template v-if="f.help || f.description" #suffix>
<el-tooltip :content="f.help || f.description" placement="bottom"><el-icon class="help-ic">
<QuestionFilled />
</el-icon></el-tooltip>
</template>
</el-input>
<el-select v-else-if="f.type === 'multiselect'" v-model="form[f.key]" multiple filterable allow-create
default-first-option placeholder="选择或输入后回车" :disabled="store.running">
<el-option v-for="opt in (f.options || [])" :key="opt" :value="opt" :label="opt" />
</el-select>
<el-select v-else v-model="form[f.key]" :disabled="store.running">
<el-option v-for="opt in f.options" :key="opt" :value="opt" :label="opt" />
</el-select>
</el-form-item>
</div>
</el-form>
</section>
<!-- 插件专属界面(同源 iframe,自动携带会话 cookie)
sandbox 白名单加固:允许脚本/同源/表单,禁用 top 跳转与弹窗
仅一层容器承载尺寸,不再叠提示条/卡片 -->
<div v-if="plugin.ui" v-show="tab === 'ui'" class="ui-pane">
<iframe :key="plugin.id" :src="uiSrc" class="pui-frame" title="插件界面"
sandbox="allow-scripts allow-same-origin allow-forms"></iframe>
</div>
<!-- 运行日志(当前/本次运行) -->
<div v-show="tab === 'log'" class="rt-log"><LogPanel /></div>
<!-- 历史运行:本场景已完成的运行,点击回看该次日志 -->
<section v-show="tab === 'history'" class="history">
<div v-if="!replay" class="hist-view">
<div class="hist-head">
<span class="hist-title">本场景最近运行</span>
<el-button size="small" text :icon="Refresh" :loading="loadingRuns" @click="loadRuns">刷新</el-button>
</div>
<div v-if="!runs.length" class="hist-empty">
{{ loadingRuns ? '加载中…' : '该场景还没有运行记录,执行一次后这里可回看' }}
</div>
<ul v-else class="hist-list">
<li v-for="r in runs" :key="r.run_id" class="hist-item" @click="openReplay(r.run_id)">
<i class="hist-dot" :class="r.ok ? 'ok' : 'err'"></i>
<div class="hist-meta">
<b>{{ triggerLabel(r.trigger) }}</b>
<span class="hist-time">{{ fmtTime(r.started) }} · {{ durText(r.duration_sec) }}</span>
</div>
<span class="hist-state" :class="r.ok ? 'ok' : 'err'">{{ r.ok ? '成功' : '失败' }}</span>
<el-icon class="hist-arrow"><ArrowRight /></el-icon>
</li>
</ul>
</div>
<!-- 回看单次运行(结论 + 该次日志) -->
<div v-else class="hist-replay">
<div class="replay-head">
<el-button size="small" text :icon="ArrowLeft" :disabled="replayBusy" @click="replay = null">返回列表</el-button>
<div class="replay-tags">
<span class="badge" :class="replay.ok ? 'on' : 'off'"><i class="bdot"></i>{{ replay.ok ? '成功' : '失败' }}</span>
<span class="replay-tag">{{ triggerLabel(replay.trigger) }}</span>
<span class="replay-tag">{{ fmtTime(replay.started) }}</span>
<span class="replay-tag">耗时 {{ durText(replay.duration_sec) }}</span>
<span v-if="replay.summary" class="replay-sum">{{ replay.summary }}</span>
</div>
</div>
<div class="rt-log"><LogPanel :static-logs="replay.logs || []" /></div>
</div>
</section>
</div>
</div>
</div>
<div v-else-if="!store.plugins.length" class="empty-note">
<b>当前账号暂无可用场景</b><br>请联系管理员在控制面进行授权,授权后点击右上角刷新
</div>
<div v-else class="empty-note"><b>未选择场景</b></div>
</template>
<script setup>
import { computed, ref, watch } from 'vue'
import { QuestionFilled, Refresh, RefreshLeft, ArrowLeft, ArrowRight, FolderAdd, Delete } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { store, log } from '../store'
import { startRun, getRun, fetchRuns, fetchMeta, listRollbacks, rollbackPlugin, listPluginConfigs, savePluginConfig, deletePluginConfig } from '../api'
import LogPanel from './LogPanel.vue'
const GRADS = [
'var(--grad-sky)', 'var(--grad-peach)', 'var(--grad-mint)',
'var(--grad-lilac)', 'var(--grad-honey)', 'var(--grad-blush)',
]
const months = computed(() => {
const now = new Date()
const list = []
for (let off = 1; off <= 6; off++) {
const d = new Date(now.getFullYear(), now.getMonth() - off, 1)
list.push(`${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}`)
}
return list
})
const month = ref(months.value[0])
const idx = computed(() => Math.max(0, store.plugins.findIndex((p) => p.id === store.selectedId)))
const avatarBg = computed(() => GRADS[idx.value % GRADS.length])
const plugin = computed(() => store.plugins.find((p) => p.id === store.selectedId) || null)
const form = ref({})
function buildFormDefaults(p) {
const f = {}
if (p) p.fields.forEach((x) => (f[x.key] = x.default ?? (x.type === 'int' ? 0 : '')))
return f
}
watch(
() => plugin.value?.id,
(id) => {
form.value = buildFormDefaults(store.plugins.find((x) => x.id === id))
loadConfigs()
},
{ immediate: true }
)
function resetForm() {
form.value = buildFormDefaults(plugin.value)
curCfg.value = ''
}
// ===== 配置方案(多配置):把当前参数存成命名方案,运行台可一键套用、定时任务可引用 =====
const configs = ref([])
const curCfg = ref('')
const curCfgLabel = computed(() => {
if (!curCfg.value) return ''
const c = configs.value.find((x) => x.id === curCfg.value)
return c ? c.name : ''
})
async function loadConfigs() {
if (!plugin.value?.id) {
configs.value = []
curCfg.value = ''
return
}
try {
const r = await listPluginConfigs(plugin.value.id)
configs.value = r.configs || []
if (curCfg.value && !configs.value.some((c) => c.id === curCfg.value)) curCfg.value = ''
} catch (e) {
ElMessage.error('配置方案加载失败:' + (e.message || e))
}
}
function onCfgChange(id) {
const c = configs.value.find((x) => x.id === id)
if (!c) return
Object.assign(form.value, c.fields)
ElMessage.success(`已套用配置「${c.name}」`)
}
async function saveAsCfg() {
let name
try {
const r = await ElMessageBox.prompt('给这套参数起个名字(同名会覆盖旧配置)', '保存为配置', {
confirmButtonText: '保存',
cancelButtonText: '取消',
inputPattern: /\S+/,
inputErrorMessage: '名称不能为空',
inputValue: curCfgLabel.value || '',
})
name = r.value
} catch (e) {
if (e === 'cancel') return
throw e
}
try {
const r = await savePluginConfig(plugin.value.id, name, { ...form.value })
await loadConfigs()
curCfg.value = r.config.id
ElMessage.success(`配置「${r.config.name}」已保存`)
} catch (e) {
ElMessage.error(e.message || String(e))
}
}
async function delCfg() {
try {
await ElMessageBox.confirm(`确定删除配置「${curCfgLabel.value}」?`, '删除配置', {
type: 'warning',
confirmButtonText: '删除',
cancelButtonText: '取消',
})
} catch (_) { return }
try {
await deletePluginConfig(plugin.value.id, curCfg.value)
curCfg.value = ''
await loadConfigs()
ElMessage.success('已删除')
} catch (e) {
ElMessage.error('删除失败:' + (e.message || e))
}
}
// 专属界面插件:插件 UI 直接内嵌在页面主体(同源自动携带会话 cookie,不再弹窗/外跳)。
const uiSrc = computed(() => (plugin.value?.ui ? `/pui/${plugin.value.id}/` : ''))
// ===== 运行台标签页 =====
// 带专属界面的插件由界面自己配置参数,故不并列参数表单(与改造前语义一致)
const tabs = computed(() => {
const base = plugin.value?.ui
? [{ k: 'ui', label: '插件界面' }]
: [{ k: 'params', label: '参数配置' }]
return [...base, { k: 'log', label: '运行日志' }, { k: 'history', label: '历史运行' }]
})
const tab = ref('params')
const fieldCount = computed(() => (plugin.value?.fields || []).length)
watch(
() => plugin.value?.id,
(id) => {
tab.value = plugin.value?.ui ? 'ui' : 'params'
resetHistory()
consumePendingReplay()
},
{ immediate: true }
)
// ===== 历史运行 =====
const runs = ref([]) // 本场景最近运行(brief 列表)
const loadingRuns = ref(false)
const runsLoaded = ref(false) // 本场景是否已拉过(切换场景后重置)
const replay = ref(null) // 正在回看的单次运行 {brief..., logs:[...]}
const replayBusy = ref(false)
async function loadRuns() {
if (!plugin.value || loadingRuns.value) return
loadingRuns.value = true
try {
const data = await fetchRuns(60)
const mine = (data.runs || []).filter((r) => r.plugin_id === plugin.value.id)
runs.value = mine.slice(0, 30)
runsLoaded.value = true
} catch (_) { /* 历史是辅助能力,加载失败静默(列表保持上次/空) */ }
finally { loadingRuns.value = false }
}
async function openReplay(runId) {
if (!runId || replayBusy.value) return
replayBusy.value = true
try {
const data = await getRun(runId)
replay.value = { ...(data || {}), logs: (data && data.logs) || [] }
} catch (e) {
ElMessage.error('加载运行记录失败:' + (e.message || e))
} finally {
replayBusy.value = false
}
}
function resetHistory() {
runs.value = []
runsLoaded.value = false
replay.value = null
}
// 活动流「最近运行」点击 → 直达本场景回看:匹配当前场景则消费,否则等场景切换后消费
function consumePendingReplay() {
const p = store.pendingReplay
if (!p || !plugin.value || plugin.value.id !== p.pluginId) return false
store.pendingReplay = null
tab.value = 'history'
openReplay(p.runId)
return true
}
watch(() => store.pendingReplay, consumePendingReplay)
// 打开「历史运行」标签页且未拉过 → 拉取;运行结束(recents 变化)→ 若已拉过则刷新
watch(
() => tab.value,
(t) => { if (t === 'history' && !runsLoaded.value && !loadingRuns.value) loadRuns() }
)
watch(
() => store.recents.length,
() => { if (runsLoaded.value && !replay.value) loadRuns() }
)
function triggerLabel(t) {
return ({ manual: '手动执行', schedule: '定时任务' })[t] || t || '手动执行'
}
function durText(s) {
const n = parseInt(s, 10) || 0
if (n < 60) return n + 's'
const m = Math.floor(n / 60)
return m + '分' + (n % 60 ? (n % 60) + 's' : '')
}
function fmtTime(ts) {
if (!ts) return '—'
const d = new Date(ts * 1000)
if (isNaN(d.getTime())) return '—'
const p = (n) => String(n).padStart(2, '0')
return `${d.getMonth() + 1}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`
}
// 执行进度环(SVG stroke-dasharray)
const RING_C = 2 * Math.PI * 15.5
const ringDash = computed(() => `${(store.progress / 100) * RING_C} ${RING_C}`)
const platformLabel = computed(() => {
const p = store.platforms.find((x) => x.id === plugin.value?.platform)
return p?.label || plugin.value?.platform || ''
})
const platformOnline = computed(() =>
!!(store.platforms.find((x) => x.id === plugin.value?.platform) || {}).online
)
// ===== 插件回滚(升级前自动备份上一版,坏包可回退) =====
const rollbackVer = ref('')
async function loadRollbackInfo() {
if (!plugin.value) return
rollbackVer.value = ''
try {
const r = await listRollbacks()
const item = (r.items || []).find((i) => i.id === plugin.value.id)
rollbackVer.value = item ? item.version : ''
} catch (_) { /* 本地能力,失败静默 */ }
}
watch(() => plugin.value?.id, loadRollbackInfo, { immediate: true })
async function doRollback() {
if (!plugin.value || !rollbackVer.value) return
try {
await ElMessageBox.confirm(
`将「${plugin.value.name}」回滚到 v${rollbackVer.value}(当前 v${plugin.value.version})。` +
'回滚后如需最新版,再次点击右上角同步即可。确定回滚?',
'插件回滚',
{ type: 'warning', confirmButtonText: '回滚', cancelButtonText: '取消' }
)
} catch (_) { return }
try {
await rollbackPlugin(plugin.value.id)
ElMessage.success(`已回滚到 v${rollbackVer.value}`)
// 刷新插件列表:版本号等元数据由 /api/meta 重新下发
const meta = await fetchMeta()
store.plugins = meta.plugins || []
rollbackVer.value = ''
} catch (e) {
ElMessage.error('回滚失败:' + (e.message || e))
}
}
async function run() {
if (!plugin.value || store.running) return
if (plugin.value.platform && !platformOnline.value) {
log('WARN', `插件「${plugin.value.name}」需要先登录平台「${platformLabel.value}」才能正确执行`)
}
store.running = true
store.progress = 0
store.currentRun = ''
store.lastResult = null
store.lastSummary = ''
const payload = { ...form.value }
if (plugin.value.uses_month) payload.ref_month = month.value // 仅月度插件注入月份
try {
const r = await startRun(plugin.value.id, payload)
store.lastRunId = r.run_id
} catch (e) {
store.running = false
store.lastResult = { ok: false, error: e.message || String(e) }
log('ERROR', `启动执行失败:${e.message || e}`)
}
}
// 完成时拉取后端摘要填充横幅
watch(
() => store.lastResult,
async (res) => {
if (res && res.ok && store.lastRunId) {
try {
const run = await getRun(store.lastRunId)
store.lastSummary = run.result?.summary || ''
} catch (e) { }
}
}
)
function closeBanner() {
store.lastResult = null
}
</script>
<style scoped>
.plugin-page {
display: flex;
flex-direction: column;
gap: 14px;
flex: 1 1 auto; /* 填满中栏上下文区,运行台内部自己滚 */
min-height: 0;
}
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
}
/* ---------- Hero ---------- */
.hero {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
padding: 22px 24px;
background: var(--hero-grad);
}
.hero-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.avatar {
width: 54px; height: 54px; border-radius: 16px; flex-shrink: 0;
display: grid; place-items: center; color: var(--tile-fg);
font-size: 22px; font-weight: 700;
box-shadow: 0 10px 22px -10px rgba(var(--text-rgb), .35);
}
.hero-meta { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.p-name { margin: 0; font-size: 19px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 9px; }
.ver-tag {
font-size: 10.5px; font-weight: 500; color: var(--text-faint);
background: var(--surface-2); border: 1px solid var(--border);
padding: 1px 8px; border-radius: 999px;
}
.p-desc { margin: 0; font-size: 12.5px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 560px; }
.p-badges { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.badge {
display: inline-flex; align-items: center; gap: 6px;
font-size: 11px; color: var(--badge-warm-text);
background: var(--badge-warm-bg); border: 1px solid var(--badge-warm-border);
padding: 2px 10px; border-radius: 999px;
}
.badge.on { color: var(--ok-text); background: var(--ok-weak); border-color: rgba(var(--ok-rgb), .3); }
.badge.off { color: var(--badge-off-text); }
.bdot { width: 6px; height: 6px; border-radius: 50%; background: var(--badge-dot); }
.badge.on .bdot { background: var(--ok); }
.month-sel { width: 108px; --el-component-size: 24px; }
.hero-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; flex-shrink: 0; }
.run-btn {
display: inline-flex; align-items: center; gap: 9px;
padding: 0 26px; height: 50px;
border: none; border-radius: 16px;
background: var(--primary-grad-2);
color: var(--on-primary); font-size: 15px; font-weight: 600; letter-spacing: .06em;
cursor: pointer; font-family: inherit;
box-shadow: 0 12px 26px -12px rgba(var(--primary-rgb), .85);
transition: all .16s ease;
}
.run-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 30px -12px rgba(var(--primary-rgb), .95); }
.run-btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.run-btn.running { background: var(--primary-grad-3); cursor: default; min-width: 168px; font-variant-numeric: tabular-nums; }
/* 进度环用 CSS 上色(SVG 表现属性不支持 var(),故不写在 stroke="" 上) */
.ring-bg { stroke: rgba(var(--on-primary-rgb), .35); }
.ring-fg { stroke: var(--on-primary); }
.run-btn:disabled { opacity: 1; }
.play-ic { font-size: 13px; transform: translateY(-1px); }
.ring { display: inline-flex; }
.ring-fg { transition: stroke-dasharray .25s ease; }
.hero-tip { font-size: 10.5px; color: var(--text-faint); letter-spacing: .02em; }
.rollback-btn { margin-top: -3px; }
/* ---------- 结果横幅 ---------- */
.banner {
display: flex; align-items: center; gap: 11px;
padding: 12px 16px; border-radius: 14px;
animation: riseIn .3s var(--ease) both;
}
.banner.ok { background: var(--ok-weak); border: 1px solid rgba(var(--ok-rgb), .35); }
.banner.err { background: var(--err-weak); border: 1px solid rgba(var(--err-rgb), .4); }
.b-ic {
width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--on-primary);
}
.banner.ok .b-ic { background: var(--ok); }
.banner.err .b-ic { background: var(--err); }
.b-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.b-body b { font-size: 13px; color: var(--text); font-weight: 600; }
.b-body span { font-size: 12px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-close {
border: none; background: transparent; color: rgba(var(--text-rgb), .4);
cursor: pointer; font-size: 12px; padding: 4px; border-radius: 50%;
}
.b-close:hover { color: var(--text); background: rgba(var(--on-primary-rgb), .6); }
/* ---------- 运行台(标签页容器) ---------- */
.run-tabs {
flex: 1 1 auto; min-height: 300px;
display: flex; flex-direction: column; overflow: hidden;
}
.rt-head {
display: flex; align-items: center; justify-content: space-between; gap: 10px;
padding: 0 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.rt-tabs { display: flex; align-items: center; gap: 2px; }
.rt-tab {
display: inline-flex; align-items: center; gap: 6px;
border: none; background: transparent; cursor: pointer; font-family: inherit;
padding: 11px 14px; font-size: 13px; color: var(--text-sub);
border-bottom: 2px solid transparent; margin-bottom: -1px;
transition: color .13s, border-color .13s;
}
.rt-tab:hover { color: var(--text); }
.rt-tab.on { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.rt-n {
font-size: 10.5px; color: var(--text-faint); background: var(--surface-2);
border: 1px solid var(--border); border-radius: 999px; padding: 0 6px;
}
.rt-tab.on .rt-n { color: var(--primary); background: var(--primary-weak); border-color: var(--primary-line); }
.rt-live { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: rtBlink 1s infinite; }
@keyframes rtBlink { 50% { opacity: .2; } }
.rt-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.rt-log { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
/* ---------- 专属界面插件 ---------- */
.ui-pane { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; padding: 14px 16px 16px; }
.pui-frame {
display: block; width: 100%; flex: 1 1 auto; min-height: 340px;
border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
/* ---------- 参数 ---------- */
.params { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 18px 22px 6px; }
.cfg-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.cfg-sel { width: 200px; }
.cfg-note { font-size: 11.5px; color: var(--text-faint); }
.fields { display: flex; gap: 24px; flex-wrap: wrap; }
.form-card .el-form-item { margin-bottom: 18px; }
.help-ic { color: var(--text-faint); cursor: help; }
/* ---------- 历史运行 ---------- */
.history { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.hist-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.hist-head {
display: flex; align-items: center; justify-content: space-between; gap: 10px;
padding: 10px 16px 6px; flex-shrink: 0;
}
.hist-title { font-size: 12.5px; font-weight: 600; color: var(--text-sub); }
.hist-empty {
flex: 1 1 auto; display: grid; place-items: center;
color: var(--text-faint); font-size: 12.5px; padding: 30px 20px; text-align: center;
}
.hist-list { flex: 1 1 auto; min-height: 0; overflow: auto; list-style: none; margin: 4px 8px 10px; padding: 0; }
.hist-item {
display: flex; align-items: center; gap: 11px;
padding: 10px 12px; border-radius: 12px; cursor: pointer;
transition: background .13s ease;
}
.hist-item:hover { background: var(--surface-2); }
.hist-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.hist-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-weak); }
.hist-dot.err { background: var(--err); box-shadow: 0 0 0 3px var(--err-weak); }
.hist-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hist-meta b { font-size: 13px; color: var(--text); font-weight: 600; }
.hist-time { font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.hist-state { font-size: 12px; font-weight: 600; flex-shrink: 0; }
.hist-state.ok { color: var(--ok); }
.hist-state.err { color: var(--err); }
.hist-arrow { color: var(--text-faint); font-size: 13px; flex-shrink: 0; }
.hist-replay { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.replay-head {
display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
padding: 8px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.replay-tags { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; }
.replay-tag {
font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums;
background: var(--surface-2); border: 1px solid var(--border);
padding: 1px 9px; border-radius: 999px;
}
.replay-sum {
font-size: 11.5px; color: var(--text-sub); white-space: nowrap;
overflow: hidden; text-overflow: ellipsis; max-width: 340px;
}
@keyframes riseIn {
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: none; }
}
</style>