Add no-GUI boot mode and quieter boot diagnostics
This commit is contained in:
@@ -1323,8 +1323,20 @@ td:first-child{color:#718096;width:55%}
|
||||
<script>
|
||||
(function(){
|
||||
var gone = false;
|
||||
var pollStarted = false;
|
||||
var fallbackOpenTimer = null;
|
||||
var AUTO_OPEN_DELAY_MS = 15000;
|
||||
function go(){ if(!gone){gone=true;window.location.replace('/');} }
|
||||
|
||||
function scheduleFallbackOpen(){
|
||||
if(fallbackOpenTimer!==null) return;
|
||||
fallbackOpenTimer=setTimeout(function(){
|
||||
document.getElementById('spin').className='spinner hidden';
|
||||
document.getElementById('st').textContent='Startup checks are taking too long — opening app...';
|
||||
go();
|
||||
},AUTO_OPEN_DELAY_MS);
|
||||
}
|
||||
|
||||
function icon(s){
|
||||
if(s==='active') return '<span class="ok">● active</span>';
|
||||
if(s==='failed') return '<span class="fail">✕ failed</span>';
|
||||
@@ -1356,6 +1368,7 @@ function pollServices(){
|
||||
tbl.innerHTML=html;
|
||||
if(allSettled(svcs)){
|
||||
clearInterval(pollTimer);
|
||||
if(fallbackOpenTimer!==null) clearTimeout(fallbackOpenTimer);
|
||||
document.getElementById('spin').className='spinner hidden';
|
||||
document.getElementById('st').textContent='Ready \u2014 opening...';
|
||||
setTimeout(go,800);
|
||||
@@ -1370,8 +1383,12 @@ function probe(){
|
||||
if(r.ok){
|
||||
document.getElementById('st').textContent='bee-web running \u2014 checking services...';
|
||||
document.getElementById('btn').style.display='';
|
||||
pollServices();
|
||||
pollTimer=setInterval(pollServices,1500);
|
||||
scheduleFallbackOpen();
|
||||
if(!pollStarted){
|
||||
pollStarted=true;
|
||||
pollServices();
|
||||
pollTimer=setInterval(pollServices,1500);
|
||||
}
|
||||
} else {
|
||||
document.getElementById('st').textContent='bee-web starting (status '+r.status+')...';
|
||||
setTimeout(probe,500);
|
||||
|
||||
@@ -604,6 +604,25 @@ func TestReadyIsOKWhenAuditPathIsUnset(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadingPageHasFallbackAutoOpen(t *testing.T) {
|
||||
handler := NewHandler(HandlerOptions{})
|
||||
rec := httptest.NewRecorder()
|
||||
handler.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/loading", nil))
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("status=%d body=%s", rec.Code, rec.Body.String())
|
||||
}
|
||||
body := rec.Body.String()
|
||||
for _, needle := range []string{
|
||||
`var AUTO_OPEN_DELAY_MS = 15000;`,
|
||||
`function scheduleFallbackOpen(){`,
|
||||
`Startup checks are taking too long — opening app...`,
|
||||
} {
|
||||
if !strings.Contains(body, needle) {
|
||||
t.Fatalf("loading page missing %q: %s", needle, body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuditPageRendersViewerFrameAndActions(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
path := filepath.Join(dir, "audit.json")
|
||||
|
||||
Reference in New Issue
Block a user