Fix status check colors, add SMTP relay stub

This commit is contained in:
David Duque 2020-04-13 01:16:23 +01:00
parent 0d17caccfe
commit 974c9bba61
No known key found for this signature in database
GPG Key ID: 2F327738A3C0AE3A
4 changed files with 506 additions and 484 deletions

View File

@ -12,6 +12,9 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.html]
indent_style = tab
[Makefile]
indent_style = tab
indent_size = 4

View File

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -20,7 +21,10 @@
margin-bottom: 1.25em;
}
h1, h2, h3, h4 {
h1,
h2,
h3,
h4 {
font-family: sans-serif;
font-weight: bold;
}
@ -36,6 +40,7 @@
margin-bottom: 13px;
margin-top: 30px;
}
.panel-heading h3 {
border: none;
padding: 0;
@ -47,6 +52,7 @@
margin-bottom: 13px;
margin-top: 18px;
}
h4:first-child {
margin-top: 6px;
}
@ -64,8 +70,9 @@
}
</style>
<link rel="stylesheet" href="/admin/assets/bootstrap/css/bootstrap-theme.min.css">
</head>
<body>
</head>
<body>
<!--[if lt IE 8]><p>Internet Explorer version 8 or any modern web browser is required to use this website, sorry.<![endif]-->
<!--[if gt IE 7]><!-->
@ -73,7 +80,8 @@
<div class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -89,6 +97,7 @@
<li><a href="#system_status" onclick="return show_panel(this);">Status Checks</a></li>
<li><a href="#tls" onclick="return show_panel(this);">TLS (SSL) Certificates</a></li>
<li><a href="#system_backup" onclick="return show_panel(this);">Backup Status</a></li>
<li><a href="#smtp_relays" onclick="return show_panel(this);">SMTP Relays</a></li>
<li class="divider"></li>
<li class="dropdown-header">Advanced Pages</li>
<li><a href="#custom_dns" onclick="return show_panel(this);">Custom DNS</a></li>
@ -110,7 +119,8 @@
<ul class="nav navbar-nav navbar-right">
<li><a href="#" onclick="do_logout(); return false;" style="color: white">Log out</a></li>
</ul>
</div><!--/.navbar-collapse -->
</div>
<!--/.navbar-collapse -->
</div>
</div>
@ -166,14 +176,16 @@
</footer>
</div> <!-- /container -->
<div id="ajax_loading_indicator" style="display: none; position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 100000; text-align: center; background-color: rgba(255,255,255,.75)">
<div id="ajax_loading_indicator"
style="display: none; position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 100000; text-align: center; background-color: rgba(255,255,255,.75)">
<div style="margin: 20% auto">
<div><span class="fa fa-spinner fa-pulse"></span></div>
<div>Loading...</div>
</div>
</div>
<div id="global_modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="errorModalTitle" aria-hidden="true">
<div id="global_modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="errorModalTitle"
aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
@ -195,22 +207,22 @@
<script src="/admin/assets/bootstrap/js/bootstrap.min.js"></script>
<script>
var global_modal_state = null;
var global_modal_funcs = null;
var global_modal_state = null;
var global_modal_funcs = null;
$(function() {
$(function () {
$('#global_modal').on('shown.bs.modal', function (e) {
// set focus to first input in the global modal's body
var input = $('#global_modal .modal-body input');
if (input.length > 0) $(input[0]).focus();
})
$('#global_modal .btn-danger').click(function() {
$('#global_modal .btn-danger').click(function () {
// Don't take action now. Wait for the modal to be totally hidden
// so that we don't attempt to show another modal while this one
// is closing.
global_modal_state = 0; // OK
})
$('#global_modal .btn-default').click(function() {
$('#global_modal .btn-default').click(function () {
global_modal_state = 1; // Cancel
})
$('#global_modal').on('hidden.bs.modal', function (e) {
@ -219,9 +231,9 @@ $(function() {
if (global_modal_funcs && global_modal_funcs[global_modal_state])
global_modal_funcs[global_modal_state]();
})
})
})
function show_modal_error(title, message, callback) {
function show_modal_error(title, message, callback) {
$('#global_modal h4').text(title);
$('#global_modal .modal-body').html("<p/>");
if (typeof question == 'string') {
@ -237,9 +249,9 @@ function show_modal_error(title, message, callback) {
global_modal_state = null;
$('#global_modal').modal({});
return false; // handy when called from onclick
}
}
function show_modal_confirm(title, question, verb, yes_callback, cancel_callback) {
function show_modal_confirm(title, question, verb, yes_callback, cancel_callback) {
$('#global_modal h4').text(title);
if (typeof question == 'string') {
$('#global_modal .modal-dialog').addClass("modal-sm");
@ -260,10 +272,10 @@ function show_modal_confirm(title, question, verb, yes_callback, cancel_callback
global_modal_state = null;
$('#global_modal').modal({});
return false; // handy when called from onclick
}
}
var ajax_num_executing_requests = 0;
function ajax_with_indicator(options) {
var ajax_num_executing_requests = 0;
function ajax_with_indicator(options) {
setTimeout("if (ajax_num_executing_requests > 0) $('#ajax_loading_indicator').fadeIn()", 100);
function hide_loading_indicator() {
ajax_num_executing_requests--;
@ -272,14 +284,14 @@ function ajax_with_indicator(options) {
}
var old_success = options.success;
var old_error = options.error;
options.success = function(data) {
options.success = function (data) {
hide_loading_indicator();
if (data.status == "error")
show_modal_error("Error", data.message);
else if (old_success)
old_success(data);
};
options.error = function(jqxhr) {
options.error = function (jqxhr) {
hide_loading_indicator();
if (!old_error)
show_modal_error("Error", "Something went wrong, sorry.")
@ -289,10 +301,10 @@ function ajax_with_indicator(options) {
ajax_num_executing_requests++;
$.ajax(options);
return false; // handy when called from onclick
}
}
var api_credentials = ["", ""];
function api(url, method, data, callback, callback_error) {
var api_credentials = ["", ""];
function api(url, method, data, callback, callback_error) {
// from http://www.webtoolkit.info/javascript-base64.html
function base64encode(input) {
_keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
@ -335,7 +347,7 @@ function api(url, method, data, callback, callback_error) {
processData: typeof data != "string",
mimeType: typeof data == "string" ? "text/plain; charset=ascii" : null,
beforeSend: function(xhr) {
beforeSend: function (xhr) {
// We don't store user credentials in a cookie to avoid the hassle of CSRF
// attacks. The Authorization header only gets set in our AJAX calls triggered
// by user actions.
@ -346,7 +358,7 @@ function api(url, method, data, callback, callback_error) {
success: callback,
error: callback_error || default_error,
statusCode: {
403: function(xhr) {
403: function (xhr) {
// Credentials are no longer valid. Try to login again.
var p = current_panel;
show_panel('login');
@ -354,11 +366,11 @@ function api(url, method, data, callback, callback_error) {
}
}
})
}
}
var current_panel = null;
var switch_back_to_panel = null;
function show_panel(panelid) {
var current_panel = null;
var switch_back_to_panel = null;
function show_panel(panelid) {
if (panelid.getAttribute)
// we might be passed an HTMLElement <a>.
panelid = panelid.getAttribute('href').substring(1);
@ -374,9 +386,9 @@ function show_panel(panelid) {
switch_back_to_panel = null;
return false; // when called from onclick, cancel navigation
}
}
$(function() {
$(function () {
// Recall saved user credentials.
if (typeof sessionStorage != 'undefined' && sessionStorage.getItem("miab-cp-credentials"))
api_credentials = sessionStorage.getItem("miab-cp-credentials").split(":");
@ -389,8 +401,9 @@ $(function() {
} else {
show_panel('login');
}
})
})
</script>
</body>
</body>
</html>

View File

@ -0,0 +1,6 @@
<style>
</style>
<h2>SMTP Relays</h2>
<p>Coming Soon™</p>

View File

@ -13,15 +13,15 @@
}
#system-checks .status-error td {
color: rgb(180, 0, 0);
color: rgb(140, 0, 0);
}
#system-checks .status-warning td {
color: rgb(180, 180, 0);
color: rgb(170, 120, 0);
}
#system-checks .status-ok td {
color: rgb(0, 180, 0);
color: rgb(0, 140, 0);
}
#system-checks div.extra {