Merge pull request #1696 from TDT-AG/pr/20180323-luci-app-mwan3-add-boxes-again

luci-app-mwan3: add boxes again and update css in luci-theme-material
This commit is contained in:
Hannu Nyman 2018-03-23 16:59:42 +02:00 committed by GitHub
commit 92408aaf17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 7 deletions

View file

@ -15,29 +15,35 @@ XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_
for ( var iface in status.interfaces) for ( var iface in status.interfaces)
{ {
var state = ''; var state = '';
var css = ''
switch (status.interfaces[iface].status) switch (status.interfaces[iface].status)
{ {
case 'online': case 'online':
state = '<%:Online (tracking active)%>'; state = '<%:Online (tracking active)%>';
break; css = 'success';
case 'notMonitored':
state = '<%:Online (tracking off)%>';
break; break;
case 'offline': case 'offline':
state = '<%:Offline%>'; state = '<%:Offline%>';
css = 'danger';
break; break;
default: default:
state = '<%:Disabled%>'; state = '<%:Disabled%>';
css = 'warning';
break; break;
} }
statusview += String.format(
'<div class="alert-message %s">',
css
);
statusview += String.format( statusview += String.format(
'<div><strong>Interface: </strong>%s</div>', '<div><strong>Interface: </strong>%s</div>',
iface iface
); );
statusview += String.format( statusview += String.format(
'<div><strong>Status: </strong>%s</div></br></br>', '<div><strong>Status: </strong>%s</div>',
state state
); );
statusview += '</div>'
} }
statusDiv.innerHTML = statusview; statusDiv.innerHTML = statusview;
} }
@ -49,6 +55,17 @@ XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_
); );
//]]></script> //]]></script>
<style type="text/css">
#mwan_status_text > div {
display: inline-block;
margin: 1rem;
padding: 1rem;
width: 10rem;
float: left;
line-height: 125%;
}
</style>
<fieldset id="interface_field" class="cbi-section"> <fieldset id="interface_field" class="cbi-section">
<legend><%:MWAN Interfaces%></legend> <legend><%:MWAN Interfaces%></legend>
<div id="mwan_status_text"> <div id="mwan_status_text">

View file

@ -253,9 +253,19 @@ header > .container > .brand {
vertical-align: text-bottom; vertical-align: text-bottom;
} }
.danger {
background-color: #FA8072 !important;
color: black;
}
.warning { .warning {
background-color: #FF7D60 !important; background-color: #F0E68C !important;
color: #FFF; color: black;
}
.success {
background-color: #90EE90 !important;
color: black;
} }
.errorbox, .errorbox,
@ -1546,4 +1556,4 @@ body.lang_pl.node-main-login .cbi-value-title {
.cbi-value-field .cbi-input-select { .cbi-value-field .cbi-input-select {
min-width: 25rem; min-width: 25rem;
} }
} }