Переделал UI добавления проекта в модалку
Этот коммит содержится в:
@@ -5,25 +5,28 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>DevConsole Runtime</title>
|
<title>DevConsole Runtime</title>
|
||||||
<style>
|
<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:grid;grid-template-columns:1fr 360px;overflow:hidden}.runtime-panel,.errors-panel{display:flex;flex-direction:column;background:#0f1115}.errors-panel{border-left:1px solid #2a2f3a;background:#111318}.runtime-header,.errors-header{padding:16px;background:#171a21;border-bottom:1px solid #2a2f3a;display:flex;justify-content:space-between;align-items:center;gap:12px}.logs,.errors-box{flex:1;background:#0b0d11;border-top:1px solid #2a2f3a;padding:14px;overflow:auto;font-family:monospace;font-size:12px;white-space:pre-wrap}.errors-box{background:#160d0d;color:#ffd4d4}.errors-actions{padding:10px;background:#171a21;border-top:1px solid #2a2f3a;display:flex;gap:8px;flex-wrap:wrap}button{background:#2563eb;color:#fff;border:none;padding:10px 14px;border-radius:8px;cursor:pointer}button:hover{background:#3b82f6}.danger{background:#991b1b}.danger:hover{background:#b91c1c}.muted{background:#374151}.muted:hover{background:#4b5563}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}.status-line{display:flex;align-items:center;gap:8px;font-size:13px;color:#d1d5db}.status-dot{width:10px;height:10px;border-radius:999px;background:#6b7280}.status-dot.running{background:#f59e0b;animation:pulse 1s infinite}.status-dot.done{background:#22c55e}.status-dot.error{background:#ef4444}.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}.error-count{font-size:12px;color:#fecaca}@keyframes pulse{0%{opacity:.35}50%{opacity:1}100%{opacity:.35}}
|
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:grid;grid-template-columns:1fr 360px;overflow:hidden}.runtime-panel,.errors-panel{display:flex;flex-direction:column;background:#0f1115}.errors-panel{border-left:1px solid #2a2f3a;background:#111318}.runtime-header,.errors-header{padding:16px;background:#171a21;border-bottom:1px solid #2a2f3a;display:flex;justify-content:space-between;align-items:center;gap:12px}.logs,.errors-box{flex:1;background:#0b0d11;border-top:1px solid #2a2f3a;padding:14px;overflow:auto;font-family:monospace;font-size:12px;white-space:pre-wrap}.errors-box{background:#160d0d;color:#ffd4d4}.errors-actions{padding:10px;background:#171a21;border-top:1px solid #2a2f3a;display:flex;gap:8px;flex-wrap:wrap}button{background:#2563eb;color:#fff;border:none;padding:10px 14px;border-radius:8px;cursor:pointer}button:hover{background:#3b82f6}.danger{background:#991b1b}.danger:hover{background:#b91c1c}.muted{background:#374151}.muted:hover{background:#4b5563}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:420px;overflow:auto}.runtime-grid{display:flex;gap:10px;flex-wrap:wrap}.status{font-size:12px;color:#9ca3af;margin-top:8px}.status-line{display:flex;align-items:center;gap:8px;font-size:13px;color:#d1d5db}.status-dot{width:10px;height:10px;border-radius:999px;background:#6b7280}.status-dot.running{background:#f59e0b;animation:pulse 1s infinite}.status-dot.done{background:#22c55e}.status-dot.error{background:#ef4444}.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}.error-count{font-size:12px;color:#fecaca}.modal-backdrop{display:none;position:fixed;inset:0;background:rgba(0,0,0,.65);align-items:center;justify-content:center;z-index:50}.modal{width:520px;max-width:calc(100vw - 32px);background:#171a21;border:1px solid #2a2f3a;border-radius:16px;padding:18px;box-shadow:0 20px 80px rgba(0,0,0,.45)}.modal h3{margin-top:0}.modal-row{display:flex;gap:10px;margin-top:10px}.auth-extra{display:none;margin-top:10px}.checkline{display:flex;gap:8px;align-items:center;margin-top:10px;color:#d1d5db}.checkline input{width:auto;flex:0}.sidebar-actions{display:flex;gap:10px;flex-direction:column}@keyframes pulse{0%{opacity:.35}50%{opacity:1}100%{opacity:.35}}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<aside class="sidebar">
|
<aside class="sidebar">
|
||||||
<div><h2>DevConsole</h2><p>GitHub-driven Runtime</p></div>
|
<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 sidebar-actions"><button onclick="openAddProjectModal()">Добавить проект</button><div class="note">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>Проекты</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>
|
<div class="section"><h3>Android устройства</h3><select id="deviceSelect"><option value="">Поиск устройств...</option></select><div style="height:10px"></div><div id="devices">Поиск устройств...</div></div>
|
||||||
</aside>
|
</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 class="status-line"><span id="runtimeStatusDot" class="status-dot"></span><span id="runtimeStatus">Ожидание</span></div><div class="progress-wrap" id="taskProgressWrap"><div class="progress-bar" id="taskProgressBar"></div></div><div class="progress-label" id="taskProgressLabel"></div></div><div class="runtime-grid" id="runtimeButtons"></div></div><div class="logs" id="logs">DevConsole runtime initialized...</div></div><div class="errors-panel"><div class="errors-header"><div><strong>Ошибки для передачи AI</strong><div id="errorCount" class="error-count">Ошибок пока нет</div></div></div><div class="errors-box" id="errorsBox">Здесь появятся ошибки из Flutter, Gradle, ADB, API и stderr.</div><div class="errors-actions"><button class="muted" onclick="copyErrorsForAI()">Скопировать</button><button class="danger" onclick="clearErrors()">Очистить</button></div></div></div></div>
|
<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. Flutter output идёт live.</div><div class="status-line"><span id="runtimeStatusDot" class="status-dot"></span><span id="runtimeStatus">Ожидание</span></div><div class="progress-wrap" id="taskProgressWrap"><div class="progress-bar" id="taskProgressBar"></div></div><div class="progress-label" id="taskProgressLabel"></div></div><div class="runtime-grid" id="runtimeButtons"></div></div><div class="logs" id="logs">DevConsole runtime initialized...</div></div><div class="errors-panel"><div class="errors-header"><div><strong>Ошибки для передачи AI</strong><div id="errorCount" class="error-count">Ошибок пока нет</div></div></div><div class="errors-box" id="errorsBox">Здесь появятся ошибки из Flutter, Gradle, ADB, API и stderr.</div><div class="errors-actions"><button class="muted" onclick="copyErrorsForAI()">Скопировать</button><button class="danger" onclick="clearErrors()">Очистить</button></div></div></div></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-backdrop" id="addProjectModal"><div class="modal"><h3>Добавить проект</h3><input type="text" id="repoUrl" placeholder="Ссылка на GIT"><label class="checkline"><input type="checkbox" id="repoNeedsAuth" onchange="toggleAuthFields()"> Требуется аутентификация</label><div class="auth-extra" id="authFields"><input type="text" id="githubUsername" placeholder="Логин"><div style="height:10px"></div><input type="password" id="githubToken" placeholder="Ключ"></div><div class="progress-wrap" id="analysisProgressWrap"><div class="progress-bar" id="analysisProgressBar"></div></div><div class="progress-label" id="analysisProgressLabel"></div><div class="modal-row"><button onclick="analyzeProject()">Добавить</button><button class="muted" onclick="closeAddProjectModal()">Закрыть</button></div></div></div>
|
||||||
<script src="/workspace.js"></script>
|
<script src="/workspace.js"></script>
|
||||||
<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();}
|
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 openAddProjectModal(){document.getElementById('addProjectModal').style.display='flex';}
|
||||||
|
function closeAddProjectModal(){document.getElementById('addProjectModal').style.display='none';}
|
||||||
|
function toggleAuthFields(){document.getElementById('authFields').style.display=document.getElementById('repoNeedsAuth').checked?'block':'none';}
|
||||||
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);}
|
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 analyzeProject(){const repo_url=document.getElementById('repoUrl').value.trim();if(!repo_url){appendLog('0% — Укажи Git URL');return;}if(document.getElementById('repoNeedsAuth').checked){await saveGitHubSettings();}setAnalysisProgress(5,'Проверяю Git URL');setAnalysisProgress(20,'Готовлю workspace');setAnalysisProgress(35,'Клонирую или обновляю репозиторий');const data=await api('/api/projects/analyze',{repo_url});if(data.detail){setAnalysisProgress(100,'Ошибка анализа: '+data.detail);return;}setAnalysisProgress(65,'Репозиторий получен, сканирую структуру');if(data.analysis?.detected_stack?.length){setAnalysisProgress(76,'Стек: '+data.analysis.detected_stack.join(', '));}else{setAnalysisProgress(76,'Стек не определён автоматически');}if(data.analysis?.workspace){setAnalysisProgress(88,'Workspace: '+data.analysis.workspace);document.getElementById('workspacePath').value=data.analysis.workspace;setAnalysisProgress(94,'Регистрирую проект');await registerCurrentProject(repo_url,data.analysis.workspace,data.analysis.detected_stack?.join(', ')||'unknown');}setAnalysisProgress(100,'Проект добавлен');closeAddProjectModal();}
|
||||||
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 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');}
|
async function buildApk(){await runRuntimeScenario('build');}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user