Добавил GitHub-only runtime UI

Этот коммит содержится в:
Виктор
2026-05-12 00:31:56 +09:00
родитель 8515d61971
Коммит 008eae9e84
+31
Просмотреть файл
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DevConsole Runtime</title>
<style>
body{margin:0;background:#0f1115;color:#fff;font-family:Arial,sans-serif}.layout{display:flex;height:100vh}.sidebar{width:380px;background:#171a21;padding:20px;border-right:1px solid #2a2f3a;overflow:auto;display:flex;flex-direction:column;gap:16px}.workspace{flex:1;display:flex;flex-direction:column}.topbar{padding:10px;background:#171a21;border-bottom:1px solid #2a2f3a;display:flex;gap:10px;flex-wrap:wrap}.workspace-body{flex:1;display:flex;overflow:hidden}.runtime-panel{flex:1;display:flex;flex-direction:column;background:#0f1115}.runtime-header{padding:16px;background:#171a21;border-bottom:1px solid #2a2f3a;display:flex;justify-content:space-between;align-items:center;gap:12px}.logs{flex:1;background:#0b0d11;border-top:1px solid #2a2f3a;padding:14px;overflow:auto;font-family:monospace;font-size:12px;white-space:pre-wrap}button{background:#2563eb;color:#fff;border:none;padding:10px 14px;border-radius:8px;cursor:pointer}button:hover{background:#3b82f6}input,select{background:#0f1115;border:1px solid #2a2f3a;color:#fff;padding:10px;border-radius:8px;flex:1;width:100%;box-sizing:border-box}.section{background:#13161c;border:1px solid #2a2f3a;border-radius:12px;padding:14px}.section h3{margin-top:0}.projects-list{max-height:260px;overflow:auto}.runtime-grid{display:flex;gap:10px;flex-wrap:wrap}.status{font-size:12px;color:#9ca3af;margin-top:8px}.progress-wrap{display:none;margin-top:12px;background:#0f1115;border:1px solid #2a2f3a;border-radius:10px;overflow:hidden}.progress-bar{height:10px;width:0;background:#2563eb;transition:width .25s ease}.progress-label{font-size:12px;color:#d1d5db;margin-top:8px;line-height:1.4}.note{font-size:13px;color:#9ca3af;line-height:1.45}.project-card{padding:10px;margin-bottom:10px;background:#1d2430;border-radius:10px;cursor:pointer}
</style>
</head>
<body>
<div class="layout">
<aside class="sidebar">
<div><h2>DevConsole</h2><p>GitHub-driven Runtime</p></div>
<div class="section"><h3>GitHub доступ</h3><input type="text" id="githubUsername" placeholder="GitHub username"><div style="height:10px"></div><input type="password" id="githubToken" placeholder="GitHub credential"><div style="height:10px"></div><button onclick="saveGitHubSettings()">Сохранить GitHub доступ</button><div class="status" id="githubStatus">GitHub доступ не сохранён</div></div>
<div class="section"><h3>Импорт проекта</h3><input type="text" id="repoUrl" placeholder="https://github.com/viktor138irk/Pulse.git"><div style="margin-top:10px;display:flex;flex-direction:column;gap:10px"><button onclick="analyzeProject()">Анализ проекта</button><button onclick="installDependencies()">Установить зависимости</button></div><div class="progress-wrap" id="analysisProgressWrap"><div class="progress-bar" id="analysisProgressBar"></div></div><div class="progress-label" id="analysisProgressLabel"></div></div>
<div class="section"><h3>Проекты</h3><div id="projectsList" class="projects-list">Загрузка проектов...</div></div>
<div class="section"><h3>Android устройства</h3><select id="deviceSelect"><option value="">Поиск устройств...</option></select><div style="height:10px"></div><div id="devices">Поиск устройств...</div></div>
</aside>
<div class="workspace"><div class="topbar"><input type="text" id="workspacePath" placeholder="Workspace из GitHub import" readonly><input type="text" id="packageName" placeholder="Package name"><button onclick="installLatestApk()">Install APK</button><button onclick="restartCurrentApp()">Restart App</button></div><div class="workspace-body"><div class="runtime-panel"><div class="runtime-header"><div><strong>Runtime сценарии</strong><div class="note">Ручной редактор файлов отключён. Изменения делаем через GitHub commit/pull.</div></div><div class="runtime-grid" id="runtimeButtons"></div></div><div class="logs" id="logs">DevConsole runtime initialized...</div></div></div></div>
</div>
<script src="/workspace.js"></script>
<script>
async function api(url,payload={},method='POST'){const r=await fetch(url,{method,headers:{'Content-Type':'application/json'},body:method==='GET'?undefined:JSON.stringify(payload)});return await r.json();}
function setAnalysisProgress(percent,message){const wrap=document.getElementById('analysisProgressWrap');const bar=document.getElementById('analysisProgressBar');const label=document.getElementById('analysisProgressLabel');if(wrap){wrap.style.display='block';}if(bar){bar.style.width=percent+'%';}if(label){label.innerText=percent+'% — '+message;}appendLog(percent+'% — '+message);}
async function analyzeProject(){const repo_url=document.getElementById('repoUrl').value.trim();if(!repo_url){appendLog('0% — Укажи GitHub repository URL');return;}setAnalysisProgress(5,'Проверяю адрес репозитория');setAnalysisProgress(15,'Готовлю доступ и рабочую папку');setAnalysisProgress(30,'Клонирую или обновляю репозиторий');const data=await api('/api/projects/analyze',{repo_url});if(data.detail){setAnalysisProgress(100,'Ошибка анализа: '+data.detail);return;}setAnalysisProgress(60,'Репозиторий получен, сканирую структуру');if(data.analysis?.detected_stack?.length){setAnalysisProgress(72,'Стек: '+data.analysis.detected_stack.join(', '));}else{setAnalysisProgress(72,'Стек не определён автоматически');}if(data.analysis?.workspace){setAnalysisProgress(82,'Workspace: '+data.analysis.workspace);document.getElementById('workspacePath').value=data.analysis.workspace;setAnalysisProgress(90,'Регистрирую проект');await registerCurrentProject(repo_url,data.analysis.workspace,data.analysis.detected_stack?.join(', ')||'unknown');}setAnalysisProgress(100,'Анализ завершён');}
async function installDependencies(){const repo_url=document.getElementById('repoUrl').value;const data=await api('/api/projects/install-dependencies',{repo_url});appendLog(JSON.stringify(data,null,2));}
async function buildApk(){await runRuntimeScenario('build');}
</script>
</body>
</html>