Add a 'welcome' panel to the control panel and make it the default page instead of the status checks which take too long to load

Fixes #2014
This commit is contained in:
Joshua Tauberer 2021-08-22 16:38:49 -04:00
parent e884c4774f
commit 26932ecb10
3 changed files with 23 additions and 1 deletions

View File

@ -118,6 +118,10 @@
</div> </div>
<div class="container"> <div class="container">
<div id="panel_welcome" class="admin_panel">
{% include "welcome.html" %}
</div>
<div id="panel_system_status" class="admin_panel"> <div id="panel_system_status" class="admin_panel">
{% include "system-status.html" %} {% include "system-status.html" %}
</div> </div>
@ -409,6 +413,8 @@ $(function() {
// Recall what the user was last looking at. // Recall what the user was last looking at.
if (typeof localStorage != 'undefined' && localStorage.getItem("miab-cp-lastpanel")) { if (typeof localStorage != 'undefined' && localStorage.getItem("miab-cp-lastpanel")) {
show_panel(localStorage.getItem("miab-cp-lastpanel")); show_panel(localStorage.getItem("miab-cp-lastpanel"));
} else if (api_credentials[0] != "") {
show_panel('welcome');
} else { } else {
show_panel('login'); show_panel('login');
} }

View File

@ -163,7 +163,7 @@ function do_login() {
// Open the next panel the user wants to go to. Do this after the XHR response // Open the next panel the user wants to go to. Do this after the XHR response
// is over so that we don't start a new XHR request while this one is finishing, // is over so that we don't start a new XHR request while this one is finishing,
// which confuses the loading indicator. // which confuses the loading indicator.
setTimeout(function() { show_panel(!switch_back_to_panel || switch_back_to_panel == "login" ? 'system_status' : switch_back_to_panel) }, 300); setTimeout(function() { show_panel(!switch_back_to_panel || switch_back_to_panel == "login" ? 'welcome' : switch_back_to_panel) }, 300);
} }
}, },
undefined, undefined,

View File

@ -0,0 +1,16 @@
<style>
.title {
margin: 1em;
text-align: center;
}
.subtitle {
margin: 2em;
text-align: center;
}
</style>
<h1 class="title">{{hostname}}</h1>
<p class="subtitle">Welcome to your Mail-in-a-Box control panel.</p>