Добавил UI для GitHub credentials и улучшил импорт

Этот коммит содержится в:
Виктор
2026-05-12 00:20:22 +09:00
родитель 3c3a1679ef
Коммит 16168d3fbe
+37 -4
Просмотреть файл
@@ -7,17 +7,18 @@
<style> <style>
body{margin:0;background:#0f1115;color:#fff;font-family:Arial,sans-serif} body{margin:0;background:#0f1115;color:#fff;font-family:Arial,sans-serif}
.layout{display:flex;height:100vh} .layout{display:flex;height:100vh}
.sidebar{width:320px;background:#171a21;padding:20px;border-right:1px solid #2a2f3a;overflow:auto;display:flex;flex-direction:column;gap:16px} .sidebar{width:360px;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{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}.file-tree{width:320px;background:#13161c;border-right:1px solid #2a2f3a;overflow:auto;padding:10px}.editor-panel{flex:1;display:flex;flex-direction:column} .workspace-body{flex:1;display:flex;overflow:hidden}.file-tree{width:320px;background:#13161c;border-right:1px solid #2a2f3a;overflow:auto;padding:10px}.editor-panel{flex:1;display:flex;flex-direction:column}
.editor-header{padding:10px;background:#171a21;border-bottom:1px solid #2a2f3a;display:flex;justify-content:space-between;align-items:center} .editor-header{padding:10px;background:#171a21;border-bottom:1px solid #2a2f3a;display:flex;justify-content:space-between;align-items:center}
textarea{flex:1;background:#0f1115;color:#fff;border:none;padding:16px;font-family:monospace;font-size:14px;outline:none;resize:none} textarea{flex:1;background:#0f1115;color:#fff;border:none;padding:16px;font-family:monospace;font-size:14px;outline:none;resize:none}
button{background:#2563eb;color:#fff;border:none;padding:10px 14px;border-radius:8px;cursor:pointer} button{background:#2563eb;color:#fff;border:none;padding:10px 14px;border-radius:8px;cursor:pointer}
button:hover{background:#3b82f6} button:hover{background:#3b82f6}
input,select{background:#0f1115;border:1px solid #2a2f3a;color:#fff;padding:10px;border-radius:8px;flex:1}.tree-node{padding:6px;border-radius:6px;cursor:pointer}.tree-node:hover{background:#1d2430} input,select{background:#0f1115;border:1px solid #2a2f3a;color:#fff;padding:10px;border-radius:8px;flex:1;width:100%;box-sizing:border-box}.tree-node{padding:6px;border-radius:6px;cursor:pointer}.tree-node:hover{background:#1d2430}
.logs{height:220px;background:#0b0d11;border-top:1px solid #2a2f3a;padding:10px;overflow:auto;font-family:monospace;font-size:12px;white-space:pre-wrap} .logs{height:220px;background:#0b0d11;border-top:1px solid #2a2f3a;padding:10px;overflow:auto;font-family:monospace;font-size:12px;white-space:pre-wrap}
.section{background:#13161c;border:1px solid #2a2f3a;border-radius:12px;padding:14px}.section h3{margin-top:0}.projects-list{max-height:260px;overflow:auto} .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} .runtime-grid{display:flex;gap:10px;flex-wrap:wrap}
.status{font-size:12px;color:#9ca3af;margin-top:8px}
</style> </style>
</head> </head>
<body> <body>
@@ -27,9 +28,20 @@ input,select{background:#0f1115;border:1px solid #2a2f3a;color:#fff;padding:10px
<h2>DevConsole</h2> <h2>DevConsole</h2>
<p>AI Development Runtime</p> <p>AI Development Runtime</p>
</div> </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 token">
<div style="height:10px"></div>
<button onclick="saveGitHubSettings()">Сохранить GitHub доступ</button>
<div class="status" id="githubStatus">GitHub token не сохранён</div>
</div>
<div class="section"> <div class="section">
<h3>Импорт проекта</h3> <h3>Импорт проекта</h3>
<input type="text" id="repoUrl" placeholder="https://github.com/user/project"> <input type="text" id="repoUrl" placeholder="https://github.com/viktor138irk/Pulse.git">
<div style="margin-top:10px;display:flex;flex-direction:column;gap:10px"> <div style="margin-top:10px;display:flex;flex-direction:column;gap:10px">
<button onclick="analyzeProject()">Анализ проекта</button> <button onclick="analyzeProject()">Анализ проекта</button>
<button onclick="installDependencies()">Установить зависимости</button> <button onclick="installDependencies()">Установить зависимости</button>
@@ -37,10 +49,12 @@ input,select{background:#0f1115;border:1px solid #2a2f3a;color:#fff;padding:10px
<button onclick="buildApk()">Собрать APK</button> <button onclick="buildApk()">Собрать APK</button>
</div> </div>
</div> </div>
<div class="section"> <div class="section">
<h3>Проекты</h3> <h3>Проекты</h3>
<div id="projectsList" class="projects-list">Загрузка проектов...</div> <div id="projectsList" class="projects-list">Загрузка проектов...</div>
</div> </div>
<div class="section"> <div class="section">
<h3>Android устройства</h3> <h3>Android устройства</h3>
<select id="deviceSelect"> <select id="deviceSelect">
@@ -50,6 +64,7 @@ input,select{background:#0f1115;border:1px solid #2a2f3a;color:#fff;padding:10px
<div id="devices">Поиск устройств...</div> <div id="devices">Поиск устройств...</div>
</div> </div>
</aside> </aside>
<div class="workspace"> <div class="workspace">
<div class="topbar"> <div class="topbar">
<input type="text" id="workspacePath" placeholder="Путь workspace"> <input type="text" id="workspacePath" placeholder="Путь workspace">
@@ -58,8 +73,10 @@ input,select{background:#0f1115;border:1px solid #2a2f3a;color:#fff;padding:10px
<button onclick="installLatestApk()">Install APK</button> <button onclick="installLatestApk()">Install APK</button>
<button onclick="restartCurrentApp()">Restart App</button> <button onclick="restartCurrentApp()">Restart App</button>
</div> </div>
<div class="workspace-body"> <div class="workspace-body">
<div class="file-tree" id="fileTree"></div> <div class="file-tree" id="fileTree"></div>
<div class="editor-panel"> <div class="editor-panel">
<div class="editor-header"> <div class="editor-header">
<div id="editorPath">Файл не открыт</div> <div id="editorPath">Файл не открыт</div>
@@ -68,20 +85,36 @@ input,select{background:#0f1115;border:1px solid #2a2f3a;color:#fff;padding:10px
<button onclick="saveCurrentFile()">Сохранить файл</button> <button onclick="saveCurrentFile()">Сохранить файл</button>
</div> </div>
</div> </div>
<div style="padding:10px;background:#13161c;border-bottom:1px solid #2a2f3a;display:flex;flex-direction:column;gap:10px"> <div style="padding:10px;background:#13161c;border-bottom:1px solid #2a2f3a;display:flex;flex-direction:column;gap:10px">
<div><strong>Runtime Commands</strong></div> <div><strong>Runtime Commands</strong></div>
<div class="runtime-grid" id="runtimeButtons"></div> <div class="runtime-grid" id="runtimeButtons"></div>
</div> </div>
<textarea id="editor"></textarea> <textarea id="editor"></textarea>
<div class="logs" id="logs">DevConsole runtime initialized...</div> <div class="logs" id="logs">DevConsole runtime initialized...</div>
</div> </div>
</div> </div>
</div> </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();}
async function analyzeProject(){const repo_url=document.getElementById('repoUrl').value;const data=await api('/api/projects/analyze',{repo_url});if(data.analysis?.workspace){document.getElementById('workspacePath').value=data.analysis.workspace;await registerCurrentProject(repo_url,data.analysis.workspace,data.analysis.stack||'unknown');}document.getElementById('logs').innerText=JSON.stringify(data,null,2);}
async function analyzeProject(){
const repo_url=document.getElementById('repoUrl').value;
appendLog('Начат анализ проекта: '+repo_url);
const data=await api('/api/projects/analyze',{repo_url});
if(data.analysis?.workspace){
appendLog('Workspace создан: '+data.analysis.workspace);
document.getElementById('workspacePath').value=data.analysis.workspace;
await registerCurrentProject(repo_url,data.analysis.workspace,data.analysis.detected_stack?.join(', ')||'unknown');
loadWorkspaceTree();
}
if(data.detail){appendLog('Ошибка: '+data.detail);}else{appendLog('Анализ проекта завершён');}
}
async function installDependencies(){const repo_url=document.getElementById('repoUrl').value;const data=await api('/api/projects/install-dependencies',{repo_url});document.getElementById('logs').innerText=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});document.getElementById('logs').innerText=JSON.stringify(data,null,2);}
async function buildApk(){const workspace=document.getElementById('workspacePath').value;const data=await api('/api/android/build',{workspace});document.getElementById('logs').innerText=JSON.stringify(data,null,2);} async function buildApk(){const workspace=document.getElementById('workspacePath').value;const data=await api('/api/android/build',{workspace});document.getElementById('logs').innerText=JSON.stringify(data,null,2);}
</script> </script>