-
Notifications
You must be signed in to change notification settings - Fork 142
Widget - football-league-table: No output in api. #224
Copy link
Copy link
Open
Labels
Description
Widget link
https://github.com/glanceapp/community-widgets/blob/main/widgets/football-league-table/README.md
Description
This api gives nothing. I have correct Token, but gives and error.
url: https://api.football-data.org/v4/competitions/BL1/standings
From log in Portainer:
2025/11/19 12:33:37 Config file changed, reloading...
2025/11/19 12:33:37 Config has errors: parsing variable: environment variable TEAM_ID not found
2025/11/19 12:34:13 Config has errors: parsing variable: environment variable TEAM_ID not found
Any help?
widgets:
- type: custom-api
title: League Table
cache: 30m
url: https://api.football-data.org/v4/competitions/BL1/standings
headers:
X-Auth-Token: xxxxxxxxxx
template: |
<div style="padding: 10px; font-size: 0.85em;">
{{ $compName := .JSON.String "competition.name" }}
<div class="color-subdue" style="font-size: 0.75em; margin-bottom: 6px; text-transform: uppercase;">{{ $compName }}</div>
{{ $standings := .JSON.Array "standings" }}
{{ if $standings }}
{{ $standing := index $standings 0 }}
{{ $table := $standing.Array "table" }}
<div style="display: grid; grid-template-columns: 25px 1.5fr 30px 30px 35px; gap: 6px; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.1); font-weight: bold; margin-bottom: 4px;">
<div style="text-align: center;">#</div>
<div>Team</div>
<div style="text-align: center;">P</div>
<div style="text-align: center;">GD</div>
<div style="text-align: center;">Pts</div>
</div>
{{ range $table }}
{{ $position := .Int "position" }}
{{ $team := .Get "team" }}
{{ $teamName := $team.String "shortName" }}
{{ $played := .Int "playedGames" }}
{{ $gd := .Int "goalDifference" }}
{{ $points := .Int "points" }}
{{ $teamId := $team.Int "id" }}
{{ $rowStyle := "padding: 4px 0;" }}
{{ $textStyle := "" }}
{{ if eq $teamId ${TEAM_ID} }}
{{ $rowStyle = "padding: 4px 0; background: rgba(255,255,255,0.05); border-left: 3px solid var(--color-highlight);" }}
{{ $textStyle = "font-weight: bold; color: var(--color-highlight);" }}
{{ end }}
<div style="display: grid; grid-template-columns: 25px 1.5fr 30px 30px 35px; gap: 6px; {{ $rowStyle }}">
<div style="text-align: center; {{ $textStyle }}">{{ $position }}</div>
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; {{ $textStyle }}">{{ $teamName }}</div>
<div style="text-align: center; {{ $textStyle }}">{{ $played }}</div>
<div style="text-align: center; {{ $textStyle }}">{{ if gt $gd 0 }}+{{ end }}{{ $gd }}</div>
<div style="text-align: center; font-weight: bold; {{ $textStyle }}">{{ $points }}</div>
</div>
{{ end }}
{{ else }}
<div class="color-negative">Unable to load standings</div>
{{ end }}
</div>
Reactions are currently unavailable