feat: 初始化DevOps平台前端
This commit is contained in:
@@ -0,0 +1,243 @@
|
||||
<script setup lang="ts">
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { computed, ref } from 'vue'
|
||||
import { devopsApi } from '../services/devopsApi'
|
||||
import { usePlatformStore } from '../stores/platform'
|
||||
import type { AgentMode, AgentPurpose } from '../types/devops'
|
||||
|
||||
const platform = usePlatformStore()
|
||||
const selectedMode = ref<AgentMode>('risk')
|
||||
const selectedProject = ref('access-manage')
|
||||
const selectedRun = ref('run-1050')
|
||||
const runbookQuestion = ref('测试环境 Jenkins 构建失败时应该先看哪些信息?')
|
||||
const generating = ref(false)
|
||||
const resultMarkdown = ref('')
|
||||
|
||||
const activeCard = computed(() => {
|
||||
return platform.agentCards.find((card) => card.mode === selectedMode.value)
|
||||
})
|
||||
|
||||
const preview = computed(() => {
|
||||
if (selectedMode.value === 'risk') {
|
||||
return ['检查生产 tag 是否来自 develop 合并记录', '确认 Jenkins prod job 参数模板已配置', '通知平台未配置时不阻断发布流程']
|
||||
}
|
||||
|
||||
if (selectedMode.value === 'diagnosis') {
|
||||
return ['失败节点:Jenkins 构建', '建议先查看 pnpm build 类型错误和 env 注入', '重试前确认依赖锁文件未被并行任务改写']
|
||||
}
|
||||
|
||||
if (selectedMode.value === 'runbook') {
|
||||
return ['查看 run steps 中的失败节点和 build URL', '读取 progressiveText 的最后 200 行', '若为配置缺失,升级到后端维护密钥和 Job mapping']
|
||||
}
|
||||
|
||||
return ['发布对象、环境、tag 和操作者', '主要变更和验证范围', '回滚入口与通知对象']
|
||||
})
|
||||
|
||||
const purpose = computed<AgentPurpose>(() => {
|
||||
if (selectedMode.value === 'diagnosis') {
|
||||
return 'failure-diagnosis'
|
||||
}
|
||||
|
||||
if (selectedMode.value === 'runbook') {
|
||||
return 'runbook-qa'
|
||||
}
|
||||
|
||||
if (selectedMode.value === 'releaseNotes') {
|
||||
return 'release-note'
|
||||
}
|
||||
|
||||
return 'release-risk'
|
||||
})
|
||||
|
||||
async function generateAgentResult() {
|
||||
generating.value = true
|
||||
try {
|
||||
const invocation = await devopsApi.createAgentInvocation({
|
||||
type: purpose.value,
|
||||
runId: selectedMode.value === 'diagnosis' ? selectedRun.value : undefined,
|
||||
projectKey: selectedProject.value,
|
||||
promptSummary:
|
||||
selectedMode.value === 'runbook'
|
||||
? runbookQuestion.value
|
||||
: `${activeCard.value?.title ?? 'Agent'} · ${selectedProject.value}`,
|
||||
})
|
||||
resultMarkdown.value = invocation.resultMarkdown || 'Agent 未返回内容'
|
||||
ElMessage.success('Agent 结果已生成')
|
||||
} finally {
|
||||
generating.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-shell">
|
||||
<div class="page-header">
|
||||
<div>
|
||||
<h1>Agent 辅助</h1>
|
||||
<p>仅提供 DevOps 场景能力:发布风险、失败诊断、Runbook 问答和发布说明草稿。</p>
|
||||
</div>
|
||||
<ElTag type="warning" effect="plain" round>无泛聊天入口</ElTag>
|
||||
</div>
|
||||
|
||||
<div class="three-column">
|
||||
<button
|
||||
v-for="card in platform.agentCards"
|
||||
:key="card.mode"
|
||||
class="agent-card"
|
||||
:class="{ active: selectedMode === card.mode }"
|
||||
type="button"
|
||||
@click="selectedMode = card.mode"
|
||||
>
|
||||
<strong>{{ card.title }}</strong>
|
||||
<span>{{ card.description }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="two-column">
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>{{ activeCard?.title }}</h2>
|
||||
<span>输入被限制在运维对象内</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ElForm label-position="top">
|
||||
<ElFormItem label="项目">
|
||||
<ElSelect v-model="selectedProject">
|
||||
<ElOption
|
||||
v-for="project in platform.projects"
|
||||
:key="project.key"
|
||||
:label="project.name"
|
||||
:value="project.key"
|
||||
/>
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<ElFormItem v-if="selectedMode === 'diagnosis'" label="失败 Run">
|
||||
<ElSelect v-model="selectedRun">
|
||||
<ElOption
|
||||
v-for="run in platform.failedRuns"
|
||||
:key="run.id"
|
||||
:label="`${run.id} · ${run.projectName} · ${run.ref}`"
|
||||
:value="run.id"
|
||||
/>
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<ElFormItem v-if="selectedMode === 'runbook'" label="Runbook 问题">
|
||||
<ElInput v-model="runbookQuestion" type="textarea" :rows="3" maxlength="120" show-word-limit />
|
||||
<div class="field-hint">问题必须围绕发布、构建、通知、流程状态或回滚。</div>
|
||||
</ElFormItem>
|
||||
<ElFormItem v-if="selectedMode === 'releaseNotes'" label="发布 tag">
|
||||
<ElSelect model-value="v2026.06.11-api.1">
|
||||
<ElOption label="v2026.06.11-api.1" value="v2026.06.11-api.1" />
|
||||
<ElOption label="v2026.06.05-envsplit.7" value="v2026.06.05-envsplit.7" />
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<ElButton type="primary" :loading="generating" @click="generateAgentResult">
|
||||
生成结果
|
||||
</ElButton>
|
||||
</ElForm>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>输出预览</h2>
|
||||
<span>后端代理 LLM 后替换</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="scope-block">
|
||||
<strong>允许输入</strong>
|
||||
<ElTag v-for="scope in activeCard?.inputScope" :key="scope" type="info" effect="plain">
|
||||
{{ scope }}
|
||||
</ElTag>
|
||||
</div>
|
||||
<div class="scope-block">
|
||||
<strong>预期输出</strong>
|
||||
<ul>
|
||||
<li v-for="item in preview" :key="item">{{ item }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-if="resultMarkdown" class="result-block">
|
||||
<strong>生成结果</strong>
|
||||
<p>{{ resultMarkdown }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.agent-card {
|
||||
min-height: 118px;
|
||||
padding: 16px;
|
||||
border: 1px solid #e3e8f2;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.agent-card.active {
|
||||
border-color: #1d5fd0;
|
||||
background: #f3f7ff;
|
||||
}
|
||||
|
||||
.agent-card strong,
|
||||
.agent-card span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.agent-card strong {
|
||||
color: #172033;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.agent-card span {
|
||||
margin-top: 10px;
|
||||
color: #697386;
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.scope-block {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
padding: 12px 0;
|
||||
}
|
||||
|
||||
.scope-block + .scope-block {
|
||||
border-top: 1px solid #edf1f7;
|
||||
}
|
||||
|
||||
.scope-block strong {
|
||||
width: 100%;
|
||||
color: #172033;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
padding-left: 18px;
|
||||
color: #596578;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.result-block {
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid #edf1f7;
|
||||
}
|
||||
|
||||
.result-block strong {
|
||||
display: block;
|
||||
color: #172033;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.result-block p {
|
||||
margin: 8px 0 0;
|
||||
color: #334155;
|
||||
line-height: 1.7;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,116 @@
|
||||
<script setup lang="ts">
|
||||
import { Lock, Monitor } from '@element-plus/icons-vue'
|
||||
import { reactive } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useSessionStore } from '../stores/session'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const session = useSessionStore()
|
||||
|
||||
const form = reactive({
|
||||
operator: 'ops-admin',
|
||||
password: 'mock-password',
|
||||
})
|
||||
|
||||
function submit() {
|
||||
session.login(form.operator)
|
||||
const redirect = typeof route.query.redirect === 'string' ? route.query.redirect : '/overview'
|
||||
void router.push(redirect)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="login-page">
|
||||
<section class="login-panel">
|
||||
<div class="login-copy">
|
||||
<ElIcon><Monitor /></ElIcon>
|
||||
<h1>DevOps 运维平台</h1>
|
||||
<p>第一阶段使用 mock session,仅用于本地控制台联调。真实身份、RBAC 和审计由后端接入后替换。</p>
|
||||
</div>
|
||||
<ElForm class="login-form" label-position="top" @submit.prevent="submit">
|
||||
<ElFormItem label="操作员">
|
||||
<ElInput v-model="form.operator" size="large" autocomplete="username" />
|
||||
</ElFormItem>
|
||||
<ElFormItem label="口令">
|
||||
<ElInput
|
||||
v-model="form.password"
|
||||
size="large"
|
||||
type="password"
|
||||
autocomplete="current-password"
|
||||
show-password
|
||||
/>
|
||||
</ElFormItem>
|
||||
<ElButton type="primary" size="large" :icon="Lock" native-type="submit">
|
||||
进入控制台
|
||||
</ElButton>
|
||||
</ElForm>
|
||||
</section>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.login-page {
|
||||
display: grid;
|
||||
min-height: 100vh;
|
||||
place-items: center;
|
||||
padding: 24px;
|
||||
background: #eef2f7;
|
||||
}
|
||||
|
||||
.login-panel {
|
||||
display: grid;
|
||||
width: min(860px, 100%);
|
||||
grid-template-columns: 1fr 360px;
|
||||
overflow: hidden;
|
||||
border: 1px solid #dfe6f0;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 18px 50px rgb(15 23 42 / 10%);
|
||||
}
|
||||
|
||||
.login-copy {
|
||||
padding: 44px;
|
||||
border-right: 1px solid #e6ebf3;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.login-copy .el-icon {
|
||||
color: #1d5fd0;
|
||||
font-size: 34px;
|
||||
}
|
||||
|
||||
.login-copy h1 {
|
||||
margin: 18px 0 10px;
|
||||
color: #111827;
|
||||
font-size: 28px;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.login-copy p {
|
||||
max-width: 420px;
|
||||
color: #697386;
|
||||
font-size: 14px;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
padding: 44px 36px;
|
||||
}
|
||||
|
||||
.login-form .el-button {
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
@media (max-width: 780px) {
|
||||
.login-panel {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.login-copy {
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid #e6ebf3;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,163 @@
|
||||
<script setup lang="ts">
|
||||
import { CircleCheck, Cpu, Failed, Finished } from '@element-plus/icons-vue'
|
||||
import { computed } from 'vue'
|
||||
import MetricTile from '../components/MetricTile.vue'
|
||||
import StatusPill from '../components/StatusPill.vue'
|
||||
import { usePlatformStore } from '../stores/platform'
|
||||
|
||||
const platform = usePlatformStore()
|
||||
|
||||
const successCount = computed(() => platform.runs.filter((run) => run.status === 'success').length)
|
||||
const failedCount = computed(() => platform.failedRuns.length)
|
||||
const runningCount = computed(() => platform.runningRuns.length)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-shell">
|
||||
<div class="page-header">
|
||||
<div>
|
||||
<h1>运维总览</h1>
|
||||
<p>集中查看纳管项目环境、最近发布、Jenkins/Gitea/通知平台/LLM 当前状态。</p>
|
||||
</div>
|
||||
<ElButton type="primary" plain @click="platform.loadAll">刷新数据</ElButton>
|
||||
</div>
|
||||
|
||||
<div class="status-grid">
|
||||
<MetricTile label="纳管项目" :value="platform.projects.length" caption="含 DevOps 平台自管理项目" :icon="Cpu" />
|
||||
<MetricTile label="运行中发布" :value="runningCount" caption="当前 Jenkins 或健康检查处理中" :icon="Finished" tone="warning" />
|
||||
<MetricTile label="成功记录" :value="successCount" caption="最近 mock run 成功数" :icon="CircleCheck" tone="success" />
|
||||
<MetricTile label="失败提醒" :value="failedCount" caption="需要诊断或重试的 run" :icon="Failed" tone="danger" />
|
||||
</div>
|
||||
|
||||
<div class="section-grid">
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>集成状态</h2>
|
||||
<span>{{ platform.dataSource === 'backend' ? '来自后端 health' : '后端不可用,当前使用 mock' }}</span>
|
||||
</div>
|
||||
<div class="panel-body compact-list">
|
||||
<div v-for="item in platform.integrations" :key="item.key" class="list-row">
|
||||
<span>
|
||||
<strong>{{ item.name }}</strong>
|
||||
<small>{{ item.summary }}</small>
|
||||
</span>
|
||||
<span class="integration-tail">
|
||||
<StatusPill :state="item.state" />
|
||||
<small>{{ item.latencyMs ? `${item.latencyMs}ms` : item.checkedAt }}</small>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>最近发布</h2>
|
||||
<span>按 startedAt 倒序</span>
|
||||
</div>
|
||||
<div class="panel-body compact-list">
|
||||
<div v-for="run in platform.runs" :key="run.id" class="list-row">
|
||||
<span>
|
||||
<strong>{{ run.projectName }} · {{ run.ref }}</strong>
|
||||
<small>{{ run.environment }} · {{ run.actor }} · {{ run.duration }}</small>
|
||||
</span>
|
||||
<StatusPill :state="run.status" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>项目环境</h2>
|
||||
<span>测试/生产状态和集成摘要</span>
|
||||
</div>
|
||||
<div class="project-grid panel-body">
|
||||
<article v-for="project in platform.projects" :key="project.key" class="project-card">
|
||||
<div class="project-head">
|
||||
<div>
|
||||
<strong>{{ project.name }}</strong>
|
||||
<small>{{ project.serviceType }}</small>
|
||||
</div>
|
||||
<ElTag type="info" round>{{ project.defaultBranch }}</ElTag>
|
||||
</div>
|
||||
<div class="compact-list">
|
||||
<div v-for="env in project.environments" :key="env.name" class="env-row">
|
||||
<span>
|
||||
<strong>{{ env.label }}</strong>
|
||||
<small>{{ env.version }} · {{ env.lastReleasedAt }}</small>
|
||||
</span>
|
||||
<StatusPill :state="env.status" />
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.integration-tail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.project-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.project-card {
|
||||
padding: 14px;
|
||||
border: 1px solid #e3e8f2;
|
||||
border-radius: 8px;
|
||||
background: #fbfcff;
|
||||
}
|
||||
|
||||
.project-head,
|
||||
.env-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.project-head {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.project-head strong,
|
||||
.env-row strong {
|
||||
display: block;
|
||||
color: #172033;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.project-head small,
|
||||
.env-row small {
|
||||
display: block;
|
||||
margin-top: 3px;
|
||||
color: #7b8798;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.env-row {
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
.project-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.project-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,125 @@
|
||||
<script setup lang="ts">
|
||||
import StatusPill from '../components/StatusPill.vue'
|
||||
import { usePlatformStore } from '../stores/platform'
|
||||
|
||||
const platform = usePlatformStore()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-shell">
|
||||
<div class="page-header">
|
||||
<div>
|
||||
<h1>项目配置</h1>
|
||||
<p>第一版展示项目、环境、Jenkins Job、Gitea 仓库和通知通道绑定关系。</p>
|
||||
</div>
|
||||
<ElButton type="primary" plain disabled>新增项目</ElButton>
|
||||
</div>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>项目清单</h2>
|
||||
<span>{{ platform.dataSource === 'backend' ? '由后端 projects 接口返回' : '当前使用本地 mock 配置' }}</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ElTable :data="platform.projects" row-key="key">
|
||||
<ElTableColumn type="expand">
|
||||
<template #default="{ row }">
|
||||
<div class="env-config">
|
||||
<div v-for="env in row.environments" :key="env.name" class="env-config-card">
|
||||
<div class="env-config-head">
|
||||
<strong>{{ env.label }}</strong>
|
||||
<StatusPill :state="env.status" />
|
||||
</div>
|
||||
<dl>
|
||||
<dt>分支策略</dt>
|
||||
<dd>{{ env.branchPolicy }}</dd>
|
||||
<dt>Jenkins Job</dt>
|
||||
<dd class="mono">{{ env.jenkinsJob }}</dd>
|
||||
<dt>通知通道</dt>
|
||||
<dd>{{ env.wecomRobot }}</dd>
|
||||
<dt>最近发布</dt>
|
||||
<dd>{{ env.lastRunId }} · {{ env.version }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn prop="name" label="项目" min-width="150" />
|
||||
<ElTableColumn prop="serviceType" label="类型" min-width="130" />
|
||||
<ElTableColumn prop="repository" label="Gitea 仓库" min-width="320">
|
||||
<template #default="{ row }">
|
||||
<span class="mono">{{ row.repository }}</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn prop="defaultBranch" label="默认分支" width="120" />
|
||||
<ElTableColumn prop="tagPolicy" label="Tag 策略" min-width="220" />
|
||||
<ElTableColumn label="集成状态" width="280">
|
||||
<template #default="{ row }">
|
||||
<div class="status-tags">
|
||||
<StatusPill :state="row.integrations.jenkins" text="Jenkins" />
|
||||
<StatusPill :state="row.integrations.gitea" text="Gitea" />
|
||||
<StatusPill :state="row.integrations.wecom" text="通知" />
|
||||
<StatusPill :state="row.integrations.llm" text="LLM" />
|
||||
</div>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.env-config {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
padding: 14px 46px;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.env-config-card {
|
||||
padding: 14px;
|
||||
border: 1px solid #e1e8f2;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.env-config-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
dl {
|
||||
display: grid;
|
||||
grid-template-columns: 100px minmax(0, 1fr);
|
||||
gap: 8px 12px;
|
||||
margin: 0;
|
||||
color: #596578;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
dt {
|
||||
color: #7b8798;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.status-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.env-config {
|
||||
grid-template-columns: 1fr;
|
||||
padding: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,360 @@
|
||||
<script setup lang="ts">
|
||||
import { CircleClose, Promotion, RefreshRight, VideoPause } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import BpmnStatusViewer from '../components/BpmnStatusViewer.vue'
|
||||
import RunExecutionDetails from '../components/RunExecutionDetails.vue'
|
||||
import StatusPill from '../components/StatusPill.vue'
|
||||
import { usePlatformStore } from '../stores/platform'
|
||||
import type { EnvironmentName, ReleaseRun, ReleaseStatus } from '../types/devops'
|
||||
|
||||
const platform = usePlatformStore()
|
||||
|
||||
const form = reactive({
|
||||
projectKey: 'access-manage',
|
||||
environment: 'test' as EnvironmentName,
|
||||
ref: 'develop',
|
||||
note: '测试环境部署验证',
|
||||
confirmed: false,
|
||||
})
|
||||
|
||||
const localStatus = ref<ReleaseStatus>('idle')
|
||||
const activeRun = ref<ReleaseRun | null>(null)
|
||||
const submitting = ref(false)
|
||||
const refsLoading = ref(false)
|
||||
|
||||
const selectedProject = computed(() => {
|
||||
return platform.projects.find((project) => project.key === form.projectKey)
|
||||
})
|
||||
|
||||
const currentRefs = computed(() => platform.projectRefs[form.projectKey])
|
||||
|
||||
const environmentOptions = computed(() => {
|
||||
const environments = selectedProject.value?.environments ?? []
|
||||
|
||||
if (!environments.length) {
|
||||
return [
|
||||
{ label: '测试环境', value: 'test' },
|
||||
{ label: '生产环境', value: 'production' },
|
||||
]
|
||||
}
|
||||
|
||||
return environments.map((environment) => ({
|
||||
label: environment.label,
|
||||
value: environment.name,
|
||||
}))
|
||||
})
|
||||
|
||||
const selectedEnvironment = computed(() => {
|
||||
return selectedProject.value?.environments.find((environment) => environment.name === form.environment)
|
||||
})
|
||||
|
||||
const useBranchRefs = computed(() => {
|
||||
return selectedEnvironment.value?.branchPolicy === 'master'
|
||||
})
|
||||
|
||||
const refOptions = computed(() => {
|
||||
const refs = currentRefs.value
|
||||
|
||||
if (form.environment === 'production' && !useBranchRefs.value) {
|
||||
return refs?.tags.map((tag) => tag.name) ?? ['v2026.06.05-envsplit.7']
|
||||
}
|
||||
|
||||
return refs?.branches.map((branch) => branch.name) ?? [selectedProject.value?.defaultBranch ?? 'develop']
|
||||
})
|
||||
|
||||
const refSourceText = computed(() => {
|
||||
const source = currentRefs.value?.source
|
||||
|
||||
if (source === 'gitea') {
|
||||
return 'Gitea 实时 refs'
|
||||
}
|
||||
|
||||
if (source === 'fallback') {
|
||||
return '后端 fallback refs'
|
||||
}
|
||||
|
||||
return '本地 mock refs'
|
||||
})
|
||||
|
||||
const canTrigger = computed(() => {
|
||||
if (!form.projectKey || !form.environment || !form.ref) {
|
||||
return false
|
||||
}
|
||||
|
||||
return form.environment === 'production' ? form.confirmed : true
|
||||
})
|
||||
|
||||
const shownRun = computed(() => {
|
||||
return activeRun.value || platform.runs[0]
|
||||
})
|
||||
|
||||
const canSyncJenkins = computed(() => {
|
||||
return shownRun.value?.status === 'queued' || shownRun.value?.status === 'running'
|
||||
})
|
||||
|
||||
async function triggerRelease() {
|
||||
submitting.value = true
|
||||
try {
|
||||
const run = await platform.createDeployRun({
|
||||
projectKey: form.projectKey,
|
||||
environment: form.environment,
|
||||
ref: form.ref,
|
||||
operator: 'ops-admin',
|
||||
remark: form.note,
|
||||
idempotencyKey: `${form.projectKey}:${form.environment}:${form.ref}:${Date.now()}`,
|
||||
})
|
||||
activeRun.value = run
|
||||
localStatus.value = run.status
|
||||
ElMessage.success(platform.dataSource === 'backend' ? '发布单已提交到后端' : '后端不可用,已生成本地发布单')
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function cancelRelease() {
|
||||
if (!shownRun.value) {
|
||||
return
|
||||
}
|
||||
|
||||
submitting.value = true
|
||||
try {
|
||||
const run = await platform.cancelDeployRun(shownRun.value)
|
||||
activeRun.value = run
|
||||
localStatus.value = run.status
|
||||
ElMessage.success('发布单已取消')
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function retryRelease() {
|
||||
if (!shownRun.value) {
|
||||
return
|
||||
}
|
||||
|
||||
submitting.value = true
|
||||
try {
|
||||
const run = await platform.retryDeployRun(shownRun.value)
|
||||
activeRun.value = run
|
||||
localStatus.value = run.status
|
||||
ElMessage.success(platform.dataSource === 'backend' ? '已提交重试发布单' : '后端不可用,已生成本地重试单')
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function syncJenkinsRun() {
|
||||
if (!shownRun.value) {
|
||||
return
|
||||
}
|
||||
|
||||
submitting.value = true
|
||||
try {
|
||||
const run = await platform.syncJenkinsRun(shownRun.value)
|
||||
activeRun.value = run
|
||||
localStatus.value = run.status
|
||||
ElMessage.success(platform.dataSource === 'backend' ? '已同步 Jenkins 状态' : '后端不可用,保留本地状态')
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadProjectRefs() {
|
||||
if (!form.projectKey) {
|
||||
return
|
||||
}
|
||||
|
||||
refsLoading.value = true
|
||||
try {
|
||||
await platform.loadProjectRefs(form.projectKey)
|
||||
} finally {
|
||||
refsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function useFailedRun() {
|
||||
const failed = platform.failedRuns[0]
|
||||
if (!failed) {
|
||||
return
|
||||
}
|
||||
|
||||
form.projectKey = failed.projectKey
|
||||
form.environment = failed.environment
|
||||
form.ref = failed.ref
|
||||
form.note = `重试 ${failed.id}`
|
||||
form.confirmed = failed.environment !== 'production'
|
||||
localStatus.value = 'failed'
|
||||
activeRun.value = failed
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [form.projectKey, platform.projects.length],
|
||||
() => {
|
||||
const firstEnvironment = selectedProject.value?.environments[0]
|
||||
|
||||
if (firstEnvironment && !selectedProject.value?.environments.some((env) => env.name === form.environment)) {
|
||||
form.environment = firstEnvironment.name
|
||||
}
|
||||
void loadProjectRefs()
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
watch(refOptions, (options) => {
|
||||
if (options.length > 0 && !options.includes(form.ref)) {
|
||||
form.ref = options[0]
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-shell">
|
||||
<div class="page-header">
|
||||
<div>
|
||||
<h1>发布中心</h1>
|
||||
<p>选择项目、环境和 ref/tag,填写备注后触发发布;生产环境必须完成二次确认。</p>
|
||||
</div>
|
||||
<div class="toolbar">
|
||||
<ElButton :icon="RefreshRight" @click="useFailedRun">载入最近失败</ElButton>
|
||||
<StatusPill :state="localStatus" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="two-column">
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>发布参数</h2>
|
||||
<span>{{ platform.dataSource === 'backend' ? '通过后端创建发布单' : '后端不可用时使用本地降级' }}</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ElForm label-position="top">
|
||||
<div class="form-grid">
|
||||
<ElFormItem label="项目">
|
||||
<ElSelect v-model="form.projectKey" filterable>
|
||||
<ElOption
|
||||
v-for="project in platform.projects"
|
||||
:key="project.key"
|
||||
:label="project.name"
|
||||
:value="project.key"
|
||||
/>
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="环境">
|
||||
<ElSegmented
|
||||
v-model="form.environment"
|
||||
:options="environmentOptions"
|
||||
/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="ref / tag">
|
||||
<ElSelect
|
||||
v-model="form.ref"
|
||||
filterable
|
||||
allow-create
|
||||
default-first-option
|
||||
:loading="refsLoading"
|
||||
>
|
||||
<ElOption v-for="item in refOptions" :key="item" :label="item" :value="item" />
|
||||
</ElSelect>
|
||||
<div class="field-hint">
|
||||
{{ form.environment === 'production' ? selectedProject?.tagPolicy : selectedProject?.defaultBranch }}
|
||||
· {{ refSourceText }}
|
||||
</div>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="备注">
|
||||
<ElInput v-model="form.note" type="textarea" :rows="3" maxlength="120" show-word-limit />
|
||||
</ElFormItem>
|
||||
</div>
|
||||
<ElAlert
|
||||
v-if="form.environment === 'production'"
|
||||
class="danger-note"
|
||||
title="生产发布需要二次确认:已确认 tag、回滚方案、通知对象和业务窗口。"
|
||||
type="warning"
|
||||
:closable="false"
|
||||
/>
|
||||
<ElCheckbox v-model="form.confirmed" class="confirm-line">
|
||||
我确认本次发布参数、目标环境和通知范围无误
|
||||
</ElCheckbox>
|
||||
<div class="action-row">
|
||||
<ElButton
|
||||
type="primary"
|
||||
:icon="Promotion"
|
||||
:disabled="!canTrigger || submitting"
|
||||
:loading="submitting"
|
||||
@click="triggerRelease"
|
||||
>
|
||||
触发发布
|
||||
</ElButton>
|
||||
<ElButton :icon="VideoPause" :disabled="localStatus !== 'queued' || submitting" @click="cancelRelease">
|
||||
取消
|
||||
</ElButton>
|
||||
<ElButton :icon="CircleClose" :disabled="localStatus !== 'failed' || submitting" @click="retryRelease">
|
||||
重试
|
||||
</ElButton>
|
||||
</div>
|
||||
</ElForm>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>当前发布单</h2>
|
||||
<div class="toolbar compact-toolbar">
|
||||
<ElButton
|
||||
size="small"
|
||||
:icon="RefreshRight"
|
||||
:disabled="!canSyncJenkins || submitting"
|
||||
:loading="submitting && canSyncJenkins"
|
||||
@click="syncJenkinsRun"
|
||||
>
|
||||
同步 Jenkins
|
||||
</ElButton>
|
||||
<StatusPill :state="shownRun?.status || 'idle'" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body" v-if="shownRun">
|
||||
<RunExecutionDetails :run="shownRun" />
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>BPMN 流程状态</h2>
|
||||
<span>step.bpmnNodeId 与 BPMN XML 节点 id 对齐后高亮</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<BpmnStatusViewer
|
||||
v-if="platform.releaseProcessXml && shownRun"
|
||||
:xml="platform.releaseProcessXml"
|
||||
:steps="shownRun.steps"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 8px 14px;
|
||||
}
|
||||
|
||||
.confirm-line {
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.action-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.form-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,143 @@
|
||||
<script setup lang="ts">
|
||||
import { RefreshRight } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { computed, ref } from 'vue'
|
||||
import BpmnStatusViewer from '../components/BpmnStatusViewer.vue'
|
||||
import RunExecutionDetails from '../components/RunExecutionDetails.vue'
|
||||
import StatusPill from '../components/StatusPill.vue'
|
||||
import { usePlatformStore } from '../stores/platform'
|
||||
import type { ReleaseRun } from '../types/devops'
|
||||
|
||||
const platform = usePlatformStore()
|
||||
const selectedRunId = ref(platform.runs[0]?.id || '')
|
||||
const syncingAll = ref(false)
|
||||
|
||||
const selectedRun = computed<ReleaseRun | undefined>(() => {
|
||||
return platform.runs.find((run) => run.id === selectedRunId.value) || platform.runs[0]
|
||||
})
|
||||
|
||||
const canSyncSelectedRun = computed(() => {
|
||||
return canSyncRun(selectedRun.value)
|
||||
})
|
||||
|
||||
const canSyncAnyRun = computed(() => platform.runs.some((run) => canSyncRun(run)))
|
||||
|
||||
function canSyncRun(run?: ReleaseRun): boolean {
|
||||
return (
|
||||
Boolean(run?.jenkinsQueueId || run?.jenkinsBuildNumber) &&
|
||||
(run?.status === 'queued' || run?.status === 'running')
|
||||
)
|
||||
}
|
||||
|
||||
async function syncSelectedRun() {
|
||||
if (!selectedRun.value) {
|
||||
return
|
||||
}
|
||||
|
||||
const run = await platform.syncJenkinsRun(selectedRun.value)
|
||||
selectedRunId.value = run.id
|
||||
ElMessage.success(platform.dataSource === 'backend' ? '已同步 Jenkins 状态' : '后端不可用,保留本地状态')
|
||||
}
|
||||
|
||||
async function syncAllJenkinsRuns() {
|
||||
syncingAll.value = true
|
||||
try {
|
||||
const result = await platform.syncJenkinsRuns()
|
||||
if (result.failedRuns.length > 0) {
|
||||
ElMessage.warning(
|
||||
`已同步 ${result.syncedRuns.length} 个 run,${result.failedRuns.length} 个同步失败`,
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
ElMessage.success(
|
||||
result.totalCandidates > 0
|
||||
? `已同步 ${result.syncedRuns.length} 个 Jenkins run`
|
||||
: '当前没有需要同步的 Jenkins run',
|
||||
)
|
||||
} finally {
|
||||
syncingAll.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-shell">
|
||||
<div class="page-header">
|
||||
<div>
|
||||
<h1>运行记录</h1>
|
||||
<p>查看发布 run、Jenkins 构建链接、耗时、失败节点和流程轨迹。</p>
|
||||
</div>
|
||||
<ElButton
|
||||
:icon="RefreshRight"
|
||||
:loading="syncingAll"
|
||||
:disabled="!canSyncAnyRun"
|
||||
@click="syncAllJenkinsRuns"
|
||||
>
|
||||
同步全部 Jenkins
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>Run 列表</h2>
|
||||
<span>点击行切换下方流程图</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ElTable
|
||||
:data="platform.runs"
|
||||
row-key="id"
|
||||
highlight-current-row
|
||||
@row-click="(row: ReleaseRun) => (selectedRunId = row.id)"
|
||||
>
|
||||
<ElTableColumn prop="id" label="Run ID" width="110" />
|
||||
<ElTableColumn prop="projectName" label="项目" min-width="140" />
|
||||
<ElTableColumn prop="environment" label="环境" width="120" />
|
||||
<ElTableColumn prop="ref" label="ref/tag" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<span class="mono">{{ row.ref }}</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn prop="status" label="状态" width="110">
|
||||
<template #default="{ row }">
|
||||
<StatusPill :state="row.status" />
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn prop="actor" label="操作者" width="130" />
|
||||
<ElTableColumn prop="duration" label="耗时" width="100" />
|
||||
<ElTableColumn prop="note" label="备注" min-width="220" />
|
||||
</ElTable>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel" v-if="selectedRun">
|
||||
<div class="panel-header">
|
||||
<h2>{{ selectedRun.id }} 执行详情</h2>
|
||||
<div class="toolbar compact-toolbar">
|
||||
<ElButton
|
||||
size="small"
|
||||
:icon="RefreshRight"
|
||||
:disabled="!canSyncSelectedRun"
|
||||
@click="syncSelectedRun"
|
||||
>
|
||||
同步 Jenkins
|
||||
</ElButton>
|
||||
<StatusPill :state="selectedRun.status" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<RunExecutionDetails :run="selectedRun" />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel" v-if="selectedRun">
|
||||
<div class="panel-header">
|
||||
<h2>{{ selectedRun.id }} 流程轨迹</h2>
|
||||
<StatusPill :state="selectedRun.status" />
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<BpmnStatusViewer :xml="platform.releaseProcessXml" :steps="selectedRun.steps" />
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,297 @@
|
||||
<script setup lang="ts">
|
||||
import StatusPill from '../components/StatusPill.vue'
|
||||
import { usePlatformStore } from '../stores/platform'
|
||||
import type { IntegrationConfigState } from '../types/devops'
|
||||
|
||||
const platform = usePlatformStore()
|
||||
|
||||
const configStatusMeta: Record<
|
||||
IntegrationConfigState,
|
||||
{ label: string; type: 'success' | 'warning' | 'danger' }
|
||||
> = {
|
||||
configured: { label: '已配置', type: 'success' },
|
||||
partial: { label: '部分配置', type: 'warning' },
|
||||
missing: { label: '未配置', type: 'danger' },
|
||||
}
|
||||
|
||||
function configStatusLabel(status: IntegrationConfigState): string {
|
||||
return configStatusMeta[status]?.label ?? '未配置'
|
||||
}
|
||||
|
||||
function configStatusType(
|
||||
status: IntegrationConfigState,
|
||||
): 'success' | 'warning' | 'danger' {
|
||||
return configStatusMeta[status]?.type ?? 'danger'
|
||||
}
|
||||
|
||||
function formatCheckedAt(value: string): string {
|
||||
if (!value) {
|
||||
return '-'
|
||||
}
|
||||
|
||||
const date = new Date(value)
|
||||
|
||||
if (Number.isNaN(date.getTime())) {
|
||||
return value
|
||||
}
|
||||
|
||||
return new Intl.DateTimeFormat('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
}).format(date)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-shell">
|
||||
<div class="page-header">
|
||||
<div>
|
||||
<h1>系统配置</h1>
|
||||
<p>展示后端集成配置状态、API 契约来源、BPMN 映射、Agent 边界和通知维护状态。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>后端集成配置状态</h2>
|
||||
<span>检查时间:{{ formatCheckedAt(platform.integrationConfig.checkedAt) }}</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="secret-boundary">
|
||||
这里只展示环境变量名和配置状态;Jenkins token、Gitea token、通知 webhook、LLM key、数据库连接串不会进入浏览器。
|
||||
</div>
|
||||
<div class="config-list">
|
||||
<article
|
||||
v-for="item in platform.integrationConfig.integrations"
|
||||
:key="item.key"
|
||||
class="config-row"
|
||||
>
|
||||
<div class="config-row-main">
|
||||
<div>
|
||||
<h3>{{ item.name }}</h3>
|
||||
<p v-if="item.note">{{ item.note }}</p>
|
||||
</div>
|
||||
<ElTag :type="configStatusType(item.status)" effect="light" round>
|
||||
{{ configStatusLabel(item.status) }}
|
||||
</ElTag>
|
||||
</div>
|
||||
|
||||
<div class="variable-grid">
|
||||
<div class="variable-group">
|
||||
<strong>必需变量</strong>
|
||||
<div class="variable-tags">
|
||||
<ElTag v-for="name in item.required" :key="name" class="mono" effect="plain">
|
||||
{{ name }}
|
||||
</ElTag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="variable-group">
|
||||
<strong>已识别</strong>
|
||||
<div class="variable-tags">
|
||||
<ElTag
|
||||
v-for="name in item.configured"
|
||||
:key="name"
|
||||
class="mono"
|
||||
type="success"
|
||||
effect="plain"
|
||||
>
|
||||
{{ name }}
|
||||
</ElTag>
|
||||
<span v-if="item.configured.length === 0" class="empty-value">暂无</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="variable-group">
|
||||
<strong>缺失</strong>
|
||||
<div class="variable-tags">
|
||||
<ElTag
|
||||
v-for="name in item.missing"
|
||||
:key="name"
|
||||
class="mono"
|
||||
type="danger"
|
||||
effect="plain"
|
||||
>
|
||||
{{ name }}
|
||||
</ElTag>
|
||||
<span v-if="item.missing.length === 0" class="empty-value">无</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="variable-group">
|
||||
<strong>可选变量</strong>
|
||||
<div class="variable-tags">
|
||||
<ElTag
|
||||
v-for="name in item.optional ?? []"
|
||||
:key="name"
|
||||
class="mono"
|
||||
type="info"
|
||||
effect="plain"
|
||||
>
|
||||
{{ name }}
|
||||
</ElTag>
|
||||
<span v-if="!item.optional?.length" class="empty-value">暂无</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="section-grid">
|
||||
<section v-for="item in platform.settings" :key="item.key" class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>{{ item.name }}</h2>
|
||||
<StatusPill :state="item.status" />
|
||||
</div>
|
||||
<div class="panel-body setting-card">
|
||||
<dl>
|
||||
<dt>责任方</dt>
|
||||
<dd>{{ item.owner }}</dd>
|
||||
<dt>契约</dt>
|
||||
<dd>{{ item.contract }}</dd>
|
||||
<dt>边界</dt>
|
||||
<dd>{{ item.boundary }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<h2>前端环境变量</h2>
|
||||
<span>第一阶段仅保留 API 地址</span>
|
||||
</div>
|
||||
<div class="panel-body compact-list">
|
||||
<div class="list-row">
|
||||
<span>
|
||||
<strong class="mono">VITE_API_BASE_URL</strong>
|
||||
<small>联调时指向后端网关;未配置时默认 /api。</small>
|
||||
</span>
|
||||
<ElTag type="info" round>{{ platform.dataSource === 'backend' ? '后端已联通' : '/api 或 mock 降级' }}</ElTag>
|
||||
</div>
|
||||
<div class="list-row">
|
||||
<span>
|
||||
<strong>密钥策略</strong>
|
||||
<small>Jenkins token、Gitea token、通知 webhook、LLM key 均不得进入前端。</small>
|
||||
</span>
|
||||
<ElTag type="success" round>前端隔离</ElTag>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.setting-card dl {
|
||||
display: grid;
|
||||
grid-template-columns: 74px minmax(0, 1fr);
|
||||
gap: 10px 12px;
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.setting-card dt {
|
||||
color: #7b8798;
|
||||
}
|
||||
|
||||
.setting-card dd {
|
||||
margin: 0;
|
||||
color: #172033;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.secret-boundary {
|
||||
margin-bottom: 14px;
|
||||
padding: 12px 14px;
|
||||
border: 1px solid #dbeafe;
|
||||
border-radius: 8px;
|
||||
background: #eff6ff;
|
||||
color: #25508f;
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.config-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.config-row {
|
||||
padding: 14px;
|
||||
border: 1px solid #edf1f7;
|
||||
border-radius: 8px;
|
||||
background: #fbfcff;
|
||||
}
|
||||
|
||||
.config-row-main {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.config-row-main h3 {
|
||||
margin: 0;
|
||||
color: #182033;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.config-row-main p {
|
||||
margin: 6px 0 0;
|
||||
color: #748093;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.variable-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.variable-group {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.variable-group strong {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
color: #4b5565;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.variable-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
min-height: 24px;
|
||||
}
|
||||
|
||||
.empty-value {
|
||||
color: #9aa4b2;
|
||||
font-size: 12px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
@media (max-width: 1080px) {
|
||||
.variable-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 680px) {
|
||||
.config-row-main {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.variable-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user