Skip to content

Commit 609e566

Browse files
Merge pull request #107 from metabase/restore-data
resintate db and fix templates
2 parents 7f59a21 + 5163384 commit 609e566

File tree

9 files changed

+359
-20
lines changed

9 files changed

+359
-20
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
*.pyc
2+
.DS_Store
3+
metabase/plugins

metabase/metabase.db.mv.db

272 KB
Binary file not shown.

metabase/metabase.db.trace.db

Lines changed: 343 additions & 0 deletions
Large diffs are not rendered by default.

node/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const PORT = process.env["PORT"] ? parseInt(process.env["PORT"]) : 3001;
66

77
// these should match the settings in your Metabase instance
88
let MB_SITE_URL = "http://localhost:3000";
9-
let MB_EMBEDDING_SECRET_KEY = "c39fcfd02abd76b0ad200d1eada354f136c383638dcfc189253b9b8e0dd13e46";
9+
let MB_EMBEDDING_SECRET_KEY = "a1c0952f3ff361f1e7dd8433a0a50689a004317a198ecb0a67ba90c73c27a958";
1010

1111
function checkAuth(req, res, next) {
1212
const userId = req.session.userId;

node/views/chart.pug

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ block content
88

99
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.
1010

11-
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
11+
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
1212

1313
pre.
1414
payload = {
@@ -22,7 +22,7 @@ block content
2222

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

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

2727
pre.
2828
<iframe
@@ -34,8 +34,8 @@ block content
3434
/></iframe>
3535

3636
a(href="/") Go back to a global view
37-
p
38-
This results in the below when put together
37+
38+
p The above code results should give you:
3939

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

node/views/dashboard.pug

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@ extends layout.pug
33
block content
44
h1 Embedding dashboards with signed parameters</h1>
55

6-
p
7-
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.
6+
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.
87

9-
p
10-
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.
8+
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.
119

12-
p
13-
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.
10+
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.
1411

15-
p
16-
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
12+
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
1713

1814

1915
pre.

node/views/index.pug

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ block content
44
div
55
article
66
h1 Embedding Metabase in a Node app
7-
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.
7+
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:
88
nav
99
a(href="#public") Public embedding
1010
a(href="#signed") Signed embedding
@@ -13,7 +13,7 @@ block content
1313

1414
section(id="public")
1515
h2 Public Embeds
16-
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.
16+
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.
1717

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

node/views/layout.pug

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ html
146146
border-radius: 2px;
147147
padding: 2rem;
148148
white-space: pre-wrap;
149+
overflow: scroll;
149150
}
150151
body
151152
div.container

node/views/public_dashboard.pug

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ extends layout.pug
33
block content
44
h1 Signed dashboards without parameters</h1>
55

6-
p
7-
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.
8-
9-
p
10-
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
6+
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.
117

8+
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.
129

1310
pre.
1411
payload = {

0 commit comments

Comments
 (0)