Skip to content
Snippets Groups Projects
Commit d0e0b9a1 authored by Cam Saül's avatar Cam Saül
Browse files

Merge branch 'master' into caching

parents 10655808 94bedbc1
No related branches found
No related tags found
No related merge requests found
Showing
with 135 additions and 13 deletions
#!/usr/bin/env bash
VERSION="v0.23.0-snapshot"
VERSION="v0.24.0-snapshot"
# dynamically pull more interesting stuff from latest git commit
HASH=$(git show-ref --head --hash=7 head) # first 7 letters of hash should be enough; that's what GitHub uses
......
## Sharing and embedding dashboards or questions
Sometimes you'll want to share a dashboard or question you've saved with someone that isn't a part of your organization or company, or someone who doesn't need access to your full Metabase instance. Metabase lets administrators create public links and simple embeds to let you do just that.
### Turning public links on
![Enable public sharing](images/public-links/enable-public-sharing.png)
First things first, you'll need to go to the Admin Panel and enable public sharing. In the future, you'll see dashboards and questions you've shared listed here, and you'll be able to revoke any public links that you no longer want to be used.
### Enable sharing on your dashboard or saved question
![Enable sharing](images/public-links/enable-links.png)
Next, exit the Admin Panel and go to the dashboard or question that you want to share, then click on the `Sharing and Embedding` icon in the top-right of the screen (it looks like a box with an arrow pointing up). Then click on the toggle to enable public sharing for this dashboard or question.
### Copy, paste, and share!
Now just copy and share the public link URL with whomever you please. If you want to embed your dashboard or question in a simple web page or blog post, then copy and paste the iframe snippet to your destination of choice.
If you're trying to do more complex, integrated embedding in your own web application, then you can check out the [documentation for that feature](13-embedding.md).
## Embedding Metabase in other applications
Metabase includes a powerful application embedding feature that allows you to embed your saved questions or dashboards in your own web applications. You can even pass parameters to these embeds to customize them for different users.
### Key Concepts
#### Applications
An important distinction to keep in mind is the difference between Metabase and the embedding application. The charts and dashboards you will be embedding live in the Metabase application, and will be embedded in your application (i.e. the embedding application).
#### Parameters
Some dashboards and questions have the ability to accept parameters. In dashboards, these are synonymous with dashboard filters. For example, if you have a dashboard with a filter on Publisher ID, this can be specified as a parameter when embedding, so that you could insert the dashboard filtered down to a specific Publisher ID.
SQL based questions with template variables can also accept parameters for each variable. So for a query like
```
SELECT count(*)
FROM orders
WHERE product_id = {{productID}}
```
you could specify a specific productID when embedding the question.
#### Signed parameters
In general, when embedding a chart or dashboard, the server of your embedding application will need to sign a request for that resource.
If you choose to sign a specific parameter value, that means the user can't modify that, nor is a filter widget displayed for that parameter. For example, if the "Publisher ID" is assigned a value and the request signed, that means the front-end client that renders that dashboard on behalf of a given logged-in user can only see information for that publisher ID.
### Enabling embedding
To enable embedding, go to the Admin Panel and under Settings, go to the "Embedding in other applications" tab. From there, click "Enable." Here you will see a secret signing key you can use later to sign requests. If you ever need to invalidate that key and generate a new one, just click on "Regenerate Key".
![Enabling Embedding](images/embedding/01-enabling.png)
You can also see all questions and dashboards that have been marked as "Embeddable" here, as well as revoke any questions or dashboards that should no longer be embeddable in other applications.
Once you've enabled the embedding feature on your Metabase instance, you should then go to the individual questions and dashboards you wish to embed to set them up for embedding.
### Embedding Charts and Dashboards
To mark a given question or dashboard, click on the sharing icon
![Share icon](images/embedding/02-share-icon.png)
Then select "Embed this question in an application"
![Enable sharing for a question](images/embedding/03-enable-question.png)
Here you will see a preview of the question or dashboard as it will appear in your application, as well as a panel that shows you the code you will need to insert in your application.
![Preview](images/embedding/04-preview.png)
Importantly, you will need to hit "Publish" when you first set up a chart or dashboard for embedding and each time you change your embedding settings. Also, any changes you make to the resource might require you to update the code in your own application to the latest code sample in the "Code Pane".
![Code samples for embedding](images/embedding/05-code.png)
We provide code samples for common front end template languages as well as some common back-end web frameworks and languages. You may also use these as starting points for writing your own versions in other platforms.
### Embedding Charts and Dashboards with locked parameters
If you wish to have a parameter locked down to prevent your embedding application's end users from seeing other users' data, you can mark parameters as "Locked."Once a parameter is marked as Locked, it is not displayed as a filter widget, and must be set by the embedding application's server code.
![Locked parameters](images/embedding/06-locked.png)
### Reference applications
To see concrete examples of how to embed Metabase in applications under a number of common frameworks, check out our [reference implementations](https://github.com/metabase/embedding-reference-apps) on Github.
## That’s it!
If you still have questions, or want to share Metabase tips and tricks, head over to our [discussion board](http://discourse.metabase.com/). See you there!
docs/administration-guide/images/embedding/01-enabling.png

57.1 KiB

docs/administration-guide/images/embedding/02-share-icon.png

4.63 KiB

docs/administration-guide/images/embedding/03-enable-question.png

63.9 KiB

docs/administration-guide/images/embedding/04-preview.png

62.7 KiB

docs/administration-guide/images/embedding/05-code.png

104 KiB

docs/administration-guide/images/embedding/06-locked.png

31 KiB

docs/administration-guide/images/public-links/enable-links.png

30.1 KiB

docs/administration-guide/images/public-links/enable-public-sharing.png

33.8 KiB

......@@ -15,6 +15,8 @@ Are you in charge of managing Metabase for your organization? Then you're in the
* [Setting up Slack integration](09-setting-up-slack.md)
* [Enabling single sign-on with Google](10-single-sign-on.md)
* [Creating a Getting Started Guide for your team](11-getting-started-guide.md)
* [Sharing dashboards and questions with public links](12-public-links.md)
* [Embedding Metabase in other Applications](13-embedding.md)
First things first, you'll need to install Metabase. If you haven’t done that yet, our [Installation Guide](../operations-guide/start.md#installing-and-running-metabase) will help you through the process.
......
## Sharing Your Questions and Answers
## Sharing your questions and answers
---
### How to Save a Question
### How to save a question
Whenever you’ve arrived at an answer that you want to save for later, click the **SAVE** button in the top right of the screen. This will also save the visualization option you’ve chosen for your answer.
![savebutton](images/SaveButton.png)
......@@ -11,7 +11,12 @@ A pop-up box will appear, you to give your question a name and a description. We
Now, whenever you want to refer to your question again you can find it in the saved questions list by clicking on the **Questions** link from the main navigation. To edit your question, go to it and click the pencil icon in the top-right.
### Organizing and Finding your Saved Questions
### Sharing questions with public links
If your Metabase administrator has enabled [public sharing](../administration-guide/12-public-links.md) on a saved question or dashboard, you can go to that question or dashboard and click on the sharing icon to find its public links. Public links can be viewed by anyone, even if they don't have access to Metabase. You can also use the public embedding code to embed your question or dashboard in a simple web page or blog post.
![Share icon](images/share-icon.png)
### Organizing and finding your saved questions
After your team has been using Metabase for a while, you’ll probably end up with lots of saved questions. The Questions page has several tools that’ll help you organize things and find what you’re looking for.
![Questions](images/saved-questions.png)
......@@ -45,5 +50,5 @@ Clicking on the icon to the left of questions let's you select several at once s
---
## Next: Creating dashboards
## Next: creating dashboards
Next, we'll learn about [creating dashboards and adding questions to them](06-dashboards.md).
......@@ -61,6 +61,11 @@ Enabling auto refresh will re-run all the queries on the dashboard at the interv
Combining fullscreen mode and auto refresh is a great way to keep your team in sync with your data throughout the day.
## Sharing dashboards with public links
If your Metabase administrator has enabled [public sharing](../administration-guide/12-public-links.md) on a saved question or dashboard, you can go to that question or dashboard and click on the sharing icon to find its public links. Public links can be viewed by anyone, even if they don't have access to Metabase. You can also use the public embedding code to embed your question or dashboard in a simple web page or blog post.
![Share icon](images/share-icon.png)
### Configuring a dashboard through its URL
It is possible to amend URL of the dashboard to automatically enter fullscreen, enable night mode or auto-refresh the dashboard. This allows you to configure the dashboard even when you do not have any input access to the device where the dashboard will be displayed, like scripted screens, for example.
......
......@@ -58,3 +58,4 @@ WHERE True
## That’s it!
If you still have questions, or want to share Metabase tips and tricks, head over to our [discussion board](http://discourse.metabase.com/). See you there!
docs/users-guide/images/share-icon.png

4.63 KiB

import React from 'react';
import MetabaseAnalytics from 'metabase/lib/analytics';
const EmbeddingLegalese = ({ updateSetting }) =>
<div className="bordered rounded text-measure p4">
......@@ -14,7 +15,15 @@ const EmbeddingLegalese = ({ updateSetting }) =>
If you want to hide the Metabase logo inside your own application we'd love to get in touch.
</p> */}
<div className="flex layout-centered mt4">
<button className="Button Button--primary" onClick={() => updateSetting(true)}>Enable</button>
<button
className="Button Button--primary"
onClick={() => {
MetabaseAnalytics.trackEvent("Admin Embed Settings", "Embedding Enable Click");
updateSetting(true);
}}
>
Enable
</button>
</div>
</div>
......
......@@ -11,6 +11,8 @@ import LoadingAndErrorWrapper from "metabase/components/LoadingAndErrorWrapper";
import { CardApi, DashboardApi } from "metabase/services";
import Urls from "metabase/lib/urls";
import MetabaseAnalytics from "metabase/lib/analytics";
type PublicLink = {
id: string,
name: string,
......@@ -23,6 +25,7 @@ type Props = {
getUrl: (link: PublicLink) => string,
getPublicUrl: (link: PublicLink) => string,
noLinksMessage: string,
type: string
};
type State = {
......@@ -64,6 +67,10 @@ export default class PublicLinksListing extends Component<*, Props, State> {
}
}
trackEvent(label: string) {
MetabaseAnalytics.trackEvent(`Admin ${this.props.type}`, label)
}
render() {
const { getUrl, getPublicUrl, revoke, noLinksMessage } = this.props;
let { list, error } = this.state;
......@@ -91,13 +98,23 @@ export default class PublicLinksListing extends Component<*, Props, State> {
{ list && list.map(link =>
<tr>
<td>
<Link to={getUrl(link)}>
<Link
to={getUrl(link)}
onClick={() =>
this.trackEvent('Entity Link Clicked')
}
>
{link.name}
</Link>
</td>
{ getPublicUrl &&
<td>
<ExternalLink href={getPublicUrl(link)}>
<ExternalLink
href={getPublicUrl(link)}
onClick={() =>
this.trackEvent('Public Link Clicked')
}
>
{getPublicUrl(link)}
</ExternalLink>
</td>
......@@ -107,7 +124,10 @@ export default class PublicLinksListing extends Component<*, Props, State> {
<Confirm
title="Disable this link?"
content="They won't work any more, and can't be restored, but you can create new links."
action={() => this.revoke(link)}
action={() => {
this.revoke(link)
this.trackEvent('Revoked link')
}}
>
<Icon
name="close"
......@@ -130,6 +150,7 @@ export const PublicLinksDashboardListing = () =>
<PublicLinksListing
load={DashboardApi.listPublic}
revoke={DashboardApi.deletePublicLink}
type='Public Dashboard Listing'
getUrl={({ id }) => Urls.dashboard(id)}
getPublicUrl={({ public_uuid }) => window.location.origin + Urls.publicDashboard(public_uuid)}
noLinksMessage="No dashboards have been publicly shared yet."
......@@ -139,6 +160,7 @@ export const PublicLinksQuestionListing = () =>
<PublicLinksListing
load={CardApi.listPublic}
revoke={CardApi.deletePublicLink}
type='Public Card Listing'
getUrl={({ id }) => Urls.card(id)}
getPublicUrl={({ public_uuid }) => window.location.origin + Urls.publicCard(public_uuid)}
noLinksMessage="No questions have been publicly shared yet."
......@@ -148,6 +170,7 @@ export const EmbeddedDashboardListing = () =>
<PublicLinksListing
load={DashboardApi.listEmbeddable}
getUrl={({ id }) => Urls.dashboard(id)}
type='Embedded Dashboard Listing'
noLinksMessage="No dashboards have been embedded yet."
/>;
......@@ -155,5 +178,6 @@ export const EmbeddedQuestionListing = () =>
<PublicLinksListing
load={CardApi.listEmbeddable}
getUrl={({ id }) => Urls.card(id)}
type='Embedded Card Listing'
noLinksMessage="No questions have been embedded yet."
/>;
......@@ -78,9 +78,8 @@ export default class SettingsEditorApp extends Component {
}
this.refs.layout.setSaved();
let val = (setting.key === "report-timezone" || setting.key === "anon-tracking-enabled") ? setting.value : "success";
MetabaseAnalytics.trackEvent("General Settings", setting.display_name, val);
let val = (setting.key === "report-timezone" || setting.type === "boolean") ? setting.value : "success";
MetabaseAnalytics.trackEvent("General Settings", setting.display_name || setting.key, val);
} catch (error) {
let message = error && (error.message || (error.data && error.data.message));
this.refs.layout.setSaveError(message);
......
......@@ -3,7 +3,6 @@ import { createSelector } from "reselect";
import MetabaseSettings from "metabase/lib/settings";
import { slugify } from "metabase/lib/formatting";
import CustomGeoJSONWidget from "./components/widgets/CustomGeoJSONWidget.jsx";
import {
PublicLinksDashboardListing,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment