<commit_before>{% extends 'chariot/base.html' %}

{% load crispy_forms_tags %}
{% load humanize %}

{% block scripts %}
	<script src="/scripts/jquery.min.js"></script>
{% endblock %}

{% block title %}{{ deployment.client_name }} Deployment{% endblock %}

{% block content %}
<div class="mdl-grid">
	<div class="mdl-cell mdl-cell--6-col mdl-cell--1-offset-tablet">
		{% crispy form %}
	</div>

	<div class="mdl-cell mdl-cell--6-col mdl-cell--1-offset-tablet">
		<div class="mdl-typography--text-right" style="margin-bottom: 16px">
			{% if deployment.status.0 == 2 %}
			<form style="display: inline" action="{% url 'deployments:start' deployment.id %}" method="post">
				{% csrf_token %}
				<input type="hidden" name="deployment" value="{{ deployment.id }}"/>
				<button type="submit" class="mdl-button mdl-js-button mdl-button--colored">Start Deployment</button>
			</form>
			{% endif %}
			{% if deployment.status.0 == 3 %}
			<form style="display: inline" action="{% url 'deployments:end' deployment.id %}" method="post">
				{% csrf_token %}
				<input type="hidden" name="deployment" value="{{ deployment.id }}"/>
				<button type="submit" class="mdl-button mdl-js-button mdl-button--colored">End Deployment</button>
			</form>
			{% endif %}
			{% if deployment.status.0 != 2 and deployment.status.0 != 1 %}
			<a class="mdl-button mdl-js-button mdl-button--colored" href="{% url 'graphs:deployment' deployment.id %}">View
				Data</a>
			{% endif %}
		</div>

		{% if deployment.hub %}
			<div class="device-item">
				<i class="material-icons">device_hub</i>
				<div>
					{% if 'hub' in deployment.hub.name|lower %}
					<div>Hub</div>
					{% else %}
					<div>Hub {{ deployment.hub.name }}</div>
					{% endif %}
					<div class="mdl-card__subtitle-text">{{ deployment.hub.id }}</div>
				</div>
				<div style="flex: 1"></div>
				<div class="mdl-typography--caption-force-preferred-font-color-contrast">
					{{ deployment.hub.connection_status.1 }}
					{% if deployment.hub.connection_status.2 %}
					for {{ deployment.hub.connection_status.2 }}
					{% endif %}
				</div>
			</div>
		{% endif %}

		{% for deployment_sensor in deployment.sensors.all %}
		{% with deployment_sensor.sensor as sensor %}
			<a class="device-item" href="{% url 'deployments:sensor' deployment.id sensor.id %}">
				<i class="material-icons">router</i>
				<div>{{ deployment_sensor.location|default:deployment_sensor.sensor.name }}
					{% for reading in deployment_sensor.latest_readings %}
						{% if not reading.channel.hidden %}
							<div class="mdl-typography--caption-force-preferred-font-color-contrast">
								{% if 'value' in reading %}
									{{ reading.channel.name }}: {{ reading.value|floatformat:2 }}{{ reading.channel.units }}
								{% else %}
									{{ reading.channel.name }}: No data
								{% endif %}
							</div>
							{% if reading.channel == deployment_sensor.sensor.cost_channel %}
								<div class="mdl-typography--caption-force-preferred-font-color-contrast">
									{{ reading.channel.name }} Cost: {{ deployment_sensor.cost }}p
								</div>
							{% endif %}
						{% endif %}
					{% endfor %}
				</div>
				<div style="flex: 1"></div>
				<div class="mdl-typography--caption-force-preferred-font-color-contrast">
					<span>
						{% if deployment_sensor.latest_reading %}
							{{ deployment_sensor.latest_reading.time|naturaltime }}<commit_msg>Float formatting<commit_after>{% extends 'chariot/base.html' %}

{% load crispy_forms_tags %}
{% load humanize %}

{% block scripts %}
	<script src="/scripts/jquery.min.js"></script>
{% endblock %}

{% block title %}{{ deployment.client_name }} Deployment{% endblock %}

{% block content %}
<div class="mdl-grid">
	<div class="mdl-cell mdl-cell--6-col mdl-cell--1-offset-tablet">
		{% crispy form %}
	</div>

	<div class="mdl-cell mdl-cell--6-col mdl-cell--1-offset-tablet">
		<div class="mdl-typography--text-right" style="margin-bottom: 16px">
			{% if deployment.status.0 == 2 %}
			<form style="display: inline" action="{% url 'deployments:start' deployment.id %}" method="post">
				{% csrf_token %}
				<input type="hidden" name="deployment" value="{{ deployment.id }}"/>
				<button type="submit" class="mdl-button mdl-js-button mdl-button--colored">Start Deployment</button>
			</form>
			{% endif %}
			{% if deployment.status.0 == 3 %}
			<form style="display: inline" action="{% url 'deployments:end' deployment.id %}" method="post">
				{% csrf_token %}
				<input type="hidden" name="deployment" value="{{ deployment.id }}"/>
				<button type="submit" class="mdl-button mdl-js-button mdl-button--colored">End Deployment</button>
			</form>
			{% endif %}
			{% if deployment.status.0 != 2 and deployment.status.0 != 1 %}
			<a class="mdl-button mdl-js-button mdl-button--colored" href="{% url 'graphs:deployment' deployment.id %}">View
				Data</a>
			{% endif %}
		</div>

		{% if deployment.hub %}
			<div class="device-item">
				<i class="material-icons">device_hub</i>
				<div>
					{% if 'hub' in deployment.hub.name|lower %}
					<div>Hub</div>
					{% else %}
					<div>Hub {{ deployment.hub.name }}</div>
					{% endif %}
					<div class="mdl-card__subtitle-text">{{ deployment.hub.id }}</div>
				</div>
				<div style="flex: 1"></div>
				<div class="mdl-typography--caption-force-preferred-font-color-contrast">
					{{ deployment.hub.connection_status.1 }}
					{% if deployment.hub.connection_status.2 %}
					for {{ deployment.hub.connection_status.2 }}
					{% endif %}
				</div>
			</div>
		{% endif %}

		{% for deployment_sensor in deployment.sensors.all %}
		{% with deployment_sensor.sensor as sensor %}
			<a class="device-item" href="{% url 'deployments:sensor' deployment.id sensor.id %}">
				<i class="material-icons">router</i>
				<div>{{ deployment_sensor.location|default:deployment_sensor.sensor.name }}
					{% for reading in deployment_sensor.latest_readings %}
						{% if not reading.channel.hidden %}
							<div class="mdl-typography--caption-force-preferred-font-color-contrast">
								{% if 'value' in reading %}
									{{ reading.channel.name }}: {{ reading.value|floatformat }}{{ reading.channel.units }}
								{% else %}
									{{ reading.channel.name }}: No data
								{% endif %}
							</div>
							{% if reading.channel == deployment_sensor.sensor.cost_channel %}
								<div class="mdl-typography--caption-force-preferred-font-color-contrast">
									{{ reading.channel.name }} Cost: {{ deployment_sensor.cost }}p
								</div>
							{% endif %}
						{% endif %}
					{% endfor %}
				</div>
				<div style="flex: 1"></div>
				<div class="mdl-typography--caption-force-preferred-font-color-contrast">
					<span>
						{% if deployment_sensor.latest_reading %}
							{{ deployment_sensor.latest_reading.time|naturaltime }}
{'fraction_non_alphanumeric': 0.18765613519470978, 'fraction_numerical': 0.005731080088170463, 'mean_word_length': 3.280503144654088, 'pattern_counts': {'":': 0, '<': 101, '<?xml version=': 0, '>': 101, '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': '4441064', 'n_tokens_mistral': 2869, 'n_tokens_neox': 2163, 'n_words': 409}