Skip to content

Commit 5bfab84

Browse files
author
Russ Garner
committed
initial commit
0 parents  commit 5bfab84

24 files changed

Lines changed: 29597 additions & 0 deletions

.DS_Store

6 KB
Binary file not shown.

.gitignore

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
.venv
2+
ssl/cert.key
3+
ssl/cert.pem
4+
config.ini
5+
6+
# dependencies
7+
/frontend/node_modules
8+
/.pnp
9+
.pnp.js
10+
11+
# testing
12+
/frontend/coverage
13+
14+
# production
15+
/frontend/build
16+
17+
# misc
18+
.DS_Store
19+
.env.local
20+
.env.development.local
21+
.env.test.local
22+
.env.production.local
23+
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
29+
# Byte-compiled / optimized / DLL files
30+
__pycache__/
31+
*.py[cod]
32+
*$py.class
33+
34+
# C extensions
35+
*.so
36+
37+
# Distribution / packaging
38+
.Python
39+
build/
40+
develop-eggs/
41+
dist/
42+
downloads/
43+
eggs/
44+
.eggs/
45+
lib/
46+
lib64/
47+
parts/
48+
sdist/
49+
var/
50+
wheels/
51+
share/python-wheels/
52+
*.egg-info/
53+
.installed.cfg
54+
*.egg
55+
MANIFEST
56+
57+
# PyInstaller
58+
# Usually these files are written by a python script from a template
59+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
60+
*.manifest
61+
*.spec
62+
63+
# Installer logs
64+
pip-log.txt
65+
pip-delete-this-directory.txt
66+
67+
# Unit test / coverage reports
68+
htmlcov/
69+
.tox/
70+
.nox/
71+
.coverage
72+
.coverage.*
73+
.cache
74+
nosetests.xml
75+
coverage.xml
76+
*.cover
77+
*.py,cover
78+
.hypothesis/
79+
.pytest_cache/
80+
cover/
81+
82+
# Translations
83+
*.mo
84+
*.pot
85+
86+
# Django stuff:
87+
*.log
88+
local_settings.py
89+
db.sqlite3
90+
db.sqlite3-journal
91+
92+
# Flask stuff:
93+
instance/
94+
.webassets-cache
95+
96+
# Scrapy stuff:
97+
.scrapy
98+
99+
# Sphinx documentation
100+
docs/_build/
101+
102+
# PyBuilder
103+
.pybuilder/
104+
target/
105+
106+
# Jupyter Notebook
107+
.ipynb_checkpoints
108+
109+
# IPython
110+
profile_default/
111+
ipython_config.py
112+
113+
# pyenv
114+
# For a library or package, you might want to ignore these files since the code is
115+
# intended to run in multiple environments; otherwise, check them in:
116+
# .python-version
117+
118+
# pipenv
119+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
120+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
121+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
122+
# install all needed dependencies.
123+
#Pipfile.lock
124+
125+
# poetry
126+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
127+
# This is especially recommended for binary packages to ensure reproducibility, and is more
128+
# commonly ignored for libraries.
129+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
130+
#poetry.lock
131+
132+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
133+
__pypackages__/
134+
135+
# Celery stuff
136+
celerybeat-schedule
137+
celerybeat.pid
138+
139+
# SageMath parsed files
140+
*.sage.py
141+
142+
# Environments
143+
.env
144+
.venv
145+
env/
146+
venv/
147+
ENV/
148+
env.bak/
149+
venv.bak/
150+
151+
# Spyder project settings
152+
.spyderproject
153+
.spyproject
154+
155+
# Rope project settings
156+
.ropeproject
157+
158+
# mkdocs documentation
159+
/site
160+
161+
# mypy
162+
.mypy_cache/
163+
.dmypy.json
164+
dmypy.json
165+
166+
# Pyre type checker
167+
.pyre/
168+
169+
# pytype static type analyzer
170+
.pytype/
171+
172+
# Cython debug symbols
173+
cython_debug/
174+
175+
# PyCharm
176+
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
177+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
178+
# and can be added to the global gitignore or merged into this file. For a more nuclear
179+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
180+
#.idea/

README

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
Step 1) Sorry I like to have a custom localhost domain!
3+
in your /etc/hosts add an entry for embed.demo.com
4+
127.0.0.1 embed.demo.com
5+
6+
Step 2) configure green ssl
7+
create an ssl cert pair named cert.pem and cert.key and place them under the /ssl folder
8+
I found this process worked for me on mac, with the latest browser updates. Green SSL is required for events
9+
https://eengstrom.github.io/musings/self-signed-tls-certs-v.-chrome-on-macos-catalina
10+
11+
12+
Step 3) configure looker
13+
ensure https://embed.demo.com:3000 is added to your looker's embed domain whitelist
14+
at <<yourlooker>>.cloud.looker.com/admin/embed
15+
16+
Step 4) fill out config.ini
17+
I left a config.ini.example with values in it to make it as clear as possible (avoiding little issues like trailing slashes)
18+
rename it to config.ini and put in your real values
19+
20+
Step 5) put in the correct host at
21+
frontend/src/components/dashboard.js line 14. this app does not put in the config.ini values onto the frontend
22+
23+
Step 5) install the dependencies
24+
pip install -r requirements.txt
25+
cd frontend
26+
npm install
27+
28+
Step 6) Run it!
29+
I didn't link them up into a single command, so you might need to open two shells
30+
python main.py
31+
cd frontend
32+
npm start
33+
34+
Now you should be redirected to https://embed.demo.com:3000 where you should see an embeded dashboard
35+
with an event that triggered a simple 'Successfully Loaded!' message
36+
37+
Step 7) Vary the user and URL generation methods as a test
38+
User:
39+
Since in your real application, the URL will need to be sensitive to the logged in user
40+
this demonstrates how the frontend's request will change what the user sees via the userToken
41+
passed in the headers. On frontend/src/components/dashboard.js you can change
42+
URL generation method:
43+
the /auth route uses local cryptography to produce the magic URL
44+
/auth2 uses an API call to looker
45+
you can change these routes in the init call on the page as an experiment
46+

0 commit comments

Comments
 (0)