Skip to content

Commit

Permalink
Update Business Text 5.1.0 (#704)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhail-vl authored Jul 1, 2024
1 parent 8757d90 commit 69d94bb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
16 changes: 7 additions & 9 deletions docs/volkovlabs-dynamictext-panel/code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ The Business Text Panel supports `context` starting from version 4.3.0.

:::

Starting from release 4.3.0, we allowed access to the panel data `panelData` and selected data frame `data` via a new object `context`.

In addition, we are actively working on refactoring existing JavaScript and Grafana parameters to include in the `context`.
Starting from release 4.3.0, we provide access to the panel data `panelData` and selected data frame `data` via a new object `context`.

Start typing the `context` word in the **Before Content Rendering** or **After Content Ready** boxes and see the latest list of all available features.

Expand All @@ -42,12 +40,12 @@ Start typing the `context` word in the **Before Content Rendering** or **After C
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `context.data` | Data from data sources. The display of one or multiple data rows from the selected data frame or from all data frames is determined by the **Render template** option. It can be one of three values: **Every Row**, **All Rows**, and **All data**. |
| `context.dataFrame` | Selected Data Frame for **Every Row**, **All Rows** templates |
| `context.grafana.eventBus` | Publish and subscribe to application events. Supported starting from the Business Text Panel 4.0.0. |
| `context.grafana.eventBus` | Publish and subscribe to application events. |
| `context.grafana.getLocale()` | Returns the user's locale: 'en', 'fr', 'es', and so on. |
| `context.grafana.locationService` | The `locationService` works with the browser location and history. Supported since the Business Text Panel 3.1.0. |
| `context.grafana.replaceVariables()` | The `replaceVariables()` function to interpolate variables. Supported since the Business Text Panel 3.1.0. |
| `context.grafana.timeRange` | Time range of the current dashboard. Supported since the Business Text Panel 3.1.0. |
| `context.grafana.timeZone` | Time zone of the current dashboard. Supported since the Business Text Panel 3.1.0. |
| `context.grafana.locationService` | The `locationService` works with the browser location and history. |
| `context.grafana.replaceVariables()` | The `replaceVariables()` function to interpolate variables. |
| `context.grafana.timeRange` | Time range of the current dashboard. |
| `context.grafana.timeZone` | Time zone of the current dashboard. |
| `context.handlebars` | Handlebars library. |
| `context.panelData` | Panel data. |

Expand Down Expand Up @@ -109,7 +107,7 @@ myFunc = () => {
```

<Image
title="Event handler."
title="JavaScript handler for button onclick event."
src="/img/plugins/volkovlabs-dynamictext-panel/event-handler.png"
/>

Expand Down
11 changes: 4 additions & 7 deletions docs/volkovlabs-dynamictext-panel/content.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The first is **Render Template** and the second is rendering order.

## Render Template

:::info Version
:::info All data

The Business Text Panel supports the **All data** template starting from version 4.3.0.

Expand All @@ -28,9 +28,8 @@ The Business Text Panel supports the **All data** template starting from version
The **Render Template** option instructs the Business Text plugin on how to apply your template to the fetched data frame.

- **Every row**. The template applies to every row returned by your query. Your template is rendered as many times as rows are fetched.
- **All rows**. The query results are passed as a single `data` field to the **Content** template. Your template is rendered once. To work with query results as a whole, you can use [#each built-in helper](../recipes/#iterate-through-all-fields-in-each-record) to iterate through records.

- **All data**. The template applies to all rows from the fetched data of all specified data frames.
- **All rows**. The query results from selected data frame are passed as a `data` field to the **Content** template. Your template is rendered once. To work with query results as a whole, you can use [#each built-in helper](../recipes/#iterate-through-all-fields-in-each-record) to iterate through records.
- **All data**. The query results from all data frames are passed as a `data` field to the Content template. Your template is rendered once.

| Render Template | Description |
| --------------- | ------------------------------------ |
Expand Down Expand Up @@ -95,7 +94,7 @@ With the **All rows** option selected, your template might look like this:

### All data and two other render templates

Below are the illustrations of all three **Render templates** created using data generated by the Static data source. Follow the order number in the comments, starting from 1.
Below are the illustrations of all three **Render templates** created using data generated by the Business Input data source. Follow the order number in the comments, starting from 1.

<Image
title="Render templates differences."
Expand Down Expand Up @@ -132,8 +131,6 @@ If your data looks like this:

You can reference it using the following code:

Please, modify the code according to my example above (blog and docs).

```handlebars
{{#each data.[0]}}
{{Metric}} - {{#with (lookup ../data.[1] @index)}}{{Attitude}}{{/with}}
Expand Down
9 changes: 3 additions & 6 deletions docs/volkovlabs-dynamictext-panel/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@ By working with the Business Text plugin you construct a text visualization temp
- using the above-mentioned features and
- indicating the spots where the fetched data frame elements should be placed.

Below is the last of three videos we created to demonstrate the possibilities of this plugin.
Please, note, that since the date the last video was published (August 15, 2023), we introduced many more features.

<Video
src="https://www.youtube.com/embed/AcQi-6GCrNU"
title="Use HTML, Markdown, JavaScript, and CSS in the Business Text Panel for Grafana."
src="https://www.youtube.com/embed/UVMysEjouNo"
title="Business Text Panel for Grafana. Main features overview."
/>

## Requirements
Expand Down Expand Up @@ -72,7 +69,7 @@ grafana-cli plugins install marcusolsson-dynamictext-panel
- Supports display of nested objects using the `{{json object}}` Handlebars helper.
- Supports display of time global variables (`__to` and `__from`) as seconds, ISO timestamps, or formatted using the `dayjs` library.
- Supports adding the Handlebars helpers and event handlers.
- Supports adding CSS styles with and without dashboard variables.
- Supports adding CSS styles with dashboard variables.
- Supports internationalization using custom helpers.

<Image
Expand Down
18 changes: 13 additions & 5 deletions docs/volkovlabs-dynamictext-panel/release.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,21 @@ import BlogPost from "@theme/BlogPost";

Release Notes for Business Text Panel.

## 5.1.0 (2024-07-01)

### Features / Enhancements

- Updated before render code async and pass markdown instance (#322)
- Added running e2e tests in docker (#323)
- Updated Video tutorial (#330)

## 5.0.0 (2024-06-06)

<BlogPost
href="/blog/dynamictext-panel-5.0.0-20240619/"
src="/img/blog/2024-06-19-dynamictext-panel-5.0.0/banner.png"
/>

### Breaking changes

- Requires Grafana 10 and Grafana 11.
Expand Down Expand Up @@ -41,11 +54,6 @@ Release Notes for Business Text Panel.
- Added Units and Decimal in panel options (#311)
- Updated to Grafana 11.0 and dependencies (#315)

<BlogPost
href="/blog/dynamictext-panel-5.0.0-20240619/"
src="/img/blog/2024-06-19-dynamictext-panel-5.0.0/banner.png"
/>

## 4.5.0 (2024-03-13)

### Features / Enhancements
Expand Down

0 comments on commit 69d94bb

Please sign in to comment.