<%#
 Copyright 2008-2024 by sirpdboy <herboy2008@gmail.com>
 https://github.com/sirpdboy/luci-app-netdata
 Licensed to the public under the Apache License 2.0.
-%>
<%
	local running = luci.sys.exec("busybox ps -w | grep netdata | grep -v grep  >/dev/null && echo -ne '1' ")
%>
<%+header%>
<div class="cbi-map">

<% if running == "1" then %>
<iframe id="netdata" style="width: 100%; min-height: 780px; border: none; border-radius: .375rem;box-shadow: rgba(0, 0, 0, 0.75) 0px 0px 15px -5px;"></iframe>

</div>
<script type="text/javascript">
        document.getElementById("netdata").src = window.location.protocol + "//" + window.location.hostname + ":<%=luci.model.uci.cursor():get("netdata", "netdata", "port") %>";
 		document.getElementById("netdata").height = document.documentElement.clientHeight;
        window.onresize = function(){
            document.getElementById("netdata").height = document.documentElement.clientHeight;
        }
</script>
<% else %>
	<style>.running{text-align: center;} .running>h1{font-size: 25px; color: #333; margin: 1rem;} .running>p{ font-size: 1.2rem; color: #8391a2; margin: 1rem;}</style>
	<div class="running">
	<img src="data:image/svg+xml;base64, " height="100">
		<h1><font color="color:red"><%:The Netdata service is not running.%></font></h1>
		<p><%:Please enable the NetData service%></p>
    </div>
<% end -%>
</div>
<%+footer%>
