kin: auto-commit after pipeline

This commit is contained in:
Gros Frumos 2026-03-17 17:39:40 +02:00
parent 248934d5d7
commit 939a30a3de
6 changed files with 796 additions and 3 deletions

View file

@ -1,7 +1,7 @@
<script setup lang="ts">
import { ref, onMounted, onUnmounted, computed, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { api, ApiError, type ProjectDetail, type AuditResult, type Phase, type Task, type ProjectEnvironment } from '../api'
import { api, ApiError, type ProjectDetail, type AuditResult, type Phase, type Task, type ProjectEnvironment, type DeployResult, type ProjectLink } from '../api'
import Badge from '../components/Badge.vue'
import Modal from '../components/Modal.vue'
@ -12,7 +12,7 @@ const router = useRouter()
const project = ref<ProjectDetail | null>(null)
const loading = ref(true)
const error = ref('')
const activeTab = ref<'tasks' | 'phases' | 'decisions' | 'modules' | 'kanban' | 'environments'>('tasks')
const activeTab = ref<'tasks' | 'phases' | 'decisions' | 'modules' | 'kanban' | 'environments' | 'links'>('tasks')
// Phases
const phases = ref<Phase[]>([])
@ -369,6 +369,81 @@ async function deleteEnv(envId: number) {
}
}
// Deploy
const deploying = ref(false)
const deployResult = ref<DeployResult | null>(null)
const hasDeployConfig = computed(() => {
if (!project.value) return false
return !!(project.value.deploy_host && project.value.deploy_path && project.value.deploy_runtime) || !!project.value.deploy_command
})
async function runDeploy() {
deploying.value = true
deployResult.value = null
try {
deployResult.value = await api.deployProject(props.id)
} catch (e: any) {
error.value = e.message
} finally {
deploying.value = false
}
}
// Project Links
const links = ref<ProjectLink[]>([])
const linksLoading = ref(false)
const linksError = ref('')
const showAddLink = ref(false)
const linkForm = ref({ to_project: '', link_type: 'depends_on', description: '' })
const linkFormError = ref('')
const linkSaving = ref(false)
async function loadLinks() {
linksLoading.value = true
linksError.value = ''
try {
links.value = await api.projectLinks(props.id)
} catch (e: any) {
linksError.value = e.message
} finally {
linksLoading.value = false
}
}
async function addLink() {
linkFormError.value = ''
if (!linkForm.value.to_project) { linkFormError.value = 'Выберите проект'; return }
linkSaving.value = true
try {
await api.createProjectLink({
from_project: props.id,
to_project: linkForm.value.to_project,
link_type: linkForm.value.link_type,
description: linkForm.value.description || undefined,
})
showAddLink.value = false
linkForm.value = { to_project: '', link_type: 'depends_on', description: '' }
await loadLinks()
} catch (e: any) {
linkFormError.value = e.message
} finally {
linkSaving.value = false
}
}
async function deleteLink(id: number) {
if (!confirm('Удалить связь?')) return
try {
await api.deleteProjectLink(id)
await loadLinks()
} catch (e: any) {
linksError.value = e.message
}
}
const allProjects = ref<{ id: string; name: string }[]>([])
// Add task modal
const TASK_CATEGORIES = ['SEC', 'UI', 'API', 'INFRA', 'BIZ', 'DB', 'ARCH', 'TEST', 'PERF', 'DOCS', 'FIX', 'OBS']
const CATEGORY_COLORS: Record<string, string> = {
@ -425,12 +500,19 @@ watch(() => props.id, () => {
environments.value = []
showScanBanner.value = false
scanTaskId.value = null
links.value = []
deployResult.value = null
})
onMounted(async () => {
await load()
await loadPhases()
await loadEnvironments()
await loadLinks()
try {
const all = await api.projects()
allProjects.value = all.map(p => ({ id: p.id, name: p.name }))
} catch {}
})
onUnmounted(() => {