2026-03-16 07:15:04 +02:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref, onMounted } from 'vue'
|
2026-03-17 18:31:00 +02:00
|
|
|
import { api, type Project, type ObsidianSyncResult, type ProjectLink } from '../api'
|
2026-03-16 07:15:04 +02:00
|
|
|
|
|
|
|
|
const projects = ref<Project[]>([])
|
|
|
|
|
const vaultPaths = ref<Record<string, string>>({})
|
2026-03-16 08:21:13 +02:00
|
|
|
const deployCommands = ref<Record<string, string>>({})
|
2026-03-17 15:49:37 +02:00
|
|
|
const testCommands = ref<Record<string, string>>({})
|
2026-03-17 16:03:26 +02:00
|
|
|
const autoTestEnabled = ref<Record<string, boolean>>({})
|
2026-03-17 20:32:49 +02:00
|
|
|
const worktreesEnabled = ref<Record<string, boolean>>({})
|
2026-03-16 07:15:04 +02:00
|
|
|
const saving = ref<Record<string, boolean>>({})
|
2026-03-17 15:49:37 +02:00
|
|
|
const savingTest = ref<Record<string, boolean>>({})
|
2026-03-17 16:03:26 +02:00
|
|
|
const savingAutoTest = ref<Record<string, boolean>>({})
|
2026-03-17 20:32:49 +02:00
|
|
|
const savingWorktrees = ref<Record<string, boolean>>({})
|
2026-03-16 07:15:04 +02:00
|
|
|
const syncing = ref<Record<string, boolean>>({})
|
|
|
|
|
const saveStatus = ref<Record<string, string>>({})
|
2026-03-17 15:49:37 +02:00
|
|
|
const saveTestStatus = ref<Record<string, string>>({})
|
2026-03-17 16:03:26 +02:00
|
|
|
const saveAutoTestStatus = ref<Record<string, string>>({})
|
2026-03-17 20:32:49 +02:00
|
|
|
const saveWorktreesStatus = ref<Record<string, string>>({})
|
2026-03-16 07:15:04 +02:00
|
|
|
const syncResults = ref<Record<string, ObsidianSyncResult | null>>({})
|
|
|
|
|
const error = ref<string | null>(null)
|
|
|
|
|
|
2026-03-17 17:39:40 +02:00
|
|
|
// Deploy config
|
|
|
|
|
const deployHosts = ref<Record<string, string>>({})
|
|
|
|
|
const deployPaths = ref<Record<string, string>>({})
|
|
|
|
|
const deployRuntimes = ref<Record<string, string>>({})
|
|
|
|
|
const deployRestartCmds = ref<Record<string, string>>({})
|
|
|
|
|
const savingDeployConfig = ref<Record<string, boolean>>({})
|
|
|
|
|
const saveDeployConfigStatus = ref<Record<string, string>>({})
|
|
|
|
|
|
2026-03-17 18:31:00 +02:00
|
|
|
// Project Links
|
|
|
|
|
const projectLinksMap = ref<Record<string, ProjectLink[]>>({})
|
|
|
|
|
const linksLoading = ref<Record<string, boolean>>({})
|
|
|
|
|
const showAddLinkForm = ref<Record<string, boolean>>({})
|
|
|
|
|
const linkForms = ref<Record<string, { to_project: string; link_type: string; description: string }>>({})
|
|
|
|
|
const linkSaving = ref<Record<string, boolean>>({})
|
|
|
|
|
const linkError = ref<Record<string, string>>({})
|
|
|
|
|
const allProjectList = ref<{ id: string; name: string }[]>([])
|
|
|
|
|
|
2026-03-16 07:15:04 +02:00
|
|
|
onMounted(async () => {
|
|
|
|
|
try {
|
|
|
|
|
projects.value = await api.projects()
|
2026-03-17 18:31:00 +02:00
|
|
|
allProjectList.value = projects.value.map(p => ({ id: p.id, name: p.name }))
|
2026-03-16 07:15:04 +02:00
|
|
|
for (const p of projects.value) {
|
|
|
|
|
vaultPaths.value[p.id] = p.obsidian_vault_path ?? ''
|
2026-03-16 08:21:13 +02:00
|
|
|
deployCommands.value[p.id] = p.deploy_command ?? ''
|
2026-03-17 15:49:37 +02:00
|
|
|
testCommands.value[p.id] = p.test_command ?? ''
|
2026-03-17 16:03:26 +02:00
|
|
|
autoTestEnabled.value[p.id] = !!(p.auto_test_enabled)
|
2026-03-17 20:32:49 +02:00
|
|
|
worktreesEnabled.value[p.id] = !!(p.worktrees_enabled)
|
2026-03-17 17:39:40 +02:00
|
|
|
deployHosts.value[p.id] = p.deploy_host ?? ''
|
|
|
|
|
deployPaths.value[p.id] = p.deploy_path ?? ''
|
|
|
|
|
deployRuntimes.value[p.id] = p.deploy_runtime ?? ''
|
|
|
|
|
deployRestartCmds.value[p.id] = p.deploy_restart_cmd ?? ''
|
2026-03-17 18:31:00 +02:00
|
|
|
linkForms.value[p.id] = { to_project: '', link_type: 'depends_on', description: '' }
|
|
|
|
|
projectLinksMap.value[p.id] = []
|
2026-03-16 07:15:04 +02:00
|
|
|
}
|
2026-03-17 18:31:00 +02:00
|
|
|
await Promise.all(projects.value.map(p => loadLinks(p.id)))
|
|
|
|
|
} catch (e: unknown) {
|
|
|
|
|
error.value = e instanceof Error ? e.message : String(e)
|
2026-03-16 07:15:04 +02:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2026-03-17 17:39:40 +02:00
|
|
|
async function saveDeployConfig(projectId: string) {
|
|
|
|
|
savingDeployConfig.value[projectId] = true
|
|
|
|
|
saveDeployConfigStatus.value[projectId] = ''
|
|
|
|
|
try {
|
|
|
|
|
await api.patchProject(projectId, {
|
2026-03-17 18:37:02 +02:00
|
|
|
deploy_host: deployHosts.value[projectId],
|
|
|
|
|
deploy_path: deployPaths.value[projectId],
|
|
|
|
|
deploy_runtime: deployRuntimes.value[projectId],
|
|
|
|
|
deploy_restart_cmd: deployRestartCmds.value[projectId],
|
2026-03-17 18:54:02 +02:00
|
|
|
deploy_command: deployCommands.value[projectId],
|
2026-03-17 17:39:40 +02:00
|
|
|
})
|
|
|
|
|
saveDeployConfigStatus.value[projectId] = 'Saved'
|
2026-03-17 18:31:00 +02:00
|
|
|
} catch (e: unknown) {
|
|
|
|
|
saveDeployConfigStatus.value[projectId] = `Error: ${e instanceof Error ? e.message : String(e)}`
|
2026-03-17 17:39:40 +02:00
|
|
|
} finally {
|
|
|
|
|
savingDeployConfig.value[projectId] = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-16 07:15:04 +02:00
|
|
|
async function saveVaultPath(projectId: string) {
|
|
|
|
|
saving.value[projectId] = true
|
|
|
|
|
saveStatus.value[projectId] = ''
|
|
|
|
|
try {
|
|
|
|
|
await api.patchProject(projectId, { obsidian_vault_path: vaultPaths.value[projectId] })
|
|
|
|
|
saveStatus.value[projectId] = 'Saved'
|
2026-03-17 18:31:00 +02:00
|
|
|
} catch (e: unknown) {
|
|
|
|
|
saveStatus.value[projectId] = `Error: ${e instanceof Error ? e.message : String(e)}`
|
2026-03-16 07:15:04 +02:00
|
|
|
} finally {
|
|
|
|
|
saving.value[projectId] = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-17 15:49:37 +02:00
|
|
|
async function saveTestCommand(projectId: string) {
|
|
|
|
|
savingTest.value[projectId] = true
|
|
|
|
|
saveTestStatus.value[projectId] = ''
|
|
|
|
|
try {
|
|
|
|
|
await api.patchProject(projectId, { test_command: testCommands.value[projectId] })
|
|
|
|
|
saveTestStatus.value[projectId] = 'Saved'
|
2026-03-17 18:31:00 +02:00
|
|
|
} catch (e: unknown) {
|
|
|
|
|
saveTestStatus.value[projectId] = `Error: ${e instanceof Error ? e.message : String(e)}`
|
2026-03-17 15:49:37 +02:00
|
|
|
} finally {
|
|
|
|
|
savingTest.value[projectId] = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-17 16:03:26 +02:00
|
|
|
async function toggleAutoTest(projectId: string) {
|
|
|
|
|
autoTestEnabled.value[projectId] = !autoTestEnabled.value[projectId]
|
|
|
|
|
savingAutoTest.value[projectId] = true
|
|
|
|
|
saveAutoTestStatus.value[projectId] = ''
|
|
|
|
|
try {
|
|
|
|
|
await api.patchProject(projectId, { auto_test_enabled: autoTestEnabled.value[projectId] })
|
|
|
|
|
saveAutoTestStatus.value[projectId] = 'Saved'
|
2026-03-17 18:31:00 +02:00
|
|
|
} catch (e: unknown) {
|
2026-03-17 16:03:26 +02:00
|
|
|
autoTestEnabled.value[projectId] = !autoTestEnabled.value[projectId]
|
2026-03-17 18:31:00 +02:00
|
|
|
saveAutoTestStatus.value[projectId] = `Error: ${e instanceof Error ? e.message : String(e)}`
|
2026-03-17 16:03:26 +02:00
|
|
|
} finally {
|
|
|
|
|
savingAutoTest.value[projectId] = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-17 20:32:49 +02:00
|
|
|
async function toggleWorktrees(projectId: string) {
|
|
|
|
|
worktreesEnabled.value[projectId] = !worktreesEnabled.value[projectId]
|
|
|
|
|
savingWorktrees.value[projectId] = true
|
|
|
|
|
saveWorktreesStatus.value[projectId] = ''
|
|
|
|
|
try {
|
|
|
|
|
await api.patchProject(projectId, { worktrees_enabled: worktreesEnabled.value[projectId] })
|
|
|
|
|
saveWorktreesStatus.value[projectId] = 'Saved'
|
|
|
|
|
} catch (e: unknown) {
|
|
|
|
|
worktreesEnabled.value[projectId] = !worktreesEnabled.value[projectId]
|
|
|
|
|
saveWorktreesStatus.value[projectId] = `Error: ${e instanceof Error ? e.message : String(e)}`
|
|
|
|
|
} finally {
|
|
|
|
|
savingWorktrees.value[projectId] = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-16 07:15:04 +02:00
|
|
|
async function runSync(projectId: string) {
|
|
|
|
|
syncing.value[projectId] = true
|
|
|
|
|
syncResults.value[projectId] = null
|
|
|
|
|
saveStatus.value[projectId] = ''
|
|
|
|
|
try {
|
2026-03-16 08:38:49 +02:00
|
|
|
await api.patchProject(projectId, { obsidian_vault_path: vaultPaths.value[projectId] })
|
2026-03-16 07:15:04 +02:00
|
|
|
syncResults.value[projectId] = await api.syncObsidian(projectId)
|
2026-03-17 18:31:00 +02:00
|
|
|
} catch (e: unknown) {
|
|
|
|
|
saveStatus.value[projectId] = `Sync error: ${e instanceof Error ? e.message : String(e)}`
|
2026-03-16 07:15:04 +02:00
|
|
|
} finally {
|
|
|
|
|
syncing.value[projectId] = false
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-03-17 18:31:00 +02:00
|
|
|
|
|
|
|
|
async function loadLinks(projectId: string) {
|
|
|
|
|
linksLoading.value[projectId] = true
|
|
|
|
|
try {
|
|
|
|
|
projectLinksMap.value[projectId] = await api.projectLinks(projectId)
|
|
|
|
|
} catch (e: unknown) {
|
|
|
|
|
linkError.value[projectId] = e instanceof Error ? e.message : String(e)
|
|
|
|
|
} finally {
|
|
|
|
|
linksLoading.value[projectId] = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function addLink(projectId: string) {
|
|
|
|
|
const form = linkForms.value[projectId]
|
|
|
|
|
if (!form.to_project) { linkError.value[projectId] = 'Выберите проект'; return }
|
|
|
|
|
linkSaving.value[projectId] = true
|
|
|
|
|
linkError.value[projectId] = ''
|
|
|
|
|
try {
|
|
|
|
|
await api.createProjectLink({
|
|
|
|
|
from_project: projectId,
|
|
|
|
|
to_project: form.to_project,
|
2026-03-17 18:54:02 +02:00
|
|
|
type: form.link_type,
|
2026-03-17 18:31:00 +02:00
|
|
|
description: form.description || undefined,
|
|
|
|
|
})
|
|
|
|
|
showAddLinkForm.value[projectId] = false
|
|
|
|
|
linkForms.value[projectId] = { to_project: '', link_type: 'depends_on', description: '' }
|
|
|
|
|
await loadLinks(projectId)
|
|
|
|
|
} catch (e: unknown) {
|
|
|
|
|
linkError.value[projectId] = e instanceof Error ? e.message : String(e)
|
|
|
|
|
} finally {
|
|
|
|
|
linkSaving.value[projectId] = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function deleteLink(projectId: string, linkId: number) {
|
|
|
|
|
if (!confirm('Удалить связь?')) return
|
|
|
|
|
try {
|
|
|
|
|
await api.deleteProjectLink(linkId)
|
|
|
|
|
await loadLinks(projectId)
|
|
|
|
|
} catch (e: unknown) {
|
|
|
|
|
linkError.value[projectId] = e instanceof Error ? e.message : String(e)
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-03-16 07:15:04 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<h1 class="text-xl font-semibold text-gray-100 mb-6">Settings</h1>
|
|
|
|
|
|
|
|
|
|
<div v-if="error" class="text-red-400 mb-4">{{ error }}</div>
|
|
|
|
|
|
|
|
|
|
<div v-for="project in projects" :key="project.id" class="mb-6 p-4 border border-gray-700 rounded-lg">
|
|
|
|
|
<div class="flex items-center gap-3 mb-3">
|
|
|
|
|
<span class="font-medium text-gray-100">{{ project.name }}</span>
|
|
|
|
|
<span class="text-xs text-gray-500 font-mono">{{ project.id }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label class="block text-xs text-gray-400 mb-1">Obsidian Vault Path</label>
|
|
|
|
|
<input
|
|
|
|
|
v-model="vaultPaths[project.id]"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder="/path/to/obsidian/vault"
|
|
|
|
|
class="w-full bg-gray-900 border border-gray-700 rounded px-3 py-2 text-sm text-gray-200 font-mono focus:outline-none focus:border-gray-500"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-03-17 15:49:37 +02:00
|
|
|
<div class="mb-3">
|
|
|
|
|
<label class="block text-xs text-gray-400 mb-1">Test Command</label>
|
|
|
|
|
<input
|
|
|
|
|
v-model="testCommands[project.id]"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder="make test"
|
|
|
|
|
class="w-full bg-gray-900 border border-gray-700 rounded px-3 py-2 text-sm text-gray-200 font-mono focus:outline-none focus:border-gray-500"
|
|
|
|
|
/>
|
2026-03-17 18:31:00 +02:00
|
|
|
<p class="text-xs text-gray-600 mt-1">Команда запуска тестов, выполняется через shell в директории проекта.</p>
|
2026-03-17 15:49:37 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="flex items-center gap-3 flex-wrap mb-3">
|
|
|
|
|
<button
|
|
|
|
|
@click="saveTestCommand(project.id)"
|
|
|
|
|
:disabled="savingTest[project.id]"
|
|
|
|
|
class="px-3 py-1.5 text-sm bg-gray-700 hover:bg-gray-600 text-gray-200 rounded disabled:opacity-50"
|
|
|
|
|
>
|
2026-03-17 18:31:00 +02:00
|
|
|
{{ savingTest[project.id] ? 'Saving…' : 'Save Test' }}
|
2026-03-17 15:49:37 +02:00
|
|
|
</button>
|
|
|
|
|
<span v-if="saveTestStatus[project.id]" class="text-xs" :class="saveTestStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
|
|
|
|
{{ saveTestStatus[project.id] }}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-03-17 17:39:40 +02:00
|
|
|
<!-- Deploy Config -->
|
|
|
|
|
<div class="mb-2 pt-2 border-t border-gray-800">
|
|
|
|
|
<p class="text-xs font-semibold text-gray-400 mb-2">Deploy Config</p>
|
|
|
|
|
<div class="mb-2">
|
|
|
|
|
<label class="block text-xs text-gray-500 mb-1">Server host</label>
|
|
|
|
|
<input
|
|
|
|
|
v-model="deployHosts[project.id]"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder="server host (e.g. vdp-prod)"
|
|
|
|
|
class="w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-sm text-gray-200 font-mono focus:outline-none focus:border-gray-500"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mb-2">
|
|
|
|
|
<label class="block text-xs text-gray-500 mb-1">Project path on server</label>
|
|
|
|
|
<input
|
|
|
|
|
v-model="deployPaths[project.id]"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder="/srv/myproject"
|
|
|
|
|
class="w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-sm text-gray-200 font-mono focus:outline-none focus:border-gray-500"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mb-2">
|
|
|
|
|
<label class="block text-xs text-gray-500 mb-1">Runtime</label>
|
|
|
|
|
<select
|
|
|
|
|
v-model="deployRuntimes[project.id]"
|
|
|
|
|
class="w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-sm text-gray-300 focus:outline-none focus:border-gray-500"
|
|
|
|
|
>
|
2026-03-17 18:31:00 +02:00
|
|
|
<option value="">— выберите runtime —</option>
|
2026-03-17 17:39:40 +02:00
|
|
|
<option value="docker">docker</option>
|
|
|
|
|
<option value="node">node</option>
|
|
|
|
|
<option value="python">python</option>
|
|
|
|
|
<option value="static">static</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mb-2">
|
|
|
|
|
<label class="block text-xs text-gray-500 mb-1">Restart command (optional override)</label>
|
|
|
|
|
<input
|
|
|
|
|
v-model="deployRestartCmds[project.id]"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder="optional override command"
|
|
|
|
|
class="w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-sm text-gray-200 font-mono focus:outline-none focus:border-gray-500"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2026-03-17 18:31:00 +02:00
|
|
|
<div class="mb-2">
|
|
|
|
|
<label class="block text-xs text-gray-500 mb-1">Fallback command (legacy, used when runtime not set)</label>
|
|
|
|
|
<input
|
|
|
|
|
v-model="deployCommands[project.id]"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder="git push origin main"
|
|
|
|
|
class="w-full bg-gray-800 border border-gray-700 rounded px-3 py-2 text-sm text-gray-200 font-mono focus:outline-none focus:border-gray-500"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2026-03-17 17:39:40 +02:00
|
|
|
<div class="flex items-center gap-3 flex-wrap mb-3">
|
|
|
|
|
<button
|
|
|
|
|
@click="saveDeployConfig(project.id)"
|
|
|
|
|
:disabled="savingDeployConfig[project.id]"
|
|
|
|
|
class="px-3 py-1.5 text-sm bg-teal-900/50 text-teal-400 border border-teal-800 rounded hover:bg-teal-900 disabled:opacity-50"
|
|
|
|
|
>
|
2026-03-17 18:31:00 +02:00
|
|
|
{{ savingDeployConfig[project.id] ? 'Saving…' : 'Save Deploy Config' }}
|
2026-03-17 17:39:40 +02:00
|
|
|
</button>
|
|
|
|
|
<span v-if="saveDeployConfigStatus[project.id]" class="text-xs" :class="saveDeployConfigStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
|
|
|
|
{{ saveDeployConfigStatus[project.id] }}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-03-17 18:31:00 +02:00
|
|
|
<!-- Project Links -->
|
|
|
|
|
<div class="mb-2 pt-2 border-t border-gray-800">
|
|
|
|
|
<div class="flex items-center justify-between mb-2">
|
|
|
|
|
<p class="text-xs font-semibold text-gray-400">Project Links</p>
|
|
|
|
|
<button
|
|
|
|
|
@click="showAddLinkForm[project.id] = !showAddLinkForm[project.id]"
|
|
|
|
|
class="px-2 py-0.5 text-xs bg-gray-800 text-gray-300 border border-gray-700 rounded hover:bg-gray-700"
|
|
|
|
|
>
|
|
|
|
|
+ Add Link
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<p v-if="linksLoading[project.id]" class="text-xs text-gray-500">Загрузка...</p>
|
|
|
|
|
<p v-else-if="linkError[project.id]" class="text-xs text-red-400">{{ linkError[project.id] }}</p>
|
|
|
|
|
<div v-else-if="!projectLinksMap[project.id]?.length" class="text-xs text-gray-600">Нет связей</div>
|
|
|
|
|
<div v-else class="space-y-1 mb-2">
|
|
|
|
|
<div v-for="link in projectLinksMap[project.id]" :key="link.id"
|
|
|
|
|
class="flex items-center gap-2 px-2 py-1 bg-gray-900 border border-gray-800 rounded text-xs">
|
|
|
|
|
<span class="text-gray-500 font-mono">{{ link.from_project }}</span>
|
|
|
|
|
<span class="text-gray-600">→</span>
|
|
|
|
|
<span class="text-gray-500 font-mono">{{ link.to_project }}</span>
|
2026-03-17 18:54:02 +02:00
|
|
|
<span class="px-1 bg-indigo-900/30 text-indigo-400 border border-indigo-800 rounded">{{ link.type }}</span>
|
2026-03-17 18:31:00 +02:00
|
|
|
<span v-if="link.description" class="text-gray-600">{{ link.description }}</span>
|
|
|
|
|
<button @click="deleteLink(project.id, link.id)"
|
|
|
|
|
class="ml-auto text-red-500 hover:text-red-400 bg-transparent border-none cursor-pointer text-xs shrink-0">
|
|
|
|
|
✕
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<form v-if="showAddLinkForm[project.id]" @submit.prevent="addLink(project.id)" class="space-y-2 p-2 bg-gray-900 border border-gray-800 rounded">
|
|
|
|
|
<div>
|
|
|
|
|
<label class="block text-[10px] text-gray-500 mb-0.5">From (current)</label>
|
|
|
|
|
<input :value="project.id" disabled class="w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-500 font-mono" />
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label class="block text-[10px] text-gray-500 mb-0.5">To project</label>
|
|
|
|
|
<select v-model="linkForms[project.id].to_project" required
|
|
|
|
|
class="w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-300">
|
|
|
|
|
<option value="">— выберите проект —</option>
|
|
|
|
|
<option v-for="p in allProjectList.filter(p => p.id !== project.id)" :key="p.id" :value="p.id">{{ p.id }} — {{ p.name }}</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label class="block text-[10px] text-gray-500 mb-0.5">Link type</label>
|
|
|
|
|
<select v-model="linkForms[project.id].link_type"
|
|
|
|
|
class="w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-300">
|
|
|
|
|
<option value="depends_on">depends_on</option>
|
|
|
|
|
<option value="triggers">triggers</option>
|
|
|
|
|
<option value="related_to">related_to</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label class="block text-[10px] text-gray-500 mb-0.5">Description (optional)</label>
|
|
|
|
|
<input v-model="linkForms[project.id].description" placeholder="e.g. API used by frontend"
|
|
|
|
|
class="w-full bg-gray-800 border border-gray-700 rounded px-2 py-1 text-xs text-gray-200 placeholder-gray-600" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex gap-2">
|
|
|
|
|
<button type="submit" :disabled="linkSaving[project.id]"
|
|
|
|
|
class="px-3 py-1 text-xs bg-blue-900/50 text-blue-400 border border-blue-800 rounded hover:bg-blue-900 disabled:opacity-50">
|
|
|
|
|
{{ linkSaving[project.id] ? 'Saving...' : 'Add' }}
|
|
|
|
|
</button>
|
|
|
|
|
<button type="button" @click="showAddLinkForm[project.id] = false; linkError[project.id] = ''"
|
|
|
|
|
class="px-3 py-1 text-xs text-gray-500 hover:text-gray-300 bg-transparent border-none cursor-pointer">
|
|
|
|
|
Отмена
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-03-17 16:03:26 +02:00
|
|
|
<div class="flex items-center gap-3 mb-3">
|
|
|
|
|
<label class="flex items-center gap-2 cursor-pointer select-none">
|
|
|
|
|
<input
|
|
|
|
|
type="checkbox"
|
|
|
|
|
:checked="autoTestEnabled[project.id]"
|
|
|
|
|
@change="toggleAutoTest(project.id)"
|
|
|
|
|
:disabled="savingAutoTest[project.id]"
|
|
|
|
|
class="w-4 h-4 rounded border-gray-600 bg-gray-800 accent-blue-500 cursor-pointer disabled:opacity-50"
|
|
|
|
|
/>
|
|
|
|
|
<span class="text-sm text-gray-300">Auto-test</span>
|
2026-03-17 18:31:00 +02:00
|
|
|
<span class="text-xs text-gray-500">— запускать тесты автоматически после pipeline</span>
|
2026-03-17 16:03:26 +02:00
|
|
|
</label>
|
|
|
|
|
<span v-if="saveAutoTestStatus[project.id]" class="text-xs" :class="saveAutoTestStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
|
|
|
|
{{ saveAutoTestStatus[project.id] }}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-03-17 20:32:49 +02:00
|
|
|
<div class="flex items-center gap-3 mb-3">
|
|
|
|
|
<label class="flex items-center gap-2 cursor-pointer select-none">
|
|
|
|
|
<input
|
|
|
|
|
type="checkbox"
|
|
|
|
|
:checked="worktreesEnabled[project.id]"
|
|
|
|
|
@change="toggleWorktrees(project.id)"
|
|
|
|
|
:disabled="savingWorktrees[project.id]"
|
|
|
|
|
class="w-4 h-4 rounded border-gray-600 bg-gray-800 accent-blue-500 cursor-pointer disabled:opacity-50"
|
|
|
|
|
/>
|
|
|
|
|
<span class="text-sm text-gray-300">Worktrees</span>
|
|
|
|
|
<span class="text-xs text-gray-500">— агенты запускаются в изолированных git worktrees</span>
|
|
|
|
|
</label>
|
|
|
|
|
<span v-if="saveWorktreesStatus[project.id]" class="text-xs" :class="saveWorktreesStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
|
|
|
|
{{ saveWorktreesStatus[project.id] }}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-03-16 07:15:04 +02:00
|
|
|
<div class="flex items-center gap-3 flex-wrap">
|
|
|
|
|
<button
|
|
|
|
|
@click="saveVaultPath(project.id)"
|
|
|
|
|
:disabled="saving[project.id]"
|
|
|
|
|
class="px-3 py-1.5 text-sm bg-gray-700 hover:bg-gray-600 text-gray-200 rounded disabled:opacity-50"
|
|
|
|
|
>
|
2026-03-17 18:31:00 +02:00
|
|
|
{{ saving[project.id] ? 'Saving…' : 'Save Vault' }}
|
2026-03-16 07:15:04 +02:00
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
@click="runSync(project.id)"
|
|
|
|
|
:disabled="syncing[project.id] || !vaultPaths[project.id]"
|
|
|
|
|
class="px-3 py-1.5 text-sm bg-indigo-700 hover:bg-indigo-600 text-white rounded disabled:opacity-50"
|
|
|
|
|
>
|
2026-03-17 18:31:00 +02:00
|
|
|
{{ syncing[project.id] ? 'Syncing…' : 'Sync Obsidian' }}
|
2026-03-16 07:15:04 +02:00
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<span v-if="saveStatus[project.id]" class="text-xs" :class="saveStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
|
|
|
|
{{ saveStatus[project.id] }}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div v-if="syncResults[project.id]" class="mt-3 p-3 bg-gray-900 rounded text-xs text-gray-300">
|
|
|
|
|
<div>Exported: <span class="text-green-400 font-medium">{{ syncResults[project.id]!.exported_decisions }}</span> decisions</div>
|
|
|
|
|
<div>Updated: <span class="text-green-400 font-medium">{{ syncResults[project.id]!.tasks_updated }}</span> tasks</div>
|
|
|
|
|
<div v-if="syncResults[project.id]!.errors.length > 0" class="mt-1">
|
|
|
|
|
<div v-for="err in syncResults[project.id]!.errors" :key="err" class="text-red-400">{{ err }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-03-16 19:26:51 +02:00
|
|
|
|
2026-03-16 07:15:04 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|