v1.0.84: log panel hidden by default, toggle button bottom-right
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ from routes.main import bp as main_bp
|
||||
from routes.api import bp as api_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.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc")
|
||||
|
||||
@@ -384,25 +384,32 @@ async function refreshInstances(){
|
||||
document.getElementById('inst-list').innerHTML=html;
|
||||
}
|
||||
|
||||
// === Панель логов ===
|
||||
// === Панель логов (скрыта, показывается по кнопке) ===
|
||||
let logPollTimer=null;
|
||||
function startLogPoll(){
|
||||
if(logPollTimer) return;
|
||||
logPollTimer=setInterval(async()=>{
|
||||
const el=document.getElementById('log-panel');
|
||||
if(!el||el.style.display==='none') return; // не дёргать если скрыта
|
||||
try{
|
||||
const r=await fetch('/api/log');
|
||||
const lines=await r.json();
|
||||
const el=document.getElementById('log-panel');
|
||||
if(!el) return;
|
||||
el.innerHTML=lines.map(l=>`<div>${l}</div>`).join('');
|
||||
el.scrollTop=el.scrollHeight;
|
||||
}catch(e){}
|
||||
},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();
|
||||
</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>
|
||||
</html>
|
||||
Reference in New Issue
Block a user