@cloudcare/guance-front-tools 1.0.12 → 1.0.15
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/guance-all-charts.json +3415 -0
- package/lib/cjs/generated/dashboardCharts.d.ts +54 -13
- package/lib/cjs/scripts/convert-grafana-dashboard-core.js +1770 -0
- package/lib/cjs/scripts/convert-grafana-dashboard.js +147 -0
- package/lib/cjs/scripts/grafana-covert-to-guance-core.d.ts +1 -1
- package/lib/cjs/scripts/grafana-covert-to-guance-core.js +5 -289
- package/lib/esm/generated/dashboardCharts.d.ts +54 -13
- package/lib/esm/scripts/convert-grafana-dashboard-core.js +1770 -0
- package/lib/esm/scripts/convert-grafana-dashboard.js +147 -0
- package/lib/esm/scripts/grafana-covert-to-guance-core.d.ts +1 -1
- package/lib/esm/scripts/grafana-covert-to-guance-core.js +5 -289
- package/lib/example/grafana2.json +878 -0
- package/lib/example/guance-dahs-3.json +348 -0
- package/lib/scripts/convert-grafana-dashboard-core.js +1770 -0
- package/lib/scripts/convert-grafana-dashboard.js +147 -0
- package/lib/scripts/grafana-covert-to-guance-core.js +5 -286
- package/lib/scripts/grafana-covert-to-guance-core.ts +12 -326
- package/lib/scripts/grafana-covert-to-guance.js +54 -29
- package/lib/scripts/grafana-covert-to-guance.ts +59 -32
- package/package.json +6 -4
- package/schemas/charts/chart-schema.json +8 -5
- package/schemas/charts/common/chart-link-item-schema.json +48 -0
- package/schemas/charts/common/chart-links-schema.json +9 -0
- package/schemas/charts/common/common-chart-types-schema.json +3 -1
- package/schemas/charts/dashboard-schema.json +11 -4
- package/schemas/charts/query/query-item-schema.json +19 -1
- package/schemas/charts/settings/settings-time-schema.json +1 -5
- package/schemas/charts/settings/settings-unit-items-schema.json +3 -1
- package/schemas/charts/settings/settings-units-schema.json +2 -3
- package/scripts/sync-converter.mjs +41 -0
- package/scripts/validate-file.mjs +57 -0
- package/skills/grafana-to-guance-dashboard/SKILL.md +102 -0
- package/skills/grafana-to-guance-dashboard/agents/openai.yaml +4 -0
- package/skills/grafana-to-guance-dashboard/references/converter-notes.md +134 -0
- package/skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard-core.js +1770 -0
- package/skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard.mjs +147 -0
- package/test/cli.test.mjs +446 -1
- package/test-output/grafana2.cli.guance.json +1029 -0
- package/test-output/grafana2.guance.json +1029 -0
- package/test-output/grafana2.keep-meta.guance.json +1384 -0
- package/test-output/pod.guance.json +2153 -0
- package/test-output/skill-test2-enhanced.guance.json +21596 -0
- package/test-output/skill-test2-validated.guance.json +11610 -0
- package/test-output/skill-test2.guance.json +11610 -0
- package/test-output/test.guance.json +1086 -0
- package/test-output/test2.guance.guance-promql.json +23212 -0
- package/test-output/test2.guance.json +17554 -0
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
* 图表视图变量列表结构
|
|
6
6
|
*/
|
|
7
7
|
export type ChartVarsSettings = ChartVarsItem[];
|
|
8
|
+
/**
|
|
9
|
+
* 图表跳转链接列表
|
|
10
|
+
*/
|
|
11
|
+
export type ChartsCommonChartLinksSchemaJson = ChartsCommonChartLinkItemSchemaJson[];
|
|
8
12
|
/**
|
|
9
13
|
* 图表设置配置完整结构。
|
|
10
14
|
*/
|
|
@@ -201,22 +205,20 @@ export type CommonChartStackContentSettings = 'group' | 'index';
|
|
|
201
205
|
/**
|
|
202
206
|
* 图表全局设置单位
|
|
203
207
|
*
|
|
208
|
+
* @minItems 2
|
|
204
209
|
* @maxItems 2
|
|
205
210
|
*/
|
|
206
|
-
export type ChartUnitItemsSettings = [
|
|
207
|
-
'custom' | 'length' | 'area' | 'mass' | 'volume' | 'each' | 'temperature' | 'time' | 'digital' | 'diitalUnit' | 'partsPer' | 'speed' | 'pace' | 'pressure' | 'current' | 'voltage' | 'power' | 'reactivePower' | 'apparentPower' | 'energy' | 'reactiveEnergy' | 'volumeFlowRate' | 'illuminance' | 'frequency' | 'angle' | 'throughput' | 'percent' | 'rmb' | 'currencySymbol'
|
|
208
|
-
] | [
|
|
211
|
+
export type ChartUnitItemsSettings = [
|
|
209
212
|
('custom' | 'length' | 'area' | 'mass' | 'volume' | 'each' | 'temperature' | 'time' | 'digital' | 'diitalUnit' | 'partsPer' | 'speed' | 'pace' | 'pressure' | 'current' | 'voltage' | 'power' | 'reactivePower' | 'apparentPower' | 'energy' | 'reactiveEnergy' | 'volumeFlowRate' | 'illuminance' | 'frequency' | 'angle' | 'throughput' | 'percent' | 'rmb' | 'currencySymbol'),
|
|
210
213
|
(('mm' | 'cm' | 'm' | 'in' | 'ft-us' | 'ft' | 'mi' | 'mm2' | 'cm2' | 'm2' | 'ha' | 'km2' | 'in2' | 'ft2' | 'ac' | 'mi2' | 'mcg' | 'mg' | 'g' | 'kg' | 'oz' | 'lb' | 'mt' | 't' | 'mm3' | 'cm3' | 'ml' | 'l' | 'kl' | 'm3' | 'km3' | 'tsp' | 'Tbs' | 'in3' | 'fl-oz' | 'cup' | 'pnt' | 'qt' | 'gal' | 'ft3' | 'yd3' | 'mm3/s' | 'cm3/s' | 'ml/s' | 'cl/s' | 'dl/s' | 'l/s' | 'l/min' | 'l/h' | 'kl/s' | 'kl/min' | 'kl/h' | 'm3/s' | 'm3/min' | 'm3/h' | 'km3/s' | 'tsp/s' | 'Tbs/s' | 'in3/s' | 'in3/min' | 'in3/h' | 'fl-oz/s' | 'fl-oz/min' | 'fl-oz/h' | 'cup/s' | 'pnt/s' | 'pnt/min' | 'pnt/h' | 'qt/s' | 'gal/s' | 'gal/min' | 'gal/h' | 'ft3/s' | 'ft3/min' | 'ft3/h' | 'yd3/s' | 'yd3/min' | 'yd3/h' | 'C' | 'F' | 'K' | 'R' | 'ns' | 'μs' | 'ms' | 's' | 'min' | 'h' | 'd' | 'week' | 'month' | 'year' | 'Hz' | 'mHz' | 'kHz' | 'MHz' | 'GHz' | 'THz' | 'rpm' | 'deg/s' | 'rad/s' | 'm/s' | 'km/h' | 'm/h' | 'knot' | 'ft/s' | 's/m' | 'min/km' | 's/ft' | 'Pa' | 'hPa' | 'kPa' | 'MPa' | 'bar' | 'torr' | 'psi' | 'ksi' | 'b' | 'Kb' | 'Mb' | 'Gb' | 'Tb' | 'B' | 'KB' | 'MB' | 'GB' | 'TB' | 'lx' | 'ft-cd' | 'ppm' | 'ppb' | 'ppt' | 'ppq' | 'V' | 'mV' | 'kV' | 'A' | 'mA' | 'kA' | 'W' | 'mW' | 'kW' | 'MW' | 'GW' | 'VA' | 'mVA' | 'kVA' | 'MVA' | 'GVA' | 'VAR' | 'mVAR' | 'kVAR' | 'MVAR' | 'GVAR' | 'Wh' | 'mWh' | 'kWh' | 'MWh' | 'GWh' | 'J' | 'kJ' | 'VARh' | 'mVARh' | 'kVARh' | 'MVARh' | 'GVARh' | 'deg' | 'rad' | 'grad' | 'arcmin' | 'arcsec') | string)
|
|
211
214
|
];
|
|
212
215
|
/**
|
|
213
216
|
* 图表单位数据配置
|
|
214
217
|
*
|
|
218
|
+
* @minItems 2
|
|
215
219
|
* @maxItems 2
|
|
216
220
|
*/
|
|
217
|
-
export type ChartUnitItemsSettings1 = [
|
|
218
|
-
'custom' | 'length' | 'area' | 'mass' | 'volume' | 'each' | 'temperature' | 'time' | 'digital' | 'diitalUnit' | 'partsPer' | 'speed' | 'pace' | 'pressure' | 'current' | 'voltage' | 'power' | 'reactivePower' | 'apparentPower' | 'energy' | 'reactiveEnergy' | 'volumeFlowRate' | 'illuminance' | 'frequency' | 'angle' | 'throughput' | 'percent' | 'rmb' | 'currencySymbol'
|
|
219
|
-
] | [
|
|
221
|
+
export type ChartUnitItemsSettings1 = [
|
|
220
222
|
('custom' | 'length' | 'area' | 'mass' | 'volume' | 'each' | 'temperature' | 'time' | 'digital' | 'diitalUnit' | 'partsPer' | 'speed' | 'pace' | 'pressure' | 'current' | 'voltage' | 'power' | 'reactivePower' | 'apparentPower' | 'energy' | 'reactiveEnergy' | 'volumeFlowRate' | 'illuminance' | 'frequency' | 'angle' | 'throughput' | 'percent' | 'rmb' | 'currencySymbol'),
|
|
221
223
|
(('mm' | 'cm' | 'm' | 'in' | 'ft-us' | 'ft' | 'mi' | 'mm2' | 'cm2' | 'm2' | 'ha' | 'km2' | 'in2' | 'ft2' | 'ac' | 'mi2' | 'mcg' | 'mg' | 'g' | 'kg' | 'oz' | 'lb' | 'mt' | 't' | 'mm3' | 'cm3' | 'ml' | 'l' | 'kl' | 'm3' | 'km3' | 'tsp' | 'Tbs' | 'in3' | 'fl-oz' | 'cup' | 'pnt' | 'qt' | 'gal' | 'ft3' | 'yd3' | 'mm3/s' | 'cm3/s' | 'ml/s' | 'cl/s' | 'dl/s' | 'l/s' | 'l/min' | 'l/h' | 'kl/s' | 'kl/min' | 'kl/h' | 'm3/s' | 'm3/min' | 'm3/h' | 'km3/s' | 'tsp/s' | 'Tbs/s' | 'in3/s' | 'in3/min' | 'in3/h' | 'fl-oz/s' | 'fl-oz/min' | 'fl-oz/h' | 'cup/s' | 'pnt/s' | 'pnt/min' | 'pnt/h' | 'qt/s' | 'gal/s' | 'gal/min' | 'gal/h' | 'ft3/s' | 'ft3/min' | 'ft3/h' | 'yd3/s' | 'yd3/min' | 'yd3/h' | 'C' | 'F' | 'K' | 'R' | 'ns' | 'μs' | 'ms' | 's' | 'min' | 'h' | 'd' | 'week' | 'month' | 'year' | 'Hz' | 'mHz' | 'kHz' | 'MHz' | 'GHz' | 'THz' | 'rpm' | 'deg/s' | 'rad/s' | 'm/s' | 'km/h' | 'm/h' | 'knot' | 'ft/s' | 's/m' | 'min/km' | 's/ft' | 'Pa' | 'hPa' | 'kPa' | 'MPa' | 'bar' | 'torr' | 'psi' | 'ksi' | 'b' | 'Kb' | 'Mb' | 'Gb' | 'Tb' | 'B' | 'KB' | 'MB' | 'GB' | 'TB' | 'lx' | 'ft-cd' | 'ppm' | 'ppb' | 'ppt' | 'ppq' | 'V' | 'mV' | 'kV' | 'A' | 'mA' | 'kA' | 'W' | 'mW' | 'kW' | 'MW' | 'GW' | 'VA' | 'mVA' | 'kVA' | 'MVA' | 'GVA' | 'VAR' | 'mVAR' | 'kVAR' | 'MVAR' | 'GVAR' | 'Wh' | 'mWh' | 'kWh' | 'MWh' | 'GWh' | 'J' | 'kJ' | 'VARh' | 'mVARh' | 'kVARh' | 'MVARh' | 'GVARh' | 'deg' | 'rad' | 'grad' | 'arcmin' | 'arcsec') | string)
|
|
222
224
|
];
|
|
@@ -625,7 +627,7 @@ export type CommonChartLegendValuesSettings = ('first' | 'last' | 'avg' | 'min'
|
|
|
625
627
|
/**
|
|
626
628
|
* 支持图表类型枚举
|
|
627
629
|
*/
|
|
628
|
-
export type ChartType = 'group' | 'sequence' | 'singlestat' | 'pie' | 'bar' | 'histogram' | 'slo' | 'toplist' | 'gauge' | 'scatter' | 'bubble' | 'table' | 'treemap' | 'funnel' | 'chinamap' | 'worldmap' | 'hexgon' | 'heatmap' | 'topology' | 'sankey' | 'log' | 'object' | 'alarm' | 'text' | 'video' | 'picture' | 'command' | 'iframe';
|
|
630
|
+
export type ChartType = 'group' | 'sequence' | 'singlestat' | 'pie' | 'bar' | 'histogram' | 'slo' | 'toplist' | 'gauge' | 'scatter' | 'bubble' | 'table' | 'treemap' | 'funnel' | 'chinamap' | 'worldmap' | 'hexgon' | 'heatmap' | 'topology' | 'sankey' | 'change' | 'log' | 'object' | 'monitor' | 'alarm' | 'text' | 'video' | 'picture' | 'command' | 'iframe';
|
|
629
631
|
/**
|
|
630
632
|
* 概览图配置信息
|
|
631
633
|
*/
|
|
@@ -919,11 +921,11 @@ export type ChartWorldMapSettings = CommonChartSettings & {
|
|
|
919
921
|
/**
|
|
920
922
|
* 支持图表类型枚举
|
|
921
923
|
*/
|
|
922
|
-
export type ChartType1 = 'group' | 'sequence' | 'singlestat' | 'pie' | 'bar' | 'histogram' | 'slo' | 'toplist' | 'gauge' | 'scatter' | 'bubble' | 'table' | 'treemap' | 'funnel' | 'chinamap' | 'worldmap' | 'hexgon' | 'heatmap' | 'topology' | 'sankey' | 'log' | 'object' | 'alarm' | 'text' | 'video' | 'picture' | 'command' | 'iframe';
|
|
924
|
+
export type ChartType1 = 'group' | 'sequence' | 'singlestat' | 'pie' | 'bar' | 'histogram' | 'slo' | 'toplist' | 'gauge' | 'scatter' | 'bubble' | 'table' | 'treemap' | 'funnel' | 'chinamap' | 'worldmap' | 'hexgon' | 'heatmap' | 'topology' | 'sankey' | 'change' | 'log' | 'object' | 'monitor' | 'alarm' | 'text' | 'video' | 'picture' | 'command' | 'iframe';
|
|
923
925
|
/**
|
|
924
926
|
* 支持图表类型枚举
|
|
925
927
|
*/
|
|
926
|
-
export type ChartType2 = 'group' | 'sequence' | 'singlestat' | 'pie' | 'bar' | 'histogram' | 'slo' | 'toplist' | 'gauge' | 'scatter' | 'bubble' | 'table' | 'treemap' | 'funnel' | 'chinamap' | 'worldmap' | 'hexgon' | 'heatmap' | 'topology' | 'sankey' | 'log' | 'object' | 'alarm' | 'text' | 'video' | 'picture' | 'command' | 'iframe';
|
|
928
|
+
export type ChartType2 = 'group' | 'sequence' | 'singlestat' | 'pie' | 'bar' | 'histogram' | 'slo' | 'toplist' | 'gauge' | 'scatter' | 'bubble' | 'table' | 'treemap' | 'funnel' | 'chinamap' | 'worldmap' | 'hexgon' | 'heatmap' | 'topology' | 'sankey' | 'change' | 'log' | 'object' | 'monitor' | 'alarm' | 'text' | 'video' | 'picture' | 'command' | 'iframe';
|
|
927
929
|
/**
|
|
928
930
|
* 图表查询语句列表结构
|
|
929
931
|
*/
|
|
@@ -966,9 +968,9 @@ export interface DashboardData {
|
|
|
966
968
|
[k: string]: unknown;
|
|
967
969
|
}[];
|
|
968
970
|
/**
|
|
969
|
-
*
|
|
971
|
+
* 仪表板主体类型,现有数据中常缺省,存在时固定为 template
|
|
970
972
|
*/
|
|
971
|
-
type?: 'template';
|
|
973
|
+
type?: 'template' | null;
|
|
972
974
|
[k: string]: unknown;
|
|
973
975
|
};
|
|
974
976
|
/**
|
|
@@ -1072,6 +1074,7 @@ export interface ChartVarsItem {
|
|
|
1072
1074
|
*/
|
|
1073
1075
|
export interface ChartData {
|
|
1074
1076
|
extend: {
|
|
1077
|
+
links?: ChartsCommonChartLinksSchemaJson;
|
|
1075
1078
|
settings?: ChartSettings;
|
|
1076
1079
|
[k: string]: unknown;
|
|
1077
1080
|
};
|
|
@@ -1109,16 +1112,42 @@ export interface ChartData {
|
|
|
1109
1112
|
queries: ChartQueries;
|
|
1110
1113
|
[k: string]: unknown;
|
|
1111
1114
|
}
|
|
1115
|
+
/**
|
|
1116
|
+
* 图表联动跳转项
|
|
1117
|
+
*/
|
|
1118
|
+
export interface ChartsCommonChartLinkItemSchemaJson {
|
|
1119
|
+
/**
|
|
1120
|
+
* 跳转地址
|
|
1121
|
+
*/
|
|
1122
|
+
url: string;
|
|
1123
|
+
/**
|
|
1124
|
+
* 打开方式
|
|
1125
|
+
*/
|
|
1126
|
+
open: 'newWin' | 'curWin' | 'drawerWin';
|
|
1127
|
+
/**
|
|
1128
|
+
* 是否展示
|
|
1129
|
+
*/
|
|
1130
|
+
show: boolean;
|
|
1131
|
+
/**
|
|
1132
|
+
* 跳转类型
|
|
1133
|
+
*/
|
|
1134
|
+
type: 'logging' | 'container' | 'processes' | 'tracing' | 'host' | 'custom';
|
|
1135
|
+
/**
|
|
1136
|
+
* 是否修改过显示状态
|
|
1137
|
+
*/
|
|
1138
|
+
showChanged: boolean;
|
|
1139
|
+
[k: string]: unknown;
|
|
1140
|
+
}
|
|
1112
1141
|
/**
|
|
1113
1142
|
* 图表时间相关配置完整结构。
|
|
1114
1143
|
*/
|
|
1115
1144
|
export interface ChartTimeSettings {
|
|
1116
|
-
timeInterval
|
|
1145
|
+
timeInterval?: 'auto' | '1ms' | '10ms' | '50ms' | '100ms' | '500ms' | '1s' | '10s' | '20s' | '30s' | '1m' | '5m' | '10m' | '30m' | '1h' | '6h' | '12h' | '1d' | '7d' | '30d';
|
|
1117
1146
|
/**
|
|
1118
1147
|
* 返回最大数据电枢
|
|
1119
1148
|
*/
|
|
1120
1149
|
maxPointCount?: number;
|
|
1121
|
-
fixedTime
|
|
1150
|
+
fixedTime?: ChartsSettingsSettingsFixedTimeSchemaJson;
|
|
1122
1151
|
[k: string]: unknown;
|
|
1123
1152
|
}
|
|
1124
1153
|
/**
|
|
@@ -1359,10 +1388,22 @@ export interface ChartQueryItem {
|
|
|
1359
1388
|
* 图表查询语句,可以是 dql语句,也可以是 promql 语句
|
|
1360
1389
|
*/
|
|
1361
1390
|
q?: string;
|
|
1391
|
+
/**
|
|
1392
|
+
* 文本图内容,支持 HTML 或 Markdown 文本
|
|
1393
|
+
*/
|
|
1394
|
+
content?: string;
|
|
1362
1395
|
/**
|
|
1363
1396
|
* 查询语句的唯一标识,由单个大写英文字母构成
|
|
1364
1397
|
*/
|
|
1365
1398
|
code?: string;
|
|
1399
|
+
/**
|
|
1400
|
+
* 查询语句类型冗余字段,实际数据中可能是 promql/dql,也可能是 default/simple 这类查询模式
|
|
1401
|
+
*/
|
|
1402
|
+
type?: 'default' | 'simple' | 'dql' | 'promql';
|
|
1403
|
+
/**
|
|
1404
|
+
* PromQL 查询顺序编号
|
|
1405
|
+
*/
|
|
1406
|
+
promqlCode?: number;
|
|
1366
1407
|
[k: string]: unknown;
|
|
1367
1408
|
};
|
|
1368
1409
|
[k: string]: unknown;
|