DoDiODev opened a new pull request, #9239:
URL: https://github.com/apache/devlake/pull/9239

   ### Summary
   
   Fixes two bugs with the Grafana links of the config-ui. Part of #9219
   (section B). Defaults and proxy mode are unchanged.
   
   **External Grafana redirect keeps path and query**
   
   With `USE_EXTERNAL_GRAFANA=true`, `nginx.conf` answered every `/grafana/...`
   request with `302 ${GRAFANA_ENDPOINT}` and dropped the path and the query. 
All
   dashboard links (e.g. `/grafana/d/<uid>/<slug>?orgId=1`) therefore ended on 
the
   Grafana home page.
   
   - The redirect now appends the part after `/grafana` from `$request_uri`
     (still URL-encoded, query string included), via a `map` in `nginx.conf`.
   - `nginx.sh` drops a trailing slash from `GRAFANA_ENDPOINT`, so
     `https://grafana.example.com/` does not produce `//`.
   - Proxy mode (default) is unchanged.
   
   **"Check Dashboard" button in the onboarding**
   
   The button opened `import.meta.env.DEVLAKE_DASHBOARD_URL_*`. These are
   build-time variables; the released image is built without them, so the button
   opened an empty tab. The example values in `config-ui/env.example` also point
   to the MySQL dashboard UIDs, while the PostgreSQL dashboards use a `-pg`
   suffix.
   
   - New `getDashboardURL(plugin)`: uses the configured URL if set, otherwise 
the
     Grafana dashboard search for the plugin (e.g.
     `/grafana/dashboards?query=GitHub`, respecting `DEVLAKE_GRAFANA_PATH`). The
     titles are the same for MySQL and PostgreSQL, so this works for both.
   - Unit tests for the helper.
   
   **Docs**
   
   - `config-ui/README.md`: `GRAFANA_ENDPOINT` / `USE_EXTERNAL_GRAFANA` in the
     Docker image.
   - `config-ui/env.example`: the dashboard URLs are optional, and the
     PostgreSQL UIDs use the `-pg` suffix.
   
   ### Does this close any open issues?
   
   Part of #9219 (section B).
   
   ### Screenshots
   
   N/A
   
   ### Other Information
   
   Tested with the image built from this branch and from `main` (`ee0079ab3`):
   
   | Scenario | `main` | this PR |
   |---|---|---|
   | External: `/grafana/d/KXWvOFQnz-pg/github?orgId=1&var-repo_id=All` | ❌ 
redirects to `https://grafana.example.com/` | ✅ 
`https://grafana.example.com/d/KXWvOFQnz-pg/github?orgId=1&var-repo_id=All` |
   | External: encoded query (`var-repo=a%20b&var-team=%2Fdev`) | ❌ dropped | ✅ 
kept as is |
   | External with a sub path (`GRAFANA_ENDPOINT=https://example.com/grafana`) 
| ❌ `https://example.com/grafana` | ✅ `https://example.com/grafana/d/…` |
   | External: `/grafana/` | ✅ | ✅ |
   | Proxy mode: deep link, `/grafana/`, SPA route | ✅ | ✅ unchanged |
   | Built bundle | no dashboard URL (empty tab) | falls back to the dashboard 
search |
   
   The search URL was checked against Grafana 13.2.3 in a headless browser:
   `/dashboards?query=GitHub` lists only the matching dashboard.
   `tsc`, `eslint`, `vitest` and `vite build` pass. Full CI mirror on my fork:
   [run](https://github.com/DoDiODev/devlake/actions/runs/39229366858)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to