<?php

$algo = user()->getState('vexon-algo');

JavascriptFile("/extensions/jqplot/jquery.jqplot.js");
JavascriptFile("/extensions/jqplot/plugins/jqplot.dateAxisRenderer.js");
JavascriptFile("/extensions/jqplot/plugins/jqplot.barRenderer.js");
JavascriptFile("/extensions/jqplot/plugins/jqplot.highlighter.js");
JavascriptFile('/vexon/ui/js/auto_refresh.js');

echo <<<end

<div id="resume_update_button" class="vexon-refresh-paused" onclick="auto_page_resume();" style="display: none;">
	Auto refresh is paused. Click to resume.
</div>

<section class="vexon-page-title">
	<div>
		<p class="vexon-kicker">Workers</p>
		<h1>Miner Versions</h1>
	</div>
	<p>Monitor connected miners, firmware versions, accepted rate, and reject signals.</p>
</section>

<section class="vexon-dashboard-grid">
	<div class="vexon-dashboard-main">
		<div id="miners_results" class="vexon-live-box"><div class="vexon-loading">Loading miner data...</div></div>
	</div>
	<aside class="vexon-side-panel">
		<div id="pool_current_results"><div class="vexon-loading">Loading pool status...</div></div>
	</aside>
</section>

<script>
function page_refresh()
{
	miners_refresh();
	pool_current_refresh();
}

function select_algo(algo)
{
	window.location.href = '/site/algo?algo='+algo+'&r=/site/miners';
}

function pool_current_ready(data) { $('#pool_current_results').html(data); }
function pool_current_refresh() { $.get("/site/current_results", '', pool_current_ready); }

function miners_ready(data) { $('#miners_results').html(data); }
function miners_refresh() { $.get("/site/miners_results", '', miners_ready); }
</script>
end;
