From 097d84b3c9b7a2b71349e99eb14a64611f01a56e Mon Sep 17 00:00:00 2001 From: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> Date: Thu, 7 May 2020 13:14:08 -0700 Subject: [PATCH] Added URL variables and changed content --- ...{link-dashboards.md => dashboard-links.md} | 2 +- docs/sources/linking/linking-overview.md | 18 ++++--- .../{link-panels.md => panel-links.md} | 22 +++++--- docs/sources/menu.yaml | 2 + docs/sources/variables/url-variables.md | 51 +++++++++++++++++++ 5 files changed, 80 insertions(+), 15 deletions(-) rename docs/sources/linking/{link-dashboards.md => dashboard-links.md} (99%) rename docs/sources/linking/{link-panels.md => panel-links.md} (65%) create mode 100644 docs/sources/variables/url-variables.md diff --git a/docs/sources/linking/link-dashboards.md b/docs/sources/linking/dashboard-links.md similarity index 99% rename from docs/sources/linking/link-dashboards.md rename to docs/sources/linking/dashboard-links.md index f29d79e8bf9..1dc391c6ffe 100644 --- a/docs/sources/linking/link-dashboards.md +++ b/docs/sources/linking/dashboard-links.md @@ -9,7 +9,7 @@ parent = "linking" weight = 1 +++ -# Link dashboards +# Dashboard links When you create a dashboard link, you can include the time range and current template variables to directly jump to the same context in another dashboard. This way, you don’t have to worry whether the person you send the link to is looking at the right data. diff --git a/docs/sources/linking/linking-overview.md b/docs/sources/linking/linking-overview.md index c4af0ab3dcc..63b2c8fec74 100644 --- a/docs/sources/linking/linking-overview.md +++ b/docs/sources/linking/linking-overview.md @@ -13,9 +13,7 @@ weight = 400 You can use links to navigate between commonly-used dashboards or to connect others to your visualizations. Links let you create shortcuts to other dashboards, panels, and even external websites. -Grafana supports three types of links: Dashboard Links, Panel Links, and Data Links. They are all available from your dashboard. - -{{< docs-imagebox img="/assets/img/blog/dashboard_links.png" max-width="800px" caption="Links Supported in Grafana" >}} +Grafana supports dashboard links and panel links. Dashboard links are displayed at the top of the dashboard. Panel links are accessible by clicking an icon on the top left corner of the panel. ## Which link should you use? @@ -23,6 +21,14 @@ Start by figuring out how you're currently navigating between dashboards. If you The next step is to figure out which link type is right for your workflow. Even though all the link types in Grafana are used to create shortcuts to other dashboards or external websites, they work in different contexts. -- If the link relates to most if not all of the panels in the dashboard, use a _dashboard link_. -- If you want to drill down into specific panels, use a _panel link_. -- If you want to drill down into a specific series, or even a single measurement, use a _data link_. +- If the link relates to most if not all of the panels in the dashboard, use [dashboard links]({{< relref "dashboard-links.md" >}}). +- If you want to drill down into specific panels, use [panel links]({{< relref "panel-links.md" >}}). +- If you want to link to an external site, you can use either type of link. + +## Controlling time range using URL + +You can control the time range of a panel or dashboard by providing following query parameters in dashboard URL: + +- `from` - defines lower limit of the time range, specified in ms epoch +- `to` - defines upper limit of the time range, specified in ms epoch +- `time` and `time.window` - defines a time range from `time-time.window/2` to `time+time.window/2`. Both params should be specified in ms. For example `?time=1500000000000&time.window=10000` will result in 10s time range from 1499999995000 to 1500000005000 \ No newline at end of file diff --git a/docs/sources/linking/link-panels.md b/docs/sources/linking/panel-links.md similarity index 65% rename from docs/sources/linking/link-panels.md rename to docs/sources/linking/panel-links.md index ebf7998f36c..04f1858e5f4 100644 --- a/docs/sources/linking/link-panels.md +++ b/docs/sources/linking/panel-links.md @@ -12,19 +12,25 @@ weight = 1 # Panel links -Each panel can have its own set of links that are shown in the upper left corner of the panel. You can link to any available URL, including dashboards, panels, or external sites. You can even [control the time range](https://grafana.com/docs/grafana/latest/reference/timerange/#controlling-time-range-using-url) to ensure the user is zoomed in on the right data in Grafana. +> **Note:** This documentation refers to the Grafana 7.0 beta UI. -Click the icon on the top left corner of a panel to see available panel links. To see an example of panel links in action, check out [this demo](https://play.grafana.org/d/000000156/dashboard-with-panel-link?orgId=1). +Each panel can have its own set of links that are shown in the upper left corner of the panel. You can link to any available URL, including dashboards, panels, or external sites. You can even control the time range to ensure the user is zoomed in on the right data in Grafana. + +Click the icon on the top left corner of a panel to see available panel links. + + ## Add a panel link 1. Hover your cursor over the panel that you want to add a link to and then press `e`. Or click the dropdown arrow next to the panel title and then click **Edit**. -2. Open the **General** tab in the panel settings and then scroll down to the Panel links section. -3. Click **Add link**. -4. Enter a **Title**. -5. If you want the link to open in a new tab, then select **Open in a new tab**. -6. Enter the **URL** you want to link to. - You can even add one of the template variables that are available. Press Ctrl+Space in the **URL** field to see the available variables. By adding template variables to your panel ink, the link sends the user to the right context, with the relevant variables already set. +1. On the Panel tab, scroll down to the Links section. +1. Expand Links and then click **Add link**. +1. Enter a **Title**. +1. Enter the **URL** you want to link to. + You can even add one of the template variables that are available. Press Ctrl+Space in the **URL** field to see the available variables. By adding template variables to your panel link, the link sends the user to the right context, with the relevant variables already set. +1. If you want the link to open in a new tab, then select **Open in a new tab**. +1. Click **Save** to save changes and close the window. +1. Click **Save** in the upper right to save your changes to the dashboard. ## Update a panel link diff --git a/docs/sources/menu.yaml b/docs/sources/menu.yaml index fc2c49c8279..d8b8e8bebc5 100644 --- a/docs/sources/menu.yaml +++ b/docs/sources/menu.yaml @@ -198,6 +198,8 @@ name: Overview - link: /variables/global-variables/ name: Global variables + - link: /variables/url-variables/ + name: URL variables - link: /variables/advanced-variable-format-options/ name: Advanced variable formats - link: /variables/repeat-panels-or-rows/ diff --git a/docs/sources/variables/url-variables.md b/docs/sources/variables/url-variables.md new file mode 100644 index 00000000000..7e482bfd87b --- /dev/null +++ b/docs/sources/variables/url-variables.md @@ -0,0 +1,51 @@ ++++ +title = "URL variables" +keywords = ["grafana", "url variables", "documentation", "variables"] +type = "docs" ++++ + +# URL variables + +You can use variables in URLs to link to specific portions of your visualizations. For more information about linking, refer to [Dashboard links]({{< relref "../linking/dashboard-links.md" >}}) and [Panel links]({{< relref "../linking/panel-links.md" >}}). + +> **Note:** These variables changed in 6.4 so if you have an older version of Grafana please use the version picker to select +docs for an older version of Grafana. + +## Typeahead suggestions + +Press Cmd+Space or Ctrl+Space on your keyboard to open the typeahead suggestions to more easily add variables to your URL. + +{{< docs-imagebox img="/img/docs/data_link_typeahead.png" max-width= "800px" >}} + +## Time variables + +* ``__url_time_range`` - current dashboard's time range (i.e. ``?from=now-6h&to=now``) +* ``__from`` - current dashboard's time range from value +* ``__to`` - current dashboard's time range to value + +## Series variables + +Series specific variables are available under ``__series`` namespace: + +* ``__series.name`` - series name to the URL +* ``__series.labels.