Templates baked in a hardcoded influxdb datasource uid that only matched the Grafana the templates were authored against. Any other Grafana (fresh laptop, VPS, rebuilt instance) rendered every panel as "Datasource <uid> not found". resolveDatasourceUid() queries GET /api/datasources, picks the first influxdb one, and caches the result. rewriteDatasourceUid() then walks panels, nested row panels, panel.targets[], and templating.list[] and rewrites every influxdb uid before the dashboard is pushed. Annotation datasources (type: "grafana") and template-variable refs ($datasource) are left alone. Failure is silent and panels keep the template uid, so behavior is never worse than before. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5.7 KiB
5.7 KiB