@grafana/create-plugin 7.13.0 → 7.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/codemods/additions/additions.js +12 -0
- package/dist/codemods/additions/prompts/docs-content.md +119 -0
- package/dist/codemods/additions/scripts/docs-content.js +30 -0
- package/dist/codemods/additions/scripts/docs.js +250 -0
- package/dist/codemods/additions/scripts/experimental-app-sdk.js +15 -14
- package/dist/codemods/utils.agents.js +64 -0
- package/dist/codemods/utils.js +40 -7
- package/dist/codemods/utils.workflows.js +94 -0
- package/dist/utils/utils.cli.js +3 -2
- package/dist/utils/utils.handlebars.js +9 -2
- package/package.json +1 -1
- package/src/codemods/additions/additions.ts +12 -0
- package/src/codemods/additions/prompts/docs-content.md +119 -0
- package/src/codemods/additions/scripts/docs-content.test.ts +94 -0
- package/src/codemods/additions/scripts/docs-content.ts +32 -0
- package/src/codemods/additions/scripts/docs.test.ts +1037 -0
- package/src/codemods/additions/scripts/docs.ts +353 -0
- package/src/codemods/additions/scripts/experimental-app-sdk.test.ts +4 -3
- package/src/codemods/additions/scripts/experimental-app-sdk.ts +15 -15
- package/src/codemods/migrations/scripts/004-eslint9-flat-config.ts +1 -3
- package/src/codemods/utils.agents.test.ts +140 -0
- package/src/codemods/utils.agents.ts +81 -0
- package/src/codemods/utils.test.ts +23 -0
- package/src/codemods/utils.ts +29 -7
- package/src/codemods/utils.workflows.test.ts +153 -0
- package/src/codemods/utils.workflows.ts +140 -0
- package/src/utils/utils.cli.ts +2 -1
- package/src/utils/utils.handlebars.ts +9 -0
- package/templates/app-sdk/.config/app-sdk/generate-kinds.mjs +1 -1
- package/templates/docs/common/workflows/validate-docs.yml +52 -0
- package/templates/docs/panel/docs/AGENTS.md +107 -0
- package/templates/docs/panel/docs/CLAUDE.md +1 -0
- package/templates/docs/panel/docs/README.md +20 -0
- package/templates/docs/panel/docs/data-formats.md +27 -0
- package/templates/docs/panel/docs/examples.md +35 -0
- package/templates/docs/panel/docs/index.md +26 -0
- package/templates/docs/panel/docs/options.md +53 -0
- package/templates/docs/panel/docs/troubleshooting.md +35 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Examples
|
|
3
|
+
description: "Worked examples of the {{{yamlEscape pluginName}}} panel."
|
|
4
|
+
sidebar_position: 4
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
To use an example, open your dashboard and go to **Dashboard settings** > **JSON Model**. Paste the excerpt into the `panels` array and click **Save changes**.
|
|
8
|
+
|
|
9
|
+
<!-- section-brief
|
|
10
|
+
Fill this in: Show concrete examples of {{{pluginName}}} configured for real use cases. When the repo has panels of this plugin's type in `provisioning/dashboards/*.json`, take the examples from those before inventing any. Express each example as a `dashboard.json` panel excerpt: `type` and `options`, plus `fieldConfig` and `targets` when the example depends on them. Leave out `id`, `gridPos`, `pluginVersion`, datasource UIDs and timestamps - they are specific to one dashboard and hide the settings that matter. Pair each example with a screenshot of the rendered visualization.
|
|
11
|
+
|
|
12
|
+
If the repo ships a complete dashboard, for example under `provisioning/dashboards/`, link to it for readers who want the full JSON. Use the file's `https://` URL in your repository - relative links can't point outside the docs folder.
|
|
13
|
+
-->
|
|
14
|
+
|
|
15
|
+
## Basic example
|
|
16
|
+
|
|
17
|
+
A panel excerpt in dashboard JSON has this shape:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"type": "{{pluginId}}",
|
|
22
|
+
"options": {},
|
|
23
|
+
"targets": []
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
<!-- section-brief
|
|
28
|
+
Fill this in: Complete the excerpt above as the minimum viable {{{pluginName}}} configuration: the smallest `panels[]` entry that produces a meaningful visualization. Include only the settings it needs, plus a sample query in `targets` if the panel reads data. If the panel doesn't read data, remove `targets` from the excerpt. Pair with a screenshot of the result.
|
|
29
|
+
-->
|
|
30
|
+
|
|
31
|
+
## Common variations
|
|
32
|
+
|
|
33
|
+
<!-- section-brief
|
|
34
|
+
Fill this in: Show 1-3 alternate configurations that cover the most common ways dashboard authors use {{{pluginName}}} - different data shapes, option combinations, or display modes. Each variation is an excerpt showing only the settings that differ from the basic example, plus a screenshot. Explain in one line what each variation demonstrates.
|
|
35
|
+
-->
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Introduction
|
|
3
|
+
description: "Where to start and what to read next in the {{{yamlEscape pluginName}}} docs."
|
|
4
|
+
sidebar_position: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- section-brief
|
|
8
|
+
Fill this in: Write a short orientation for someone who already has {{{pluginName}}} installed and landed here from the Documentation tab. One or two sentences on what this section covers and how it's organized. Do not restate what the plugin does, its feature list, or its requirements - that's the README's job on the Overview tab, and this reader has already seen it there. Do not list every page in this folder either - the sidebar already does that; use prose to say what to read first and why.
|
|
9
|
+
-->
|
|
10
|
+
|
|
11
|
+
## Recommended path
|
|
12
|
+
|
|
13
|
+
<!-- section-brief
|
|
14
|
+
Fill this in: Give a short, ordered reading path for someone new to {{{pluginName}}} - two or three sentences, not a repeat of the sidebar. Point out the one or two pages most people need first and why, e.g. "Start with **Data formats** to shape your query results, then **Options** to configure the panel."
|
|
15
|
+
-->
|
|
16
|
+
|
|
17
|
+
## Common tasks
|
|
18
|
+
|
|
19
|
+
- [Shape your query results for {{{pluginName}}}](./data-formats.md)
|
|
20
|
+
- [Configure panel and field options](./options.md)
|
|
21
|
+
- [See worked dashboard.json examples](./examples.md)
|
|
22
|
+
- [Fix a panel that isn't rendering correctly](./troubleshooting.md)
|
|
23
|
+
|
|
24
|
+
<!-- section-brief
|
|
25
|
+
Fill this in: Keep the list above and adapt it to {{{pluginName}}}'s actual entry points - add, remove or reword tasks so each one matches a real job a user comes here to do. If you remove a page, remove its task too. This is a curated set of jobs, not a mechanical list of every file in this folder.
|
|
26
|
+
-->
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Options
|
|
3
|
+
description: "Reference for {{{yamlEscape pluginName}}} panel options."
|
|
4
|
+
sidebar_position: 3
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
To change these options, edit the panel and use the options pane.
|
|
8
|
+
|
|
9
|
+
<!-- section-brief
|
|
10
|
+
Fill this in: Reference the options {{{pluginName}}} exposes in the panel editor. Cover both the custom options the panel adds (via `setPanelOptions` in source) and the standard field options it enables (via `useFieldConfig`). Skip the sections below that don't apply to this panel - if there's no Standard field options block, no Tooltip and legend section etc., remove those headings entirely rather than leaving an empty brief.
|
|
11
|
+
|
|
12
|
+
Do not redocument the framework-level standard options themselves (Min, Max, Unit, etc.) - Grafana's own docs cover those. The Standard field options section lists which ones are enabled, nothing more.
|
|
13
|
+
-->
|
|
14
|
+
|
|
15
|
+
## Panel options
|
|
16
|
+
|
|
17
|
+
<!-- section-brief
|
|
18
|
+
Fill this in: Emit a markdown table with these columns - one row per option registered through `setPanelOptions` in `src/module.ts`. Match the Grafana built-in panel docs style: https://grafana.com/docs/grafana/latest/visualizations/panels-visualizations/visualizations/logs/#logs-options
|
|
19
|
+
|
|
20
|
+
| Option | Type | Default | Description |
|
|
21
|
+
| ------ | ---- | ------- | ----------- |
|
|
22
|
+
|
|
23
|
+
- _Option_: the `name` value from the `setPanelOptions` `.add*({...})` call, verbatim.
|
|
24
|
+
- _Type_: a short label for the editor the option uses, derived from the builder method (`addBooleanSwitch` → Toggle, `addSelect` → Select, `addNumberInput` → Number, `addFieldNamePicker` → Field picker). For a custom editor, name what it is, such as Color picker, rather than writing Custom.
|
|
25
|
+
- _Default_: the value a reader sees in the panel editor, rendered as inline code. Resolve enum members, constants and translation calls to that value - `ClockMode.time` becomes `Time`. Keep the source expression only when it can't be resolved. When there is no default but the code falls back to a value while the option is unset, give that fallback value. Leave the cell empty only when there is neither.
|
|
26
|
+
- _Description_: the `description` value, verbatim. If the verbatim text causes a `docs:validate` warning, reword it as little as possible and keep its meaning. When source has none, write one short sentence describing what the option does, based on how the panel code uses it. Don't guess beyond what the code shows.
|
|
27
|
+
|
|
28
|
+
If the panel does not call `setPanelOptions`, remove this section entirely.
|
|
29
|
+
-->
|
|
30
|
+
|
|
31
|
+
## Standard field options
|
|
32
|
+
|
|
33
|
+
For what each standard option does, refer to [Configure standard options](https://grafana.com/docs/grafana/latest/panels-visualizations/configure-standard-options/).
|
|
34
|
+
|
|
35
|
+
<!-- section-brief
|
|
36
|
+
Fill this in: A bulleted list of the standard field options this panel enables - the entries from `useFieldConfig({ standardOptions: [...] })` in `src/module.ts`. If the panel calls `useFieldConfig()` or `useFieldConfig({})` without a `standardOptions` key, document this as "all standard options are enabled" and list the standard set.
|
|
37
|
+
|
|
38
|
+
If the panel does not call `useFieldConfig` at all, remove this section entirely, including the link above.
|
|
39
|
+
-->
|
|
40
|
+
|
|
41
|
+
## Custom field options
|
|
42
|
+
|
|
43
|
+
<!-- section-brief
|
|
44
|
+
Fill this in: A table with the same shape as Panel options (Option / Type / Default / Description) but for the per-field overrides registered via `useFieldConfig({ useCustomConfig: builder => ... })`. These appear under the Overrides picker in the panel editor.
|
|
45
|
+
|
|
46
|
+
If the panel does not register custom field options, remove this section entirely.
|
|
47
|
+
-->
|
|
48
|
+
|
|
49
|
+
## Tooltip and legend options
|
|
50
|
+
|
|
51
|
+
<!-- section-brief
|
|
52
|
+
Fill this in: Describe the tooltip and legend options {{{pluginName}}} exposes: hover behavior, the fields the tooltip shows and its formatting, and legend placement, values and calculations. Most of these already appear in the Panel options table above when they're registered via `setPanelOptions` with `category: ['Tooltip']` or `category: ['Legend']`, so use this section only for narrative context that doesn't fit in a table row. Remove this section if there is nothing extra to say beyond the table.
|
|
53
|
+
-->
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Troubleshooting
|
|
3
|
+
description: "Troubleshoot the {{{yamlEscape pluginName}}} panel."
|
|
4
|
+
sidebar_position: 5
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This page explains how to fix common issues when you use the {{{pluginName}}} panel. For the data the panel expects, refer to [Data formats](./data-formats.md).
|
|
8
|
+
|
|
9
|
+
<!-- section-brief
|
|
10
|
+
Fill this in: Replace this brief with one H2 per real failure mode, such as "Panel shows no data", "Wrong field selected" or "Rendering errors". Open each H2 with the symptom users see, then give the most likely cause and the steps to resolve it. Remove this brief and add nothing if there are no real failures to report.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
## Get more detail about an error
|
|
14
|
+
|
|
15
|
+
To see the data the panel receives, open the panel editor, click **Query inspector** and select the **Data** tab.
|
|
16
|
+
|
|
17
|
+
For errors in the panel itself, open the developer tools in your browser and check the console.
|
|
18
|
+
|
|
19
|
+
## Get additional help
|
|
20
|
+
|
|
21
|
+
If this page doesn't solve your problem:
|
|
22
|
+
|
|
23
|
+
- Search the [Grafana community forums](https://community.grafana.com/).
|
|
24
|
+
- If your Grafana Cloud or Grafana Enterprise plan includes support, contact Grafana Support.
|
|
25
|
+
|
|
26
|
+
<!-- section-brief
|
|
27
|
+
Fill this in: Add links to the plugin's issue tracker to the list above.
|
|
28
|
+
-->
|
|
29
|
+
|
|
30
|
+
When you report an issue, include:
|
|
31
|
+
|
|
32
|
+
- The Grafana and plugin versions.
|
|
33
|
+
- The error message, with sensitive information removed.
|
|
34
|
+
- The steps to reproduce the issue.
|
|
35
|
+
- The panel options and a sample of the data it shows, with sensitive information removed.
|