feat: 改为真实后端接口模式

- devopsApi: 移除前端 mock 降级和本地发布单/refs 伪造逻辑
- views: 同步发布、运行记录、配置和顶部状态文案为真实接口模式
- docs: 更新前端维护规则,禁止新增 mock 数据降级
This commit is contained in:
湛兮
2026-06-11 21:27:30 +08:00
parent f74454f00a
commit af0649a302
16 changed files with 228 additions and 959 deletions
+6 -6
View File
@@ -14,11 +14,11 @@ import type {
} from '../types/devops'
/**
* 平台运行态聚合后端和 mock 降级数据,页面只消费统一后的展示模型。
* 平台运行态聚合后端真实接口数据,页面只消费统一后的展示模型。
*/
export const usePlatformStore = defineStore('platform', () => {
const loading = ref(false)
const dataSource = ref<'backend' | 'mock'>('mock')
const dataSource = ref<'backend'>('backend')
const projects = ref<ProjectConfig[]>([])
const runs = ref<ReleaseRun[]>([])
const integrations = ref<IntegrationStatus[]>([])
@@ -61,21 +61,21 @@ export const usePlatformStore = defineStore('platform', () => {
}
async function cancelDeployRun(run: ReleaseRun) {
const canceled = await devopsApi.cancelDeployRun(run.id, run)
const canceled = await devopsApi.cancelDeployRun(run.id, projects.value)
upsertRun(canceled)
dataSource.value = devopsApi.getLastDataSource()
return canceled
}
async function retryDeployRun(run: ReleaseRun) {
const retried = await devopsApi.retryDeployRun(run.id, run)
const retried = await devopsApi.retryDeployRun(run.id, projects.value)
upsertRun(retried)
dataSource.value = devopsApi.getLastDataSource()
return retried
}
async function syncJenkinsRun(run: ReleaseRun) {
const synced = await devopsApi.syncJenkinsRun(run.id, run, projects.value)
const synced = await devopsApi.syncJenkinsRun(run.id, projects.value)
upsertRun(synced)
dataSource.value = devopsApi.getLastDataSource()
return synced
@@ -89,7 +89,7 @@ export const usePlatformStore = defineStore('platform', () => {
}
async function loadProjectRefs(projectKey: string) {
const refs = await devopsApi.getProjectRefs(projectKey, projects.value)
const refs = await devopsApi.getProjectRefs(projectKey)
projectRefs.value = {
...projectRefs.value,
[projectKey]: refs,
+2 -2
View File
@@ -4,13 +4,13 @@ import { defineStore } from 'pinia'
export const useSessionStore = defineStore('session', () => {
const operator = ref('ops-admin')
const role = ref<'admin' | 'operator' | 'viewer'>('admin')
const token = ref('mock-session')
const token = ref('local-session')
const isAuthenticated = computed(() => Boolean(token.value))
function login(name: string) {
operator.value = name || 'ops-admin'
token.value = 'mock-session'
token.value = 'local-session'
}
function logout() {