kin: auto-commit after pipeline

This commit is contained in:
Gros Frumos 2026-03-17 16:03:26 +02:00
parent 1083968d45
commit 950a2251e0
2 changed files with 41 additions and 8 deletions

View file

@ -6,13 +6,16 @@ const projects = ref<Project[]>([])
const vaultPaths = ref<Record<string, string>>({})
const deployCommands = ref<Record<string, string>>({})
const testCommands = ref<Record<string, string>>({})
const autoTestEnabled = ref<Record<string, boolean>>({})
const saving = ref<Record<string, boolean>>({})
const savingDeploy = ref<Record<string, boolean>>({})
const savingTest = ref<Record<string, boolean>>({})
const savingAutoTest = ref<Record<string, boolean>>({})
const syncing = ref<Record<string, boolean>>({})
const saveStatus = ref<Record<string, string>>({})
const saveDeployStatus = ref<Record<string, string>>({})
const saveTestStatus = ref<Record<string, string>>({})
const saveAutoTestStatus = ref<Record<string, string>>({})
const syncResults = ref<Record<string, ObsidianSyncResult | null>>({})
const error = ref<string | null>(null)
@ -23,6 +26,7 @@ onMounted(async () => {
vaultPaths.value[p.id] = p.obsidian_vault_path ?? ''
deployCommands.value[p.id] = p.deploy_command ?? ''
testCommands.value[p.id] = p.test_command ?? ''
autoTestEnabled.value[p.id] = !!(p.auto_test_enabled)
}
} catch (e) {
error.value = String(e)
@ -68,6 +72,21 @@ async function saveTestCommand(projectId: string) {
}
}
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'
} catch (e) {
autoTestEnabled.value[projectId] = !autoTestEnabled.value[projectId]
saveAutoTestStatus.value[projectId] = `Error: ${e}`
} finally {
savingAutoTest.value[projectId] = false
}
}
async function runSync(projectId: string) {
syncing.value[projectId] = true
syncResults.value[projectId] = null
@ -153,6 +172,23 @@ async function runSync(projectId: string) {
</span>
</div>
<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>
<span class="text-xs text-gray-500"> запускать тесты автоматически после pipeline</span>
</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>
<div class="flex items-center gap-3 flex-wrap">
<button
@click="saveVaultPath(project.id)"