Compare commits
2 commits
e63703ad33
...
33fc38b01f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33fc38b01f | ||
|
|
c30a4c0fc4 |
8 changed files with 468 additions and 75 deletions
|
|
@ -2262,6 +2262,7 @@ def test_get_pipeline_logs_since_id_filters(client):
|
||||||
|
|
||||||
|
|
||||||
def test_get_pipeline_logs_not_found(client):
|
def test_get_pipeline_logs_not_found(client):
|
||||||
"""KIN-084: GET /api/pipelines/9999/logs → 404."""
|
"""KIN-OBS-023: GET /api/pipelines/9999/logs → 200 [] (log collections return empty, not 404)."""
|
||||||
r = client.get("/api/pipelines/9999/logs")
|
r = client.get("/api/pipelines/9999/logs")
|
||||||
assert r.status_code == 404
|
assert r.status_code == 200
|
||||||
|
assert r.json() == []
|
||||||
|
|
|
||||||
117
tests/test_kin_100_regression.py
Normal file
117
tests/test_kin_100_regression.py
Normal file
|
|
@ -0,0 +1,117 @@
|
||||||
|
"""Regression tests for KIN-100 — human-readable agent output format.
|
||||||
|
|
||||||
|
Verifies that reviewer.md and tester.md prompts contain the two-block format
|
||||||
|
instructions (## Verdict + ## Details), ensuring agents produce output that
|
||||||
|
is both human-readable and machine-parseable.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
PROMPTS_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), "agents", "prompts")
|
||||||
|
|
||||||
|
|
||||||
|
def _read_prompt(name: str) -> str:
|
||||||
|
path = os.path.join(PROMPTS_DIR, name)
|
||||||
|
with open(path, encoding="utf-8") as f:
|
||||||
|
return f.read()
|
||||||
|
|
||||||
|
|
||||||
|
class TestReviewerPromptFormat:
|
||||||
|
def test_reviewer_prompt_contains_verdict_section(self):
|
||||||
|
content = _read_prompt("reviewer.md")
|
||||||
|
assert "## Verdict" in content, "reviewer.md must contain '## Verdict' section"
|
||||||
|
|
||||||
|
def test_reviewer_prompt_contains_details_section(self):
|
||||||
|
content = _read_prompt("reviewer.md")
|
||||||
|
assert "## Details" in content, "reviewer.md must contain '## Details' section"
|
||||||
|
|
||||||
|
def test_reviewer_prompt_verdict_instructs_plain_russian(self):
|
||||||
|
"""Verdict section must instruct plain Russian for the project director."""
|
||||||
|
content = _read_prompt("reviewer.md")
|
||||||
|
assert "Russian" in content or "russian" in content, (
|
||||||
|
"reviewer.md must mention Russian language for the Verdict section"
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_reviewer_prompt_details_uses_json_fence(self):
|
||||||
|
"""Details section must specify JSON output in a ```json code fence."""
|
||||||
|
content = _read_prompt("reviewer.md")
|
||||||
|
assert "```json" in content, "reviewer.md Details section must use ```json fence"
|
||||||
|
|
||||||
|
def test_reviewer_prompt_verdict_forbids_json(self):
|
||||||
|
"""Verdict description must explicitly say no JSON/code in that section."""
|
||||||
|
content = _read_prompt("reviewer.md")
|
||||||
|
# The prompt should say something like "No JSON" near the Verdict section
|
||||||
|
assert "No JSON" in content or "no JSON" in content or "no code" in content.lower(), (
|
||||||
|
"reviewer.md Verdict section must explicitly say no JSON/code snippets"
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_reviewer_prompt_has_example_verdict(self):
|
||||||
|
"""Prompt must contain an example of a plain-language verdict."""
|
||||||
|
content = _read_prompt("reviewer.md")
|
||||||
|
# The examples in the prompt contain Russian text after ## Verdict
|
||||||
|
assert "Реализация" in content or "проверен" in content.lower(), (
|
||||||
|
"reviewer.md must contain a Russian-language example verdict"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TestTesterPromptFormat:
|
||||||
|
def test_tester_prompt_contains_verdict_section(self):
|
||||||
|
content = _read_prompt("tester.md")
|
||||||
|
assert "## Verdict" in content, "tester.md must contain '## Verdict' section"
|
||||||
|
|
||||||
|
def test_tester_prompt_contains_details_section(self):
|
||||||
|
content = _read_prompt("tester.md")
|
||||||
|
assert "## Details" in content, "tester.md must contain '## Details' section"
|
||||||
|
|
||||||
|
def test_tester_prompt_verdict_instructs_plain_russian(self):
|
||||||
|
content = _read_prompt("tester.md")
|
||||||
|
assert "Russian" in content or "russian" in content, (
|
||||||
|
"tester.md must mention Russian language for the Verdict section"
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_tester_prompt_details_uses_json_fence(self):
|
||||||
|
content = _read_prompt("tester.md")
|
||||||
|
assert "```json" in content, "tester.md Details section must use ```json fence"
|
||||||
|
|
||||||
|
def test_tester_prompt_verdict_forbids_json(self):
|
||||||
|
content = _read_prompt("tester.md")
|
||||||
|
assert "No JSON" in content or "no JSON" in content or "no code" in content.lower(), (
|
||||||
|
"tester.md Verdict section must explicitly say no JSON/code snippets"
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_tester_prompt_has_example_verdict(self):
|
||||||
|
content = _read_prompt("tester.md")
|
||||||
|
# The examples contain Russian text
|
||||||
|
assert "Написано" in content or "тест" in content.lower(), (
|
||||||
|
"tester.md must contain a Russian-language example verdict"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TestBothPromptsStructure:
|
||||||
|
def test_reviewer_verdict_comes_before_details(self):
|
||||||
|
"""## Verdict section must appear before ## Details in reviewer.md."""
|
||||||
|
content = _read_prompt("reviewer.md")
|
||||||
|
verdict_pos = content.find("## Verdict")
|
||||||
|
details_pos = content.find("## Details")
|
||||||
|
assert verdict_pos != -1, "## Verdict must exist"
|
||||||
|
assert details_pos != -1, "## Details must exist"
|
||||||
|
assert verdict_pos < details_pos, "## Verdict must come before ## Details"
|
||||||
|
|
||||||
|
def test_tester_verdict_comes_before_details(self):
|
||||||
|
"""## Verdict section must appear before ## Details in tester.md."""
|
||||||
|
content = _read_prompt("tester.md")
|
||||||
|
verdict_pos = content.find("## Verdict")
|
||||||
|
details_pos = content.find("## Details")
|
||||||
|
assert verdict_pos != -1
|
||||||
|
assert details_pos != -1
|
||||||
|
assert verdict_pos < details_pos, "## Verdict must come before ## Details in tester.md"
|
||||||
|
|
||||||
|
def test_reviewer_details_status_field_documented(self):
|
||||||
|
"""Details JSON must document a 'verdict' field."""
|
||||||
|
content = _read_prompt("reviewer.md")
|
||||||
|
assert '"verdict"' in content, "reviewer.md Details must document 'verdict' field"
|
||||||
|
|
||||||
|
def test_tester_details_status_field_documented(self):
|
||||||
|
"""Details JSON must document a 'status' field."""
|
||||||
|
content = _read_prompt("tester.md")
|
||||||
|
assert '"status"' in content, "tester.md Details must document 'status' field"
|
||||||
|
|
@ -2602,3 +2602,165 @@ class TestCheckClaudeAuth:
|
||||||
def test_ok_when_timeout(self, mock_run):
|
def test_ok_when_timeout(self, mock_run):
|
||||||
"""При TimeoutExpired не бросает исключение (не блокируем на timeout)."""
|
"""При TimeoutExpired не бросает исключение (не блокируем на timeout)."""
|
||||||
check_claude_auth() # должна вернуть None без исключений
|
check_claude_auth() # должна вернуть None без исключений
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# KIN-OBS-030: PM-шаг инструментирован в pipeline_log
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class TestPMStepPipelineLog:
|
||||||
|
"""Проверяет, что PM-шаг записывается в pipeline_log после run_pipeline."""
|
||||||
|
|
||||||
|
@patch("agents.runner._run_autocommit")
|
||||||
|
@patch("agents.runner._run_learning_extraction")
|
||||||
|
@patch("agents.runner.subprocess.run")
|
||||||
|
def test_pm_log_entry_written_when_pm_result_provided(
|
||||||
|
self, mock_run, mock_learn, mock_autocommit, conn
|
||||||
|
):
|
||||||
|
"""Если pm_result передан в run_pipeline, в pipeline_log появляется запись PM-шага."""
|
||||||
|
mock_run.return_value = _mock_claude_success({"result": "done"})
|
||||||
|
mock_learn.return_value = {"added": 0, "skipped": 0}
|
||||||
|
|
||||||
|
pm_result = {"success": True, "duration_seconds": 5, "tokens_used": 1000, "cost_usd": 0.01}
|
||||||
|
steps = [{"role": "debugger", "brief": "find bug"}]
|
||||||
|
run_pipeline(
|
||||||
|
conn, "VDOL-001", steps,
|
||||||
|
pm_result=pm_result,
|
||||||
|
pm_started_at="2026-03-17T10:00:00",
|
||||||
|
pm_ended_at="2026-03-17T10:00:05",
|
||||||
|
)
|
||||||
|
|
||||||
|
logs = conn.execute(
|
||||||
|
"SELECT * FROM pipeline_log WHERE message='PM step: task decomposed'"
|
||||||
|
).fetchall()
|
||||||
|
assert len(logs) == 1
|
||||||
|
|
||||||
|
@patch("agents.runner._run_autocommit")
|
||||||
|
@patch("agents.runner._run_learning_extraction")
|
||||||
|
@patch("agents.runner.subprocess.run")
|
||||||
|
def test_pm_log_entry_has_correct_pipeline_id(
|
||||||
|
self, mock_run, mock_learn, mock_autocommit, conn
|
||||||
|
):
|
||||||
|
"""pipeline_id в PM-записи pipeline_log совпадает с реальным pipeline."""
|
||||||
|
mock_run.return_value = _mock_claude_success({"result": "done"})
|
||||||
|
mock_learn.return_value = {"added": 0, "skipped": 0}
|
||||||
|
|
||||||
|
pm_result = {"success": True, "duration_seconds": 3, "tokens_used": 800, "cost_usd": 0.008}
|
||||||
|
steps = [{"role": "debugger", "brief": "find bug"}]
|
||||||
|
run_pipeline(
|
||||||
|
conn, "VDOL-001", steps,
|
||||||
|
pm_result=pm_result,
|
||||||
|
pm_started_at="2026-03-17T10:00:00",
|
||||||
|
pm_ended_at="2026-03-17T10:00:03",
|
||||||
|
)
|
||||||
|
|
||||||
|
pipeline = conn.execute("SELECT * FROM pipelines WHERE task_id='VDOL-001'").fetchone()
|
||||||
|
assert pipeline is not None
|
||||||
|
|
||||||
|
pm_log = conn.execute(
|
||||||
|
"SELECT * FROM pipeline_log WHERE message='PM step: task decomposed'"
|
||||||
|
).fetchone()
|
||||||
|
assert pm_log is not None
|
||||||
|
assert pm_log["pipeline_id"] == pipeline["id"]
|
||||||
|
|
||||||
|
@patch("agents.runner._run_autocommit")
|
||||||
|
@patch("agents.runner._run_learning_extraction")
|
||||||
|
@patch("agents.runner.subprocess.run")
|
||||||
|
def test_pm_log_entry_has_step_pm_in_extra(
|
||||||
|
self, mock_run, mock_learn, mock_autocommit, conn
|
||||||
|
):
|
||||||
|
"""extra_json PM-записи содержит role='pm' и корректные данные тайминга."""
|
||||||
|
mock_run.return_value = _mock_claude_success({"result": "done"})
|
||||||
|
mock_learn.return_value = {"added": 0, "skipped": 0}
|
||||||
|
|
||||||
|
pm_result = {"success": True, "duration_seconds": 7, "tokens_used": 1500, "cost_usd": 0.02}
|
||||||
|
steps = [{"role": "debugger", "brief": "find bug"}]
|
||||||
|
run_pipeline(
|
||||||
|
conn, "VDOL-001", steps,
|
||||||
|
pm_result=pm_result,
|
||||||
|
pm_started_at="2026-03-17T10:00:00",
|
||||||
|
pm_ended_at="2026-03-17T10:00:07",
|
||||||
|
)
|
||||||
|
|
||||||
|
row = conn.execute(
|
||||||
|
"SELECT extra_json FROM pipeline_log WHERE message='PM step: task decomposed'"
|
||||||
|
).fetchone()
|
||||||
|
assert row is not None
|
||||||
|
extra = json.loads(row["extra_json"])
|
||||||
|
assert extra["role"] == "pm"
|
||||||
|
assert extra["duration_seconds"] == 7
|
||||||
|
assert extra["pm_started_at"] == "2026-03-17T10:00:00"
|
||||||
|
assert extra["pm_ended_at"] == "2026-03-17T10:00:07"
|
||||||
|
|
||||||
|
@patch("agents.runner._run_autocommit")
|
||||||
|
@patch("agents.runner._run_learning_extraction")
|
||||||
|
@patch("agents.runner.subprocess.run")
|
||||||
|
def test_pm_log_not_written_when_pm_result_is_none(
|
||||||
|
self, mock_run, mock_learn, mock_autocommit, conn
|
||||||
|
):
|
||||||
|
"""Если pm_result не передан (None), записи PM-шага в pipeline_log нет."""
|
||||||
|
mock_run.return_value = _mock_claude_success({"result": "done"})
|
||||||
|
mock_learn.return_value = {"added": 0, "skipped": 0}
|
||||||
|
|
||||||
|
steps = [{"role": "debugger", "brief": "find bug"}]
|
||||||
|
run_pipeline(conn, "VDOL-001", steps) # pm_result=None по умолчанию
|
||||||
|
|
||||||
|
pm_logs = conn.execute(
|
||||||
|
"SELECT * FROM pipeline_log WHERE message='PM step: task decomposed'"
|
||||||
|
).fetchall()
|
||||||
|
assert len(pm_logs) == 0
|
||||||
|
|
||||||
|
@patch("agents.runner._run_autocommit")
|
||||||
|
@patch("agents.runner._run_learning_extraction")
|
||||||
|
@patch("agents.runner.subprocess.run")
|
||||||
|
def test_pm_log_not_written_for_sub_pipeline(
|
||||||
|
self, mock_run, mock_learn, mock_autocommit, conn
|
||||||
|
):
|
||||||
|
"""PM-лог НЕ записывается в sub-pipeline (parent_pipeline_id задан)."""
|
||||||
|
mock_run.return_value = _mock_claude_success({"result": "done"})
|
||||||
|
mock_learn.return_value = {"added": 0, "skipped": 0}
|
||||||
|
|
||||||
|
# Сначала создаём родительский pipeline
|
||||||
|
parent_pipeline = models.create_pipeline(conn, "VDOL-001", "vdol", "linear", [])
|
||||||
|
|
||||||
|
pm_result = {"success": True, "duration_seconds": 4, "tokens_used": 900, "cost_usd": 0.009}
|
||||||
|
steps = [{"role": "debugger", "brief": "find bug"}]
|
||||||
|
run_pipeline(
|
||||||
|
conn, "VDOL-001", steps,
|
||||||
|
pm_result=pm_result,
|
||||||
|
pm_started_at="2026-03-17T10:00:00",
|
||||||
|
pm_ended_at="2026-03-17T10:00:04",
|
||||||
|
parent_pipeline_id=parent_pipeline["id"],
|
||||||
|
)
|
||||||
|
|
||||||
|
pm_logs = conn.execute(
|
||||||
|
"SELECT * FROM pipeline_log WHERE message='PM step: task decomposed'"
|
||||||
|
).fetchall()
|
||||||
|
assert len(pm_logs) == 0
|
||||||
|
|
||||||
|
@patch("agents.runner._run_autocommit")
|
||||||
|
@patch("agents.runner._run_learning_extraction")
|
||||||
|
@patch("agents.runner.subprocess.run")
|
||||||
|
def test_pm_log_no_orphan_records(
|
||||||
|
self, mock_run, mock_learn, mock_autocommit, conn
|
||||||
|
):
|
||||||
|
"""FK integrity: все записи pipeline_log ссылаются на существующий pipeline."""
|
||||||
|
mock_run.return_value = _mock_claude_success({"result": "done"})
|
||||||
|
mock_learn.return_value = {"added": 0, "skipped": 0}
|
||||||
|
|
||||||
|
pm_result = {"success": True, "duration_seconds": 2, "tokens_used": 500, "cost_usd": 0.005}
|
||||||
|
steps = [{"role": "debugger", "brief": "find bug"}]
|
||||||
|
run_pipeline(
|
||||||
|
conn, "VDOL-001", steps,
|
||||||
|
pm_result=pm_result,
|
||||||
|
pm_started_at="2026-03-17T10:00:00",
|
||||||
|
pm_ended_at="2026-03-17T10:00:02",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Проверяем FK через JOIN — orphan-записей не должно быть
|
||||||
|
orphans = conn.execute(
|
||||||
|
"""SELECT pl.id FROM pipeline_log pl
|
||||||
|
LEFT JOIN pipelines p ON pl.pipeline_id = p.id
|
||||||
|
WHERE p.id IS NULL"""
|
||||||
|
).fetchall()
|
||||||
|
assert len(orphans) == 0
|
||||||
|
|
|
||||||
|
|
@ -761,12 +761,10 @@ def patch_task(task_id: str, body: TaskPatch):
|
||||||
|
|
||||||
@app.get("/api/pipelines/{pipeline_id}/logs")
|
@app.get("/api/pipelines/{pipeline_id}/logs")
|
||||||
def get_pipeline_logs(pipeline_id: int, since_id: int = 0):
|
def get_pipeline_logs(pipeline_id: int, since_id: int = 0):
|
||||||
"""Get pipeline log entries after since_id (for live console polling)."""
|
"""Get pipeline log entries after since_id (for live console polling).
|
||||||
|
Returns [] if pipeline does not exist — consistent empty response for log collections.
|
||||||
|
"""
|
||||||
conn = get_conn()
|
conn = get_conn()
|
||||||
row = conn.execute("SELECT id FROM pipelines WHERE id = ?", (pipeline_id,)).fetchone()
|
|
||||||
if not row:
|
|
||||||
conn.close()
|
|
||||||
raise HTTPException(404, f"Pipeline {pipeline_id} not found")
|
|
||||||
logs = models.get_pipeline_logs(conn, pipeline_id, since_id=since_id)
|
logs = models.get_pipeline_logs(conn, pipeline_id, since_id=since_id)
|
||||||
conn.close()
|
conn.close()
|
||||||
return logs
|
return logs
|
||||||
|
|
|
||||||
|
|
@ -792,7 +792,7 @@ describe('KIN-015: TaskDetail — Edit button и форма редактиров
|
||||||
// ─────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
describe('KIN-049: TaskDetail — кнопка Deploy', () => {
|
describe('KIN-049: TaskDetail — кнопка Deploy', () => {
|
||||||
function makeDeployTask(status: string, deployCommand: string | null) {
|
function makeDeployTask(status: string, deployCommand: string | null, deployRuntime: string | null = null) {
|
||||||
return {
|
return {
|
||||||
id: 'KIN-049',
|
id: 'KIN-049',
|
||||||
project_id: 'KIN',
|
project_id: 'KIN',
|
||||||
|
|
@ -805,6 +805,9 @@ describe('KIN-049: TaskDetail — кнопка Deploy', () => {
|
||||||
spec: null,
|
spec: null,
|
||||||
execution_mode: null,
|
execution_mode: null,
|
||||||
project_deploy_command: deployCommand,
|
project_deploy_command: deployCommand,
|
||||||
|
project_deploy_host: null,
|
||||||
|
project_deploy_path: null,
|
||||||
|
project_deploy_runtime: deployRuntime,
|
||||||
created_at: '2024-01-01',
|
created_at: '2024-01-01',
|
||||||
updated_at: '2024-01-01',
|
updated_at: '2024-01-01',
|
||||||
pipeline_steps: [],
|
pipeline_steps: [],
|
||||||
|
|
@ -827,8 +830,8 @@ describe('KIN-049: TaskDetail — кнопка Deploy', () => {
|
||||||
expect(deployBtn?.exists(), 'Кнопка Deploy должна быть видна при done + deploy_command').toBe(true)
|
expect(deployBtn?.exists(), 'Кнопка Deploy должна быть видна при done + deploy_command').toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Кнопка Deploy скрыта при status=done но без project_deploy_command', async () => {
|
it('Кнопка Deploy скрыта при status=done без project_deploy_command и project_deploy_runtime', async () => {
|
||||||
vi.mocked(api.taskFull).mockResolvedValue(makeDeployTask('done', null) as any)
|
vi.mocked(api.taskFull).mockResolvedValue(makeDeployTask('done', null, null) as any)
|
||||||
const router = makeRouter()
|
const router = makeRouter()
|
||||||
await router.push('/task/KIN-049')
|
await router.push('/task/KIN-049')
|
||||||
|
|
||||||
|
|
@ -839,7 +842,22 @@ describe('KIN-049: TaskDetail — кнопка Deploy', () => {
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
|
||||||
const hasDeployBtn = wrapper.findAll('button').some(b => b.text().includes('Deploy'))
|
const hasDeployBtn = wrapper.findAll('button').some(b => b.text().includes('Deploy'))
|
||||||
expect(hasDeployBtn, 'Deploy не должна быть видна без deploy_command').toBe(false)
|
expect(hasDeployBtn, 'Deploy не должна быть видна без deploy_command и deploy_runtime').toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Кнопка Deploy видна при status=done и только project_deploy_runtime задан', async () => {
|
||||||
|
vi.mocked(api.taskFull).mockResolvedValue(makeDeployTask('done', null, 'node') as any)
|
||||||
|
const router = makeRouter()
|
||||||
|
await router.push('/task/KIN-049')
|
||||||
|
|
||||||
|
const wrapper = mount(TaskDetail, {
|
||||||
|
props: { id: 'KIN-049' },
|
||||||
|
global: { plugins: [router] },
|
||||||
|
})
|
||||||
|
await flushPromises()
|
||||||
|
|
||||||
|
const deployBtn = wrapper.findAll('button').find(b => b.text().includes('Deploy'))
|
||||||
|
expect(deployBtn?.exists(), 'Кнопка Deploy должна быть видна при done + deploy_runtime').toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Кнопка Deploy скрыта при status=pending (даже с deploy_command)', async () => {
|
it('Кнопка Deploy скрыта при status=pending (даже с deploy_command)', async () => {
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,8 @@ export interface TaskFull extends Task {
|
||||||
pipeline_steps: PipelineStep[]
|
pipeline_steps: PipelineStep[]
|
||||||
related_decisions: Decision[]
|
related_decisions: Decision[]
|
||||||
project_deploy_command: string | null
|
project_deploy_command: string | null
|
||||||
|
project_deploy_host: string | null
|
||||||
|
project_deploy_path: string | null
|
||||||
project_deploy_runtime: string | null
|
project_deploy_runtime: string | null
|
||||||
pipeline_id: string | null
|
pipeline_id: string | null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { api, type Project, type ObsidianSyncResult } from '../api'
|
import { api, type Project, type ObsidianSyncResult, type ProjectLink } from '../api'
|
||||||
|
|
||||||
const projects = ref<Project[]>([])
|
const projects = ref<Project[]>([])
|
||||||
const vaultPaths = ref<Record<string, string>>({})
|
const vaultPaths = ref<Record<string, string>>({})
|
||||||
|
|
@ -8,12 +8,10 @@ const deployCommands = ref<Record<string, string>>({})
|
||||||
const testCommands = ref<Record<string, string>>({})
|
const testCommands = ref<Record<string, string>>({})
|
||||||
const autoTestEnabled = ref<Record<string, boolean>>({})
|
const autoTestEnabled = ref<Record<string, boolean>>({})
|
||||||
const saving = ref<Record<string, boolean>>({})
|
const saving = ref<Record<string, boolean>>({})
|
||||||
const savingDeploy = ref<Record<string, boolean>>({})
|
|
||||||
const savingTest = ref<Record<string, boolean>>({})
|
const savingTest = ref<Record<string, boolean>>({})
|
||||||
const savingAutoTest = ref<Record<string, boolean>>({})
|
const savingAutoTest = ref<Record<string, boolean>>({})
|
||||||
const syncing = ref<Record<string, boolean>>({})
|
const syncing = ref<Record<string, boolean>>({})
|
||||||
const saveStatus = ref<Record<string, string>>({})
|
const saveStatus = ref<Record<string, string>>({})
|
||||||
const saveDeployStatus = ref<Record<string, string>>({})
|
|
||||||
const saveTestStatus = ref<Record<string, string>>({})
|
const saveTestStatus = ref<Record<string, string>>({})
|
||||||
const saveAutoTestStatus = ref<Record<string, string>>({})
|
const saveAutoTestStatus = ref<Record<string, string>>({})
|
||||||
const syncResults = ref<Record<string, ObsidianSyncResult | null>>({})
|
const syncResults = ref<Record<string, ObsidianSyncResult | null>>({})
|
||||||
|
|
@ -27,9 +25,19 @@ const deployRestartCmds = ref<Record<string, string>>({})
|
||||||
const savingDeployConfig = ref<Record<string, boolean>>({})
|
const savingDeployConfig = ref<Record<string, boolean>>({})
|
||||||
const saveDeployConfigStatus = ref<Record<string, string>>({})
|
const saveDeployConfigStatus = ref<Record<string, string>>({})
|
||||||
|
|
||||||
|
// 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 }[]>([])
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
projects.value = await api.projects()
|
projects.value = await api.projects()
|
||||||
|
allProjectList.value = projects.value.map(p => ({ id: p.id, name: p.name }))
|
||||||
for (const p of projects.value) {
|
for (const p of projects.value) {
|
||||||
vaultPaths.value[p.id] = p.obsidian_vault_path ?? ''
|
vaultPaths.value[p.id] = p.obsidian_vault_path ?? ''
|
||||||
deployCommands.value[p.id] = p.deploy_command ?? ''
|
deployCommands.value[p.id] = p.deploy_command ?? ''
|
||||||
|
|
@ -39,9 +47,12 @@ onMounted(async () => {
|
||||||
deployPaths.value[p.id] = p.deploy_path ?? ''
|
deployPaths.value[p.id] = p.deploy_path ?? ''
|
||||||
deployRuntimes.value[p.id] = p.deploy_runtime ?? ''
|
deployRuntimes.value[p.id] = p.deploy_runtime ?? ''
|
||||||
deployRestartCmds.value[p.id] = p.deploy_restart_cmd ?? ''
|
deployRestartCmds.value[p.id] = p.deploy_restart_cmd ?? ''
|
||||||
|
linkForms.value[p.id] = { to_project: '', link_type: 'depends_on', description: '' }
|
||||||
|
projectLinksMap.value[p.id] = []
|
||||||
}
|
}
|
||||||
} catch (e) {
|
await Promise.all(projects.value.map(p => loadLinks(p.id)))
|
||||||
error.value = String(e)
|
} catch (e: unknown) {
|
||||||
|
error.value = e instanceof Error ? e.message : String(e)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -50,14 +61,15 @@ async function saveDeployConfig(projectId: string) {
|
||||||
saveDeployConfigStatus.value[projectId] = ''
|
saveDeployConfigStatus.value[projectId] = ''
|
||||||
try {
|
try {
|
||||||
await api.patchProject(projectId, {
|
await api.patchProject(projectId, {
|
||||||
deploy_host: deployHosts.value[projectId],
|
deploy_host: deployHosts.value[projectId] || undefined,
|
||||||
deploy_path: deployPaths.value[projectId],
|
deploy_path: deployPaths.value[projectId] || undefined,
|
||||||
deploy_runtime: deployRuntimes.value[projectId],
|
deploy_runtime: deployRuntimes.value[projectId] || undefined,
|
||||||
deploy_restart_cmd: deployRestartCmds.value[projectId],
|
deploy_restart_cmd: deployRestartCmds.value[projectId] || undefined,
|
||||||
|
deploy_command: deployCommands.value[projectId] || undefined,
|
||||||
})
|
})
|
||||||
saveDeployConfigStatus.value[projectId] = 'Saved'
|
saveDeployConfigStatus.value[projectId] = 'Saved'
|
||||||
} catch (e) {
|
} catch (e: unknown) {
|
||||||
saveDeployConfigStatus.value[projectId] = `Error: ${e}`
|
saveDeployConfigStatus.value[projectId] = `Error: ${e instanceof Error ? e.message : String(e)}`
|
||||||
} finally {
|
} finally {
|
||||||
savingDeployConfig.value[projectId] = false
|
savingDeployConfig.value[projectId] = false
|
||||||
}
|
}
|
||||||
|
|
@ -69,34 +81,21 @@ async function saveVaultPath(projectId: string) {
|
||||||
try {
|
try {
|
||||||
await api.patchProject(projectId, { obsidian_vault_path: vaultPaths.value[projectId] })
|
await api.patchProject(projectId, { obsidian_vault_path: vaultPaths.value[projectId] })
|
||||||
saveStatus.value[projectId] = 'Saved'
|
saveStatus.value[projectId] = 'Saved'
|
||||||
} catch (e) {
|
} catch (e: unknown) {
|
||||||
saveStatus.value[projectId] = `Error: ${e}`
|
saveStatus.value[projectId] = `Error: ${e instanceof Error ? e.message : String(e)}`
|
||||||
} finally {
|
} finally {
|
||||||
saving.value[projectId] = false
|
saving.value[projectId] = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveDeployCommand(projectId: string) {
|
|
||||||
savingDeploy.value[projectId] = true
|
|
||||||
saveDeployStatus.value[projectId] = ''
|
|
||||||
try {
|
|
||||||
await api.patchProject(projectId, { deploy_command: deployCommands.value[projectId] })
|
|
||||||
saveDeployStatus.value[projectId] = 'Saved'
|
|
||||||
} catch (e) {
|
|
||||||
saveDeployStatus.value[projectId] = `Error: ${e}`
|
|
||||||
} finally {
|
|
||||||
savingDeploy.value[projectId] = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function saveTestCommand(projectId: string) {
|
async function saveTestCommand(projectId: string) {
|
||||||
savingTest.value[projectId] = true
|
savingTest.value[projectId] = true
|
||||||
saveTestStatus.value[projectId] = ''
|
saveTestStatus.value[projectId] = ''
|
||||||
try {
|
try {
|
||||||
await api.patchProject(projectId, { test_command: testCommands.value[projectId] })
|
await api.patchProject(projectId, { test_command: testCommands.value[projectId] })
|
||||||
saveTestStatus.value[projectId] = 'Saved'
|
saveTestStatus.value[projectId] = 'Saved'
|
||||||
} catch (e) {
|
} catch (e: unknown) {
|
||||||
saveTestStatus.value[projectId] = `Error: ${e}`
|
saveTestStatus.value[projectId] = `Error: ${e instanceof Error ? e.message : String(e)}`
|
||||||
} finally {
|
} finally {
|
||||||
savingTest.value[projectId] = false
|
savingTest.value[projectId] = false
|
||||||
}
|
}
|
||||||
|
|
@ -109,9 +108,9 @@ async function toggleAutoTest(projectId: string) {
|
||||||
try {
|
try {
|
||||||
await api.patchProject(projectId, { auto_test_enabled: autoTestEnabled.value[projectId] })
|
await api.patchProject(projectId, { auto_test_enabled: autoTestEnabled.value[projectId] })
|
||||||
saveAutoTestStatus.value[projectId] = 'Saved'
|
saveAutoTestStatus.value[projectId] = 'Saved'
|
||||||
} catch (e) {
|
} catch (e: unknown) {
|
||||||
autoTestEnabled.value[projectId] = !autoTestEnabled.value[projectId]
|
autoTestEnabled.value[projectId] = !autoTestEnabled.value[projectId]
|
||||||
saveAutoTestStatus.value[projectId] = `Error: ${e}`
|
saveAutoTestStatus.value[projectId] = `Error: ${e instanceof Error ? e.message : String(e)}`
|
||||||
} finally {
|
} finally {
|
||||||
savingAutoTest.value[projectId] = false
|
savingAutoTest.value[projectId] = false
|
||||||
}
|
}
|
||||||
|
|
@ -124,12 +123,55 @@ async function runSync(projectId: string) {
|
||||||
try {
|
try {
|
||||||
await api.patchProject(projectId, { obsidian_vault_path: vaultPaths.value[projectId] })
|
await api.patchProject(projectId, { obsidian_vault_path: vaultPaths.value[projectId] })
|
||||||
syncResults.value[projectId] = await api.syncObsidian(projectId)
|
syncResults.value[projectId] = await api.syncObsidian(projectId)
|
||||||
} catch (e) {
|
} catch (e: unknown) {
|
||||||
saveStatus.value[projectId] = `Sync error: ${e}`
|
saveStatus.value[projectId] = `Sync error: ${e instanceof Error ? e.message : String(e)}`
|
||||||
} finally {
|
} finally {
|
||||||
syncing.value[projectId] = false
|
syncing.value[projectId] = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
link_type: form.link_type,
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -154,30 +196,6 @@ async function runSync(projectId: string) {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<label class="block text-xs text-gray-400 mb-1">Deploy Command</label>
|
|
||||||
<input
|
|
||||||
v-model="deployCommands[project.id]"
|
|
||||||
type="text"
|
|
||||||
placeholder="git push origin main"
|
|
||||||
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="saveDeployCommand(project.id)"
|
|
||||||
:disabled="savingDeploy[project.id]"
|
|
||||||
class="px-3 py-1.5 text-sm bg-gray-700 hover:bg-gray-600 text-gray-200 rounded disabled:opacity-50"
|
|
||||||
>
|
|
||||||
{{ savingDeploy[project.id] ? 'Saving…' : 'Save Deploy' }}
|
|
||||||
</button>
|
|
||||||
<span v-if="saveDeployStatus[project.id]" class="text-xs" :class="saveDeployStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
|
||||||
{{ saveDeployStatus[project.id] }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="block text-xs text-gray-400 mb-1">Test Command</label>
|
<label class="block text-xs text-gray-400 mb-1">Test Command</label>
|
||||||
<input
|
<input
|
||||||
|
|
@ -186,7 +204,7 @@ async function runSync(projectId: string) {
|
||||||
placeholder="make test"
|
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"
|
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>
|
<p class="text-xs text-gray-600 mt-1">Команда запуска тестов, выполняется через shell в директории проекта.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-3 flex-wrap mb-3">
|
<div class="flex items-center gap-3 flex-wrap mb-3">
|
||||||
|
|
@ -195,7 +213,7 @@ async function runSync(projectId: string) {
|
||||||
:disabled="savingTest[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"
|
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' }}
|
{{ savingTest[project.id] ? 'Saving…' : 'Save Test' }}
|
||||||
</button>
|
</button>
|
||||||
<span v-if="saveTestStatus[project.id]" class="text-xs" :class="saveTestStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
<span v-if="saveTestStatus[project.id]" class="text-xs" :class="saveTestStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
||||||
{{ saveTestStatus[project.id] }}
|
{{ saveTestStatus[project.id] }}
|
||||||
|
|
@ -229,7 +247,7 @@ async function runSync(projectId: string) {
|
||||||
v-model="deployRuntimes[project.id]"
|
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"
|
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="">— выберите runtime —</option>
|
||||||
<option value="docker">docker</option>
|
<option value="docker">docker</option>
|
||||||
<option value="node">node</option>
|
<option value="node">node</option>
|
||||||
<option value="python">python</option>
|
<option value="python">python</option>
|
||||||
|
|
@ -245,13 +263,22 @@ async function runSync(projectId: string) {
|
||||||
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"
|
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>
|
||||||
|
<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>
|
||||||
<div class="flex items-center gap-3 flex-wrap mb-3">
|
<div class="flex items-center gap-3 flex-wrap mb-3">
|
||||||
<button
|
<button
|
||||||
@click="saveDeployConfig(project.id)"
|
@click="saveDeployConfig(project.id)"
|
||||||
:disabled="savingDeployConfig[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"
|
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' }}
|
{{ savingDeployConfig[project.id] ? 'Saving…' : 'Save Deploy Config' }}
|
||||||
</button>
|
</button>
|
||||||
<span v-if="saveDeployConfigStatus[project.id]" class="text-xs" :class="saveDeployConfigStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
<span v-if="saveDeployConfigStatus[project.id]" class="text-xs" :class="saveDeployConfigStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
||||||
{{ saveDeployConfigStatus[project.id] }}
|
{{ saveDeployConfigStatus[project.id] }}
|
||||||
|
|
@ -259,6 +286,74 @@ async function runSync(projectId: string) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 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>
|
||||||
|
<span class="px-1 bg-indigo-900/30 text-indigo-400 border border-indigo-800 rounded">{{ link.link_type }}</span>
|
||||||
|
<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>
|
||||||
|
|
||||||
<div class="flex items-center gap-3 mb-3">
|
<div class="flex items-center gap-3 mb-3">
|
||||||
<label class="flex items-center gap-2 cursor-pointer select-none">
|
<label class="flex items-center gap-2 cursor-pointer select-none">
|
||||||
<input
|
<input
|
||||||
|
|
@ -269,7 +364,7 @@ async function runSync(projectId: string) {
|
||||||
class="w-4 h-4 rounded border-gray-600 bg-gray-800 accent-blue-500 cursor-pointer disabled:opacity-50"
|
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-sm text-gray-300">Auto-test</span>
|
||||||
<span class="text-xs text-gray-500">— запускать тесты автоматически после pipeline</span>
|
<span class="text-xs text-gray-500">— запускать тесты автоматически после pipeline</span>
|
||||||
</label>
|
</label>
|
||||||
<span v-if="saveAutoTestStatus[project.id]" class="text-xs" :class="saveAutoTestStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
<span v-if="saveAutoTestStatus[project.id]" class="text-xs" :class="saveAutoTestStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
||||||
{{ saveAutoTestStatus[project.id] }}
|
{{ saveAutoTestStatus[project.id] }}
|
||||||
|
|
@ -282,7 +377,7 @@ async function runSync(projectId: string) {
|
||||||
:disabled="saving[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"
|
class="px-3 py-1.5 text-sm bg-gray-700 hover:bg-gray-600 text-gray-200 rounded disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{{ saving[project.id] ? 'Saving…' : 'Save Vault' }}
|
{{ saving[project.id] ? 'Saving…' : 'Save Vault' }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
@ -290,7 +385,7 @@ async function runSync(projectId: string) {
|
||||||
:disabled="syncing[project.id] || !vaultPaths[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"
|
class="px-3 py-1.5 text-sm bg-indigo-700 hover:bg-indigo-600 text-white rounded disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{{ syncing[project.id] ? 'Syncing…' : 'Sync Obsidian' }}
|
{{ syncing[project.id] ? 'Syncing…' : 'Sync Obsidian' }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<span v-if="saveStatus[project.id]" class="text-xs" :class="saveStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
<span v-if="saveStatus[project.id]" class="text-xs" :class="saveStatus[project.id].startsWith('Error') ? 'text-red-400' : 'text-green-400'">
|
||||||
|
|
|
||||||
|
|
@ -597,7 +597,7 @@ async function saveEdit() {
|
||||||
<span v-if="resolvingManually" class="inline-block w-3 h-3 border-2 border-orange-400 border-t-transparent rounded-full animate-spin mr-1"></span>
|
<span v-if="resolvingManually" class="inline-block w-3 h-3 border-2 border-orange-400 border-t-transparent rounded-full animate-spin mr-1"></span>
|
||||||
{{ resolvingManually ? 'Сохраняем...' : '✓ Решить вручную' }}
|
{{ resolvingManually ? 'Сохраняем...' : '✓ Решить вручную' }}
|
||||||
</button>
|
</button>
|
||||||
<button v-if="task.status === 'done' && task.project_deploy_command"
|
<button v-if="task.status === 'done' && (task.project_deploy_command || task.project_deploy_runtime)"
|
||||||
@click.stop="runDeploy"
|
@click.stop="runDeploy"
|
||||||
:disabled="deploying"
|
:disabled="deploying"
|
||||||
class="px-4 py-2 text-sm bg-teal-900/50 text-teal-400 border border-teal-800 rounded hover:bg-teal-900 disabled:opacity-50">
|
class="px-4 py-2 text-sm bg-teal-900/50 text-teal-400 border border-teal-800 rounded hover:bg-teal-900 disabled:opacity-50">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue