v1.0.84: log panel hidden by default, toggle button bottom-right

This commit is contained in:
2026-07-27 17:12:23 +04:00
parent c37709eef0
commit cd2e2349e2
2 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ from routes.main import bp as main_bp
from routes.api import bp as api_bp from routes.api import bp as api_bp
from routes.api_test import bp as api_test_bp from routes.api_test import bp as api_test_bp
VERSION = "1.0.83" VERSION = "1.0.84"
app = Flask(__name__, template_folder="templates", static_folder="static") app = Flask(__name__, template_folder="templates", static_folder="static")
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc") app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc")
+11 -4
View File
@@ -384,25 +384,32 @@ async function refreshInstances(){
document.getElementById('inst-list').innerHTML=html; document.getElementById('inst-list').innerHTML=html;
} }
// === Панель логов === // === Панель логов (скрыта, показывается по кнопке) ===
let logPollTimer=null; let logPollTimer=null;
function startLogPoll(){ function startLogPoll(){
if(logPollTimer) return; if(logPollTimer) return;
logPollTimer=setInterval(async()=>{ logPollTimer=setInterval(async()=>{
const el=document.getElementById('log-panel');
if(!el||el.style.display==='none') return; // не дёргать если скрыта
try{ try{
const r=await fetch('/api/log'); const r=await fetch('/api/log');
const lines=await r.json(); const lines=await r.json();
const el=document.getElementById('log-panel');
if(!el) return;
el.innerHTML=lines.map(l=>`<div>${l}</div>`).join(''); el.innerHTML=lines.map(l=>`<div>${l}</div>`).join('');
el.scrollTop=el.scrollHeight; el.scrollTop=el.scrollHeight;
}catch(e){} }catch(e){}
},2000); },2000);
} }
function toggleLog(){
const el=document.getElementById('log-panel');
if(!el) return;
if(el.style.display==='none'){ el.style.display='block'; startLogPoll(); }
else el.style.display='none';
}
startLogPoll(); startLogPoll();
</script> </script>
<div id="log-panel" style="position:fixed;bottom:0;left:0;right:0;height:180px;background:#1e1e1e;color:#d4d4d4;font:11px monospace;overflow-y:auto;padding:6px 10px;border-top:2px solid #555;z-index:9999;"></div> <div id="log-panel" style="display:none;position:fixed;bottom:0;left:0;right:0;height:180px;background:#1e1e1e;color:#d4d4d4;font:11px monospace;overflow-y:auto;padding:6px 10px;border-top:2px solid #555;z-index:9999;"></div>
<button onclick="toggleLog()" title="Логи" style="position:fixed;bottom:4px;right:8px;z-index:10000;background:#1e1e1e;color:#888;border:1px solid #555;border-radius:3px;font:10px monospace;padding:2px 6px;cursor:pointer;">log</button>
</body> </body>
</html> </html>