Skip to content

Commit

Permalink
Standaard zoom live grafieken zelf kunnen instellen #947
Browse files Browse the repository at this point in the history
  • Loading branch information
dennissiemensma committed May 5, 2020
1 parent f673ad9 commit b178040
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 7 deletions.
6 changes: 6 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ Changelog
=========


v3.9.1 - 2020-05-05

- [`#947 <https://github.com/dennissiemensma/dsmr-reader/issues/947>`_] Standaard zoom live grafieken zelf kunnen instellen


----
v3.9.0 - 2020-05-04

- [`#947 <https://github.com/dennissiemensma/dsmr-reader/issues/947>`_] Tijdsrange live grafieken zelf kunnen instellen
Expand Down
1 change: 1 addition & 0 deletions dsmr_frontend/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class FrontendSettingsAdmin(SingletonModelAdmin):
(
_('Graphs'), {
'fields': [
'live_graphs_initial_zoom',
'live_graphs_hours_range',
'electricity_graph_style',
'stack_electricity_graphs',
Expand Down
19 changes: 19 additions & 0 deletions dsmr_frontend/migrations/0036_graphs_zoom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.0.5 on 2020-05-05 13:05

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dsmr_frontend', '0035_graphs_range'),
]

operations = [
migrations.AddField(
model_name='frontendsettings',
name='live_graphs_initial_zoom',
field=models.IntegerField(default=10, help_text='The percentage of the graph range displayed initially', validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)], verbose_name='Live graphs initial zoom'),
),
]
6 changes: 6 additions & 0 deletions dsmr_frontend/models/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ class FrontendSettings(ModelUpdateMixin, SingletonModel):
verbose_name=_('Live graphs hours range'),
help_text=_("The range of the data displayed in live graphs (increasing it may degrade rendering performance!)")
)
live_graphs_initial_zoom = models.IntegerField(
default=10,
validators=[MinValueValidator(1), MaxValueValidator(100)],
verbose_name=_('Live graphs initial zoom'),
help_text=_("The percentage of the graph range displayed initially")
)
gas_graph_style = models.CharField(
max_length=4,
choices=GRAPH_STYLES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $(document).ready(function () {
dataZoom: [
{
show: true,
start: 0,
start: live_graphs_initial_zoom,
end: 100
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ $(document).ready(function () {
dataZoom: [
{
show: true,
start: 0,
start: live_graphs_initial_zoom,
end: 100
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $(document).ready(function () {
dataZoom: [
{
show: true,
start: 0,
start: live_graphs_initial_zoom,
end: 100
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $(document).ready(function () {
dataZoom: [
{
show: true,
start: 0,
start: live_graphs_initial_zoom,
end: 100
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ $(document).ready(function () {
dataZoom: [
{
show: true,
start: 0,
start: live_graphs_initial_zoom,
end: 100
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $(document).ready(function () {
dataZoom: [
{
show: true,
start: 0,
start: live_graphs_initial_zoom,
end: 100
},
{
Expand Down
1 change: 1 addition & 0 deletions dsmr_frontend/templates/dsmr_frontend/live-graphs.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
<script type="text/javascript">
{% localize off %}
var is_multi_phase = {{ capabilities.multi_phases|yesno:'true,false' }};
var live_graphs_initial_zoom = 100 - {{ frontend_settings.live_graphs_initial_zoom }};
var echarts_loading_options = {text: '{% blocktrans %}Loading...{% endblocktrans %}'};
{% endlocalize %}
</script>
Expand Down
2 changes: 1 addition & 1 deletion dsmrreader/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.utils.version import get_version

VERSION = (3, 9, 0, 'final', 0)
VERSION = (3, 9, 1, 'final', 0)

__version__ = get_version(VERSION)
Binary file modified dsmrreader/locales/nl/LC_MESSAGES/django.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions dsmrreader/locales/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,12 @@ msgstr "Live grafieken urenlimiet"
msgid "The range of the data displayed in live graphs (increasing it may degrade rendering performance!)"
msgstr "Het bereik van de gegevens in de live grafieken (het verhogen van deze waarde kan resulteren in verslechterde performance van de grafieken!)"

msgid "Live graphs initial zoom"
msgstr "Live grafieken initiele zoom"

msgid "The percentage of the graph range displayed initially"
msgstr "Het percentage van de grafiekgegevens dat initieel getoond wordt"

msgid "Gas graph style"
msgstr "Grafiekstijl voor gas"

Expand Down
15 changes: 15 additions & 0 deletions dsmrreader/provisioning/downgrade/v3.9.1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Dump for DSMR-reader v3.9.1
./manage.py migrate dsmr_api 0003_create_api_user
./manage.py migrate dsmr_backend 0014_verbose_field_translations
./manage.py migrate dsmr_backup 0011_remove_backupsettings_latest_backup
./manage.py migrate dsmr_consumption 0015_track_power_current
./manage.py migrate dsmr_datalogger 0022_three_month_retention
./manage.py migrate dsmr_frontend 0036_graphs_zoom
./manage.py migrate dsmr_mindergas 0005_schedule_mindergas_export
./manage.py migrate dsmr_mqtt 0014_mqtt_telegram_defaults
./manage.py migrate dsmr_notification 0007_support_for_telegram
./manage.py migrate dsmr_pvoutput 0002_pvoutput_latest_sync
./manage.py migrate dsmr_stats 0014_day_total_cost_index
./manage.py migrate dsmr_weather 0006_schedule_weather_update

0 comments on commit b178040

Please sign in to comment.