Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

217 add custom content to front page #248

Merged
merged 10 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bin/user/weewx_wdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2232,12 +2232,15 @@ def get_climatological_day(self, day, start_ts, end_ts):
aggregate_interval="day"
)

# TODO: Programmatic conversion, WeeWX best practice?
if windGust_target_unit_vt[0] in ("km_per_hour", "km_per_hour2"):
value = 62.0
if windGust_target_unit_vt[0] in ("mile_per_hour", "mile_per_hour2"):
value = 38.5
if windGust_target_unit_vt[0] in ("meter_per_second", "meter_per_second2"):
value = 17.2
if windGust_target_unit_vt[0] in ("knot"):
value = 33.5

days = filter(
lambda windGust: windGust is not None and self.generator.converter.convert(
Expand Down Expand Up @@ -2333,12 +2336,15 @@ def get_climatological_day_description(self, day):
)

if day == "stormDays":
# TODO: Programmatic conversion, WeeWX best practice?
if windGust_target_unit_vt[0] == "km_per_hour":
value = "62"
if windGust_target_unit_vt[0] == "mile_per_hour":
value = "38.5"
if windGust_target_unit_vt[0] == "meter_per_second":
value = "17.2"
if windGust_target_unit_vt[0] == "knot":
value = "33.5"

return (
self.obs.label["windGust"]
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,13 @@ See https://github.com/Daveiano/weewx-wdc/compare/v3.3.0...580071ca175a03fe4924b
- Bugfix: Fixed "ValueError: could not convert string to float" in forecast, introduced in GH-191
- Bugfix: Added missing `nl.conf` in `install.py` GH-221
- Bugfix: Fixed Gauge tiles daily reset (via MQTT)
- Bugfix: year-%Y.html.tmpl fails when changing group_speed to knots in weewx.conf GH-239
- Bugfix: Translation Footer Text 'This station is controlled by...' GH-238
- Bugfix: Fix page title in dwd.html.tmpl GH-246
- Bugfix: Fix page title in externals.html.tmpl GH-244
- Open Webcam Links/Stat Tile links in a Modal GH-220
- Bugfix: Max Rain Rate Does Not Reset GH-224
- Added MQTT connection with username/password GH-225
- Added finnish translation GH-230
- Added "Precipitation detail" on forecast display (show rain/snow separately) GH-231
- Allow to add custom content to front page via custom templates GH-217
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"report": "NODE_ENV=production webpack --profile --json > stats.json; webpack-bundle-analyzer ./stats.json",
"dev": "NODE_ENV=development webpack --watch",
"build": "NODE_ENV=production webpack && mv skins/weewx-wdc/dist/service-worker.js skins/weewx-wdc/service-worker.js",
"deploy:local": "sudo rsync -vua ./skins/weewx-wdc/ /etc/weewx/skins/weewx-wdc/ && sudo cp -r ./bin/user/. /usr/share/weewx/user/ && sudo /usr/share/weewx/wee_reports",
"deploy:local": "sudo rsync -vua ./skins/weewx-wdc/ /etc/weewx/skins/weewx-wdc/ && sudo cp -r ./bin/user/. /etc/weewx/bin/user/ && sudo weectl report run",
"serve:local": "docker run -it --rm -d -p 8080:80 --name web -v /var/www/html/weewx:/usr/share/nginx/html nginx",
"deploy:pi": "yarn run build && sudo rsync -vua ./bin/ pi@weewx:/home/pi/bin && sudo rsync -vua --exclude 'weewx-wdc/dwd/*' --exclude 'weewx-wdc/skin.conf' ./skins/ pi@weewx:/home/pi/skins",
"test:e2e": "yarn playwright test --config playwright.config.ts",
Expand Down
2 changes: 1 addition & 1 deletion skins/weewx-wdc/dwd.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<html lang="$lang">
<head>
#include "includes/html-head.inc"
<title>$station.location - $gettext("DWD")</title>
<title>$station.location - $gettext("Forecast")</title>
<script
type="module"
src="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/version/v1.19.0/image-with-caption.min.js"
Expand Down
2 changes: 1 addition & 1 deletion skins/weewx-wdc/externals.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<html lang="$lang">
<head>
#include "includes/html-head.inc"
<title>$station.location - $gettext("About")</title>
<title>$station.location - $gettext("Webcams/Externals")</title>
<script
type="module"
src="https://1.www.s81c.com/common/carbon/web-components/version/v1.21.0/notification.min.js"
Expand Down
44 changes: 24 additions & 20 deletions skins/weewx-wdc/includes/body-alternative.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<!--prettier-ignore-->
#errorCatcher Echo
#encoding UTF-8
#from datetime import datetime, timedelta
Expand Down Expand Up @@ -53,16 +52,19 @@
#end for
#end if

<!--prettier-ignore-->
#if os.path.exists("custom-content-top.inc") and $context == 'day' and not $daily_archive
<div class="custom-content top">
#include "custom-content-top.inc"
</div>
#end if

#if $show_gauges and $gauges_display == 'before'
<!--prettier-ignore-->
<div class="bx--row">
$render_gauges($DisplayOptions['Gauges'][$context])
</div>
<div class="bx--row">
$render_gauges($DisplayOptions['Gauges'][$context])
</div>
#end if

<div class="bx--row">
<!--prettier-ignore-->
#for $skin_obs in $DisplayOptions.get('stat_tile_observations')
#if $skin_obs != 'windDir' and $skin_obs != 'windGustDir' and $skin_obs != 'rainRate'
#set $skin_obs_binding = $get_data_binding($skin_obs)
Expand Down Expand Up @@ -91,7 +93,6 @@ $render_gauges($DisplayOptions['Gauges'][$context])
#end if
#end for

<!--prettier-ignore-->
#if $stat_tiles_xaggs_same_row
#set global $hide_xaggs_heading = False
#for $stat_xaggs in $stat_tiles_xaggs_same_row
Expand All @@ -101,26 +102,21 @@ $render_gauges($DisplayOptions['Gauges'][$context])
#end if
</div>

<!--prettier-ignore-->
#if $show_gauges and $gauges_display == 'after'
<!--prettier-ignore-->
<div class="bx--row">
$render_gauges($DisplayOptions['Gauges'][$context])
</div>
<div class="bx--row">
$render_gauges($DisplayOptions['Gauges'][$context])
</div>
#end if

<!--prettier-ignore-->
#if $stat_tiles_xaggs_extra_row
#set global $hide_xaggs_heading = True
<!--prettier-ignore-->
<header class="bx--col section-header">
#if $context == 'day'
<h2>$gettext("Historical values for today")</h2>
#else
<h2>$gettext("Historical values")</h2>
#end if
</header>
<!--prettier-ignore-->
<div class="bx--row">
#for $stat_xaggs in $stat_tiles_xaggs_extra_row
#set global $stat_xaggs = $stat_xaggs
Expand All @@ -129,17 +125,20 @@ $render_gauges($DisplayOptions['Gauges'][$context])
</div>
#end if

<!--prettier-ignore-->
#if os.path.exists("custom-content-after-stat.inc") and $context == 'day' and not $daily_archive
<div class="custom-content after-stat">
#include "custom-content-after-stat.inc"
</div>
#end if

#if $context == "day" and $daily_archive == False
#include "includes/forecast.inc"
#end if

<!--prettier-ignore-->
<div class="bx--row">
#include "includes/section-heading.inc"
</div>

<!-- prettier-ignore -->
<div class="bx--row">
#set $diagram_index = 0
#set $context_for_diagrams = $context if $context != 'yesterday' else 'day'
Expand Down Expand Up @@ -186,9 +185,14 @@ $render_gauges($DisplayOptions['Gauges'][$context])
#end for
</div>

#if os.path.exists("custom-content-bottom.inc") and $context == 'day' and not $daily_archive
<div class="custom-content bottom">
#include "custom-content-bottom.inc"
</div>
#end if

#if 'table_tile_observations' in $DisplayOptions
<div class="bx--row">
<!-- prettier-ignore -->
#set global $table_obs = None
#include "includes/data-table-tile.inc"
</div>
Expand Down
18 changes: 18 additions & 0 deletions skins/weewx-wdc/includes/body-classic.inc
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,23 @@
#end for
</div>
#end if

#if os.path.exists("custom-content-left.inc") and $context == 'day' and not $daily_archive
<div class="custom-content left">
#include "custom-content-left.inc"
</div>
#end if
</div>


<div class="bx--col-sm-4 bx--col-md-8 bx--col-lg-6 bx--col-xlg-8 bx--col-max-8 layout-col">

#if os.path.exists("custom-content-top.inc") and $context == 'day' and not $daily_archive
<div class="custom-content top">
#include "custom-content-top.inc"
</div>
#end if

<!--prettier-ignore-->
#if $show_gauges
<!--prettier-ignore-->
Expand Down Expand Up @@ -134,6 +146,12 @@
#end if
#end for
</div>

#if os.path.exists("custom-content-bottom.inc") and $context == 'day' and not $daily_archive
<div class="custom-content bottom">
#include "custom-content-bottom.inc"
</div>
#end if
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion skins/weewx-wdc/lang/de.conf
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
"Server uptime" = "Server-Laufzeit"
"WeeWX uptime" = "WeeWX-Laufzeit"
"WeeWX version" = "WeeWX-Version"
"This station is controlled by <a href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python." = "Diese Station wird von <a href='https://weewx.com'>WeeWX</a> gesteuert, einer experimentellen Wetter-Software, geschrieben in Python."
"This station is controlled by <a target='_blank' href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python." = "Diese Station wird von <a href='https://weewx.com'>WeeWX</a> gesteuert, einer experimentellen Wetter-Software, geschrieben in Python."
"Archive & NOAA Reports" = "Archiv & NOAA Reporte"
"Archive" = "Archiv"
"All data" = "Alle Daten"
Expand Down
2 changes: 1 addition & 1 deletion skins/weewx-wdc/lang/en.conf
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
"Server uptime" = "Server uptime"
"WeeWX uptime" = "WeeWX uptime"
"WeeWX version" = "WeeWX version"
"This station is controlled by <a href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python." = "This station is controlled by <a href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python."
"This station is controlled by <a target='_blank' href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python." = "This station is controlled by <a target='_blank' href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python."
"Archive & NOAA Reports" = "Archive & NOAA Reports"
"Archive" = "Archive"
"All data" = "All data"
Expand Down
4 changes: 2 additions & 2 deletions skins/weewx-wdc/lang/fi.conf
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
swap_total = Swappia Yhteensä
swap_free = Swappia Vapaana
swap_used = Swappia Käytetty
cpu_user = CPU User
cpu_user = CPU User
cpu_system = CPU System
cpu_idle = CPU Idle
cpu_nice = CPU Nice
Expand Down Expand Up @@ -251,7 +251,7 @@
"Server uptime" = "Palvelin käynnissä"
"WeeWX uptime" = "WeeWX käynnissä"
"WeeWX version" = "WeeWX versio"
"This station is controlled by <a href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python." = "Sääasema toimii WeeWX ohjelmalla. <a href='https://weewx.com'>WeeWX</a>"
"This station is controlled by <a target='_blank' href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python." = "Sääasema toimii WeeWX ohjelmalla. <a href='https://weewx.com'>WeeWX</a>"
"Archive & NOAA Reports" = "Arkisto ja NOAA raportit"
"Archive" = "Arkisto"
"All data" = "Kaikki data"
Expand Down
2 changes: 1 addition & 1 deletion skins/weewx-wdc/lang/it.conf
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
"Server uptime" = "Server uptime"
"WeeWX uptime" = "WeeWX uptime"
"WeeWX version" = "WeeWX version"
"This station is controlled by <a href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python." = "This station is controlled by <a href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python."
"This station is controlled by <a target='_blank' href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python." = "This station is controlled by <a href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python."
"Archive & NOAA Reports" = "Archive & NOAA Reports"
"Archive" = "Archive"
"All data" = "All data"
Expand Down
2 changes: 1 addition & 1 deletion skins/weewx-wdc/lang/nl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
"Server uptime" = "Server uptime"
"WeeWX uptime" = "WeeWX uptime"
"WeeWX version" = "WeeWX versie"
"This station is controlled by <a href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python." = "Dit station wordt bestuurd door <a href='https://weewx.com'>WeeWX</a>, een experimenteel weer software systeem geschreven in Python."
"This station is controlled by <a target='_blank' href='https://weewx.com'>WeeWX</a>, an experimental weather software system written in Python." = "Dit station wordt bestuurd door <a href='https://weewx.com'>WeeWX</a>, een experimenteel weer software systeem geschreven in Python."
"Archive & NOAA Reports" = "Archief & NOAA Rapportages"
"Archive" = "Archief"
"All data" = "Alle data"
Expand Down
9 changes: 9 additions & 0 deletions skins/weewx-wdc/src/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,15 @@ bx-structured-list-cell,
margin-right: -0.5rem;
}

.custom-content {
&.top {
margin-bottom: $spacing-05;
}
&.bottom {
margin-bottom: $spacing-05;
}
}

main.user-page {
h1,
h2,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading