-
Notifications
You must be signed in to change notification settings - Fork 12
feat(looker-studio): create a new Edge App that displays Looker Studio dashboards #612
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
Draft
nicomiguelino
wants to merge
7
commits into
master
Choose a base branch
from
poc/looker-studio-edge-app
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5b765ea
feat(looker-studio): lay the groundwork for the looker studio POC
nicomiguelino d6c5dad
fix(looker-studio): modify HTML page title
nicomiguelino 39cf370
feat(looker-studio): implement dashboard embedding with auto-refresh
nicomiguelino dcad664
docs: update edge-apps/looker-studio/README.md
nicomiguelino 5792b2b
chore: remove deprecated `frameborder` attribute
nicomiguelino 243f74f
chore: bump the bun group across 10 directories with 1 update (#613)
dependabot[bot] adbabcc
Merge remote-tracking branch 'origin/master' into poc/looker-studio-e…
nicomiguelino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| node_modules/ | ||
| dist/ | ||
| *.log | ||
| .DS_Store | ||
| static/js/*.js | ||
| static/js/*.js.map |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| node_modules/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Looker Studio | ||
|
|
||
| ## Deployment | ||
|
|
||
| Create and deploy the Edge App: | ||
|
|
||
| ```bash | ||
| screenly edge-app create --name my-looker-studio --repository | ||
| screenly edge-app deploy | ||
| screenly edge-app instance create | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| The app accepts the following settings via `screenly.yml`: | ||
|
|
||
| - `embed_url` - The Looker Studio embed URL to display on the screen. | ||
| - `refresh_interval` - How often to refresh the embed (in seconds). | ||
|
|
||
| ## Development | ||
|
|
||
| ```bash | ||
| bun install # Install dependencies | ||
| bun run build # Build the app | ||
| bun test # Run tests | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| ```bash | ||
| bun test | ||
| ``` |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Looker Studio App</title> | ||
| <script src="screenly.js?version=1"></script> | ||
| <link rel="stylesheet" href="dist/css/style.css" /> | ||
| </head> | ||
| <body> | ||
| <iframe | ||
| id="looker-studio-iframe" | ||
| title="Looker Studio Dashboard" | ||
| src="about:blank" | ||
| width="100%" | ||
| height="100%" | ||
| allowfullscreen | ||
| ></iframe> | ||
| <script src="dist/js/main.js"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "name": "looker-studio", | ||
| "version": "1.0.0", | ||
| "devDependencies": { | ||
| "@screenly/edge-apps": "workspace:../edge-apps-library", | ||
| "@types/bun": "^1.3.6", | ||
| "@types/jsdom": "^27.0.0", | ||
| "@types/qrcode": "^1.5.6", | ||
| "bun-types": "^1.3.6", | ||
| "jsdom": "^27.4.0", | ||
| "npm-run-all2": "^8.0.4", | ||
| "prettier": "^3.8.0", | ||
| "typescript": "^5.9.3" | ||
| }, | ||
| "prettier": "../edge-apps-library/.prettierrc.json", | ||
| "scripts": { | ||
| "prebuild": "bun run type-check", | ||
| "generate-mock-data": "screenly edge-app run --generate-mock-data", | ||
| "predev": "bun run generate-mock-data && edge-apps-scripts build", | ||
| "dev": "run-p build:dev edge-app-server", | ||
| "edge-app-server": "screenly edge-app run", | ||
| "build": "edge-apps-scripts build", | ||
| "build:dev": "edge-apps-scripts build:dev", | ||
| "build:prod": "edge-apps-scripts build", | ||
| "test": "bun test", | ||
| "test:unit": "bun test", | ||
| "lint": "edge-apps-scripts lint --fix", | ||
| "format": "prettier --write src/ README.md index.html", | ||
| "format:check": "prettier --check src/ README.md index.html", | ||
| "deploy": "bun run build && screenly edge-app deploy", | ||
| "type-check": "edge-apps-scripts type-check", | ||
| "prepare": "cd ../edge-apps-library && bun install && bun run build" | ||
| }, | ||
| "type": "module" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| --- | ||
| syntax: manifest_v1 | ||
| description: Looker Studio edge app for displaying dashboards | ||
| icon: https://playground.srly.io/edge-apps/looker-studio/static/img/icon.svg | ||
| author: Screenly, Inc. | ||
| ready_signal: true | ||
| settings: | ||
| embed_url: | ||
| type: string | ||
| title: Embed URL | ||
| optional: false | ||
| help_text: | ||
| properties: | ||
| help_text: Enter the Looker Studio embed URL or paste the full iframe embed code. | ||
| type: string | ||
| schema_version: 1 | ||
| refresh_interval: | ||
| type: string | ||
| default_value: '60' | ||
| title: Refresh Interval (seconds) | ||
| optional: true | ||
| help_text: | ||
| properties: | ||
| help_text: How often to refresh the dashboard in seconds. Set to 0 to disable auto-refresh. | ||
| type: number | ||
| schema_version: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| --- | ||
| syntax: manifest_v1 | ||
| description: Looker Studio edge app for displaying dashboards | ||
| icon: https://playground.srly.io/edge-apps/looker-studio/static/img/icon.svg | ||
| author: Screenly, Inc. | ||
| ready_signal: true | ||
| settings: | ||
| embed_url: | ||
| type: string | ||
| title: Embed URL | ||
| optional: false | ||
| help_text: | ||
| properties: | ||
| help_text: "Enter the Looker Studio embed URL or paste the full iframe embed code." | ||
| type: string | ||
| schema_version: 1 | ||
| refresh_interval: | ||
| type: string | ||
| title: Refresh Interval (seconds) | ||
| default_value: 60 | ||
| optional: true | ||
| help_text: | ||
| properties: | ||
| help_text: "How often to refresh the dashboard in seconds. Set to 0 to disable auto-refresh." | ||
| type: number | ||
| schema_version: 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| @import 'tailwindcss'; | ||
|
|
||
| html, | ||
| body { | ||
| margin: 0; | ||
| padding: 0; | ||
| width: 100%; | ||
| height: 100%; | ||
| overflow: hidden; | ||
| } | ||
|
|
||
| #looker-studio-iframe { | ||
| position: absolute; | ||
| top: 0; | ||
| left: 0; | ||
| width: 100%; | ||
| height: 100%; | ||
| border: none; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import './css/style.css' | ||
|
|
||
| import { | ||
| setupTheme, | ||
| getSettingWithDefault, | ||
| signalReady, | ||
| } from '@screenly/edge-apps' | ||
|
|
||
| function extractUrlFromEmbedSetting(settingValue: string): string | null { | ||
| if (settingValue.includes('<iframe')) { | ||
| const match = settingValue.match(/<iframe.*?src=["'](.*?)["']/) | ||
| if (match && match[1]) { | ||
| return match[1] | ||
| } | ||
| return null | ||
| } | ||
| return settingValue | ||
| } | ||
|
|
||
| window.onload = function () { | ||
| const embedSettingValue = getSettingWithDefault<string>('embed_url', '') | ||
| const refreshInterval = getSettingWithDefault<number>('refresh_interval', 60) | ||
| const embedUrl = extractUrlFromEmbedSetting(embedSettingValue) | ||
| const iframeElement = document.getElementById( | ||
| 'looker-studio-iframe', | ||
| ) as HTMLIFrameElement | null | ||
|
|
||
| // Setup branding colors using the library | ||
| setupTheme() | ||
|
|
||
| if (!iframeElement) { | ||
| console.error('Iframe element not found') | ||
| signalReady() | ||
| return | ||
| } | ||
|
|
||
| if (!embedUrl) { | ||
| console.error('Embed URL not configured or invalid') | ||
| signalReady() | ||
| return | ||
| } | ||
|
|
||
| let refreshTimer: number | null = null | ||
|
|
||
| const loadIframe = () => { | ||
| iframeElement.src = embedUrl | ||
| } | ||
|
|
||
| const setupRefreshTimer = () => { | ||
| if (refreshTimer) { | ||
| clearInterval(refreshTimer) | ||
| } | ||
|
|
||
| if (refreshInterval > 0) { | ||
| refreshTimer = window.setInterval(() => { | ||
| loadIframe() | ||
| }, refreshInterval * 1000) | ||
| } | ||
| } | ||
|
|
||
| iframeElement.onload = () => { | ||
| signalReady() | ||
| setupRefreshTimer() | ||
| } | ||
|
|
||
| loadIframe() | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.