Skip to content

resintate db and fix templates #107

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

Merged
merged 1 commit into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.pyc
.DS_Store
metabase/plugins
Binary file added metabase/metabase.db.mv.db
Binary file not shown.
343 changes: 343 additions & 0 deletions metabase/metabase.db.trace.db

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const PORT = process.env["PORT"] ? parseInt(process.env["PORT"]) : 3001;

// these should match the settings in your Metabase instance
let MB_SITE_URL = "http://localhost:3000";
let MB_EMBEDDING_SECRET_KEY = "c39fcfd02abd76b0ad200d1eada354f136c383638dcfc189253b9b8e0dd13e46";
let MB_EMBEDDING_SECRET_KEY = "a1c0952f3ff361f1e7dd8433a0a50689a004317a198ecb0a67ba90c73c27a958";

function checkAuth(req, res, next) {
const userId = req.session.userId;
Expand Down
8 changes: 4 additions & 4 deletions node/views/chart.pug
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ block content

p The parameter is "User ID". This parameter marked as "Locked". This means that the embedding application's server process must specify a value and sign the request. This prevents an end user of the application from changing the url and seeing other user's charts or dashboards. There is no reference to this ID in the embedded iframe, and it is kept a secret from the end user.

p To embed this graph in a webpage (as below), you'll need to generate a url on the server by signing a dictionary specifying the resource and it's signed parameters as below
p To embed this graph in a webpage (as below), you'll need to generate a url on the server by signing a dictionary specifying the resource and its signed parameters as below

pre.
payload = {
Expand All @@ -22,7 +22,7 @@ block content

iframeUrl = METABASE_SITE_URL + "/embed/question/" + token + "#bordered=true"

p In the place you wish to embed the chart in your HTML, insert the below:
p In the place you want to embed the chart in your HTML, insert the below:

pre.
<iframe
Expand All @@ -34,8 +34,8 @@ block content
/></iframe>

a(href="/") Go back to a global view
p
This results in the below when put together

p The above code results should give you:

h1 Orders for User: #{userId}</h1>

Expand Down
12 changes: 4 additions & 8 deletions node/views/dashboard.pug
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ extends layout.pug
block content
h1 Embedding dashboards with signed parameters</h1>

p
This is an example of an embedded dashboard with signed parameters. Signed parameters are dashboard parameters that must be signed by the embedding application. This lets you do things like provide per-user dashboards.
p Signed parameters are dashboard parameters that must be signed by the embedding application. Signed parameters lets you do things like provide per-user dashboards.

p
In this example, the user stats dashboard has two parameters. The first, "Category" is marked as "editable" in the embedding settings for the "User Stats". This means the widget is displayed in the dashboard below and the end user of you application can interact with that widget.
p In this example, the user stats dashboard has two parameters. The first, "Category" is marked as "editable" in the embedding settings for the "User Stats". This means the widget is displayed in the dashboard below and the end user of you application can interact with that widget.

p
The second parameter is "User ID". This parameter marked as "Locked". This means that the embedding application's server process must specify a value and sign the request. This prevents an end user of the application from changing the url and seeing other user's charts or dashboards. There is no reference to this ID in the embedded iframe, and it is kept a secret from the end user.
p The second parameter is "User ID". This parameter marked as "Locked". This means that the embedding application's server process must specify a value and sign the request. This prevents an end user of the application from changing the url and seeing other user's charts or dashboards. There is no reference to this ID in the embedded iframe, and it is kept a secret from the end user.

p
To embed this dasbhoard in a webpage (as below), you'll need to generate a url on the server by signing a dictionary specifying the resource and it's signed parameters as below
p To embed this dasbhoard in a webpage (as below), you'll need to generate a url on the server by signing a dictionary specifying the resource and its signed parameters as below


pre.
Expand Down
4 changes: 2 additions & 2 deletions node/views/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ block content
div
article
h1 Embedding Metabase in a Node app
p By embedding Metabase, you can use Metabase charts and Dashboards within your application. You have two choices depending on the degree of security you need in your application.
p By embedding Metabase, you can use Metabase charts and Dashboards within your application. You can embed the entire Metabase application in your app (see our <a href='https://www.metabase.com/embedding-demo'> full-app embedding demo</a>). You can also embed standalone questions and dashboards in one of two ways, depending on the degree of security you need in your application:
nav
a(href="#public") Public embedding
a(href="#signed") Signed embedding
Expand All @@ -13,7 +13,7 @@ block content

section(id="public")
h2 Public Embeds
p One is to simply use the public link urls inside of an iframe. In this case, the same public dashboard you see via a <a href="http://localhost:3000/public/dashboard/e104be98-2ea1-4dce-abff-aa3cfeddfe40">Public Dashboard</a> link, is embedded directly in your application. This can also be embedded in a blog, or really anywhere that you can insert HTML. It has a secure URL in that a user can only look at the contents of the dashboard being shared. An end user never has information they can use to modify the url and gain access to any other resources on your Metabase instance. That same dashboard can be seen embedded in this page below.
p You can use the public link URLs inside of an iframe. In this case, the same public dashboard you see via a <a href="http://localhost:3000/public/dashboard/e104be98-2ea1-4dce-abff-aa3cfeddfe40">Public Dashboard</a> link, is embedded directly in your application, blog, or really anywhere that you can insert HTML. The iframe has a secure URL in that a user can only look at the contents of the dashboard being shared. An end user never has information they can use to modify the url and gain access to any other resources on your Metabase instance. That same dashboard can be seen embedded in this page below.

iframe(src="http://localhost:3000/public/dashboard/e104be98-2ea1-4dce-abff-aa3cfeddfe40" frameborder="0" width="800" height="600" allowtransparency)

Expand Down
1 change: 1 addition & 0 deletions node/views/layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ html
border-radius: 2px;
padding: 2rem;
white-space: pre-wrap;
overflow: scroll;
}
body
div.container
Expand Down
7 changes: 2 additions & 5 deletions node/views/public_dashboard.pug
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ extends layout.pug
block content
h1 Signed dashboards without parameters</h1>

p
This is an example of a signed embedded dashboard. We haven't signed any parameters, but we have signed the resource id (in this case dashboard 1). This is means that only application with the signing key are allowed to embed a Metabase resource (vs the public link which can be copy/pasted and shared). Signed embeds can also be set to have an expiration time, which further improves security.

p
To embed this dasbhoard in a webpage (as below), you'll need to generate a url on the server by signing a dictionary specifying the resource and it's signed parameters as below
p This is an example of a signed embedded dashboard. We haven't signed any parameters, but we have signed the resource id (in this case dashboard 1). This means that only application with the signing key are allowed to embed a Metabase resource (vs the public link which can be copy/pasted and shared). Signed embeds can also be set to have an expiration time, which further improves security.

p To embed this dasbhoard in a webpage (as below), you'll need to generate a url on the server by signing a dictionary specifying the resource and its signed parameters as below.

pre.
payload = {
Expand Down