Skip to content

Commit

Permalink
Statuspagina: onderdelen 'backup' en 'mindergas upload' toevoegen #292
Browse files Browse the repository at this point in the history
  • Loading branch information
dennissiemensma committed Jul 23, 2018
1 parent 597f05a commit e9d66d0
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 29 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Expand Up @@ -24,6 +24,7 @@ v1.23.0 - 2018-xx-xx
**Tickets resolved in this release:**

- [`#xxxxxx <https://github.com/dennissiemensma/dsmr-reader/issues/xxxxxx>`_] xxxxxxx
- [`#292 <https://github.com/dennissiemensma/dsmr-reader/issues/292>`_] Statuspagina: onderdelen 'backup' en 'mindergas upload' toevoegen
- [`#499 <https://github.com/dennissiemensma/dsmr-reader/issues/499>`_] Upgrade Font Awesome to v5


Expand Down
8 changes: 4 additions & 4 deletions dsmr_backend/services.py
Expand Up @@ -193,25 +193,25 @@ def status_info():
# (External) tools below.
backup_settings = BackupSettings.get_solo()

if backup_settings.daily_backup and backup_settings.latest_backup:
if backup_settings.daily_backup:
status['tools']['backup']['enabled'] = True
status['tools']['backup']['latest_backup'] = backup_settings.latest_backup

dropbox_settings = DropboxSettings.get_solo()

if dropbox_settings.access_token and dropbox_settings.latest_sync:
if dropbox_settings.access_token:
status['tools']['dropbox']['enabled'] = True
status['tools']['dropbox']['latest_sync'] = dropbox_settings.latest_sync

pvoutput_settings = PVOutputAddStatusSettings.get_solo()

if pvoutput_settings.export and pvoutput_settings.latest_sync:
if pvoutput_settings.export:
status['tools']['pvoutput']['enabled'] = True
status['tools']['pvoutput']['latest_sync'] = pvoutput_settings.latest_sync

mindergas_settings = MinderGasSettings.get_solo()

if mindergas_settings.export and mindergas_settings.latest_sync:
if mindergas_settings.export:
status['tools']['mindergas']['enabled'] = True
status['tools']['mindergas']['latest_sync'] = mindergas_settings.latest_sync

Expand Down
2 changes: 2 additions & 0 deletions dsmr_backend/tests/test_services.py
Expand Up @@ -217,6 +217,8 @@ def test_status_info(self, now_mock):
""" Application status info dict. """
now_mock.return_value = timezone.make_aware(timezone.datetime(2018, 1, 1))

BackupSettings.get_solo()
BackupSettings.objects.update(daily_backup=False)
tools_status = dsmr_backend.services.status_info()['tools']

# Tools should be asserted, other content is tested in dsmr_frontend.
Expand Down
89 changes: 65 additions & 24 deletions dsmr_frontend/templates/dsmr_frontend/status.html
Expand Up @@ -11,7 +11,7 @@
<section class="content">
{% if not capabilities.any %}
<div class="alert alert-danger" role="alert">
<span class="fas fa-exclamation fa-2x"></span> {% blocktrans %}No data found. Please make sure the datalogger is up and running and the backend process is running as well.{% endblocktrans %}
<span class="fas fa-exclamation"></span> {% blocktrans %}No data found. Please make sure the datalogger is up and running and the backend process is running as well.{% endblocktrans %}
</div>
{% endif %}

Expand Down Expand Up @@ -39,10 +39,10 @@
<a class="btn btn-success" href="#" id="check_for_updates"><i class="fas fa-sync"></i> &nbsp; {% trans 'Check now' %}</a>
<div id="loader" class="xhr-hidden"><i class="fas fa-sync fa-spin fa-fw"></i> &nbsp; {% trans 'Currently checking for updates...' %}</div>
<div id="update_available" class="alert alert-warning xhr-hidden" role="alert">
<i class="fas fa-exclamation fa-2x"></i> &nbsp; {% blocktrans %}There is a newer version available!{% endblocktrans %}
<i class="fas fa-exclamation"></i> &nbsp; {% blocktrans %}There is a newer version available!{% endblocktrans %}
<a href="https://github.com/dennissiemensma/dsmr-reader/releases" target="_blank">{% trans 'View the latest release' %}</a> {% trans 'for the changelog and further upgrade instructions.' %}
</div>
<div id="no_update_available" class="alert alert-info xhr-hidden" role="alert"><i class="fas fa-smile fa-2x"></i> &nbsp; {% blocktrans %}You are already running the latest version released.{% endblocktrans %}</div>
<div id="no_update_available" class="alert alert-info xhr-hidden" role="alert"><i class="fas fa-check-square"></i> &nbsp; {% blocktrans %}You are already running the latest version released.{% endblocktrans %}</div>
</td>
</tr>
</table>
Expand All @@ -60,12 +60,12 @@
<div class="panel-body">
{% if status.readings.seconds_since == None or status.readings.seconds_since > 90 %}
<div class="alert alert-danger" role="alert">
<span class="fas fa-frown fa-2x"></span>
<span class="fas fa-exclamation-circle"></span>
{% blocktrans %}It has been a while since the latest telegram reading.{% endblocktrans %}
<br /><br />
{% else %}
<div class="alert alert-success" role="alert">
<span class="fas fa-smile fa-2x"></span>
<span class="fas fa-check-square"></span>
{% endif %}

{% trans "Most recent reading" %}:
Expand Down Expand Up @@ -102,12 +102,12 @@
<div class="panel-body">
{% if status.readings.unprocessed.seconds_since > 300 %}
<div class="alert alert-danger" role="alert">
<span class="fas fa-frown fa-2x"></span>
<span class="fas fa-exclamation-circle"></span>
{% blocktrans %}There are too many unprocessed telegrams.{% endblocktrans %}
<br /><br />
{% else %}
<div class="alert alert-success" role="alert">
<span class="fas fa-smile fa-2x"></span>
<span class="fas fa-check-square"></span>
{% endif %}

{% trans "Unprocessed telegrams" %}: <strong>{{ status.readings.unprocessed.count|default:'-' }}</strong>
Expand Down Expand Up @@ -141,25 +141,25 @@
<div class="col-md-8">
<div class="panel">
<header class="panel-heading">
<i class="fas fa-cogs"></i> &nbsp; {% trans "Electricity statistics" %} <br />
<i class="fas fa-bolt"></i> &nbsp; {% trans "Electricity statistics" %} <br />
<small>{% blocktrans %}For dashboard display.{% endblocktrans %}</small>
</header>
<div class="panel-body">
{% if status.electricity.latest %}
{% if status.electricity.minutes_since == None or status.electricity.minutes_since > 2 %}
<div class="alert alert-danger" role="alert">
<span class="fas fa-frown fa-2x"></span>
<span class="fas fa-exclamation-circle"></span>
{% trans "Data processing is lagging behind" %}: <strong>{{ status.electricity.latest|naturaltime }}</strong>
</div>
{% else %}
<div class="alert alert-success" role="alert">
<span class="fas fa-check-square fa-2x"></span>
<span class="fas fa-check-square"></span>
{% trans "Data processing is on schedule" %}: <strong>{{ status.electricity.latest|naturaltime }}</strong>
</div>
{% endif %}
{% else %}
<div class="alert alert-gray" role="alert">
<span class="fas fa-times fa-2x"></span> {% trans "No data." %}
<span class="fas fa-exclamation-circle"></span> {% trans "No data." %}
</div>
{% endif %}

Expand All @@ -177,25 +177,25 @@
<div class="col-md-4">
<div class="panel">
<header class="panel-heading">
<i class="fas fa-cogs"></i> &nbsp; {% trans "Gas statistics" %} <br />
<i class="fas fa-fire"></i> &nbsp; {% trans "Gas statistics" %} <br />
<small>{% blocktrans %}For dashboard display.{% endblocktrans %}</small>
</header>
<div class="panel-body">
{% if status.gas.latest %}
{% if status.gas.hours_since == None or status.gas.hours_since > 3 %}
<div class="alert alert-danger" role="alert">
<span class="fas fa-frown fa-2x"></span>
<span class="fas fa-exclamation-circle"></span>
{% trans "Data processing is lagging behind" %}: <strong>{{ status.gas.latest|naturaltime }}</strong>
</div>
{% else %}
<div class="alert alert-success" role="alert">
<span class="fas fa-check-square fa-2x"></span>
<span class="fas fa-check-square"></span>
{% trans "Data processing is on schedule" %}: <strong>{{ status.gas.latest|naturaltime }}</strong>
</div>
{% endif %}
{% else %}
<div class="alert alert-gray" role="alert">
<span class="fas fa-times fa-2x"></span> {% trans "No data." %}
<span class="fas fa-exclamation-circle"></span> {% trans "No data." %}
</div>
{% endif %}

Expand Down Expand Up @@ -234,11 +234,11 @@
<div class="panel-body">
{% if capabilities.electricity %}
<div class="alert alert-success" role="alert">
<span class="fas fa-check-square fa-2x"></span> {% trans "Electricity usage" %}
<span class="fas fa-check-square"></span> {% trans "Electricity usage" %}
</div>
{% else %}
<div class="alert alert-gray" role="alert">
<span class="fas fa-times fa-2x"></span> {% trans "Electricity usage" %}: <strong>{% trans "No data." %}</strong>
<span class="fas fa-exclamation-circle"></span> {% trans "Electricity usage" %}: <strong>{% trans "No data." %}</strong>
</div>
{% endif %}

Expand All @@ -260,11 +260,11 @@
<div class="panel-body">
{% if capabilities.electricity_returned %}
<div class="alert alert-success" role="alert">
<span class="fas fa-check-square fa-2x"></span> {% trans "Electricity return" %}
<span class="fas fa-check-square"></span> {% trans "Electricity return" %}
</div>
{% else %}
<div class="alert alert-gray" role="alert">
<span class="fas fa-times fa-2x"></span> {% trans "Electricity return" %}: <strong>{% trans "No data." %}</strong>
<span class="fas fa-exclamation-circle"></span> {% trans "Electricity return" %}: <strong>{% trans "No data." %}</strong>
</div>
{% endif %}

Expand All @@ -286,11 +286,11 @@
<div class="panel-body">
{% if capabilities.gas %}
<div class="alert alert-success" role="alert">
<span class="fas fa-check-square fa-2x"></span> {% trans "Gas usage" %}
<span class="fas fa-check-square"></span> {% trans "Gas usage" %}
</div>
{% else %}
<div class="alert alert-gray" role="alert">
<span class="fas fa-times fa-2x"></span> {% trans "Gas usage" %}: <strong>{% trans "No data." %}</strong>
<span class="fas fa-exclamation-circle"></span> {% trans "Gas usage" %}: <strong>{% trans "No data." %}</strong>
</div>
{% endif %}

Expand Down Expand Up @@ -324,18 +324,18 @@
<div class="col-md-12">
<div class="panel">
<header class="panel-heading">
<i class="fas fa-cogs"></i> &nbsp; {% trans "Day &amp; hour statistics" %}<br />
<i class="fas fa-history"></i> &nbsp; {% trans "Day &amp; hour statistics" %}<br />
</header>
<div class="panel-body">
{% if status.statistics.days_since == None or status.statistics.days_since > 1 %}
<div class="alert alert-danger" role="alert">
<span class="fas fa-frown fa-2x"></span>
<span class="fas fa-exclamation-circle"></span>
{% trans "Data processing is lagging behind" %}:
<strong>{% if status.statistics.latest %}{{ status.statistics.latest }}{% else %}{% trans "No data." %}{% endif %}</strong>
</div>
{% else %}
<div class="alert alert-success" role="alert">
<span class="fas fa-check-square fa-2x"></span>
<span class="fas fa-check-square"></span>
{% trans "Data processing is on schedule" %}: <strong>{{ status.statistics.latest }}</strong>
</div>
{% endif %}
Expand All @@ -352,6 +352,47 @@
</div>
</div>
</div>

<br />

<div class="row">
<div class="col-md-12">
<div class="panel">
<header class="panel-heading">
<i class="fas fa-cogs"></i> &nbsp; {% trans "Tools" %}<br />
</header>
<div class="panel-body">
{% if status.tools.backup.enabled %}
<div class="alert alert-info" role="alert">
<i class="fas fa-hdd"></i>
{% trans "Latest backup" %}: <strong>{{ status.tools.backup.latest_backup|default:'-' }}</strong>
</div>
{% endif %}

{% if status.tools.dropbox.enabled %}
<div class="alert alert-info" role="alert">
<i class="fas fa-upload"></i>
{% trans "Latest Dropbox sync" %}: <strong>{{ status.tools.dropbox.latest_sync|default:'-' }}</strong>
</div>
{% endif %}

{% if status.tools.mindergas.enabled %}
<div class="alert alert-info" role="alert">
<i class="fas fa-upload"></i>
{% trans "Latest MinderGas sync" %}: <strong>{{ status.tools.mindergas.latest_sync|default:'-' }}</strong>
</div>
{% endif %}

{% if status.tools.pvoutput.enabled %}
<div class="alert alert-info" role="alert">
<i class="fas fa-upload"></i>
{% trans "Latest PVOutput sync" %}: <strong>{{ status.tools.pvoutput.latest_sync|default:'-' }}</strong>
</div>
{% endif %}
</div>
</div>
</div>
</div>

</section>
{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion dsmrreader/__init__.py
Expand Up @@ -17,6 +17,6 @@
from django.utils.version import get_version


VERSION = (1, 23, 0, 'beta', 1)
VERSION = (1, 23, 0, 'beta', 2)

__version__ = get_version(VERSION)
Binary file modified dsmrreader/locales/nl/LC_MESSAGES/django.mo
Binary file not shown.
12 changes: 12 additions & 0 deletions dsmrreader/locales/nl/LC_MESSAGES/django.po
Expand Up @@ -937,6 +937,18 @@ msgstr "Deze statistieken nodes bevatten dagtotalen en uurtotalen van je verbrui
msgid "They are used in many pages displaying long term data, such as the Archive, Trends and Compare pages."
msgstr "Deze worden gebruikt in pagina's die lange termijn gegevens tonen, zoals het Archief, Trends en de Vergelijk pagina's."

msgid "Tools"
msgstr "Tools"

msgid "Latest Dropbox sync"
msgstr "Meest recente synchronisatie met Dropbox"

msgid "Latest MinderGas sync"
msgstr "Meest recente synchronisatie met MinderGas"

msgid "Latest PVOutput sync"
msgstr "Meest recente synchronisatie met PVOutput"

msgid "Untracked consumption in the past (and today), is not taken into account."
msgstr "Ongemeten verbruik in het verleden (inclusief vandaag) wordt buiten beschouwing gelaten."

Expand Down

0 comments on commit e9d66d0

Please sign in to comment.