From f4b0b5e45ac65b5e8c946e65d3606595111204af Mon Sep 17 00:00:00 2001 From: Jack Baldry Date: Fri, 14 Jun 2024 17:27:04 +0100 Subject: [PATCH] [v10.3.x] Use ref URIs with the reference style links (#89241) Use ref URIs with the reference style links (#89204) * Use ref URIs with the reference style links If I remember correctly, the UI needs reference style links so it can substitute its own link destinations. ref URIs work both inline and as the destination for reference style links. * Remove unused ref URI * Remove unused Data frames link --------- (cherry picked from commit f5468542bae524202790988caf5c896f8281e7be) Signed-off-by: Jack Baldry --- .../transform-data/index.md | 77 ++++++++++--------- scripts/docs/generate-transformations.ts | 71 ++++++++++------- 2 files changed, 82 insertions(+), 66 deletions(-) diff --git a/docs/sources/panels-visualizations/query-transform-data/transform-data/index.md b/docs/sources/panels-visualizations/query-transform-data/transform-data/index.md index be312bc8e22..5ca0fa399be 100644 --- a/docs/sources/panels-visualizations/query-transform-data/transform-data/index.md +++ b/docs/sources/panels-visualizations/query-transform-data/transform-data/index.md @@ -42,46 +42,41 @@ title: Transform data description: Use transformations to rename fields, join series data, apply mathematical operations, and more weight: 100 refs: - configuration-file: - - pattern: /docs/grafana/ - destination: /docs/grafana//setup-grafana/configure-grafana/#configuration-file-location - - pattern: /docs/grafana-cloud/ - destination: /docs/grafana//setup-grafana/configure-grafana/#configuration-file-location - table-panel: - - pattern: /docs/grafana/ - destination: /docs/grafana//panels-visualizations/visualizations/table/ - - pattern: /docs/grafana-cloud/ - destination: /docs/grafana//panels-visualizations/visualizations/table/ - calculation-types: - - pattern: /docs/grafana/ - destination: /docs/grafana//panels-visualizations/query-transform-data/calculation-types/ - - pattern: /docs/grafana-cloud/ - destination: /docs/grafana-cloud/visualizations/panels-visualizations/query-transform-data/calculation-types/ - feature-toggle: - - pattern: /docs/grafana/ - destination: /docs/grafana//setup-grafana/configure-grafana/#feature_toggles - - pattern: /docs/grafana-cloud/ - destination: /docs/grafana//setup-grafana/configure-grafana/#feature_toggles - heatmap-panel: - - pattern: /docs/grafana/ - destination: /docs/grafana//panels-visualizations/visualizations/heatmap/ - - pattern: /docs/grafana-cloud/ - destination: /docs/grafana//panels-visualizations/visualizations/heatmap/ - time-series-panel: - - pattern: /docs/grafana/ - destination: /docs/grafana//panels-visualizations/visualizations/time-series/ - - pattern: /docs/grafana-cloud/ - destination: /docs/grafana//panels-visualizations/visualizations/time-series/ sparkline-cell-type: - pattern: /docs/grafana/ destination: /docs/grafana//panels-visualizations/visualizations/table/#sparkline - pattern: /docs/grafana-cloud/ destination: /docs/grafana//panels-visualizations/visualizations/table/#sparkline + calculation-types: + - pattern: /docs/grafana/ + destination: /docs/grafana//panels-visualizations/query-transform-data/calculation-types/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/visualizations/panels-visualizations/query-transform-data/calculation-types/ + configuration-file: + - pattern: /docs/grafana/ + destination: /docs/grafana//setup-grafana/configure-grafana/#configuration-file-location + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana//setup-grafana/configure-grafana/#configuration-file-location dashboard-variable: - pattern: /docs/grafana/ destination: docs/grafana//dashboards/variables/ - pattern: /docs/grafana-cloud/ destination: docs/grafana//dashboards/variables/ + feature-toggle: + - pattern: /docs/grafana/ + destination: /docs/grafana//setup-grafana/configure-grafana/#feature_toggles + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana//setup-grafana/configure-grafana/#feature_toggles + table-panel: + - pattern: /docs/grafana/ + destination: /docs/grafana//panels-visualizations/visualizations/table/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana//panels-visualizations/visualizations/table/ + time-series-panel: + - pattern: /docs/grafana/ + destination: /docs/grafana//panels-visualizations/visualizations/time-series/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana//panels-visualizations/visualizations/time-series/ --- # Transform data @@ -119,7 +114,7 @@ The following steps guide you in adding a transformation to data. This documenta 1. Click the **Transform** tab. 1. Click a transformation. A transformation row appears where you configure the transformation options. For more information about how to configure a transformation, refer to [Transformation functions](#transformation-functions). - For information about available calculations, refer to [Calculation types](ref:calculation-types). + For information about available calculations, refer to [Calculation types][]. 1. To apply another transformation, click **Add transformation**. This transformation acts on the result set returned by the previous transformation. {{< figure src="/static/img/docs/transformations/transformations-7-0.png" class="docs-image--no-shadow" max-width= "1100px" alt="Transform tab in the panel editor" >}} @@ -191,7 +186,7 @@ Use this transformation to add a new field calculated from two other fields. Eac - **Variance** - Calculates the moving variance. - **Row index** - Insert a field with the row index. - **Field name** - Select the names of fields you want to use in the calculation for the new field. -- **Calculation** - If you select **Reduce row** mode, then the **Calculation** field appears. Click in the field to see a list of calculation choices you can use to create the new field. For information about available calculations, refer to [Calculation types](ref:calculation-types). +- **Calculation** - If you select **Reduce row** mode, then the **Calculation** field appears. Click in the field to see a list of calculation choices you can use to create the new field. For information about available calculations, refer to [Calculation types][]. - **Operation** - If you select **Binary operation** or **Unary operation** mode, then the **Operation** fields appear. These fields allow you to apply basic math operations on values in a single row from selected fields. You can also use numerical values for binary operations. - **As percentile** - If you select **Row index** mode, then the **As percentile** switch appears. This switch allows you to transform the row index as a percentage of the total number of rows. - **Alias** - (Optional) Enter the name of your new field. If you leave this blank, then the field will be named to match the calculation. @@ -355,7 +350,7 @@ Consider the following dataset: | 1636678680000000000 | {"value": 5} | | 1636678620000000000 | {"value": 12} | -You could prepare the data to be used by a [Time series panel](ref:time-series-panel) with this configuration: +You could prepare the data to be used by a [Time series panel][] with this configuration: - Source: json_data - Format: JSON @@ -531,7 +526,7 @@ Click and uncheck the field names to remove them from the result. Fields that ar #### Use a dashboard variable -Enable 'From variable' to let you select a dashboard variable that's used to include fields. By setting up a [dashboard variable](ref:dashboard-variable) with multiple choices, the same fields can be displayed across multiple visualizations. +Enable 'From variable' to let you select a dashboard variable that's used to include fields. By setting up a [dashboard variable][] with multiple choices, the same fields can be displayed across multiple visualizations. {{< figure src="/static/img/docs/transformations/filter-name-table-before-7-0.png" class="docs-image--no-shadow" max-width= "1100px" alt="A table visualization with time, value, Min, and Max columns" >}} @@ -590,7 +585,7 @@ This transformation lets you tailor the time representation in your visualizatio ### Group by -Use this transformation to group the data by a specified field (column) value and process calculations on each group. Click to see a list of calculation choices. For information about available calculations, refer to [Calculation types](ref:calculation-types). +Use this transformation to group the data by a specified field (column) value and process calculations on each group. Click to see a list of calculation choices. For information about available calculations, refer to [Calculation types][]. Here's an example of original data. @@ -1306,11 +1301,11 @@ This transformation allows you to manipulate and analyze geospatial data, enabli ### Time series to table transform -Use this transformation to convert time series results into a table, transforming a time series data frame into a **Trend** field. The **Trend** field can then be rendered using the [sparkline cell type](ref:sparkline-cell-type), generating an inline sparkline for each table row. If there are multiple time series queries, each will result in a separate table data frame. These can be joined using join or merge transforms to produce a single table with multiple sparklines per row. +Use this transformation to convert time series results into a table, transforming a time series data frame into a **Trend** field. The **Trend** field can then be rendered using the [sparkline cell type][], generating an inline sparkline for each table row. If there are multiple time series queries, each will result in a separate table data frame. These can be joined using join or merge transforms to produce a single table with multiple sparklines per row. For each generated **Trend** field value, a calculation function can be selected. The default is **Last non-null value**. This value is displayed next to the sparkline and used for sorting table rows. -> **Note:** This transformation is available in Grafana 9.5+ as an opt-in beta feature. Modify the Grafana [configuration file](ref:configuration-file) to use it. +> **Note:** This transformation is available in Grafana 9.5+ as an opt-in beta feature. Modify the Grafana [configuration file][] to use it. ### Regression analysis @@ -1325,4 +1320,10 @@ There are two different models: > **Note:** This transformation is currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available. Enable the `regressionTransformation` feature toggle in Grafana to use this feature. Contact Grafana Support to enable this feature in Grafana Cloud. -[Data frames]: https://grafana.com/developers/plugin-tools/introduction/data-frames/ +[Table panel]: ref:table-panel +[Calculation types]: ref:calculation-types +[sparkline cell type]: ref:sparkline-cell-type +[configuration file]: ref:configuration-file +[Time series panel]: ref:time-series-panel +[feature toggle]: ref:feature-toggle +[dashboard variable]: ref:dashboard-variable diff --git a/scripts/docs/generate-transformations.ts b/scripts/docs/generate-transformations.ts index 0e9cabcb02c..7cc61c5cccd 100644 --- a/scripts/docs/generate-transformations.ts +++ b/scripts/docs/generate-transformations.ts @@ -47,6 +47,42 @@ labels: title: Transform data description: Use transformations to rename fields, join series data, apply mathematical operations, and more weight: 100 +refs: + sparkline-cell-type: + - pattern: /docs/grafana/ + destination: /docs/grafana//panels-visualizations/visualizations/table/#sparkline + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana//panels-visualizations/visualizations/table/#sparkline + calculation-types: + - pattern: /docs/grafana/ + destination: /docs/grafana//panels-visualizations/query-transform-data/calculation-types/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/visualizations/panels-visualizations/query-transform-data/calculation-types/ + configuration-file: + - pattern: /docs/grafana/ + destination: /docs/grafana//setup-grafana/configure-grafana/#configuration-file-location + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana//setup-grafana/configure-grafana/#configuration-file-location + dashboard-variable: + - pattern: /docs/grafana/ + destination: docs/grafana//dashboards/variables/ + - pattern: /docs/grafana-cloud/ + destination: docs/grafana//dashboards/variables/ + feature-toggle: + - pattern: /docs/grafana/ + destination: /docs/grafana//setup-grafana/configure-grafana/#feature_toggles + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana//setup-grafana/configure-grafana/#feature_toggles + table-panel: + - pattern: /docs/grafana/ + destination: /docs/grafana//panels-visualizations/visualizations/table/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana//panels-visualizations/visualizations/table/ + time-series-panel: + - pattern: /docs/grafana/ + destination: /docs/grafana//panels-visualizations/visualizations/time-series/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana//panels-visualizations/visualizations/time-series/ --- # Transform data @@ -133,34 +169,13 @@ You can perform the following transformations on your data. ${buildTransformationDocsContent(transformationDocsContent)} -{{% docs/reference %}} -[Table panel]: "/docs/grafana/ -> /docs/grafana//panels-visualizations/visualizations/table" -[Table panel]: "/docs/grafana-cloud/ -> /docs/grafana//panels-visualizations/visualizations/table" - -[Calculation types]: "/docs/grafana/ -> /docs/grafana//panels-visualizations/query-transform-data/calculation-types" -[Calculation types]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/visualizations/panels-visualizations/query-transform-data/calculation-types" - -[sparkline cell type]: "/docs/grafana/ -> /docs/grafana//panels-visualizations/visualizations/table#sparkline" -[sparkline cell type]: "/docs/grafana-cloud/ -> /docs/grafana//panels-visualizations/visualizations/table#sparkline" - -[Heatmap panel]: "/docs/grafana/ -> /docs/grafana//panels-visualizations/visualizations/heatmap" -[Heatmap panel]: "/docs/grafana-cloud/ -> /docs/grafana//panels-visualizations/visualizations/heatmap" - -[configuration file]: "/docs/grafana/ -> /docs/grafana//setup-grafana/configure-grafana#configuration-file-location" -[configuration file]: "/docs/grafana-cloud/ -> /docs/grafana//setup-grafana/configure-grafana#configuration-file-location" - -[Time series panel]: "/docs/grafana/ -> /docs/grafana//panels-visualizations/visualizations/time-series" -[Time series panel]: "/docs/grafana-cloud/ -> /docs/grafana//panels-visualizations/visualizations/time-series" - -[feature toggle]: "/docs/grafana/ -> /docs/grafana//setup-grafana/configure-grafana#feature_toggles" -[feature toggle]: "/docs/grafana-cloud/ -> /docs/grafana//setup-grafana/configure-grafana#feature_toggles" - -[dashboard variable]: "/docs/grafana/ -> docs/grafana//dashboards/variables" -[dashboard variable]: "/docs/grafana-cloud/ -> docs/grafana//dashboards/variables" - -{{% /docs/reference %}} - -[Data frames]: https://grafana.com/developers/plugin-tools/introduction/data-frames/ +[Table panel]: ref:table-panel +[Calculation types]: ref:calculation-types +[sparkline cell type]: ref:sparkline-cell-type +[configuration file]: ref:configuration-file +[Time series panel]: ref:time-series-panel +[feature toggle]: ref:feature-toggle +[dashboard variable]: ref:dashboard-variable `; function buildTransformationDocsContent(transformationDocsContent: TransformationDocsContentType) {