-
Notifications
You must be signed in to change notification settings - Fork 126
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
feat: public api for embeds #6680
Conversation
|
||
const instanceId = $page.url.searchParams.get("instance_id"); | ||
const runtimeHost = $page.url.searchParams | ||
.get("runtime_host") | ||
.replace("localhost:9091", "localhost:8081"); | ||
const accessToken = $page.url.searchParams.get("access_token"); | ||
|
||
onMount(() => { |
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.
kept the initializing here if we want to support state for canvas in the future
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.
Makes sense. Though for now I'd propose this code would be easier-to-follow (more co-located) if this went in the initEmbedPublicAPI()
function.
Closes #5490 |
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.
Regarding the strict JSON-RPC 2.0 interface, I think it's too heavy to ask that host application developers implement their own JSON-RPC 2.0 over postMessage
client (since there's no widely adopted NPM library for this). I looked around a little bit and didn't find any other BI tools that take this approach (correct me if I'm wrong).
Instead, I'd propose we either:
- Use a simple custom JSON interface, much like what Looker, Sigma, and Metabase offer.
- Build a Javascript SDK that hides the JSON-RPC 2.0 exchange under-the-hood.
I'd suggest we do Option 1 in the short-run and explore Option 2 in the long-run.
355cd82
to
008d5b8
Compare
For ref: removed references to JSON-RPC and made id optional if you do not want a response back. |
|
||
const instanceId = $page.url.searchParams.get("instance_id"); | ||
const runtimeHost = $page.url.searchParams | ||
.get("runtime_host") | ||
.replace("localhost:9091", "localhost:8081"); | ||
const accessToken = $page.url.searchParams.get("access_token"); | ||
|
||
onMount(() => { |
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.
Makes sense. Though for now I'd propose this code would be easier-to-follow (more co-located) if this went in the initEmbedPublicAPI()
function.
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.
Great feature. Big thanks – especially for the tests!
await generateEmbed( | ||
RILL_ORG_NAME, | ||
RILL_PROJECT_NAME, | ||
"bids_explore", | ||
rillServiceToken, | ||
); | ||
const filePath = "file://" + path.resolve(__dirname, "..", "embed.html"); |
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.
Suggestion, so we don't have embed.html
hardcoded in two places:
const embedPath = await generateEmbed(
RILL_ORG_NAME,
RILL_PROJECT_NAME,
"bids_explore",
rillServiceToken
);
const filePath = "file://" + path.resolve(embedPath);
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.
I'll keep the two versions for now since resolve
is relative to the callers directory. Could make sense to move into a constant though since the file location would always have to be in the root of tests
* feat: first rpc stub * add emit * feat: embed public api * fix: better name for state stream * fix: error handling and better spec conformatiy * fix: cleanup * fix: format * fix: make id optional * fix: first stub of tests * Revert "fix: first stub of tests" This reverts commit 2e33082. * fix: clear method names * fix: check input * fix: gitignore * fix: ignore * Revert "fix: ignore" This reverts commit 46ee2b3. * Revert "fix: gitignore" This reverts commit ec97c8e. * fix: add tests * Merge remote-tracking branch 'origin/main' into feat/emit-state-embed * fix: comments * fix: moving org and project to const * fix: moving embed to test hook * fix: format * fix: read token * fix: more fixes * fix: comments * fix: format * .gitignore * delete test file * fix: pr comments * fix: cleaner init * fix: format * fix: lint * fix: more lint (in my pocket) * fix: wait for bids * fix: format * fix: nits * fix: format
* feat: first rpc stub * add emit * feat: embed public api * fix: better name for state stream * fix: error handling and better spec conformatiy * fix: cleanup * fix: format * fix: make id optional * fix: first stub of tests * Revert "fix: first stub of tests" This reverts commit 2e33082. * fix: clear method names * fix: check input * fix: gitignore * fix: ignore * Revert "fix: ignore" This reverts commit 46ee2b3. * Revert "fix: gitignore" This reverts commit ec97c8e. * fix: add tests * Merge remote-tracking branch 'origin/main' into feat/emit-state-embed * fix: comments * fix: moving org and project to const * fix: moving embed to test hook * fix: format * fix: read token * fix: more fixes * fix: comments * fix: format * .gitignore * delete test file * fix: pr comments * fix: cleaner init * fix: format * fix: lint * fix: more lint (in my pocket) * fix: wait for bids * fix: format * fix: nits * fix: format
Adds a RPC API for Rill embeds.
methods:
setState
getState
notifications:
stateChange
Checklist: