<commit_before><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Power monitor</title>

	<link rel="stylesheet" href="/bower/bootstrap/dist/css/bootstrap.min.css">
	<link rel="stylesheet/less" href="/less/style.less" type="text/css" />
</head>
<body>
	<div class="container">
		<div class="page-header">
			<h1>UPS Monitor <small id="model"></small></h1>
		</div>

		<div class="row snapshots">
			<div class="col-sm-3 snapshot">
				<div id="battery-remaining"></div>
			</div>

			<div class="col-sm-3 snapshot">
				<div id="load"></div>
			</div>

			<div class="col-sm-3 snapshot">
				<div id="remaining-runtime"></div>
			</div>

			<div class="col-sm-3 snapshot">
				<div id="utility-voltage"></div>
			</div>
		</div>

		<div class="row">
			<div class="col-lg-6">
				<div id="battery-remaining-chart"></div>
			</div>

			<div class="col-lg-6">
				<div id="load-chart"></div>
			</div>
		</div>

		<div class="row">
			<div class="col-lg-6">
				<div id="remaining-runtime-chart"></div>
			</div>
		</div>
	</div>

	<script type="text/javascript" src="/bower/underscore/underscore-min.js"></script>
	<script type="text/javascript" src="/bower/jquery/dist/jquery.min.js"></script>
	<script type="text/javascript" src="/bower/highcharts/highcharts.js"></script>
	<script type="text/javascript" src="/bower/bootstrap/dist/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="/bower/moment/moment.js"></script>
	<script type="text/javascript" src="/bower/less/dist/less.min.js"></script>
	<script type="text/javascript">
		var Interval = {{ .Interval }};

		$(document).ready(function()
		{
			window.setInterval(update, 30 * 1000);
			update();
		});

		function update()
		{
			$.get('/api/snapshots', function(snapshots)
			{
				if (snapshots === null)
				{
					return;
				}

				_.each(snapshots, function(snapshot, i)
				{
					snapshots[i].duration = +moment() - +moment(snapshot.timestamp);
				});

				updateModel(snapshots[0]);

				updateBatteryRemaining(snapshots[0]);
				updateLoad(snapshots[0]);
				updateRemainingRuntime(snapshots[0]);
				updateUtilityVoltage(snapshots[0]);

				drawBatteryRemainingChart(snapshots);
				drawLoadChart(snapshots);
				drawRemainingRuntimeChart(snapshots);
			}, 'json');
		}

		function humanizeDuration(d)
		{
			var s = moment.duration(-d).humanize(true);
			s = s[0].toUpperCase() + s.substr(1);
			return s;
		}<commit_msg>Adding a filter on the returned snapshots so that we're not trying to render 15000+ points on graphs that aren't nearly big enough to show it<commit_after><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Power monitor</title>

	<link rel="stylesheet" href="/bower/bootstrap/dist/css/bootstrap.min.css">
	<link rel="stylesheet/less" href="/less/style.less" type="text/css" />
</head>
<body>
	<div class="container">
		<div class="page-header">
			<h1>UPS Monitor <small id="model"></small></h1>
		</div>

		<div class="row snapshots">
			<div class="col-sm-3 snapshot">
				<div id="battery-remaining"></div>
			</div>

			<div class="col-sm-3 snapshot">
				<div id="load"></div>
			</div>

			<div class="col-sm-3 snapshot">
				<div id="remaining-runtime"></div>
			</div>

			<div class="col-sm-3 snapshot">
				<div id="utility-voltage"></div>
			</div>
		</div>

		<div class="row">
			<div class="col-lg-6">
				<div id="battery-remaining-chart"></div>
			</div>

			<div class="col-lg-6">
				<div id="load-chart"></div>
			</div>
		</div>

		<div class="row">
			<div class="col-lg-6">
				<div id="remaining-runtime-chart"></div>
			</div>
		</div>
	</div>

	<script type="text/javascript" src="/bower/underscore/underscore-min.js"></script>
	<script type="text/javascript" src="/bower/jquery/dist/jquery.min.js"></script>
	<script type="text/javascript" src="/bower/highcharts/highcharts.js"></script>
	<script type="text/javascript" src="/bower/bootstrap/dist/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="/bower/moment/moment.js"></script>
	<script type="text/javascript" src="/bower/less/dist/less.min.js"></script>
	<script type="text/javascript">
		var Interval = {{ .Interval }};

		$(document).ready(function()
		{
			window.setInterval(update, 30 * 1000);
			update();
		});

		function update()
		{
			$.get('/api/snapshots', function(snapshots)
			{
				if (snapshots === null)
				{
					return;
				}

				_.each(snapshots, function(snapshot, i)
				{
					snapshots[i].duration = +moment() - +moment(snapshot.timestamp);
				});

				snapshots = _.filter(snapshots, function(snapshot)
				{
					var res = (
						snapshot.duration < 30 * 60 * 1000 ||
						+moment(snapshot.timestamp) % (10 * 60 * 1000) < Interval
					);

					return res;
				});

				updateModel(snapshots[0]);

				updateBatteryRemaining(snapshots[0]);
				updateLoad(snapshots[0]);
				updateRemainingRuntime(snapshots[0]);
				updateUtilityVoltage(snapshots[0]);

				drawBatteryRemainingChart(snapshots);
				drawLoadChart(snapshots);
				drawRemainingRuntimeChart(snapshots);
			}, 'json');
		}

		function humanizeDuration(d)
		{
			var s = moment.duration(-d).humanize(true);
			s = s[0].toUpperCase() + s.substr(1);
			return s;
		}
{'fraction_non_alphanumeric': 0.19747206448067411, 'fraction_numerical': 0.01263967759662942, 'mean_word_length': 3.772727272727273, 'pattern_counts': {'":': 0, '<': 139, '<?xml version=': 0, '>': 137, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1335302', 'n_tokens_mistral': 2283, 'n_tokens_neox': 1905, 'n_words': 331}