diff options
Diffstat (limited to 'localwebsite/templates-web')
-rw-r--r-- | localwebsite/templates-web/404.twig | 1 | ||||
-rw-r--r-- | localwebsite/templates-web/footer.twig | 8 | ||||
-rw-r--r-- | localwebsite/templates-web/header.twig | 10 | ||||
-rw-r--r-- | localwebsite/templates-web/index.twig | 21 | ||||
-rw-r--r-- | localwebsite/templates-web/inverter_page.twig | 15 | ||||
-rw-r--r-- | localwebsite/templates-web/modem_data.twig | 12 | ||||
-rw-r--r-- | localwebsite/templates-web/modem_status_page.twig | 19 | ||||
-rw-r--r-- | localwebsite/templates-web/pump.twig | 18 | ||||
-rw-r--r-- | localwebsite/templates-web/routing_dhcp_page.twig | 11 | ||||
-rw-r--r-- | localwebsite/templates-web/routing_header.twig | 24 | ||||
-rw-r--r-- | localwebsite/templates-web/routing_ipsets_page.twig | 29 | ||||
-rw-r--r-- | localwebsite/templates-web/routing_page.twig | 17 | ||||
-rw-r--r-- | localwebsite/templates-web/sensors.twig | 12 | ||||
-rw-r--r-- | localwebsite/templates-web/signal_level.twig | 5 | ||||
-rw-r--r-- | localwebsite/templates-web/sms_page.twig | 27 | ||||
-rw-r--r-- | localwebsite/templates-web/spinner.twig | 14 |
16 files changed, 243 insertions, 0 deletions
diff --git a/localwebsite/templates-web/404.twig b/localwebsite/templates-web/404.twig new file mode 100644 index 0000000..e28f5c5 --- /dev/null +++ b/localwebsite/templates-web/404.twig @@ -0,0 +1 @@ +Page Not Found
\ No newline at end of file diff --git a/localwebsite/templates-web/footer.twig b/localwebsite/templates-web/footer.twig new file mode 100644 index 0000000..8739f80 --- /dev/null +++ b/localwebsite/templates-web/footer.twig @@ -0,0 +1,8 @@ +{% if js %} + <script>{{ js|raw }}</script> +{% endif %} + +</div> +</body> +</html> +<!-- generated in {{ exec_time}} -->
\ No newline at end of file diff --git a/localwebsite/templates-web/header.twig b/localwebsite/templates-web/header.twig new file mode 100644 index 0000000..03560b0 --- /dev/null +++ b/localwebsite/templates-web/header.twig @@ -0,0 +1,10 @@ +<!doctype html> +<html> +<head> + <title>{{ title }}</title> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> + {{ static|raw }} +</head> +<body> +<div class="container py-3">
\ No newline at end of file diff --git a/localwebsite/templates-web/index.twig b/localwebsite/templates-web/index.twig new file mode 100644 index 0000000..d293cfd --- /dev/null +++ b/localwebsite/templates-web/index.twig @@ -0,0 +1,21 @@ +<div class="container py-4"> + <nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item active" aria-current="page">Главная</li> + </ol> + </nav> + + <h6>Интернет</h6> + <ul class="list-group list-group-flush"> + <li class="list-group-item"><a href="/modem/status/">Состояние</a></li> + <li class="list-group-item"><a href="/routing/">Маршрутизация</a></li> + <li class="list-group-item"><a href="/modem/sms/">SMS-сообщения</a></li> + </ul> + + <h6 class="mt-4">Другое</h6> + <ul class="list-group list-group-flush"> + <li class="list-group-item"><a href="/inverter/">Инвертор</a></li> + <li class="list-group-item"><a href="/pump/">Насос</a></li> + <li class="list-group-item"><a href="/sensors/">Датчики</a></li> + </ul> +</div>
\ No newline at end of file diff --git a/localwebsite/templates-web/inverter_page.twig b/localwebsite/templates-web/inverter_page.twig new file mode 100644 index 0000000..2b0af90 --- /dev/null +++ b/localwebsite/templates-web/inverter_page.twig @@ -0,0 +1,15 @@ +<nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item"><a href="/">Главная</a></li> + <li class="breadcrumb-item active" aria-current="page">Инвертор</li> + </ol> +</nav> + +<h6 class="text-primary">Статус</h6> +<div id="inverter_status"> + {{ html|raw }} +</div> + +{% js %} +Inverter.poll(); +{% endjs %}
\ No newline at end of file diff --git a/localwebsite/templates-web/modem_data.twig b/localwebsite/templates-web/modem_data.twig new file mode 100644 index 0000000..55440ea --- /dev/null +++ b/localwebsite/templates-web/modem_data.twig @@ -0,0 +1,12 @@ +{% if not loading %} +<span class="text-secondary">Сигнал:</span> {% include 'signal_level.twig' with {'level': modem_data.level} %}<br> +<span class="text-secondary">Тип сети:</span> <b>{{ modem_data.type }}</b><br> +<span class="text-secondary">RSSI:</span> {{ modem_data.rssi }}<br/> +{% if modem_data.sinr %} + <span class="text-secondary">SINR:</span> {{ modem_data.sinr }}<br/> +{% endif %} +<span class="text-secondary">Время соединения:</span> {{ modem_data.connected_time }}<br> +<span class="text-secondary">Принято/передано:</span> {{ modem_data.downloaded }} / {{ modem_data.uploaded }} +{% else %} +{% include 'spinner.twig' %} +{% endif %}
\ No newline at end of file diff --git a/localwebsite/templates-web/modem_status_page.twig b/localwebsite/templates-web/modem_status_page.twig new file mode 100644 index 0000000..1aa5cf8 --- /dev/null +++ b/localwebsite/templates-web/modem_status_page.twig @@ -0,0 +1,19 @@ +<nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item"><a href="/">Главная</a></li> + <li class="breadcrumb-item active" aria-current="page">Модемы</li> + </ol> +</nav> + +{% for modem_key, modem in modems %} + <h6 class="text-primary{% if not loop.first %} mt-4{% endif %}">{{ modem.label }}</h6> + <div id="modem_data_{{ modem_key }}"> + {% include 'modem_data.twig' with { + loading: true + } %} + </div> +{% endfor %} + +{% js %} +ModemStatus.init({{ js_modems|json_encode|raw }}); +{% endjs %} diff --git a/localwebsite/templates-web/pump.twig b/localwebsite/templates-web/pump.twig new file mode 100644 index 0000000..4a8cad5 --- /dev/null +++ b/localwebsite/templates-web/pump.twig @@ -0,0 +1,18 @@ +<nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item"><a href="/">Главная</a></li> + <li class="breadcrumb-item active" aria-current="page">Насос</li> + </ol> +</nav> + +<form action="/pump/" method="get"> + <input type="hidden" name="set" value="{{ status == 'on' ? 'off' : 'on' }}" /> + Сейчас насос + {% if status == 'on' %} + <span class="text-success"><b>включен</b></span>.<br><br> + <button type="submit" class="btn btn-primary">Выключить</button> + {% else %} + <span class="text-danger"><b>выключен</b></span>.<br><br> + <button type="submit" class="btn btn-primary">Включить</button> + {% endif %} +</form>
\ No newline at end of file diff --git a/localwebsite/templates-web/routing_dhcp_page.twig b/localwebsite/templates-web/routing_dhcp_page.twig new file mode 100644 index 0000000..12b837e --- /dev/null +++ b/localwebsite/templates-web/routing_dhcp_page.twig @@ -0,0 +1,11 @@ +{% include 'routing_header.twig' with { + selected_tab: 'dhcp' +} %} + +{% for lease in leases %} + <div class="mt-3"> + <b>{{ lease.hostname }}</b> <span class="text-secondary">(exp: {{ lease.time_s }})</span><br/> + {{ lease.ip }}<br> + <span class="text-secondary">{{ lease.mac }}</span> + </div> +{% endfor %}
\ No newline at end of file diff --git a/localwebsite/templates-web/routing_header.twig b/localwebsite/templates-web/routing_header.twig new file mode 100644 index 0000000..f7322f9 --- /dev/null +++ b/localwebsite/templates-web/routing_header.twig @@ -0,0 +1,24 @@ +<nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item"><a href="/">Главная</a></li> + <li class="breadcrumb-item active" aria-current="page">Маршрутизация</li> + </ol> +</nav> + +{% set routing_tabs = [ + {tab: 'smallhome', url: '/routing/', label: 'Маленький дом'}, + {tab: 'ipsets', url: '/routing/ipsets/', label: 'Правила'}, + {tab: 'dhcp', url: '/routing/dhcp/', label: 'DHCP'} +] %} + +<nav> + <div class="nav nav-tabs" id="nav-tab"> + {% for tab in routing_tabs %} + <a href="{{ tab.url }}" class="text-decoration-none"><button class="nav-link{% if tab.tab == selected_tab %} active{% endif %}" type="button">{{ tab.label }}</button></a> + {% endfor %} + </div> +</nav> + +{% if error %} + <div class="mt-4 alert alert-danger"><b>Ошибка:</b> {{ error }}</div> +{% endif %} diff --git a/localwebsite/templates-web/routing_ipsets_page.twig b/localwebsite/templates-web/routing_ipsets_page.twig new file mode 100644 index 0000000..5996e68 --- /dev/null +++ b/localwebsite/templates-web/routing_ipsets_page.twig @@ -0,0 +1,29 @@ +{% include 'routing_header.twig' with { + selected_tab: 'ipsets' +} %} + +<div class="mt-2 text-secondary"> + Таблицы расположены в порядке применения правил iptables. +</div> + +{% for set, ips in sets %} + <h6 class="text-primary mt-4">{{ set }}</h6> + + {% if ips %} + {% for ip in ips %} + <div>{{ ip }} (<a href="/routing/ipsets/del/?set={{ set }}&ip={{ ip }}" onclick="return confirm('Подтвердите удаление {{ ip }} из {{ set }}.')">удалить</a>)</div> + {% endfor %} + {% else %} + <span class="text-secondary">Нет записей.</span> + {% endif %} + + <div style="max-width: 300px"> + <form method="post" action="/routing/ipsets/add/"> + <input type="hidden" name="set" value="{{ set }}"> + <div class="input-group mt-2"> + <input type="text" name="ip" placeholder="x.x.x.x/y" class="form-control"> + <button type="submit" class="btn btn-outline-primary">Добавить</button> + </div> + </form> + </div> +{% endfor %}
\ No newline at end of file diff --git a/localwebsite/templates-web/routing_page.twig b/localwebsite/templates-web/routing_page.twig new file mode 100644 index 0000000..90437fd --- /dev/null +++ b/localwebsite/templates-web/routing_page.twig @@ -0,0 +1,17 @@ +{% include 'routing_header.twig' with { + selected_tab: 'smallhome' +} %} + +<div class="mt-3 mb-3"> + Текущий апстрим: <b>{{ current.label }}</b> +</div> + +{% for key, modem in modems %} + {% if key != current.key %} + <div class="pt-1 pb-2"> + <a href="/routing/switch-small-home/?upstream={{ key }}"> + <button type="button" class="btn btn-primary">Переключить на <b>{{ modem.label }}</b></button> + </a> + </div> + {% endif %} +{% endfor %}
\ No newline at end of file diff --git a/localwebsite/templates-web/sensors.twig b/localwebsite/templates-web/sensors.twig new file mode 100644 index 0000000..354e4e7 --- /dev/null +++ b/localwebsite/templates-web/sensors.twig @@ -0,0 +1,12 @@ +<nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item"><a href="/">Главная</a></li> + <li class="breadcrumb-item active" aria-current="page">Датчики</li> + </ol> +</nav> + +{% for key, sensor in sensors %} + <h6 class="text-primary{% if not loop.first %} mt-4{% endif %}">{{ sensor.name }}</h6> + <span class="text-secondary">Температура:</span> <b>{{ sensor.temp }}</b> °C<br> + <span class="text-secondary">Влажность:</span> <b>{{ sensor.humidity }}</b>% +{% endfor %} diff --git a/localwebsite/templates-web/signal_level.twig b/localwebsite/templates-web/signal_level.twig new file mode 100644 index 0000000..9498482 --- /dev/null +++ b/localwebsite/templates-web/signal_level.twig @@ -0,0 +1,5 @@ +<div class="signal_level"> + {% for i in 0..4 %} + <div{% if i < level %} class="yes"{% endif %}></div> + {% endfor %} +</div>
\ No newline at end of file diff --git a/localwebsite/templates-web/sms_page.twig b/localwebsite/templates-web/sms_page.twig new file mode 100644 index 0000000..b6551a3 --- /dev/null +++ b/localwebsite/templates-web/sms_page.twig @@ -0,0 +1,27 @@ +<nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item"><a href="/">Главная</a></li> + <li class="breadcrumb-item active" aria-current="page">SMS-сообщения</li> + </ol> +</nav> + +<nav> + <div class="nav nav-tabs" id="nav-tab"> + {% for modem in modems_list %} + {% if selected_modem != modem %}<a href="/modem/sms/?modem={{ modem }}" class="text-decoration-none">{% endif %} + <button class="nav-link{% if modem == selected_modem %} active{% endif %}" type="button">{{ modems[modem].short_label }}</button> + {% if selected_modem != modem %}</a>{% endif %} + {% endfor %} + </div> +</nav> + +<h6 class="text-primary mt-4">Последние входящие</h6> + +{% for m in messages %} + <div class="mt-3"> + <b>{{ m.phone }}</b> <span class="text-secondary">({{ m.date }})</span><br/> + {{ m.content }} + </div> +{% else %} + <span class="text-secondary">Сообщений нет.</span> +{% endfor %}
\ No newline at end of file diff --git a/localwebsite/templates-web/spinner.twig b/localwebsite/templates-web/spinner.twig new file mode 100644 index 0000000..2d629ea --- /dev/null +++ b/localwebsite/templates-web/spinner.twig @@ -0,0 +1,14 @@ +<div class="sk-fading-circle"> + <div class="sk-circle1 sk-circle"></div> + <div class="sk-circle2 sk-circle"></div> + <div class="sk-circle3 sk-circle"></div> + <div class="sk-circle4 sk-circle"></div> + <div class="sk-circle5 sk-circle"></div> + <div class="sk-circle6 sk-circle"></div> + <div class="sk-circle7 sk-circle"></div> + <div class="sk-circle8 sk-circle"></div> + <div class="sk-circle9 sk-circle"></div> + <div class="sk-circle10 sk-circle"></div> + <div class="sk-circle11 sk-circle"></div> + <div class="sk-circle12 sk-circle"></div> +</div>
\ No newline at end of file |