Skip to content

Commit 9ef9bf7

Browse files
bryans99jkaster
andauthored
feat: Embed SDK 2.0 (#210)
* feat: Embed SDK 2.0 Development (wip) * 1. Fix karma tests (new tests not added yet) 2. Upgrade karma type script packages. 3. Update documentation. 4. Reduce exposed embed sdk 2.0.0 classes to the minumum. 5. Update version to 2.0.0 6. Fix minor issue with comment in demo. 7. Correct copyright dates. * 2.0.0-alpha * 1. Clean up demo (implement missing features and remove commented out code. 2. Fix internal event handler setup so that users of the sdk can listen to events (internal event handler was overwriting handlers added with "on". 3. Fix cookieless login. Incorrect separator used. 4. Fix asLookConnection return type. Was ILookerEmbedExtension. Now is ILookerEmbedLook (copy pasta error). 5. Fix LookerEmbedSDKFactory constructor input type. Now is interface. 6. Initial karma tests for 2.0. * 1. Add tests for LookerEmbedExSDK 2. Various fixes for issues found while writing tests for LokerEmbedExSDK * 1. EmbedBuilderEx tests 2. Add more withApiHost and withAuth tests to LookerEmbedExSDK tests 3. Hide internal properties and methods from documentation 4. Regenerate documentation * 1. EmbedClientEx tests 2. LookerEmbedExSDK test update 3. doc cleanup 4. Clean up function names 5. Remove unnecessary assertions 6. Clean up generateTokens error handling 7. Fix appendRequiredParameters processing for sandboxed host 8. Add clarifying comments for sandboxed host 9. Fix connect for private embed 10. Fix isCookielessEmbed check (replaces assertions) * 2.0.0-alpha-2 * 1. generateTokens callback now receives current tokens 2. Update docs to reflect generatTokens change * 1. turn off jest-dom/prefer-to-have-style eslint rule (karma does not support it) 2. fix generateTokens handling of fetch init object 3. clean up generate error handling 4. correct initCookieless generateTokens typing 5. more EmbedClientEx tests * Fix docs * 1. Move test utils into its own file * 1. Removed loadDashboard method from ILookerEmbedDashboard 2. Updated documentation to reflect removed method 3. EmbedConnection.loadUrl method is the only method for setting default values for pushHistory and waitUntilLoaded 4. DashbordConnection tests 5. Updated EmbedClientEx tests to spy on mocks instead of connection. Spy ons now callThrough. 6. EmbedConnection tests 7. Add mock sendAndReceive method * 1. Add clarification about message to ExploreConnection 2. ExploreConnection test 3. ExtensionConnection test 4. LookConnection test * 1. Add new method to original SDK to return instance of new SDK. 2. Rename original demo to multi frame demo 3. Rename new demo to single frame demo 4. Change title of message example tp Embed Message API Demo * Remove python server * Update docs * Update multi frame demo to use getSDKFactory to instantiate SDK * Update existing SDK docs to reflect deprecation * Be more forgiving about api host provided to init functions * Fix documentation * 1. Start updating README 2. Fix bug in sanitizeHostUrl function which broke everything 3. sanitizeHostUrl now throws an error if URL is invalid 4. Add sanitizeEmbedUrl which adds missing parameters if necessary, strips protocl, hostname, port if necessary, prefixes with /embed if necessary. Throws an error if URL is invalid * fix multi frame cookieless demo * 1. Prepend host to private embed urls 2. URL only signed for first IFRAME * 1. Rename poorly named environment variables 2. Update README * Simplify instantiation of embedSDK. Eliminates factory. * 1. Add getPageType to EmbedConnection 2. Move private functions to bottom of class 3. Document IEmbedConection * Send stop running dashboard if dashboard loading and new url is requested * Add isEditing to EmbedConnection * 2.0.0-alpha-3 * Update SDK from 2 to 3 * 1. Add private embedding option to single frame demo 2. Add withAllowLoginScreen to builder * Update multi frame and message demos to use embedType instead of useCookieless * 1. Add legacy client methods to connection to make SDK migration easier. 2. Remove access to url from builder (prevents private embed issues) 3. Fix private embed issue. No longer relies on builder.url presence and uses builder.embedUrl instead. 4. Rename loadDashboard method to loadDashboard2 in order to support legacy loadDashboard method. * Cookieless session is now shared across all IFRAMEs. * 2.0.0-alpha-4 * Cookieless now shares calls to acquire sessions and generate tokens amongst all IFRAMES * 2.0.0-alpha-5 * session expired message * 1. Add query visualization 2. Add report 3. Update docs for query visualization, reports, looker version 4. Clean up page types 5. loadXXX now checks looker version 6. Removed loadDashboard2. loadDashboard now checks looker version and executes legcacy dashboard:load event for looker 25.0 or less 7. Add getLookerVersion to IEmbedConnection * 2.0.0-alpha-6 * 1. Remove majority of legacy SDK. LookerEmbedSDK delegates to getEmbedSDK 2. Update documentation to reflect deletion * 2.0.0-alpha-7 * 1. Add convenience types to aid migration 2. Update documentation * 2.0.0-alpha-8 * 1. Add more convenience types for backward compatibility 2. Add withNext to IEmbedBuilder for backwards compatibility 3. Remove the v2 directories as no longer needed. 4. Generate docs yet again. * Really regenerate the docs this time * Update README and regenerated docs * 2.0.0-alpha-9 * 1. Fix private demo 2. Add embed query and merge query create and load methods * Update docs * Fix reporting path (courtesy of Ryan) * Fix docs * Allow dev server and demo server to run on https * 1. Add clearSession method to SDK 2. Regenerate documentation * Fix code scanning non issue * 1. Replace tailwind with beercss (license issue, beercss is MIT) 2. Add proxy path config to allow embed server to proxy through Looker development environment ngnix server. * 1. Remove vestige of tailwind 2. Remove dependency of beercss CDN * Fix error condition tests for cookieless embed * 1. Add look:edit:start and look:edit:cancel events 2. Correct LookSaveEventDetail documentation 3. Generate documentation 4. EmbedClientEx tracks looks being edited 5. Change of page resets editing status * jest migration * oops * jest updated * 1. update ts-loader package 2. fix skipped tests * 1, Add default jest reporter 2. Add more tests 3. Use Promise reject instead of throwing an error when page load not supported 4. use toThrow instead of deprecated toThrowError * 1. Detect session expired and expose to embedding application 2. Update documentation * 1. Moved waitUntilLoaded to an option object 2. Added signal to option object to allow caller to abort the request (to be implemented in a follow up change) 3. Updated documentation * 1. Implemented connect/load abort 2. Fixed 404 on beercss woff2 files 3. Remove beer css from repo. Now copied from node modules and gitignored * Really delete the bearcss artifcacts * 1. Add abortableCreateSignedUrl 2. Add demo of use of abortable 3. Add env config to allow dev server to be connected from any hostname (allows testing of reports using an allow listed hostname defined in etc/hosts) * 2.0.0-beta-1 * fix publish test script * 1. Increase connection timeout to a minute 2. Prevent navigation when editing 3. Ensure page has actually changed before clearing is editing. * Update README.md Co-authored-by: John Kaster <kaster@google.com> * Update README.md Co-authored-by: John Kaster <kaster@google.com> * Update README.md Co-authored-by: John Kaster <kaster@google.com> * 1. Updated README 2. Removed python example 3. Fixed typo in types doc 4. Regenerated documentation * Fix codeql after removal of python code * 1. Restore python code to make build happy * Fix doc links * Update README.md Co-authored-by: John Kaster <kaster@google.com> * Update README.md Co-authored-by: John Kaster <kaster@google.com> * Update README.md Co-authored-by: John Kaster <kaster@google.com> * Update README.md Co-authored-by: John Kaster <kaster@google.com> * Update README.md Co-authored-by: John Kaster <kaster@google.com> * 1. docs update 2. use auto gen cert for npm start * README update * 2.0.0-beta-2 * 1. EmbedBuilder withUrl now sanitizes the URL 2. Embed sdk sanitizes the URL before determining the page type 3, createLookWithId accepts a string and a number 4. Increased test coverage 5. Added history fallback to dev and demo servers 6. Added history support to demo. 7. Updated docs * 2.0.0-beta-3 * rename css scripts * Fix tsc issue * Minor docs update * Update README.md Co-authored-by: John Kaster <kaster@google.com> * Update README.md Co-authored-by: John Kaster <kaster@google.com> * Update README.md Co-authored-by: John Kaster <kaster@google.com> * Update README.md Co-authored-by: John Kaster <kaster@google.com> * Update docs --------- Co-authored-by: John Kaster <kaster@google.com>
1 parent c864cc6 commit 9ef9bf7

File tree

136 files changed

+21192
-13257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+21192
-13257
lines changed

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ jobs:
2020
run: |
2121
npm ci
2222
npm run build --if-present
23-
npm run test-once
23+
npm run test
2424
env:
2525
CI: true

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ server_utils/*.js.map
1616
server/**/*.js
1717
server/**/*.js.map
1818
.direnv
19-
server/public/
19+
server/public/
20+
*.pem
21+
demo/beer.min.css
22+
demo/*.woff2

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
npm run build
2-
npm run test-once
2+
npm run test

README.md

Lines changed: 239 additions & 236 deletions
Large diffs are not rendered by default.

config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
require('dotenv').config()
22

33
module.exports = {
4-
host: process.env.LOOKER_EMBED_HOST || 'self-signed.looker.com:9999',
4+
host:
5+
process.env.LOOKER_WEB_URL ||
6+
process.env.LOOKER_EMBED_HOST ||
7+
'self-signed.looker.com:9999',
58
api_url:
6-
process.env.LOOKER_EMBED_API_URL || 'https://self-signed.looker.com:19999',
9+
process.env.LOOKER_API_URL ||
10+
process.env.LOOKER_EMBED_API_URL ||
11+
'https://self-signed.looker.com:19999',
712
secret: process.env.LOOKER_EMBED_SECRET,
813
demo_host: process.env.LOOKER_DEMO_HOST || 'localhost',
914
demo_port: process.env.LOOKER_DEMO_PORT || 8080,
15+
demo_protocol: process.env.LOOKER_DEMO_PROTOCOL || 'http',
1016
client_id: process.env.LOOKER_CLIENT_ID,
1117
client_secret: process.env.LOOKER_CLIENT_SECRET,
1218
verify_ssl: process.env.LOOKER_VERIFY_SSL === 'true' || false,

demo/demo.css

Lines changed: 109 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,131 @@
1+
:root,
2+
body.light {
3+
--primary: #0061a4;
4+
--on-primary: #ffffff;
5+
--primary-container: #d1e4ff;
6+
--on-primary-container: #001d36;
7+
--secondary: #535f70;
8+
--on-secondary: #ffffff;
9+
--secondary-container: #d7e3f7;
10+
--on-secondary-container: #101c2b;
11+
--tertiary: #6b5778;
12+
--on-tertiary: #ffffff;
13+
--tertiary-container: #f2daff;
14+
--on-tertiary-container: #251431;
15+
--error: #ba1a1a;
16+
--on-error: #ffffff;
17+
--error-container: #ffdad6;
18+
--on-error-container: #410002;
19+
--background: #fdfcff;
20+
--on-background: #1a1c1e;
21+
--surface: #faf9fc;
22+
--on-surface: #1a1c1e;
23+
--surface-variant: #dfe2eb;
24+
--on-surface-variant: #43474e;
25+
--outline: #73777f;
26+
--outline-variant: #c3c7cf;
27+
--shadow: #000000;
28+
--scrim: #000000;
29+
--inverse-surface: #2f3033;
30+
--inverse-on-surface: #f1f0f4;
31+
--inverse-primary: #9ecaff;
32+
--surface-dim: #dadadd;
33+
--surface-bright: #faf9fc;
34+
--surface-container-lowest: #ffffff;
35+
--surface-container-low: #f4f3f7;
36+
--surface-container: #eeedf1;
37+
--surface-container-high: #e8e8eb;
38+
--surface-container-highest: #e2e2e6;
39+
}
40+
141
body {
2-
font-family: 'open sans', arial, sans-serif;
42+
padding-top: 5px;
43+
}
44+
45+
.single-frame-container {
46+
height: 100dvh;
47+
display: flex;
48+
flex-direction: column;
49+
}
50+
51+
.main-heading {
352
text-align: center;
453
}
5-
.embeds-header {
6-
width: 100%;
7-
display: grid;
8-
grid-template-columns: repeat(3, 1fr);
54+
55+
.control-row {
56+
margin-top: 10px;
57+
display: flex;
58+
flex-direction: row;
59+
}
60+
61+
.control-column {
62+
margin-top: 10px;
63+
display: flex;
64+
flex-direction: column;
65+
align-items: flex-end;
66+
}
67+
68+
.link {
69+
text-decoration: underline;
70+
color: #0061a4;
71+
}
72+
73+
.pt-5 {
74+
padding-top: 5px;
75+
}
76+
77+
.pt-10 {
78+
padding-top: 10px;
79+
}
80+
81+
.py-10 {
82+
padding-left: 10px;
83+
padding-right: 10px;
84+
}
85+
86+
.center-button-container {
87+
display: flex;
88+
flex-direction: row;
89+
justify-content: center;
990
}
91+
92+
.hide {
93+
display: none;
94+
}
95+
96+
.flex-wrap {
97+
flex-wrap: wrap;
98+
}
99+
100+
.min-width-checkbox {
101+
min-width: 170px;
102+
}
103+
104+
#embed-container {
105+
flex-grow: 1;
106+
107+
> iframe {
108+
width: 100%;
109+
height: 100%;
110+
}
111+
}
112+
10113
.embed-container {
11-
background-color: whitesmoke;
12114
padding: 10px;
13115
display: grid;
14116
grid-template-columns: repeat(2, 1fr);
15117
grid-template-rows: repeat(auto-fill, 1fr);
16118
grid-gap: 10px;
17119
margin-top: 10px;
18120
}
121+
19122
@media (max-width: 1500px) {
20123
.embed-container {
21124
grid-template-columns: repeat(1, 1fr);
22125
grid-template-rows: repeat(auto-fill, 1fr);
23126
}
24127
}
25-
select {
26-
min-width: 150px;
27-
height: 25px;
28-
}
29-
button {
30-
min-width: 100px;
31-
height: 25px;
32-
}
33-
.loading-message {
34-
padding-top: 10px;
35-
}
36-
.embeds-controls {
37-
text-align: left;
38-
}
39-
.embeds-controls input {
40-
margin-right: 10px;
41-
}
42-
.embed-control {
43-
display: inline-block;
44-
width: 190px;
45-
}
46128

47-
.demo-link {
48-
text-align: right;
49-
}
50-
.embed-header {
51-
height: 65px;
52-
width: 100%;
53-
}
54-
.error-controls {
55-
height: 40px;
56-
width: 100%;
57-
}
58129
.looker-embed {
59130
width: 100%;
60131
height: 1200px;

demo/demo.py

Lines changed: 0 additions & 178 deletions
This file was deleted.

0 commit comments

Comments
 (0)