Juice/templates/index.html

159 lines
9.1 KiB
HTML
Raw Normal View History

2019-06-05 13:32:10 -04:00
<!DOCTYPE html>
2019-06-24 09:06:41 -04:00
<html lang="en">
2019-06-18 12:49:01 -04:00
<head>
<title>Juice</title>
<link rel="stylesheet" type="text/css" href="/static/juice.css">
2019-11-15 10:35:56 -05:00
<script>
const init_state = {{ init_state|tojson|safe }};
const ws_uri = "{{ url('ws') }}";
2019-11-15 10:35:56 -05:00
</script>
2019-06-18 12:49:01 -04:00
<script type="text/javascript" src="/static/juice.js"></script>
2019-06-19 10:15:08 -04:00
<script>window.onload = load;</script>
2019-07-02 08:47:34 -04:00
<meta name="viewport" content="width=device-width, initial-scale=0.8">
2019-06-24 09:06:41 -04:00
<meta name="description" content="An IOT hub.">
2019-07-02 08:47:34 -04:00
<meta name="theme-color" content="lightblue">
<link rel="manifest" href="/static/juice-manifest.webmanifest">
<link rel="icon" href="/static/orange-juice.svg">
<link rel="icon" href="/static/orange-juice-144p.png">
2019-06-18 12:49:01 -04:00
</head>
<body>
2019-06-20 07:48:11 -04:00
<header>
2019-07-02 08:47:34 -04:00
<div id="logo-line">
<object id="logo" aria-label="Juice: An IOT hub" data="/static/orange-juice.svg"></object>
<h1>Juice</h1>
<h3>An IOT hub</h3>
</div>
2019-06-20 07:48:11 -04:00
<nav>
2019-07-02 08:47:34 -04:00
<span class="font-awesome" title="Home"><a href="./">&#xe806;</a></span>
<span class="font-awesome" title="Add new device" onclick="new_device()">&#xe802;</span>
2019-06-20 07:48:11 -04:00
</nav>
</header>
2019-06-18 12:49:01 -04:00
<main>
<div id="devices">
2019-06-18 13:44:35 -04:00
{% for device in network %}
<div class="device {{ device.type }}" id="{{ device.id }}">
2019-06-20 14:51:00 -04:00
<div class="id editable"><span class="field_value">{{ device.id }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span><span class="delete font-awesome" onclick="delete_device(this.parentElement.parentElement)">&#xe804;</span><span class="lock font-awesome" onclick="lock_device(this.parentElement.parentElement)">&#xe803;</span>{% else %}<span class="unlock font-awesome" onclick="unlock_device(this.parentElement.parentElement)">&#xf13e;</span>{% endif %}</div>
2019-06-20 12:36:19 -04:00
<div class="description editable"><span class="field_value">{{ device.description }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span>{% endif %}</div>
<div class="location editable"><span class="field_value">{{ device.location }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span>{% endif %}</div>
2019-11-18 13:05:37 -05:00
{% if device.type == 'RelayDevice' %}
2019-06-20 12:36:19 -04:00
<div class="ip_address editable"><span class="field_value">{{ device.ip_address }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span>{% endif %}</div>
2019-11-18 13:05:37 -05:00
{% elif device.type == 'LightStrip' %}
<div class="mqtt_root editable"><span class="field_value">{{ device.ip_address }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span>{% endif %}</div>
2019-11-20 11:00:37 -05:00
<div class="light_controls">
<div class="state">
<span>State</span><br>
<select onchange="state_select(this)">
<option{% if device.state == 'solid' %} checked{% endif %} value="solid">Solid</option>
<option{% if device.state == 'rainbow' %} checked{% endif %} value="rainbow">Rainbow</option>
<option{% if device.state == 'america' %} checked{% endif %} value="america">America</option>
</select>
<div class="state_solid" style="display: {% if device.state == 'solid' %}block{% else %}hidden{% endif %}">
<input type="radio" id="state_solid_all_{{ device.id }}" name="state_solid_{{ device.id }}" value="all" onchange="state_solid_amount(this)" checked>
<label for="state_solid_all_{{ device.id }}">All</label><br>
<input type="radio" id="state_solid_single_{{ device.id }}" name="state_solid_{{ device.id }}" value="single" onchange="state_solid_amount(this)">
<label for="state_solid_single_{{ device.id }}">Single</label><br>
<label for="state_solid_all_color_{{ device.id }}">All:</label>
<input type="color" id="state_solid_all_color_{{ device.id }}">
</div>
<div class="state_rainbow" style="display: {% if device.state == 'rainbow' %}block{% else %}none{% endif %}">
<table>
<tr>
<td>Red</td>
<td>
<input type="number" id="state_rainbow_red_freq_{{ device.id }}" min="0" max="1" step="0.1">
<label for="state_rainbow_red_freq_{{ device.id }}">f</label>
</td>
<td>
<input type="number" id="state_rainbow_red_phase_{{ device.id }}" min="0" max="10" step="1">
<label for="state_rainbow_red_phase_{{ device.id }}">Φ</label>
</td>
</tr>
<tr>
<td>Green</td>
<td>
<input type="number" id="state_rainbow_green_freq_{{ device.id }}" min="0" max="1" step="0.1">
<label for="state_rainbow_green_freq_{{ device.id }}">f</label>
</td>
<td>
<input type="number" id="state_rainbow_green_phase_{{ device.id }}" min="0" max="10" step="1">
<label for="state_rainbow_green_phase_{{ device.id }}">Φ</label>
</td>
</tr>
<tr>
<td>Blue</td>
<td>
<input type="number" id="state_rainbow_blue_freq_{{ device.id }}" min="0" max="1" step="0.1">
<label for="state_rainbow_blue_freq_{{ device.id }}">f</label>
</td>
<td>
<input type="number" id="state_rainbow_blue_phase_{{ device.id }}" min="0" max="10" step="1">
<label for="state_rainbow_blue_phase_{{ device.id }}">Φ</label>
</td>
</tr>
<tr>
<td><label for="state_rainbow_center_{{ device.id }}">Center</label></td>
<td><input type="number" id="state_rainbow_center_{{ device.id }}" min="0" max="255" step="1"></td>
</tr>
<tr>
<td><label for="state_rainbow_width_{{ device.id }}">Width</label></td>
<td><input type="number" id="state_rainbow_width_{{ device.id }}" min="0" max="128" step="1"></td>
</tr>
</table>
</div>
<div class="state_america" style="display: {% if device.state == 'america' %}block{% else %}none{% endif %}">
<label for="state_america_stripe_{{ device.id }}">Stripe Length</label>
<input type="number" id="state_america_stripe_{{ device.id }}" min="1" max="256" step="1">
</div>
</div>
<div class="animation">
<span>Animation</span><br>
<select>
<option>Static</option>
<option>Rotate Left</option>
<option>Rotate Right</option>
</select>
</div>
</div>
2019-11-18 13:05:37 -05:00
{% endif %}
2019-06-18 12:49:01 -04:00
<div class="sub_devices">
{% for sub_device in device.sub_devices %}
2019-11-15 13:25:39 -05:00
<div class="sub_device {{ sub_device.type }} {{ sub_device.id }}">
{% if device.type == 'RelayDevice' %}
2019-11-15 13:25:39 -05:00
<div class="id">{{ sub_device.id }}</div>
2019-06-24 09:06:41 -04:00
<object class="outlet_image" aria-label="Outlet Image" data="/static/outlet.svg"></object>
2019-11-15 13:25:39 -05:00
<div class="description editable"><span class="field_value">{{ sub_device.description }}</span>{% if not device.locked %}<span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span>{% endif %}</div>
{% elif device.type == 'LightStrip' %}
<label class="NeoPixel_color" style="background-color: {{ sub_device.color|html_color }}">
2019-11-20 11:00:37 -05:00
<input class="NeoPixel_color_input" type="color" value="{{ sub_device.color|html_color }}" onchange="neopixel_state(this.parentElement.parentElement)" disabled>
2019-07-02 13:09:31 -04:00
</label>
{% endif %}
2019-07-02 13:09:31 -04:00
</div>
{% endfor %}
2019-06-18 12:49:01 -04:00
</div>
2019-06-16 18:22:47 -04:00
</div>
2019-06-18 12:49:01 -04:00
{% endfor %}
2019-06-05 13:32:10 -04:00
</div>
2019-06-18 12:49:01 -04:00
</main>
2019-06-20 08:38:56 -04:00
<template id="RelayDevice_template">
2019-06-19 10:15:08 -04:00
<div class="device RelayDevice" id="">
2019-06-20 14:51:00 -04:00
<div class="id editable"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span><span class="delete font-awesome" onclick="delete_device(this.parentElement.parentElement)">&#xe804;</span><span class="lock font-awesome" onclick="lock_device(this.parentElement.parentElement)">&#xe803;</span></div>
<div class="description editable"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
<div class="location editable"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
<div class="ip_address editable"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
2019-06-19 10:15:08 -04:00
<div class="sub_devices">
2019-06-24 09:06:41 -04:00
<div class="sub_device RelayOutlet OUT0">
<div class="id">OUT0</div>
2019-06-24 09:06:41 -04:00
<object class="outlet_image" alt="Outlet Image" data="/static/outlet.svg"></object>
2019-06-20 14:51:00 -04:00
<div class="description editable"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
2019-06-19 10:15:08 -04:00
</div>
2019-06-24 09:06:41 -04:00
<div class="sub_device RelayOutlet OUT2">
<div class="id">OUT2</div>
2019-06-24 09:06:41 -04:00
<object class="outlet_image" alt="Outlet Image" data="/static/outlet.svg"></object>
2019-06-20 14:51:00 -04:00
<div class="description editable"><span class="field_value"></span><span class="edit font-awesome" onclick="edit_field(this.parentElement)">&#xe800;</span></div>
2019-06-19 10:15:08 -04:00
</div>
</div>
</div>
</template>
2019-06-18 12:49:01 -04:00
</body>
2019-06-05 13:32:10 -04:00
</html>