-
Notifications
You must be signed in to change notification settings - Fork 12
feat(grafana): create a new Edge App for displaying Grafana dashboards #567
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
base: master
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍(Review updated until commit dd68464)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to dd68464 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 4b13573
Suggestions up to commit 487c3fb
|
- Add steps to enable embedding in self-hosted Grafana - Clarify support for Open Source and Enterprise editions - Add note about public accessibility requirement - Document that Grafana Cloud does not support embedding
|
Persistent review updated to latest commit 4b13573 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new Edge App for embedding Grafana dashboards in Screenly displays. The app uses a simple iframe-based approach to display Grafana content, with configurable dashboard URLs and theme integration.
Key Changes:
- New Grafana Edge App scaffolding with TypeScript/Bun build setup
- Configurable iframe embedding via
grafana_urlsetting - Theme integration using the
@screenly/edge-appslibrary
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
edge-apps/grafana/screenly.yml |
App manifest defining grafana_url setting and metadata |
edge-apps/grafana/screenly_qc.yml |
QC manifest mirroring production configuration |
edge-apps/grafana/package.json |
Build scripts and dependencies for Bun-based development |
edge-apps/grafana/tsconfig.json |
TypeScript configuration for browser target with Bun types |
edge-apps/grafana/src/main.ts |
Main app logic: theme setup, URL loading, iframe rendering |
edge-apps/grafana/src/main.test.ts |
Placeholder test structure with TODO for proper tests |
edge-apps/grafana/index.html |
HTML scaffold with asset includes and container markup |
edge-apps/grafana/static/css/style.css |
Base styling for fullscreen iframe container |
edge-apps/grafana/static/img/icon.svg |
QR code icon for the app |
edge-apps/grafana/.prettierrc.json |
Prettier configuration matching repository standards |
edge-apps/grafana/.ignore |
Ignore file for node_modules |
edge-apps/grafana/.gitignore |
Git ignore rules for build artifacts and dependencies |
edge-apps/grafana/README.md |
Comprehensive documentation with setup and configuration guides |
edge-apps/grafana/bun.lock |
Dependency lockfile for reproducible builds |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Replace grafana_url setting with domain, dashboard_id, and dashboard_slug - Update to use nested help_text syntax with properties and schema_version - Change implementation to fetch dashboard as image via GET request - Add width (1920) and height (1080) parameters with kiosk mode enabled - Include Authorization bearer token in request headers - Add refresh_interval setting for dashboard refresh configuration - Move inline styles to style.css for better organization
- Replace iframe-based dashboard embedding with Grafana render API calls - Add service account token authentication (Bearer token) - Implement dynamic resolution based on screen dimensions - Add automatic refresh with configurable intervals - Extract rendering logic to separate render.ts module - Update manifest files with new settings (domain, dashboard_id, dashboard_slug, service_access_token, refresh_interval) - Add comprehensive test suite for URL construction and configuration - Update README with service account token setup instructions - Organize CSS styling to external stylesheet
|
Persistent review updated to latest commit dd68464 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 13 out of 15 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Remove dashboard_slug setting from screenly.yml and screenly_qc.yml - Update getRenderUrl() to accept only domain and dashboardId parameters - Simplify API endpoint URL construction (omit slug from render path) - Update main.ts to remove dashboard_slug retrieval and validation - Update all tests to reflect new function signature
- Add oauth:grafana:dashboard_id schema type for dashboard_id setting - Change refresh_interval help_text type from string to number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 15 out of 17 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add getAccessToken() utility function to edge-apps-library - Update Grafana app to fetch service access token dynamically via OAuth API - Make service_access_token setting optional (for testing only) - Update manifest schemas with oauth:grafana:service_access_token type - Change refresh_interval help_text type to number - Simplify README to reflect automatic token fetching via Grafana integration - Remove static token configuration requirement from production setup
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Update getSettingWithDefault to handle numeric parsing with fallback - Use getSettingWithDefault consistently for all settings in Grafana app - Automatically parse string settings to numbers when default is numeric - Falls back to default value if parsing fails
| }, | ||
| "include": ["src/**/*.ts"], | ||
| "exclude": ["node_modules"] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, I believe it shouldn't be a part of the Edge App itself
… getAccessToken - Add optional tokenType parameter with 'access_token' default - Update function to dynamically use provided token type in URL
- We will be using `panic-overlay` for displaying error messages in future commits.
- Add panic-overlay import and configuration - Add display_errors setting to screenly.yml and screenly_qc.yml - Rename getAccessToken to getToken in edge-apps-library
PR Type
Enhancement, Documentation, Tests
Description
Introduce Grafana Edge App rendering
Add configurable settings and manifests
Document setup and embedding guidance
Include basic test and build tooling
Diagram Walkthrough
flowchart LR settings["screenly.yml settings (domain, dashboard_id, dashboard_slug, refresh_interval)"] mainjs["main.ts fetches render image via HTTPS"] image["Render dashboard PNG (1920x1080, kiosk)"] ui["index.html + style.css container"] ready["signalReady()"] settings -- "read with getSetting()" --> mainjs mainjs -- "GET /render/d/{id}/{slug}" --> image image -- "blob -> object URL" --> ui mainjs -- "append <img> to #content" --> ui ui -- "app ready" --> readyFile Walkthrough
1 files
Add placeholder unit test scaffold3 files
Fetch and render Grafana dashboard imageAdd responsive full-screen layout stylesAdd minimal app shell and script wiring7 files
Ignore Grafana app directory for PrettierIgnore node_modules in app contextAdd Prettier configuration for appDefine scripts, dev deps, and toolingDefine app settings and metadataQC manifest mirroring production settingsAdd TypeScript compiler configuration1 files
Document setup, embedding, and development