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

@ -19,6 +19,14 @@ const saveAutoTestStatus = ref<Record<string, string>>({})
const syncResults = ref<Record<string, ObsidianSyncResult | null>>({})
const error = ref<string | null>(null)
// 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>>({})
onMounted(async () => {
try {
projects.value = await api.projects()
@ -27,12 +35,34 @@ onMounted(async () => {
deployCommands.value[p.id] = p.deploy_command ?? ''
testCommands.value[p.id] = p.test_command ?? ''
autoTestEnabled.value[p.id] = !!(p.auto_test_enabled)
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 ?? ''
}
} catch (e) {
error.value = String(e)
}
})
async function saveDeployConfig(projectId: string) {
savingDeployConfig.value[projectId] = true
saveDeployConfigStatus.value[projectId] = ''
try {
await api.patchProject(projectId, {
deploy_host: deployHosts.value[projectId] || undefined,
deploy_path: deployPaths.value[projectId] || undefined,
deploy_runtime: deployRuntimes.value[projectId] || undefined,
deploy_restart_cmd: deployRestartCmds.value[projectId] || undefined,
})
saveDeployConfigStatus.value[projectId] = 'Saved'
} catch (e) {
saveDeployConfigStatus.value[projectId] = `Error: ${e}`
} finally {
savingDeployConfig.value[projectId] = false
}
}
async function saveVaultPath(projectId: string) {
saving.value[projectId] = true
saveStatus.value[projectId] = ''
@ -172,6 +202,63 @@ async function runSync(projectId: string) {
</span>
</div>
<!-- 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"
>
<option value=""> выберите runtime </option>
<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>
<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"
>
{{ savingDeployConfig[project.id] ? 'Saving…' : 'Save Deploy Config' }}
</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>
<div class="flex items-center gap-3 mb-3">
<label class="flex items-center gap-2 cursor-pointer select-none">
<input