@grafana/create-plugin 1.7.1 → 1.9.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 +33 -0
- package/package.json +2 -2
- package/templates/common/cypress.json +3 -0
- package/templates/common/package.json +2 -1
- package/templates/common/src/README.md +46 -1
- package/templates/scenes-app/src/pages/HelloWorld/helloWorldScene.tsx +2 -8
- package/templates/scenes-app/src/pages/Home/scenes.tsx +5 -5
- package/templates/scenes-app/src/pages/WithDrilldown/panels.tsx +90 -145
- package/templates/scenes-app/src/pages/WithDrilldown/scenes.tsx +3 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
# v1.9.0 (Tue Jul 11 2023)
|
|
2
|
+
|
|
3
|
+
#### 🚀 Enhancement
|
|
4
|
+
|
|
5
|
+
- Do not generate videos for cypress e2e tests [#302](https://github.com/grafana/plugin-tools/pull/302) ([@academo](https://github.com/academo))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Esteban Beltran ([@academo](https://github.com/academo))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# v1.8.0 (Tue Jul 11 2023)
|
|
14
|
+
|
|
15
|
+
:tada: This release contains work from a new contributor! :tada:
|
|
16
|
+
|
|
17
|
+
Thank you, Dominik Prokop ([@dprokop](https://github.com/dprokop)), for all your work!
|
|
18
|
+
|
|
19
|
+
#### 🚀 Enhancement
|
|
20
|
+
|
|
21
|
+
- Create Plugin: add readme best practice example [#298](https://github.com/grafana/plugin-tools/pull/298) ([@sympatheticmoose](https://github.com/sympatheticmoose))
|
|
22
|
+
|
|
23
|
+
#### 🐛 Bug Fix
|
|
24
|
+
|
|
25
|
+
- Create Plugin: Update scenes to latest version [#287](https://github.com/grafana/plugin-tools/pull/287) ([@dprokop](https://github.com/dprokop))
|
|
26
|
+
|
|
27
|
+
#### Authors: 2
|
|
28
|
+
|
|
29
|
+
- David Harris ([@sympatheticmoose](https://github.com/sympatheticmoose))
|
|
30
|
+
- Dominik Prokop ([@dprokop](https://github.com/dprokop))
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
1
34
|
# v1.7.0 (Wed Jul 05 2023)
|
|
2
35
|
|
|
3
36
|
#### 🚀 Enhancement
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/create-plugin",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">=16"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "f42baf3ba1e5ecb141aaa40319a64f2ab9fd23a2"
|
|
70
70
|
}
|
|
@@ -61,7 +61,8 @@
|
|
|
61
61
|
"@grafana/data": "{{ grafanaVersion }}",
|
|
62
62
|
"@grafana/runtime": "{{ grafanaVersion }}",
|
|
63
63
|
"@grafana/ui": "{{ grafanaVersion }}",{{#if_eq pluginType "scenesapp"}}
|
|
64
|
-
"@grafana/
|
|
64
|
+
"@grafana/schema": "10.0.1",
|
|
65
|
+
"@grafana/scenes": "^0.19.0",{{/if_eq}}
|
|
65
66
|
"react": "17.0.2",
|
|
66
67
|
"react-dom": "17.0.2",{{#if isAppType}}
|
|
67
68
|
"react-router-dom": "^5.2.0",
|
|
@@ -1,5 +1,50 @@
|
|
|
1
|
-
<!-- This README file is going to be the one displayed on the Grafana.com website for your plugin
|
|
1
|
+
<!-- This README file is going to be the one displayed on the Grafana.com website for your plugin. Uncomment and replace the content here before publishing.
|
|
2
2
|
|
|
3
|
+
Remove any remaining comments before publishing as these may be displayed on Grafana.com -->
|
|
3
4
|
# {{ titleCase pluginName }}
|
|
4
5
|
|
|
5
6
|
{{ sentenceCase pluginDescription }}
|
|
7
|
+
|
|
8
|
+
<!-- To help maximize the impact of your README and improve usability for users, we propose the following loose structure:
|
|
9
|
+
|
|
10
|
+
**BEFORE YOU BEGIN**
|
|
11
|
+
- Ensure all links are absolute URLs so that they will work when the README is displayed within Grafana and Grafana.com
|
|
12
|
+
- Be inspired ✨
|
|
13
|
+
- [grafana-polystat-panel](https://github.com/grafana/grafana-polystat-panel)
|
|
14
|
+
- [volkovlabs-variable-panel](https://github.com/volkovlabs/volkovlabs-variable-panel)
|
|
15
|
+
|
|
16
|
+
**ADD SOME BADGES**
|
|
17
|
+
|
|
18
|
+
Badges convey useful information at a glance for users whether in the Catalog or viewing the source code. You can use the generator on [Shields.io](https://shields.io/badges/dynamic-json-badge) together with the Grafana.com API
|
|
19
|
+
to create dynamic badges that update automatically when you publish a new version to the marketplace.
|
|
20
|
+
|
|
21
|
+
- For the logo field use 'grafana'.
|
|
22
|
+
- Examples (label: query)
|
|
23
|
+
- Downloads: $.downloads
|
|
24
|
+
- Catalog Version: $.version
|
|
25
|
+
- Grafana Dependency: $.grafanaDependency
|
|
26
|
+
- Signature Type: $.versionSignatureType
|
|
27
|
+
|
|
28
|
+
Full example: 
|
|
29
|
+
|
|
30
|
+
Consider other [badges](https://shields.io/badges) as you feel appropriate for your project.
|
|
31
|
+
|
|
32
|
+
## Overview / Introduction
|
|
33
|
+
Provide one or more paragraphs as an introduction to your plugin to help users understand why they should use it.
|
|
34
|
+
|
|
35
|
+
Consider including screenshots:
|
|
36
|
+
- in [plugin.json](https://grafana.com/docs/grafana/latest/developers/plugins/metadata/#info) include them as relative links.
|
|
37
|
+
- in the README ensure they are absolute URLs.
|
|
38
|
+
|
|
39
|
+
## Requirements
|
|
40
|
+
List any requirements or dependencies they may need to run the plugin.
|
|
41
|
+
|
|
42
|
+
## Getting Started
|
|
43
|
+
Provide a quick start on how to configure and use the plugin.
|
|
44
|
+
|
|
45
|
+
## Documentation
|
|
46
|
+
If your project has dedicated documentation available for users, provide links here. For help in following Grafana's style recommendations for technical documentation, refer to our [Writer's Toolkit](https://grafana.com/docs/writers-toolkit/).
|
|
47
|
+
|
|
48
|
+
## Contributing
|
|
49
|
+
Do you want folks to contribute to the plugin or provide feedback through specific means? If so, tell them how!
|
|
50
|
+
-->
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmbeddedScene, SceneFlexLayout, SceneFlexItem,
|
|
1
|
+
import { EmbeddedScene, SceneFlexLayout, SceneFlexItem, PanelBuilders } from '@grafana/scenes';
|
|
2
2
|
|
|
3
3
|
export function getScene() {
|
|
4
4
|
return new EmbeddedScene({
|
|
@@ -7,13 +7,7 @@ export function getScene() {
|
|
|
7
7
|
new SceneFlexItem({
|
|
8
8
|
width: '100%',
|
|
9
9
|
height: 300,
|
|
10
|
-
body:
|
|
11
|
-
title: 'Hello world panel',
|
|
12
|
-
pluginId: 'text',
|
|
13
|
-
options: {
|
|
14
|
-
content: 'Hello world! ',
|
|
15
|
-
},
|
|
16
|
-
}),
|
|
10
|
+
body: PanelBuilders.text().setTitle('Hello world panel').setOption('content', 'Hello world!').build(),
|
|
17
11
|
}),
|
|
18
12
|
],
|
|
19
13
|
}),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CustomVariable,
|
|
3
3
|
EmbeddedScene,
|
|
4
|
+
PanelBuilders,
|
|
4
5
|
SceneControlsSpacer,
|
|
5
6
|
SceneFlexItem,
|
|
6
7
|
SceneFlexLayout,
|
|
@@ -10,7 +11,6 @@ import {
|
|
|
10
11
|
SceneTimeRange,
|
|
11
12
|
SceneVariableSet,
|
|
12
13
|
VariableValueSelectors,
|
|
13
|
-
VizPanel,
|
|
14
14
|
} from '@grafana/scenes';
|
|
15
15
|
import { DATASOURCE_REF } from '../../constants';
|
|
16
16
|
import { CustomSceneObject } from './CustomSceneObject';
|
|
@@ -78,11 +78,11 @@ export function getBasicScene(templatised = true, seriesToShow = '__server_names
|
|
|
78
78
|
body: new SceneFlexLayout({
|
|
79
79
|
children: [
|
|
80
80
|
new SceneFlexItem({
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
minHeight: 300,
|
|
82
|
+
body: PanelBuilders.timeseries()
|
|
83
83
|
// Title is using variable value
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
.setTitle(templatised ? '${seriesToShow}' : seriesToShow)
|
|
85
|
+
.build(),
|
|
86
86
|
}),
|
|
87
87
|
],
|
|
88
88
|
}),
|
|
@@ -1,125 +1,95 @@
|
|
|
1
|
-
import { ReducerID
|
|
1
|
+
import { ReducerID } from '@grafana/data';
|
|
2
2
|
import {
|
|
3
|
+
PanelBuilders,
|
|
3
4
|
SceneByFrameRepeater,
|
|
4
5
|
SceneDataNode,
|
|
5
6
|
SceneDataTransformer,
|
|
6
7
|
SceneFlexItem,
|
|
7
8
|
SceneFlexLayout,
|
|
8
|
-
VizPanel,
|
|
9
9
|
} from '@grafana/scenes';
|
|
10
|
+
import { TableCellBackgroundDisplayMode, TableCellDisplayMode, ThresholdsMode } from '@grafana/schema';
|
|
10
11
|
|
|
11
12
|
export function getRoomsTemperatureTable() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
options: {
|
|
19
|
-
reducers: ['mean'],
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: 'organize',
|
|
24
|
-
options: {
|
|
25
|
-
excludeByName: {},
|
|
26
|
-
indexByName: {},
|
|
27
|
-
renameByName: {
|
|
28
|
-
Field: 'Room',
|
|
29
|
-
Mean: 'Average temperature',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
13
|
+
const data = new SceneDataTransformer({
|
|
14
|
+
transformations: [
|
|
15
|
+
{
|
|
16
|
+
id: 'reduce',
|
|
17
|
+
options: {
|
|
18
|
+
reducers: ['mean'],
|
|
32
19
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
defaults: {
|
|
43
|
-
custom: {
|
|
44
|
-
align: 'auto',
|
|
45
|
-
cellOptions: {
|
|
46
|
-
type: 'auto',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'organize',
|
|
23
|
+
options: {
|
|
24
|
+
excludeByName: {},
|
|
25
|
+
indexByName: {},
|
|
26
|
+
renameByName: {
|
|
27
|
+
Field: 'Room',
|
|
28
|
+
Mean: 'Average temperature',
|
|
47
29
|
},
|
|
48
|
-
inspect: false,
|
|
49
|
-
},
|
|
50
|
-
mappings: [],
|
|
51
|
-
thresholds: {
|
|
52
|
-
mode: ThresholdsMode.Absolute,
|
|
53
|
-
steps: [
|
|
54
|
-
{
|
|
55
|
-
color: 'light-blue',
|
|
56
|
-
value: 0,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
color: 'orange',
|
|
60
|
-
value: 19,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
color: 'dark-red',
|
|
64
|
-
value: 26,
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
color: {
|
|
69
|
-
mode: 'thresholds',
|
|
70
30
|
},
|
|
71
31
|
},
|
|
72
|
-
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
return PanelBuilders.table()
|
|
35
|
+
.setTitle('Room temperature overview')
|
|
36
|
+
.setData(data)
|
|
37
|
+
.setHoverHeader(true)
|
|
38
|
+
.setDisplayMode('transparent')
|
|
39
|
+
.setOption('sortBy', [{ displayName: 'Average temperature' }])
|
|
40
|
+
.setThresholds({
|
|
41
|
+
mode: ThresholdsMode.Absolute,
|
|
42
|
+
steps: [
|
|
73
43
|
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
options: 'Average temperature',
|
|
77
|
-
},
|
|
78
|
-
properties: [
|
|
79
|
-
{
|
|
80
|
-
id: 'unit',
|
|
81
|
-
value: 'celsius',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
id: 'custom.cellOptions',
|
|
85
|
-
value: {
|
|
86
|
-
type: 'color-background',
|
|
87
|
-
mode: 'basic',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
id: 'custom.width',
|
|
92
|
-
value: 200,
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: 'custom.align',
|
|
96
|
-
value: 'center',
|
|
97
|
-
},
|
|
98
|
-
],
|
|
44
|
+
color: 'light-blue',
|
|
45
|
+
value: 0,
|
|
99
46
|
},
|
|
100
47
|
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
id: 'links',
|
|
108
|
-
value: [
|
|
109
|
-
{
|
|
110
|
-
title: 'Go to room overview',
|
|
111
|
-
url: '${__url.path}/room/${__value.text}/temperature${__url.params}',
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
],
|
|
48
|
+
color: 'orange',
|
|
49
|
+
value: 19,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
color: 'dark-red',
|
|
53
|
+
value: 26,
|
|
116
54
|
},
|
|
117
55
|
],
|
|
118
|
-
}
|
|
119
|
-
|
|
56
|
+
})
|
|
57
|
+
.setColor({ mode: 'thresholds' })
|
|
58
|
+
.setCustomFieldConfig('align', 'auto')
|
|
59
|
+
.setCustomFieldConfig('cellOptions', { type: TableCellDisplayMode.Auto })
|
|
60
|
+
.setCustomFieldConfig('inspect', false)
|
|
61
|
+
.setOverrides((b) =>
|
|
62
|
+
b
|
|
63
|
+
.matchFieldsWithName('Average temperature')
|
|
64
|
+
.overrideUnit('celsius')
|
|
65
|
+
.overrideCustomFieldConfig('cellOptions', {
|
|
66
|
+
type: TableCellDisplayMode.ColorBackground,
|
|
67
|
+
mode: TableCellBackgroundDisplayMode.Basic,
|
|
68
|
+
})
|
|
69
|
+
.overrideCustomFieldConfig('width', 200)
|
|
70
|
+
.overrideCustomFieldConfig('align', 'center')
|
|
71
|
+
.matchFieldsWithName('Room')
|
|
72
|
+
.overrideLinks([
|
|
73
|
+
{ title: 'Go to room overview', url: '${__url.path}/room/${__value.text}/temperature${__url.params}' },
|
|
74
|
+
])
|
|
75
|
+
)
|
|
76
|
+
.build();
|
|
120
77
|
}
|
|
121
78
|
|
|
122
79
|
export function getRoomsTemperatureStats() {
|
|
80
|
+
const stat = PanelBuilders.stat()
|
|
81
|
+
.setUnit('celsius')
|
|
82
|
+
.setLinks([
|
|
83
|
+
{
|
|
84
|
+
title: 'Go to room temperature overview',
|
|
85
|
+
url: '${__url.path}/room/${__field.name}/temperature${__url.params}',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
title: 'Go to room humidity overview',
|
|
89
|
+
url: '${__url.path}/room/${__field.name}/humidity${__url.params}',
|
|
90
|
+
},
|
|
91
|
+
]);
|
|
92
|
+
|
|
123
93
|
return new SceneByFrameRepeater({
|
|
124
94
|
body: new SceneFlexLayout({
|
|
125
95
|
direction: 'row',
|
|
@@ -130,57 +100,32 @@ export function getRoomsTemperatureStats() {
|
|
|
130
100
|
return new SceneFlexItem({
|
|
131
101
|
height: '50%',
|
|
132
102
|
minWidth: '20%',
|
|
133
|
-
body:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
defaults: {
|
|
145
|
-
unit: 'celsius',
|
|
146
|
-
links: [
|
|
147
|
-
{
|
|
148
|
-
title: 'Go to room temperature overview',
|
|
149
|
-
url: '${__url.path}/room/${__field.name}/temperature${__url.params}',
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
title: 'Go to room humidity overview',
|
|
153
|
-
url: '${__url.path}/room/${__field.name}/humidity${__url.params}',
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
},
|
|
157
|
-
overrides: [],
|
|
158
|
-
},
|
|
159
|
-
}),
|
|
103
|
+
body: stat
|
|
104
|
+
.setTitle(frame.name || '')
|
|
105
|
+
.setData(
|
|
106
|
+
new SceneDataNode({
|
|
107
|
+
data: {
|
|
108
|
+
...data,
|
|
109
|
+
series: [frame],
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
)
|
|
113
|
+
.build(),
|
|
160
114
|
});
|
|
161
115
|
},
|
|
162
116
|
});
|
|
163
117
|
}
|
|
164
118
|
|
|
165
119
|
export function getRoomTemperatureStatPanel(reducers: ReducerID[]) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
id: 'reduce',
|
|
173
|
-
options: {
|
|
174
|
-
reducers,
|
|
175
|
-
},
|
|
120
|
+
const data = new SceneDataTransformer({
|
|
121
|
+
transformations: [
|
|
122
|
+
{
|
|
123
|
+
id: 'reduce',
|
|
124
|
+
options: {
|
|
125
|
+
reducers,
|
|
176
126
|
},
|
|
177
|
-
],
|
|
178
|
-
}),
|
|
179
|
-
fieldConfig: {
|
|
180
|
-
defaults: {
|
|
181
|
-
unit: 'celsius',
|
|
182
127
|
},
|
|
183
|
-
|
|
184
|
-
},
|
|
128
|
+
],
|
|
185
129
|
});
|
|
130
|
+
return PanelBuilders.stat().setData(data).setUnit('celsius').build();
|
|
186
131
|
}
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
EmbeddedScene,
|
|
4
4
|
SceneFlexLayout,
|
|
5
5
|
SceneQueryRunner,
|
|
6
|
-
VizPanel,
|
|
7
6
|
SceneTimeRange,
|
|
8
7
|
SceneTimePicker,
|
|
9
8
|
SceneControlsSpacer,
|
|
10
9
|
SceneRefreshPicker,
|
|
11
10
|
SceneFlexItem,
|
|
11
|
+
PanelBuilders,
|
|
12
12
|
} from '@grafana/scenes';
|
|
13
13
|
import { DATASOURCE_REF } from '../../constants';
|
|
14
14
|
import { getRoomTemperatureStatPanel } from './panels';
|
|
@@ -29,17 +29,7 @@ export function getTemperatureOverviewScene(roomName: string) {
|
|
|
29
29
|
children: [
|
|
30
30
|
new SceneFlexItem({
|
|
31
31
|
height: 500,
|
|
32
|
-
body:
|
|
33
|
-
title: 'Temperature over time',
|
|
34
|
-
pluginId: 'timeseries',
|
|
35
|
-
|
|
36
|
-
fieldConfig: {
|
|
37
|
-
defaults: {
|
|
38
|
-
unit: 'celsius',
|
|
39
|
-
},
|
|
40
|
-
overrides: [],
|
|
41
|
-
},
|
|
42
|
-
}),
|
|
32
|
+
body: PanelBuilders.timeseries().setTitle('Temperature over time').setUnit('celsius').build(),
|
|
43
33
|
}),
|
|
44
34
|
new SceneFlexItem({
|
|
45
35
|
body: new SceneFlexLayout({
|
|
@@ -79,17 +69,7 @@ export function getHumidityOverviewScene(roomName: string) {
|
|
|
79
69
|
children: [
|
|
80
70
|
new SceneFlexItem({
|
|
81
71
|
height: 500,
|
|
82
|
-
body:
|
|
83
|
-
title: 'Humidity readings over time',
|
|
84
|
-
pluginId: 'timeseries',
|
|
85
|
-
|
|
86
|
-
fieldConfig: {
|
|
87
|
-
defaults: {
|
|
88
|
-
unit: 'humidity',
|
|
89
|
-
},
|
|
90
|
-
overrides: [],
|
|
91
|
-
},
|
|
92
|
-
}),
|
|
72
|
+
body: PanelBuilders.timeseries().setTitle('Humidity over time').setUnit('humidity').build(),
|
|
93
73
|
}),
|
|
94
74
|
],
|
|
95
75
|
}),
|