@cloudcare/guance-front-tools 1.0.11 → 1.0.13

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.
Files changed (54) hide show
  1. package/README.md +8 -0
  2. package/guance-all-charts.json +3415 -0
  3. package/lib/cjs/generated/dashboardCharts.d.ts +54 -13
  4. package/lib/cjs/scripts/grafana-covert-to-guance-core.d.ts +4 -0
  5. package/lib/cjs/scripts/grafana-covert-to-guance-core.js +10 -0
  6. package/lib/cjs/scripts/grafana-dashbord.d.ts +2220 -0
  7. package/lib/cjs/scripts/grafana-dashbord.js +4 -0
  8. package/lib/cjs/src/grafana-covert-to-guance.d.ts +2 -0
  9. package/lib/cjs/src/grafana-covert-to-guance.js +5 -0
  10. package/lib/cjs/src/index.d.ts +1 -0
  11. package/lib/cjs/src/index.js +1 -0
  12. package/lib/esm/generated/dashboardCharts.d.ts +54 -13
  13. package/lib/esm/scripts/grafana-covert-to-guance-core.d.ts +4 -0
  14. package/lib/esm/scripts/grafana-covert-to-guance-core.js +7 -0
  15. package/lib/esm/scripts/grafana-dashbord.d.ts +2220 -0
  16. package/lib/esm/scripts/grafana-dashbord.js +1 -0
  17. package/lib/esm/src/grafana-covert-to-guance.d.ts +2 -0
  18. package/lib/esm/src/grafana-covert-to-guance.js +1 -0
  19. package/lib/esm/src/index.d.ts +1 -0
  20. package/lib/esm/src/index.js +1 -0
  21. package/lib/example/grafana2.json +878 -0
  22. package/lib/example/guance-dahs-3.json +348 -0
  23. package/lib/scripts/grafana-covert-to-guance-core.js +7 -0
  24. package/lib/scripts/grafana-covert-to-guance-core.ts +23 -0
  25. package/lib/scripts/grafana-covert-to-guance.js +52 -397
  26. package/lib/scripts/grafana-covert-to-guance.ts +58 -410
  27. package/lib/src/grafana-covert-to-guance.ts +7 -0
  28. package/lib/src/index.ts +1 -0
  29. package/package.json +6 -4
  30. package/schemas/charts/chart-schema.json +8 -5
  31. package/schemas/charts/common/chart-link-item-schema.json +48 -0
  32. package/schemas/charts/common/chart-links-schema.json +9 -0
  33. package/schemas/charts/common/common-chart-types-schema.json +3 -1
  34. package/schemas/charts/dashboard-schema.json +11 -4
  35. package/schemas/charts/query/query-item-schema.json +19 -1
  36. package/schemas/charts/settings/settings-time-schema.json +1 -5
  37. package/schemas/charts/settings/settings-unit-items-schema.json +3 -1
  38. package/schemas/charts/settings/settings-units-schema.json +2 -3
  39. package/scripts/validate-file.mjs +57 -0
  40. package/skills/grafana-to-guance-dashboard/SKILL.md +102 -0
  41. package/skills/grafana-to-guance-dashboard/agents/openai.yaml +4 -0
  42. package/skills/grafana-to-guance-dashboard/references/converter-notes.md +134 -0
  43. package/skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard.mjs +1899 -0
  44. package/test/cli.test.mjs +373 -0
  45. package/test-output/grafana2.cli.guance.json +1029 -0
  46. package/test-output/grafana2.guance.json +1029 -0
  47. package/test-output/grafana2.keep-meta.guance.json +1384 -0
  48. package/test-output/pod.guance.json +2153 -0
  49. package/test-output/skill-test2-enhanced.guance.json +21596 -0
  50. package/test-output/skill-test2-validated.guance.json +11610 -0
  51. package/test-output/skill-test2.guance.json +11610 -0
  52. package/test-output/test.guance.json +1086 -0
  53. package/test-output/test2.guance.guance-promql.json +23212 -0
  54. package/test-output/test2.guance.json +17554 -0
@@ -0,0 +1,348 @@
1
+ {
2
+ "title": "test-dcl-23-copy",
3
+ "dashboardType": "CUSTOM",
4
+ "dashboardExtend": {
5
+ "groupUnfoldStatus": {
6
+ "test1": false
7
+ }
8
+ },
9
+ "dashboardMapping": [],
10
+ "dashboardOwnerType": "node",
11
+ "iconSet": {},
12
+ "dashboardBindSet": [],
13
+ "thumbnail": "",
14
+ "tagInfo": [],
15
+ "summary": "1",
16
+ "main": {
17
+ "vars": [
18
+ {
19
+ "name": "host",
20
+ "seq": 0,
21
+ "datasource": "dataflux",
22
+ "code": "host",
23
+ "type": "QUERY",
24
+ "definition": {
25
+ "tag": "",
26
+ "field": "",
27
+ "value": "L('default')::RE(`.*`):(distinct_by_collapse(`host`)) LIMIT 20",
28
+ "metric": "",
29
+ "object": "",
30
+ "defaultVal": {
31
+ "label": "*",
32
+ "value": "*"
33
+ }
34
+ },
35
+ "valueSort": "asc",
36
+ "hide": 0,
37
+ "isHiddenAsterisk": 0,
38
+ "multiple": true,
39
+ "includeStar": true,
40
+ "extend": {
41
+ "starMeaning": "*"
42
+ }
43
+ },
44
+ {
45
+ "name": "test_host_link",
46
+ "seq": 1,
47
+ "datasource": "dataflux",
48
+ "code": "test",
49
+ "type": "QUERY",
50
+ "definition": {
51
+ "tag": "",
52
+ "field": "",
53
+ "value": "L('default')::RE(`.*`):(`service`) { host = '#{host}' }",
54
+ "metric": "",
55
+ "object": "",
56
+ "defaultVal": {
57
+ "label": "",
58
+ "value": ""
59
+ }
60
+ },
61
+ "valueSort": "asc",
62
+ "hide": 0,
63
+ "isHiddenAsterisk": 0,
64
+ "multiple": true,
65
+ "includeStar": false,
66
+ "extend": {}
67
+ }
68
+ ],
69
+ "charts": [
70
+ {
71
+ "extend": {
72
+ "links": [
73
+ {
74
+ "url": "/logIndi/log/all?time=#{TR}&query=#{T}",
75
+ "open": "newWin",
76
+ "show": true,
77
+ "type": "logging",
78
+ "showChanged": false
79
+ },
80
+ {
81
+ "url": "/objectadmin/docker_containers?routerTabActive=ObjectadminDocker&time=#{TR}&query=#{T}",
82
+ "open": "curWin",
83
+ "show": true,
84
+ "type": "container",
85
+ "showChanged": false
86
+ },
87
+ {
88
+ "url": "/objectadmin/host_processes?routerTabActive=ObjectadminProcesses&time=#{TR}&query=#{T}",
89
+ "open": "drawerWin",
90
+ "show": true,
91
+ "type": "processes",
92
+ "showChanged": false
93
+ },
94
+ {
95
+ "url": "/tracing/link/all?time=#{TR}&query=#{T}",
96
+ "open": "newWin",
97
+ "show": false,
98
+ "type": "tracing",
99
+ "showChanged": false
100
+ },
101
+ {
102
+ "url": "/scene/builtinview/detail?time=#{TR}&query=#{T}",
103
+ "open": "newWin",
104
+ "show": false,
105
+ "type": "host",
106
+ "showChanged": false
107
+ }
108
+ ],
109
+ "settings": {
110
+ "alias": [],
111
+ "units": [],
112
+ "colors": [],
113
+ "levels": [],
114
+ "slimit": 20,
115
+ "compares": [
116
+ {
117
+ "label": "小时同比",
118
+ "value": "hourCompare"
119
+ },
120
+ {
121
+ "label": "日同比",
122
+ "value": "dayCompare"
123
+ }
124
+ ],
125
+ "lineType": "linear",
126
+ "showLine": false,
127
+ "unitType": "global",
128
+ "chartType": "line",
129
+ "fixedTime": "",
130
+ "isPercent": false,
131
+ "openStack": false,
132
+ "precision": "2",
133
+ "showLabel": false,
134
+ "showTitle": true,
135
+ "stackType": "percent",
136
+ "titleDesc": "",
137
+ "globalUnit": [],
138
+ "isSampling": true,
139
+ "compareType": [
140
+ "hourCompare",
141
+ "dayCompare"
142
+ ],
143
+ "openCompare": true,
144
+ "yAxixMaxVal": null,
145
+ "yAxixMinVal": null,
146
+ "connectNulls": true,
147
+ "legendValues": [
148
+ "avg",
149
+ "last",
150
+ "first",
151
+ "min",
152
+ "max",
153
+ "sum"
154
+ ],
155
+ "timeInterval": "auto",
156
+ "legendPostion": "bottom",
157
+ "maxPointCount": 20,
158
+ "sorderByOrder": "desc",
159
+ "xAxisShowType": "time",
160
+ "isCombineChart": false,
161
+ "isTimeInterval": true,
162
+ "changeWorkspace": false,
163
+ "openRepeatChart": false,
164
+ "compareChartType": "sequence",
165
+ "currentChartType": "sequence",
166
+ "showFieldMapping": false,
167
+ "onlyShowGroupName": false,
168
+ "scientificNotation": true,
169
+ "repeatChartRowLimit": 3,
170
+ "repeatChartVariable": "",
171
+ "yAxixOpenIncludeZero": true,
172
+ "openThousandsSeparator": true,
173
+ "enablePreflightEstimate": true,
174
+ "mainMeasurementQueryCode": "A"
175
+ },
176
+ "fixedTime": "",
177
+ "isRefresh": false,
178
+ "fixedGroupByTime": null
179
+ },
180
+ "group": {
181
+ "name": null
182
+ },
183
+ "chartGroupUUID": "default",
184
+ "name": "新建图表",
185
+ "pos": {
186
+ "h": 9,
187
+ "w": 19,
188
+ "x": 0,
189
+ "y": 0
190
+ },
191
+ "type": "sequence",
192
+ "queries": [
193
+ {
194
+ "name": "",
195
+ "type": "sequence",
196
+ "unit": "",
197
+ "color": "",
198
+ "qtype": "dql",
199
+ "query": {
200
+ "q": "L('default')::RE(`.*`):(count(`*`) AS `aaa`) { `host` = '#{host}' } BY `host`",
201
+ "code": "A",
202
+ "fill": null,
203
+ "type": "simple",
204
+ "alias": "aaa",
205
+ "field": "*",
206
+ "limit": null,
207
+ "fillNum": null,
208
+ "filters": [
209
+ {
210
+ "id": "6b770a50-f4ef-11f0-ac95-dd561dcf45d1",
211
+ "op": "=",
212
+ "name": "host",
213
+ "type": "keyword",
214
+ "logic": "and",
215
+ "value": "#{host}",
216
+ "values": []
217
+ }
218
+ ],
219
+ "groupBy": [
220
+ "host"
221
+ ],
222
+ "labelOp": "",
223
+ "funcList": [],
224
+ "fieldFunc": "count",
225
+ "fieldType": "keyword",
226
+ "namespace": "logging",
227
+ "dataSource": "*",
228
+ "queryFuncs": [],
229
+ "withLabels": [],
230
+ "groupByTime": "",
231
+ "indexFilter": "default"
232
+ },
233
+ "disabled": false,
234
+ "datasource": "dataflux"
235
+ }
236
+ ],
237
+ "prevGroupName": null,
238
+ "uuid": "chrt_fd51995ec5e443119f66d2f5fa54c59c"
239
+ },
240
+ {
241
+ "extend": {
242
+ "settings": {
243
+ "alias": [],
244
+ "units": [],
245
+ "colors": [],
246
+ "levels": [],
247
+ "slimit": 20,
248
+ "lineType": "linear",
249
+ "showLine": false,
250
+ "unitType": "global",
251
+ "chartType": "line",
252
+ "fixedTime": "",
253
+ "isPercent": false,
254
+ "openStack": false,
255
+ "precision": "2",
256
+ "showLabel": false,
257
+ "showTitle": true,
258
+ "stackType": "time",
259
+ "titleDesc": "",
260
+ "globalUnit": [],
261
+ "isSampling": true,
262
+ "compareType": [],
263
+ "openCompare": false,
264
+ "yAxixMaxVal": null,
265
+ "yAxixMinVal": null,
266
+ "connectNulls": true,
267
+ "legendValues": "",
268
+ "timeInterval": "auto",
269
+ "legendPostion": "none",
270
+ "maxPointCount": null,
271
+ "sorderByOrder": "desc",
272
+ "xAxisShowType": "time",
273
+ "isCombineChart": false,
274
+ "isTimeInterval": true,
275
+ "changeWorkspace": false,
276
+ "openRepeatChart": false,
277
+ "currentChartType": "sequence",
278
+ "showFieldMapping": false,
279
+ "onlyShowGroupName": false,
280
+ "scientificNotation": true,
281
+ "repeatChartRowLimit": 3,
282
+ "repeatChartVariable": "",
283
+ "yAxixOpenIncludeZero": true,
284
+ "openThousandsSeparator": true,
285
+ "enablePreflightEstimate": false,
286
+ "mainMeasurementQueryCode": ""
287
+ },
288
+ "fixedTime": ""
289
+ },
290
+ "group": {
291
+ "name": null
292
+ },
293
+ "chartGroupUUID": "default",
294
+ "name": "新建图表2",
295
+ "pos": {
296
+ "h": 10,
297
+ "w": 8,
298
+ "x": 0,
299
+ "y": 0
300
+ },
301
+ "type": "sequence",
302
+ "queries": [
303
+ {
304
+ "name": "",
305
+ "type": "sequence",
306
+ "unit": "",
307
+ "color": "",
308
+ "qtype": "dql",
309
+ "query": {
310
+ "q": "",
311
+ "code": "A",
312
+ "fill": null,
313
+ "type": "simple",
314
+ "alias": "",
315
+ "field": "",
316
+ "filters": [],
317
+ "groupBy": [],
318
+ "funcList": [],
319
+ "fieldFunc": "",
320
+ "namespace": "metric",
321
+ "dataSource": "",
322
+ "queryFuncs": [],
323
+ "groupByTime": "",
324
+ "indexFilter": ""
325
+ },
326
+ "disabled": false,
327
+ "datasource": "dataflux"
328
+ }
329
+ ],
330
+ "prevGroupName": null,
331
+ "uuid": "chrt_11b8a61a4060492db997572f85f66208"
332
+ }
333
+ ],
334
+ "chartGroupPos": [
335
+ "chtg_472fc54aa73f4bd1969b16b991a71763"
336
+ ],
337
+ "groups": [
338
+ {
339
+ "name": "test1",
340
+ "extend": {
341
+ "colorKey": "style_key14"
342
+ }
343
+ }
344
+ ],
345
+ "type": "template"
346
+ },
347
+ "identifier": "12"
348
+ }
@@ -0,0 +1,7 @@
1
+ // This script is the shared conversion source for the published API and CLI.
2
+ // Keep it thin and delegate to the maintained converter implementation.
3
+ // @ts-ignore
4
+ import { convertDashboard } from '../../skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard.mjs';
5
+ export function covert(grafanaData) {
6
+ return convertDashboard(grafanaData);
7
+ }
@@ -0,0 +1,23 @@
1
+ import type { DashboardData as GuanceDashboardType } from '../generated/dashboardCharts'
2
+ import type {
3
+ DashboardData as GrafanaDashboardType,
4
+ VariableModel,
5
+ Panel,
6
+ RowPanel,
7
+ } from './grafana-dashbord'
8
+
9
+ // This script is the shared conversion source for the published API and CLI.
10
+ // Keep it thin and delegate to the maintained converter implementation.
11
+ // @ts-ignore
12
+ import { convertDashboard } from '../../skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard.mjs'
13
+
14
+ export function covert(grafanaData: GrafanaDashboardType): GuanceDashboardType {
15
+ return convertDashboard(grafanaData) as GuanceDashboardType
16
+ }
17
+
18
+ export type {
19
+ GrafanaDashboardType,
20
+ Panel as GrafanaPanel,
21
+ RowPanel as GrafanaRowPanel,
22
+ VariableModel as GrafanaVariableModel,
23
+ }