wonder fi works
This commit is contained in:
+110
-122
@@ -367,139 +367,89 @@ data:
|
||||
widgets:
|
||||
# Weather Widget (Időkép)
|
||||
- type: custom-api
|
||||
title: Időkép – Budapest VIII.
|
||||
url: http://idokep-proxy.glance-system.svc.cluster.local:8000/api/idokep?place=Budapest%20VIII.%20ker
|
||||
cache: 15m
|
||||
title: "Időkép – Budapest VIII."
|
||||
url: "http://idokep-scraper.glance-system.svc.cluster.local:8000/api"
|
||||
template: |
|
||||
<style>
|
||||
.idokep-wrap { display:grid; gap:12px; }
|
||||
{{ $loc := .JSON.String "location.name" }}
|
||||
{{ $cur := .JSON "current" }}
|
||||
{{ $daily := .JSON.Array "daily" }}
|
||||
{{ $hourly := .JSON.Array "hourly" }}
|
||||
|
||||
.idokep-top { display:flex; align-items:center; justify-content:space-between; gap:12px; }
|
||||
.idokep-now { display:flex; align-items:center; gap:12px; }
|
||||
.idokep-now img { width:44px; height:44px; }
|
||||
.idokep-temp { font-size:44px; font-weight:700; line-height:1; }
|
||||
.idokep-cond { opacity:.85; font-size:13px; margin-top:2px; }
|
||||
.idokep-place { opacity:.75; font-size:12px; text-align:right; }
|
||||
|
||||
.idokep-hourly {
|
||||
display:grid;
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
gap:8px;
|
||||
}
|
||||
.idokep-h {
|
||||
background: rgba(255,255,255,0.04);
|
||||
border-radius: 12px;
|
||||
padding: 8px;
|
||||
display:flex;
|
||||
flex-direction:column;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
gap:6px;
|
||||
}
|
||||
.idokep-h .t { font-size:12px; opacity:.85; }
|
||||
.idokep-h img { width:22px; height:22px; opacity:.95; }
|
||||
.idokep-h .v { font-weight:600; }
|
||||
.idokep-h .p { font-size:11px; opacity:.70; }
|
||||
|
||||
.idokep-daily { display:grid; gap:10px; margin-top:2px; }
|
||||
.idokep-d {
|
||||
display:grid;
|
||||
grid-template-columns: 42px 22px 1fr auto;
|
||||
align-items:center;
|
||||
gap:10px;
|
||||
}
|
||||
.idokep-d .dow { font-size:12px; opacity:.9; }
|
||||
.idokep-d img { width:18px; height:18px; opacity:.95; }
|
||||
|
||||
.idokep-bar {
|
||||
height: 12px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255,255,255,0.08);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.idokep-bar > span{
|
||||
position:absolute;
|
||||
top:0; bottom:0;
|
||||
border-radius: 999px;
|
||||
background: linear-gradient(90deg, #7dd3fc, #a7f3d0, #fde68a, #fdba74, #fca5a5);
|
||||
}
|
||||
|
||||
.idokep-mm { font-size:11px; opacity:.7; margin-left:8px; white-space:nowrap; }
|
||||
.idokep-foot { font-size:11px; opacity:.65; margin-top:2px; }
|
||||
.idokep-foot a { opacity:.8; }
|
||||
.idokep-err { opacity:.85; font-size:13px; }
|
||||
.idokep-muted { opacity:.7; font-size:12px; padding: 4px 0; }
|
||||
</style>
|
||||
|
||||
{{ if .JSON.Exists "error" }}
|
||||
<div class="idokep-err">
|
||||
{{ .JSON.String "error" }}<br>
|
||||
Place: <b>{{ .JSON.String "place" }}</b>
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="idokep-wrap">
|
||||
<div class="idokep-top">
|
||||
<div class="idokep-now">
|
||||
{{ if .JSON.Exists "current.icon_url" }}<img src="{{ .JSON.String "current.icon_url" }}" alt="">{{ end }}
|
||||
<div>
|
||||
{{ if .JSON.Exists "current.temp_c" }}
|
||||
<div class="idokep-temp">{{ .JSON.Float "current.temp_c" | toInt }}°C</div>
|
||||
{{ else }}
|
||||
<div class="idokep-temp">—</div>
|
||||
{{ end }}
|
||||
<div class="idokep-cond">{{ .JSON.String "current.condition_hu" }}</div>
|
||||
</div>
|
||||
<div class="idokep">
|
||||
<div class="idokep-top">
|
||||
<div class="idokep-top-left">
|
||||
{{ $icon := $cur.String "icon_url" }}
|
||||
{{ if $icon }}
|
||||
<img class="idokep-icon" src="{{ $icon }}" alt="" />
|
||||
{{ end }}
|
||||
<div class="idokep-temp">
|
||||
{{ printf "%.0f" ($cur.Float "temp_c") }}°C
|
||||
</div>
|
||||
<div class="idokep-place">{{ .JSON.String "place" }}</div>
|
||||
</div>
|
||||
|
||||
{{ $hourly := .JSON.Array "hourly" }}
|
||||
{{ if gt (len $hourly) 0 }}
|
||||
<div class="idokep-hourly">
|
||||
{{ range $hourly }}
|
||||
<div class="idokep-h">
|
||||
<div class="t">{{ .String "hour" }}</div>
|
||||
{{ if .Exists "icon_url" }}<img src="{{ .String "icon_url" }}" alt="">{{ end }}
|
||||
{{ if .Exists "temp_c" }}<div class="v">{{ .Float "temp_c" | toInt }}°</div>{{ else }}<div class="v">—</div>{{ end }}
|
||||
{{ if .Exists "precip_pct" }}
|
||||
<div class="p">{{ .Float "precip_pct" | toInt }}%</div>
|
||||
{{ else }}
|
||||
<div class="p"> </div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="idokep-muted">No hourly data returned by scraper yet.</div>
|
||||
{{ end }}
|
||||
<div class="idokep-top-right">
|
||||
<div class="idokep-loc">{{ $loc }}</div>
|
||||
<div class="idokep-src">Forrás: <a href="{{ .JSON.String "source.url" }}" target="_blank" rel="noreferrer">Időkép</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="idokep-daily">
|
||||
{{ range .JSON.Array "daily" }}
|
||||
<div class="idokep-d">
|
||||
<div class="dow">{{ .String "dow" }}</div>
|
||||
{{ if .Exists "icon_url" }}<img src="{{ .String "icon_url" }}" alt="">{{ end }}
|
||||
<div class="idokep-bar">
|
||||
{{ if and (.Exists "bar_left_pct") (.Exists "bar_width_pct") }}
|
||||
<span style="left: {{ .Float "bar_left_pct" }}%; width: {{ .Float "bar_width_pct" }}%; opacity:.95;"></span>
|
||||
{{ else }}
|
||||
<span style="left: 0%; width: 100%; opacity:.6;"></span>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div style="display:flex; align-items:center; gap:8px;">
|
||||
{{ if .Exists "tmin_c" }}<div style="font-weight:600;">{{ .Float "tmin_c" | toInt }}°</div>{{ else }}<div style="font-weight:600;">—</div>{{ end }}
|
||||
{{ if .Exists "tmax_c" }}<div style="opacity:.85;">{{ .Float "tmax_c" | toInt }}°</div>{{ else }}<div style="opacity:.85;">—</div>{{ end }}
|
||||
{{ if .Exists "prec_mm" }}<div class="idokep-mm">{{ .Float "prec_mm" }}mm</div>{{ end }}
|
||||
</div>
|
||||
{{ if gt (len $hourly) 0 }}
|
||||
<div class="idokep-hourly">
|
||||
{{ range $i, $h := $hourly }}
|
||||
<div class="idokep-hour">
|
||||
<div class="idokep-hour-time">{{ $h.String "time" }}</div>
|
||||
{{ $hicon := $h.String "icon_url" }}
|
||||
{{ if $hicon }}
|
||||
<img class="idokep-hour-icon" src="{{ $hicon }}" alt="" />
|
||||
{{ end }}
|
||||
<div class="idokep-hour-temp">{{ printf "%.0f" ($h.Float "temp_c") }}°</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="idokep-muted">No hourly data returned by scraper yet.</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="idokep-foot">
|
||||
Forrás: <a href="{{ .JSON.String "source.url" }}" target="_blank">{{ .JSON.String "source.name" }}</a>
|
||||
{{ if gt (len $daily) 0 }}
|
||||
{{/* compute global min/max across shown days for bar scaling */}}
|
||||
{{ $gmin := 9999.0 }}
|
||||
{{ $gmax := -9999.0 }}
|
||||
{{ range $daily }}
|
||||
{{ $tmin := .Float "tmin_c" }}
|
||||
{{ $tmax := .Float "tmax_c" }}
|
||||
{{ if lt $tmin $gmin }}{{ $gmin = $tmin }}{{ end }}
|
||||
{{ if gt $tmax $gmax }}{{ $gmax = $tmax }}{{ end }}
|
||||
{{ end }}
|
||||
{{ $span := sub $gmax $gmin }}
|
||||
{{ if eq $span 0.0 }}{{ $span = 1.0 }}{{ end }}
|
||||
|
||||
<div class="idokep-daily">
|
||||
{{ range $daily }}
|
||||
{{ $tmin := .Float "tmin_c" }}
|
||||
{{ $tmax := .Float "tmax_c" }}
|
||||
{{ $left := mul (div (sub $tmin $gmin) $span) 100.0 }}
|
||||
{{ $wid := mul (div (sub $tmax $tmin) $span) 100.0 }}
|
||||
|
||||
<div class="idokep-row">
|
||||
<div class="idokep-dow">{{ .String "dow" }}</div>
|
||||
|
||||
{{ $dicon := .String "icon_url" }}
|
||||
<div class="idokep-dayicon">
|
||||
{{ if $dicon }}<img src="{{ $dicon }}" alt="" />{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="idokep-bar">
|
||||
<div class="idokep-bar-track"></div>
|
||||
<div class="idokep-bar-fill" style="left: {{ printf "%.1f" $left }}%; width: {{ printf "%.1f" $wid }}%;"></div>
|
||||
</div>
|
||||
|
||||
<div class="idokep-min">{{ printf "%.0f" $tmin }}°</div>
|
||||
<div class="idokep-max">{{ printf "%.0f" $tmax }}°</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
# Calendar Widget
|
||||
- type: calendar
|
||||
@@ -1683,6 +1633,44 @@ data:
|
||||
color: #7ed9e6 !important;
|
||||
border-color: #5ac8d8 !important;
|
||||
}
|
||||
/* =========================================================================
|
||||
Időkép custom-api widget
|
||||
========================================================================= */
|
||||
.idokep { display: flex; flex-direction: column; gap: 10px; }
|
||||
|
||||
.idokep-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
|
||||
.idokep-top-left { display: flex; align-items: center; gap: 10px; }
|
||||
.idokep-icon { width: 42px; height: 42px; opacity: 0.95; }
|
||||
.idokep-temp { font-size: 42px; font-weight: 700; letter-spacing: 0.5px; line-height: 1; }
|
||||
|
||||
.idokep-top-right { text-align: right; }
|
||||
.idokep-loc { opacity: 0.85; font-weight: 600; }
|
||||
.idokep-src { opacity: 0.6; font-size: 12px; margin-top: 2px; }
|
||||
.idokep-src a { opacity: 0.9; }
|
||||
|
||||
.idokep-hourly { display: flex; gap: 10px; padding-top: 4px; }
|
||||
.idokep-hour { width: 54px; display: flex; flex-direction: column; align-items: center; gap: 6px; opacity: 0.9; }
|
||||
.idokep-hour-time { font-size: 12px; opacity: 0.65; }
|
||||
.idokep-hour-icon { width: 26px; height: 26px; }
|
||||
.idokep-hour-temp { font-weight: 700; }
|
||||
|
||||
.idokep-muted { opacity: 0.6; font-size: 12px; padding: 4px 0; }
|
||||
|
||||
.idokep-daily { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
|
||||
.idokep-row { display: grid; grid-template-columns: 28px 26px 1fr 36px 36px; gap: 10px; align-items: center; }
|
||||
.idokep-dow { opacity: 0.7; font-weight: 700; }
|
||||
.idokep-dayicon img { width: 22px; height: 22px; opacity: 0.95; }
|
||||
|
||||
.idokep-bar { position: relative; height: 10px; }
|
||||
.idokep-bar-track { position: absolute; inset: 0; border-radius: 999px; background: rgba(255,255,255,0.10); }
|
||||
.idokep-bar-fill {
|
||||
position: absolute; top: 0; bottom: 0;
|
||||
border-radius: 999px;
|
||||
background: linear-gradient(90deg, #8BE28B 0%, #FFE17A 50%, #FF9B7A 100%);
|
||||
box-shadow: 0 0 0 1px rgba(0,0,0,0.08) inset;
|
||||
}
|
||||
|
||||
.idokep-min, .idokep-max { text-align: right; font-weight: 700; opacity: 0.8; }
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
|
||||
Reference in New Issue
Block a user