kin: auto-commit after pipeline
This commit is contained in:
parent
6c2da26b6c
commit
396f5193d3
3 changed files with 66 additions and 1 deletions
|
|
@ -5,11 +5,14 @@ import { api, type Project, type ObsidianSyncResult } from '../api'
|
|||
const projects = ref<Project[]>([])
|
||||
const vaultPaths = ref<Record<string, string>>({})
|
||||
const deployCommands = ref<Record<string, string>>({})
|
||||
const testCommands = ref<Record<string, string>>({})
|
||||
const saving = ref<Record<string, boolean>>({})
|
||||
const savingDeploy = ref<Record<string, boolean>>({})
|
||||
const savingTest = 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 syncResults = ref<Record<string, ObsidianSyncResult | null>>({})
|
||||
const error = ref<string | null>(null)
|
||||
|
||||
|
|
@ -19,6 +22,7 @@ onMounted(async () => {
|
|||
for (const p of projects.value) {
|
||||
vaultPaths.value[p.id] = p.obsidian_vault_path ?? ''
|
||||
deployCommands.value[p.id] = p.deploy_command ?? ''
|
||||
testCommands.value[p.id] = p.test_command ?? ''
|
||||
}
|
||||
} catch (e) {
|
||||
error.value = String(e)
|
||||
|
|
@ -51,6 +55,19 @@ async function saveDeployCommand(projectId: string) {
|
|||
}
|
||||
}
|
||||
|
||||
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'
|
||||
} catch (e) {
|
||||
saveTestStatus.value[projectId] = `Error: ${e}`
|
||||
} finally {
|
||||
savingTest.value[projectId] = false
|
||||
}
|
||||
}
|
||||
|
||||
async function runSync(projectId: string) {
|
||||
syncing.value[projectId] = true
|
||||
syncResults.value[projectId] = null
|
||||
|
|
@ -112,6 +129,30 @@ async function runSync(projectId: string) {
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<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"
|
||||
/>
|
||||
<p class="text-xs text-gray-600 mt-1">Команда запуска тестов, выполняется через shell в директории проекта.</p>
|
||||
</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"
|
||||
>
|
||||
{{ savingTest[project.id] ? 'Saving…' : 'Save Test' }}
|
||||
</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>
|
||||
|
||||
<div class="flex items-center gap-3 flex-wrap">
|
||||
<button
|
||||
@click="saveVaultPath(project.id)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue