mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-18 22:43:00 +08:00
62 lines
1.3 KiB
HTML
62 lines
1.3 KiB
HTML
<style>
|
|
.cbi-map {
|
|
padding-bottom: 30px;
|
|
}
|
|
|
|
.ipsec-server-status {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.ipsec-server-status::before {
|
|
width: .65em;
|
|
height: .65em;
|
|
margin-right: .55em;
|
|
border-radius: 50%;
|
|
background: #6b7280;
|
|
content: "";
|
|
}
|
|
|
|
.ipsec-server-status.is-running::before {
|
|
background: #198754;
|
|
}
|
|
|
|
.ipsec-server-status.is-stopped::before {
|
|
background: #c0392b;
|
|
}
|
|
</style>
|
|
|
|
<% include("cbi/map") %>
|
|
|
|
<script type="text/javascript">//<![CDATA[
|
|
(function() {
|
|
var status = document.getElementsByClassName('ipsec-server-status')[0];
|
|
if (!status) {
|
|
return;
|
|
}
|
|
|
|
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "vpn", "ipsec-server", "status")%>', null,
|
|
function(x, result) {
|
|
var className;
|
|
var label;
|
|
|
|
if (!result || typeof result.ipsec_status !== 'boolean') {
|
|
className = 'ipsec-server-status is-unknown';
|
|
label = '<%=translate("Status unavailable")%>';
|
|
}
|
|
else {
|
|
className = 'ipsec-server-status ' + (result.ipsec_status ? 'is-running' : 'is-stopped');
|
|
label = result.ipsec_status ? '<%=translate("RUNNING")%>' : '<%=translate("NOT RUNNING")%>';
|
|
}
|
|
|
|
if (status.className !== className) {
|
|
status.className = className;
|
|
status.textContent = label;
|
|
}
|
|
}
|
|
);
|
|
})();
|
|
//]]>
|
|
</script>
|