@grafana/create-plugin 1.6.3 → 1.6.4-canary.287.cbc2025.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/dist/constants.js +2 -1
- package/package.json +2 -2
- package/src/constants.ts +1 -0
- package/templates/common/docker-compose.yaml +1 -0
- package/templates/common/package.json +2 -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/dist/constants.js
CHANGED
|
@@ -32,7 +32,8 @@ var PLUGIN_TYPES;
|
|
|
32
32
|
PLUGIN_TYPES["scenes"] = "scenesapp";
|
|
33
33
|
})(PLUGIN_TYPES = exports.PLUGIN_TYPES || (exports.PLUGIN_TYPES = {}));
|
|
34
34
|
exports.EXTRA_TEMPLATE_VARIABLES = {
|
|
35
|
-
grafanaVersion: '9.5.3'
|
|
35
|
+
grafanaVersion: '9.5.3',
|
|
36
|
+
grafanaImage: 'grafana-enterprise'
|
|
36
37
|
};
|
|
37
38
|
exports.GRAFANA_FE_PACKAGES = [
|
|
38
39
|
'@grafana/data',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4-canary.287.cbc2025.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": "cbc20259afd0cac3068f851c373eac9cd358dcd7"
|
|
70
70
|
}
|
package/src/constants.ts
CHANGED
|
@@ -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,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
|
}),
|