diff --git a/LoadingDashboards-Blob/client/index.html b/LoadingDashboards-Blob/client/index.html index 9466c53..fbc7245 100644 --- a/LoadingDashboards-Blob/client/index.html +++ b/LoadingDashboards-Blob/client/index.html @@ -23,7 +23,7 @@ import { RevealSdkSettings, RVDashboard, RevealView } from "https://cdn.jsdelivr.net/npm/reveal-sdk@2.0.0-alpha.6/dist/reveal-sdk.esm.js"; //set this to your server url - RevealSdkSettings.setBaseUrl("http://localhost:5111/"); + RevealSdkSettings.setBaseUrl("https://samples.revealbi.io/upmedia-backend/reveal-api/"); loadDashboard("Sales").then(dashboard => { var revealView = new RevealView("#revealView"); @@ -31,7 +31,7 @@ }); function loadDashboard(name) { - return fetch(`http://localhost:5111/dashboards/${name}`) + return fetch(`https://samples.revealbi.io/upmedia-backend/reveal-api/dashboards/${name}`) .then(r => r.blob()) .then(blob => { return RVDashboard.loadDashboardFromContainer(blob); diff --git a/LoadingDashboards-File/client/index.html b/LoadingDashboards-File/client/index.html index d58e2fe..fd04fa7 100644 --- a/LoadingDashboards-File/client/index.html +++ b/LoadingDashboards-File/client/index.html @@ -16,7 +16,7 @@ import { RevealSdkSettings, RVDashboard, RevealView } from "https://cdn.jsdelivr.net/npm/reveal-sdk@2.0.0-alpha.6/dist/reveal-sdk.esm.js"; //set this to your server url - RevealSdkSettings.setBaseUrl("http://localhost:5111/"); + RevealSdkSettings.setBaseUrl("https://samples.revealbi.io/upmedia-backend/reveal-api/"); RVDashboard.loadDashboard("Sales").then(dashboard => { var revealView = new RevealView("#revealView"); diff --git a/LoadingDashboards-FileStream/client/index.html b/LoadingDashboards-FileStream/client/index.html index d58e2fe..fd04fa7 100644 --- a/LoadingDashboards-FileStream/client/index.html +++ b/LoadingDashboards-FileStream/client/index.html @@ -16,7 +16,7 @@ import { RevealSdkSettings, RVDashboard, RevealView } from "https://cdn.jsdelivr.net/npm/reveal-sdk@2.0.0-alpha.6/dist/reveal-sdk.esm.js"; //set this to your server url - RevealSdkSettings.setBaseUrl("http://localhost:5111/"); + RevealSdkSettings.setBaseUrl("https://samples.revealbi.io/upmedia-backend/reveal-api/"); RVDashboard.loadDashboard("Sales").then(dashboard => { var revealView = new RevealView("#revealView"); diff --git a/LoadingDashboards-Json/client/index.html b/LoadingDashboards-Json/client/index.html index d58e2fe..fd04fa7 100644 --- a/LoadingDashboards-Json/client/index.html +++ b/LoadingDashboards-Json/client/index.html @@ -16,7 +16,7 @@ import { RevealSdkSettings, RVDashboard, RevealView } from "https://cdn.jsdelivr.net/npm/reveal-sdk@2.0.0-alpha.6/dist/reveal-sdk.esm.js"; //set this to your server url - RevealSdkSettings.setBaseUrl("http://localhost:5111/"); + RevealSdkSettings.setBaseUrl("https://samples.revealbi.io/upmedia-backend/reveal-api/"); RVDashboard.loadDashboard("Sales").then(dashboard => { var revealView = new RevealView("#revealView"); diff --git a/LoadingDashboards-Resource/client/index.html b/LoadingDashboards-Resource/client/index.html index d58e2fe..fd04fa7 100644 --- a/LoadingDashboards-Resource/client/index.html +++ b/LoadingDashboards-Resource/client/index.html @@ -16,7 +16,7 @@ import { RevealSdkSettings, RVDashboard, RevealView } from "https://cdn.jsdelivr.net/npm/reveal-sdk@2.0.0-alpha.6/dist/reveal-sdk.esm.js"; //set this to your server url - RevealSdkSettings.setBaseUrl("http://localhost:5111/"); + RevealSdkSettings.setBaseUrl("https://samples.revealbi.io/upmedia-backend/reveal-api/"); RVDashboard.loadDashboard("Sales").then(dashboard => { var revealView = new RevealView("#revealView"); diff --git a/LoadingDashboards/client/index.html b/LoadingDashboards/client/index.html index a440a6e..46eb9ee 100644 --- a/LoadingDashboards/client/index.html +++ b/LoadingDashboards/client/index.html @@ -16,7 +16,7 @@ import { RevealSdkSettings, RVDashboard, RevealView } from "https://cdn.jsdelivr.net/npm/reveal-sdk@2.0.0-alpha.6/dist/reveal-sdk.esm.js"; //set this to your server url - RevealSdkSettings.setBaseUrl("http://localhost:5111/"); + RevealSdkSettings.setBaseUrl("https://samples.revealbi.io/upmedia-backend/reveal-api/"); RVDashboard.loadDashboard("Sales", (dashboard) => { var revealView = new RevealView("#revealView"); diff --git a/README.md b/README.md new file mode 100644 index 0000000..7f8252e --- /dev/null +++ b/README.md @@ -0,0 +1,93 @@ +# Reveal SDK JavaScript Samples + +This repository contains end-to-end Reveal SDK samples across multiple client and server stacks. + +## Goals + +- Provide runnable examples for common SDK scenarios. +- Serve as the source for documentation-embedded code samples. +- Provide a repeatable validation process before docs updates and releases. + +## Quick Start + +From the repository root, start a static file server: + +```bash +python -m http.server 8080 +``` + +Then open sample pages at: + +```text +http://localhost:8080//index.html +``` + +## Official Local Validation Workflow + +Use this workflow for sample changes that are embedded in docs pages (especially `srcdoc` iframe content). + +### Stage A: Direct Sample Validation + +1. Start local static server from repo root. +2. Open affected sample pages directly. +3. Verify each sample renders successfully. +4. Verify browser network requests do not use `localhost:5111` (unless intentionally testing a local backend). + +### Stage B: Official `srcdoc` Harness Validation + +The official local method for docs-embed simulation is: + +- `tools/srcdoc-harness.html` + +This repository uses the root `README.md` as the single source of truth for the harness workflow. + +Open in browser: + +```text +http://localhost:8080/tools/srcdoc-harness.html +``` + +Use the harness controls: + +1. Select the sample path (or use a preset). +2. Test with CSP mode `none` (baseline should render). +3. Test with CSP mode `block` (expected to fail, validates CSP sensitivity). +4. Test with CSP mode `allow` (should render when CSP includes required hosts). + +Recommended checks while running the harness: + +1. Open browser DevTools Console and Network tabs. +2. In `none` mode, confirm dashboard renders without CSP errors. +3. In `block` mode, confirm CSP violations are visible (expected behavior). +4. In `allow` mode, confirm module loads from jsdelivr and backend calls go to `samples.revealbi.io`. + +Expected CSP allow-list requirements for docs embedding: + +- `script-src` includes `https://cdn.jsdelivr.net` +- `connect-src` includes `https://samples.revealbi.io` + +### Stage C: Documentation Integration Validation + +After Stage A and Stage B pass: + +1. Run the Documentation repository locally. +2. Validate the docs page that embeds the sample code. +3. Confirm behavior matches Stage B (`allow` mode success). +4. Confirm no iframe CSP violations in Console/Network. + +## Recommended Pass/Fail Checklist + +A change is ready when all are true: + +- Sample renders directly in Stage A. +- Sample renders in Stage B with CSP mode `allow`. +- Stage B with CSP mode `block` reproduces expected failures. +- No accidental `about:///` fetches. +- No accidental calls to `localhost:5111` in cloud-backed sample paths. +- Docs integration page passes Stage C. + +## Notes + +- Some samples intentionally use local backends for server-side walkthroughs. +- For docs-embedded cloud demos, prefer: + - `https://samples.revealbi.io/upmedia-backend/reveal-api/` diff --git a/tools/srcdoc-harness.html b/tools/srcdoc-harness.html new file mode 100644 index 0000000..17be174 --- /dev/null +++ b/tools/srcdoc-harness.html @@ -0,0 +1,240 @@ + + + + + + + + Reveal Samples Srcdoc Harness + + + + +
+
+ + + + +
+ +
+ + + + +
+ +

Open DevTools Console + Network. In block mode, module load and/or fetch should fail. In allow mode, dashboard should load.

+
+ +
+

Waiting to load sample...

+ +
+ + + + +