@perses-dev/components 0.50.0 → 0.51.0-beta.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/ColorPicker/ColorPicker.js +2 -2
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js +2 -3
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
- package/dist/DragAndDrop/DragButton.d.ts +2 -2
- package/dist/DragAndDrop/DragButton.d.ts.map +1 -1
- package/dist/DragAndDrop/DragButton.js +6 -4
- package/dist/DragAndDrop/DragButton.js.map +1 -1
- package/dist/Drawer/Drawer.js +1 -1
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/EChart/EChart.js +3 -4
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/GaugeChart/GaugeChart.js +2 -5
- package/dist/GaugeChart/GaugeChart.js.map +1 -1
- package/dist/InfoTooltip/InfoTooltip.js +5 -4
- package/dist/InfoTooltip/InfoTooltip.js.map +1 -1
- package/dist/Legend/ListLegendItem.js +3 -4
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/LineChart/LineChart.js +4 -8
- package/dist/LineChart/LineChart.js.map +1 -1
- package/dist/LinksEditor/LinksEditor.js +9 -18
- package/dist/LinksEditor/LinksEditor.js.map +1 -1
- package/dist/Overlay/Overlay.js +1 -1
- package/dist/Overlay/Overlay.js.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +1 -2
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
- package/dist/StatChart/StatChart.d.ts +4 -4
- package/dist/StatChart/StatChart.d.ts.map +1 -1
- package/dist/StatChart/StatChart.js +9 -15
- package/dist/StatChart/StatChart.js.map +1 -1
- package/dist/StatChart/calculateFontSize.js +2 -4
- package/dist/StatChart/calculateFontSize.js.map +1 -1
- package/dist/StatChart/utils/formatStatChartValue.d.ts +3 -0
- package/dist/StatChart/utils/formatStatChartValue.d.ts.map +1 -0
- package/dist/StatChart/utils/formatStatChartValue.js +26 -0
- package/dist/StatChart/utils/formatStatChartValue.js.map +1 -0
- package/dist/StatusHistoryChart/StatusHistoryChart.d.ts +16 -3
- package/dist/StatusHistoryChart/StatusHistoryChart.d.ts.map +1 -1
- package/dist/StatusHistoryChart/StatusHistoryChart.js +9 -26
- package/dist/StatusHistoryChart/StatusHistoryChart.js.map +1 -1
- package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts +2 -1
- package/dist/StatusHistoryChart/StatusHistoryTooltip.d.ts.map +1 -1
- package/dist/StatusHistoryChart/StatusHistoryTooltip.js +3 -3
- package/dist/StatusHistoryChart/StatusHistoryTooltip.js.map +1 -1
- package/dist/StatusHistoryChart/utils/get-color.d.ts +1 -1
- package/dist/StatusHistoryChart/utils/get-color.d.ts.map +1 -1
- package/dist/StatusHistoryChart/utils/get-color.js +5 -5
- package/dist/StatusHistoryChart/utils/get-color.js.map +1 -1
- package/dist/Table/Table.js +5 -5
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableCell.js +5 -6
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/VirtualizedTable.js +11 -14
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js +1 -1
- package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js +7 -13
- package/dist/Table/hooks/useVirtualizedTableKeyboardNav.js.map +1 -1
- package/dist/Table/model/table-model.js +1 -1
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +15 -23
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/TimeChart/TimeChart.js +3 -6
- package/dist/TimeChart/TimeChart.js.map +1 -1
- package/dist/TimeSeriesTooltip/LineChartTooltip.js +6 -11
- package/dist/TimeSeriesTooltip/LineChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +1 -2
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +2 -3
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +4 -10
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +13 -23
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TimeSeriesTooltip/utils.js +2 -4
- package/dist/TimeSeriesTooltip/utils.js.map +1 -1
- package/dist/TransformsEditor/TransformEditor.js +4 -7
- package/dist/TransformsEditor/TransformEditor.js.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js +3 -5
- package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.js +3 -6
- package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.d.ts +10 -0
- package/dist/ValueMappingEditor/ValueMappingEditor.d.ts.map +1 -0
- package/dist/ValueMappingEditor/ValueMappingEditor.js +374 -0
- package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -0
- package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts +8 -0
- package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -0
- package/dist/ValueMappingEditor/ValueMappingsEditor.js +118 -0
- package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -0
- package/dist/ValueMappingEditor/index.d.ts +2 -0
- package/dist/ValueMappingEditor/index.d.ts.map +1 -0
- package/dist/ValueMappingEditor/index.js +15 -0
- package/dist/ValueMappingEditor/index.js.map +1 -0
- package/dist/cjs/ColorPicker/ColorPicker.js +2 -2
- package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +2 -3
- package/dist/cjs/DragAndDrop/DragButton.js +5 -3
- package/dist/cjs/Drawer/Drawer.js +1 -1
- package/dist/cjs/EChart/EChart.js +3 -4
- package/dist/cjs/GaugeChart/GaugeChart.js +2 -5
- package/dist/cjs/InfoTooltip/InfoTooltip.js +5 -4
- package/dist/cjs/Legend/ListLegendItem.js +3 -4
- package/dist/cjs/LineChart/LineChart.js +4 -8
- package/dist/cjs/LinksEditor/LinksEditor.js +9 -18
- package/dist/cjs/Overlay/Overlay.js +1 -1
- package/dist/cjs/SettingsAutocomplete/SettingsAutocomplete.js +1 -2
- package/dist/cjs/StatChart/StatChart.js +11 -17
- package/dist/cjs/StatChart/calculateFontSize.js +2 -4
- package/dist/cjs/StatChart/utils/formatStatChartValue.js +34 -0
- package/dist/cjs/StatusHistoryChart/StatusHistoryChart.js +11 -28
- package/dist/cjs/StatusHistoryChart/StatusHistoryTooltip.js +3 -3
- package/dist/cjs/StatusHistoryChart/utils/get-color.js +7 -7
- package/dist/cjs/Table/Table.js +5 -5
- package/dist/cjs/Table/TableCell.js +5 -6
- package/dist/cjs/Table/VirtualizedTable.js +11 -14
- package/dist/cjs/Table/hooks/useTableKeyboardNav.js +1 -1
- package/dist/cjs/Table/hooks/useVirtualizedTableKeyboardNav.js +7 -13
- package/dist/cjs/Table/model/table-model.js +1 -1
- package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +15 -23
- package/dist/cjs/TimeChart/TimeChart.js +3 -6
- package/dist/cjs/TimeSeriesTooltip/LineChartTooltip.js +6 -11
- package/dist/cjs/TimeSeriesTooltip/SeriesInfo.js +1 -2
- package/dist/cjs/TimeSeriesTooltip/TimeChartTooltip.js +2 -3
- package/dist/cjs/TimeSeriesTooltip/TooltipHeader.js +4 -10
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +13 -23
- package/dist/cjs/TimeSeriesTooltip/utils.js +2 -4
- package/dist/cjs/TransformsEditor/TransformEditor.js +4 -7
- package/dist/cjs/TransformsEditor/TransformEditorContainer.js +3 -5
- package/dist/cjs/TransformsEditor/TransformsEditor.js +3 -6
- package/dist/cjs/ValueMappingEditor/ValueMappingEditor.js +387 -0
- package/dist/cjs/ValueMappingEditor/ValueMappingsEditor.js +131 -0
- package/dist/cjs/ValueMappingEditor/index.js +30 -0
- package/dist/cjs/context/TimeZoneProvider.js +1 -1
- package/dist/cjs/controls/TextField.js +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/utils/chart-actions.js +1 -2
- package/dist/cjs/utils/format.js +1 -1
- package/dist/cjs/utils/theme-gen.js +5 -7
- package/dist/context/TimeZoneProvider.js +1 -1
- package/dist/context/TimeZoneProvider.js.map +1 -1
- package/dist/controls/TextField.js +1 -1
- package/dist/controls/TextField.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/chart-actions.js +1 -2
- package/dist/utils/chart-actions.js.map +1 -1
- package/dist/utils/format.js +1 -1
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/theme-gen.js +5 -7
- package/dist/utils/theme-gen.js.map +1 -1
- package/package.json +3 -3
|
@@ -35,14 +35,12 @@ function _interop_require_default(obj) {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
function TransformEditorContainer({ index, value, isCollapsed, onChange, onCollapse, onDelete, ...props }) {
|
|
38
|
-
var _value_spec, _value_spec1;
|
|
39
38
|
function handleTransformDisable() {
|
|
40
|
-
var _value_spec;
|
|
41
39
|
onChange({
|
|
42
40
|
...value,
|
|
43
41
|
spec: {
|
|
44
42
|
...value.spec,
|
|
45
|
-
disabled: !
|
|
43
|
+
disabled: !value.spec?.disabled
|
|
46
44
|
}
|
|
47
45
|
});
|
|
48
46
|
}
|
|
@@ -90,7 +88,7 @@ function TransformEditorContainer({ index, value, isCollapsed, onChange, onColla
|
|
|
90
88
|
isCollapsed && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
91
89
|
children: [
|
|
92
90
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tooltip, {
|
|
93
|
-
title:
|
|
91
|
+
title: value.spec?.disabled ? 'Enable transformation' : 'Disable transformation',
|
|
94
92
|
placement: "top",
|
|
95
93
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
96
94
|
size: "small",
|
|
@@ -98,7 +96,7 @@ function TransformEditorContainer({ index, value, isCollapsed, onChange, onColla
|
|
|
98
96
|
marginLeft: 'auto'
|
|
99
97
|
},
|
|
100
98
|
onClick: handleTransformDisable,
|
|
101
|
-
children:
|
|
99
|
+
children: value.spec?.disabled ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_EyeOffOutline.default, {}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_EyeOutline.default, {})
|
|
102
100
|
})
|
|
103
101
|
}),
|
|
104
102
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Divider, {
|
|
@@ -81,17 +81,14 @@ function TransformsEditor({ value, onChange, ...props }) {
|
|
|
81
81
|
gap: 1,
|
|
82
82
|
...props,
|
|
83
83
|
children: [
|
|
84
|
-
value.map((transform, i)
|
|
85
|
-
var _transformsCollapsed_i;
|
|
86
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TransformEditorContainer.TransformEditorContainer, {
|
|
84
|
+
value.map((transform, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_TransformEditorContainer.TransformEditorContainer, {
|
|
87
85
|
index: i,
|
|
88
86
|
value: transform,
|
|
89
|
-
isCollapsed:
|
|
87
|
+
isCollapsed: transformsCollapsed[i] ?? true,
|
|
90
88
|
onChange: (updatedTransform)=>handleTransformChange(i, updatedTransform),
|
|
91
89
|
onDelete: ()=>handleTransformDelete(i),
|
|
92
90
|
onCollapse: (collapsed)=>handleTransformCollapseExpand(i, collapsed)
|
|
93
|
-
}, i)
|
|
94
|
-
}),
|
|
91
|
+
}, i)),
|
|
95
92
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
96
93
|
variant: "contained",
|
|
97
94
|
startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {}),
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "ValueMappingEditor", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return ValueMappingEditor;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _DeleteOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/DeleteOutline"));
|
|
26
|
+
const _Plus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Plus"));
|
|
27
|
+
const _OptionsColorPicker = require("../ColorPicker/OptionsColorPicker");
|
|
28
|
+
function _interop_require_default(obj) {
|
|
29
|
+
return obj && obj.__esModule ? obj : {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const ConditionEditor = ({ mapping, onChange, ...props })=>{
|
|
34
|
+
switch(mapping.kind){
|
|
35
|
+
case 'Value':
|
|
36
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
37
|
+
gap: 1,
|
|
38
|
+
direction: "row",
|
|
39
|
+
...props,
|
|
40
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
41
|
+
label: "Value",
|
|
42
|
+
placeholder: "Exact value",
|
|
43
|
+
value: mapping.spec?.value ?? '',
|
|
44
|
+
onChange: (e)=>onChange({
|
|
45
|
+
...mapping,
|
|
46
|
+
spec: {
|
|
47
|
+
...mapping.spec,
|
|
48
|
+
value: e.target.value
|
|
49
|
+
}
|
|
50
|
+
}),
|
|
51
|
+
fullWidth: true
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
case 'Range':
|
|
55
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
56
|
+
gap: 1,
|
|
57
|
+
direction: "row",
|
|
58
|
+
...props,
|
|
59
|
+
children: [
|
|
60
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
61
|
+
label: "From",
|
|
62
|
+
placeholder: "Start of range",
|
|
63
|
+
value: mapping.spec?.from ?? '',
|
|
64
|
+
onChange: (e)=>onChange({
|
|
65
|
+
...mapping,
|
|
66
|
+
spec: {
|
|
67
|
+
...mapping.spec,
|
|
68
|
+
from: e.target.value === '' ? undefined : +e.target.value
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
fullWidth: true
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
74
|
+
label: "To",
|
|
75
|
+
placeholder: "End of range (inclusive)",
|
|
76
|
+
value: mapping.spec?.to ?? '',
|
|
77
|
+
onChange: (e)=>onChange({
|
|
78
|
+
...mapping,
|
|
79
|
+
spec: {
|
|
80
|
+
...mapping.spec,
|
|
81
|
+
to: e.target.value === '' ? undefined : +e.target.value
|
|
82
|
+
}
|
|
83
|
+
}),
|
|
84
|
+
fullWidth: true
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
case 'Regex':
|
|
89
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
90
|
+
gap: 1,
|
|
91
|
+
direction: "row",
|
|
92
|
+
...props,
|
|
93
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
94
|
+
label: "Regular Expression",
|
|
95
|
+
placeholder: "JavaScript regular expression",
|
|
96
|
+
value: mapping.spec?.pattern ?? '',
|
|
97
|
+
onChange: (e)=>onChange({
|
|
98
|
+
...mapping,
|
|
99
|
+
spec: {
|
|
100
|
+
...mapping.spec,
|
|
101
|
+
pattern: e.target.value
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
fullWidth: true
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
case 'Misc':
|
|
108
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
109
|
+
gap: 1,
|
|
110
|
+
direction: "row",
|
|
111
|
+
...props,
|
|
112
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TextField, {
|
|
113
|
+
select: true,
|
|
114
|
+
label: "Value",
|
|
115
|
+
value: mapping.spec?.value ?? '',
|
|
116
|
+
onChange: (e)=>onChange({
|
|
117
|
+
...mapping,
|
|
118
|
+
spec: {
|
|
119
|
+
value: e.target.value
|
|
120
|
+
}
|
|
121
|
+
}),
|
|
122
|
+
SelectProps: {
|
|
123
|
+
renderValue: (selected)=>{
|
|
124
|
+
switch(selected){
|
|
125
|
+
case 'empty':
|
|
126
|
+
return 'Empty';
|
|
127
|
+
case 'null':
|
|
128
|
+
return 'Null';
|
|
129
|
+
case 'NaN':
|
|
130
|
+
return 'NaN';
|
|
131
|
+
case 'true':
|
|
132
|
+
return 'True';
|
|
133
|
+
case 'false':
|
|
134
|
+
return 'False';
|
|
135
|
+
default:
|
|
136
|
+
return String(selected);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
fullWidth: true,
|
|
141
|
+
children: [
|
|
142
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
143
|
+
value: "empty",
|
|
144
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
145
|
+
children: [
|
|
146
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
147
|
+
children: "Empty"
|
|
148
|
+
}),
|
|
149
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
150
|
+
variant: "caption",
|
|
151
|
+
children: "Matches empty string"
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
})
|
|
155
|
+
}),
|
|
156
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
157
|
+
value: "null",
|
|
158
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
159
|
+
children: [
|
|
160
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
161
|
+
children: "Null"
|
|
162
|
+
}),
|
|
163
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
164
|
+
variant: "caption",
|
|
165
|
+
children: "Matches null or undefined"
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
})
|
|
169
|
+
}),
|
|
170
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
171
|
+
value: "NaN",
|
|
172
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
173
|
+
children: [
|
|
174
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
175
|
+
children: "NaN"
|
|
176
|
+
}),
|
|
177
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
178
|
+
variant: "caption",
|
|
179
|
+
children: "Matches Not a Number value"
|
|
180
|
+
})
|
|
181
|
+
]
|
|
182
|
+
})
|
|
183
|
+
}),
|
|
184
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
185
|
+
value: "true",
|
|
186
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
187
|
+
children: [
|
|
188
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
189
|
+
children: "True"
|
|
190
|
+
}),
|
|
191
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
192
|
+
variant: "caption",
|
|
193
|
+
children: "Matches true boolean"
|
|
194
|
+
})
|
|
195
|
+
]
|
|
196
|
+
})
|
|
197
|
+
}),
|
|
198
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
199
|
+
value: "false",
|
|
200
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
201
|
+
children: [
|
|
202
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
203
|
+
children: "False"
|
|
204
|
+
}),
|
|
205
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
206
|
+
variant: "caption",
|
|
207
|
+
children: "Matches false boolean"
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
})
|
|
211
|
+
})
|
|
212
|
+
]
|
|
213
|
+
})
|
|
214
|
+
});
|
|
215
|
+
default:
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
const ValueMappingEditor = ({ mapping, onChange, onDelete, ...props })=>{
|
|
220
|
+
const handleColorChange = (color)=>{
|
|
221
|
+
onChange({
|
|
222
|
+
...mapping,
|
|
223
|
+
spec: {
|
|
224
|
+
...mapping.spec,
|
|
225
|
+
result: {
|
|
226
|
+
...mapping.spec.result,
|
|
227
|
+
color
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid2, {
|
|
233
|
+
container: true,
|
|
234
|
+
spacing: 2,
|
|
235
|
+
...props,
|
|
236
|
+
children: [
|
|
237
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
|
|
238
|
+
size: {
|
|
239
|
+
xs: 5
|
|
240
|
+
},
|
|
241
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
242
|
+
direction: "row",
|
|
243
|
+
gap: 1,
|
|
244
|
+
width: "100%",
|
|
245
|
+
children: [
|
|
246
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TextField, {
|
|
247
|
+
select: true,
|
|
248
|
+
label: "Type",
|
|
249
|
+
value: mapping.kind,
|
|
250
|
+
onChange: (e)=>onChange({
|
|
251
|
+
...mapping,
|
|
252
|
+
kind: e.target.value
|
|
253
|
+
}),
|
|
254
|
+
required: true,
|
|
255
|
+
sx: {
|
|
256
|
+
width: '120px'
|
|
257
|
+
},
|
|
258
|
+
children: [
|
|
259
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
260
|
+
value: "Value",
|
|
261
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
262
|
+
children: [
|
|
263
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
264
|
+
children: "Value"
|
|
265
|
+
}),
|
|
266
|
+
mapping.kind !== 'Value' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
267
|
+
variant: "caption",
|
|
268
|
+
children: "Matches an exact text value"
|
|
269
|
+
})
|
|
270
|
+
]
|
|
271
|
+
})
|
|
272
|
+
}),
|
|
273
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
274
|
+
value: "Range",
|
|
275
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
276
|
+
children: [
|
|
277
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
278
|
+
children: "Range"
|
|
279
|
+
}),
|
|
280
|
+
mapping.kind !== 'Range' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
281
|
+
variant: "caption",
|
|
282
|
+
children: "Matches against a numerical range"
|
|
283
|
+
})
|
|
284
|
+
]
|
|
285
|
+
})
|
|
286
|
+
}),
|
|
287
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
288
|
+
value: "Regex",
|
|
289
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
290
|
+
children: [
|
|
291
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
292
|
+
children: "Regex"
|
|
293
|
+
}),
|
|
294
|
+
mapping.kind !== 'Regex' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
295
|
+
variant: "caption",
|
|
296
|
+
children: "Matches against a regular expression"
|
|
297
|
+
})
|
|
298
|
+
]
|
|
299
|
+
})
|
|
300
|
+
}),
|
|
301
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
302
|
+
value: "Misc",
|
|
303
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
304
|
+
children: [
|
|
305
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
306
|
+
children: "Misc"
|
|
307
|
+
}),
|
|
308
|
+
mapping.kind !== 'Misc' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
309
|
+
variant: "caption",
|
|
310
|
+
children: "Matches against empty, null and NaN values"
|
|
311
|
+
})
|
|
312
|
+
]
|
|
313
|
+
})
|
|
314
|
+
})
|
|
315
|
+
]
|
|
316
|
+
}),
|
|
317
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(ConditionEditor, {
|
|
318
|
+
width: "100%",
|
|
319
|
+
mapping: mapping,
|
|
320
|
+
onChange: (updatedMapping)=>onChange({
|
|
321
|
+
...mapping,
|
|
322
|
+
...updatedMapping
|
|
323
|
+
})
|
|
324
|
+
})
|
|
325
|
+
]
|
|
326
|
+
})
|
|
327
|
+
}),
|
|
328
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
|
|
329
|
+
size: {
|
|
330
|
+
xs: 4
|
|
331
|
+
},
|
|
332
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
333
|
+
label: "Display text",
|
|
334
|
+
value: mapping.spec?.result?.value ?? '',
|
|
335
|
+
onChange: (e)=>onChange({
|
|
336
|
+
...mapping,
|
|
337
|
+
spec: {
|
|
338
|
+
...mapping.spec,
|
|
339
|
+
result: {
|
|
340
|
+
...mapping.spec?.result,
|
|
341
|
+
value: e.target.value
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}),
|
|
345
|
+
fullWidth: true
|
|
346
|
+
})
|
|
347
|
+
}),
|
|
348
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
|
|
349
|
+
size: {
|
|
350
|
+
xs: 1
|
|
351
|
+
},
|
|
352
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
353
|
+
direction: "row",
|
|
354
|
+
justifyContent: "center",
|
|
355
|
+
gap: 1,
|
|
356
|
+
children: mapping.spec?.result?.color ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsColorPicker.OptionsColorPicker, {
|
|
357
|
+
label: "Color",
|
|
358
|
+
color: mapping.spec.result.color ?? '#000',
|
|
359
|
+
onColorChange: handleColorChange,
|
|
360
|
+
onClear: ()=>handleColorChange(undefined)
|
|
361
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
362
|
+
onClick: ()=>handleColorChange('#000'),
|
|
363
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {})
|
|
364
|
+
})
|
|
365
|
+
})
|
|
366
|
+
}),
|
|
367
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
|
|
368
|
+
size: {
|
|
369
|
+
xs: 1
|
|
370
|
+
},
|
|
371
|
+
textAlign: "end",
|
|
372
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tooltip, {
|
|
373
|
+
title: "Remove mapping settings",
|
|
374
|
+
placement: "top",
|
|
375
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
376
|
+
size: "small",
|
|
377
|
+
sx: {
|
|
378
|
+
marginLeft: 'auto'
|
|
379
|
+
},
|
|
380
|
+
onClick: onDelete,
|
|
381
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DeleteOutline.default, {})
|
|
382
|
+
})
|
|
383
|
+
})
|
|
384
|
+
})
|
|
385
|
+
]
|
|
386
|
+
});
|
|
387
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "ValueMappingsEditor", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return ValueMappingsEditor;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _react = require("react");
|
|
26
|
+
const _Plus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Plus"));
|
|
27
|
+
const _ValueMappingEditor = require("./ValueMappingEditor");
|
|
28
|
+
function _interop_require_default(obj) {
|
|
29
|
+
return obj && obj.__esModule ? obj : {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const ValueMappingsEditor = ({ mappings, onChange })=>{
|
|
34
|
+
const [valueMappings, setValueMappings] = (0, _react.useState)(mappings);
|
|
35
|
+
function handleValueMappingChange(index, mapping) {
|
|
36
|
+
const updatedValueMapings = [
|
|
37
|
+
...valueMappings
|
|
38
|
+
];
|
|
39
|
+
updatedValueMapings[index] = mapping;
|
|
40
|
+
setValueMappings(updatedValueMapings);
|
|
41
|
+
onChange(updatedValueMapings);
|
|
42
|
+
}
|
|
43
|
+
function handleAddValueMappingEditor() {
|
|
44
|
+
const updatedValueMapings = [
|
|
45
|
+
...valueMappings
|
|
46
|
+
];
|
|
47
|
+
updatedValueMapings.push({
|
|
48
|
+
kind: 'Value',
|
|
49
|
+
spec: {
|
|
50
|
+
result: {
|
|
51
|
+
value: ''
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
setValueMappings(updatedValueMapings);
|
|
56
|
+
onChange(updatedValueMapings);
|
|
57
|
+
}
|
|
58
|
+
function handleValueMappingDelete(index) {
|
|
59
|
+
const updatedValueMapings = [
|
|
60
|
+
...valueMappings
|
|
61
|
+
];
|
|
62
|
+
updatedValueMapings.splice(index, 1);
|
|
63
|
+
setValueMappings(updatedValueMapings);
|
|
64
|
+
onChange(updatedValueMapings);
|
|
65
|
+
}
|
|
66
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
67
|
+
spacing: 1,
|
|
68
|
+
children: [
|
|
69
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid2, {
|
|
70
|
+
container: true,
|
|
71
|
+
spacing: 2,
|
|
72
|
+
children: [
|
|
73
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
|
|
74
|
+
size: {
|
|
75
|
+
xs: 5
|
|
76
|
+
},
|
|
77
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
78
|
+
variant: "subtitle1",
|
|
79
|
+
children: "Condition"
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
|
|
83
|
+
size: {
|
|
84
|
+
xs: 4
|
|
85
|
+
},
|
|
86
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
87
|
+
variant: "subtitle1",
|
|
88
|
+
children: "Display Text"
|
|
89
|
+
})
|
|
90
|
+
}),
|
|
91
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
|
|
92
|
+
size: {
|
|
93
|
+
xs: 1
|
|
94
|
+
},
|
|
95
|
+
textAlign: "center",
|
|
96
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
97
|
+
variant: "subtitle1",
|
|
98
|
+
children: "Color"
|
|
99
|
+
})
|
|
100
|
+
}),
|
|
101
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
|
|
102
|
+
size: {
|
|
103
|
+
xs: 1
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
}),
|
|
108
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
109
|
+
gap: 1.5,
|
|
110
|
+
divider: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Divider, {
|
|
111
|
+
flexItem: true,
|
|
112
|
+
orientation: "horizontal"
|
|
113
|
+
}),
|
|
114
|
+
children: valueMappings.map((mapping, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_ValueMappingEditor.ValueMappingEditor, {
|
|
115
|
+
mapping: mapping,
|
|
116
|
+
onChange: (updatedMapping)=>handleValueMappingChange(i, updatedMapping),
|
|
117
|
+
onDelete: ()=>handleValueMappingDelete(i)
|
|
118
|
+
}, i))
|
|
119
|
+
}),
|
|
120
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
121
|
+
variant: "contained",
|
|
122
|
+
startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {}),
|
|
123
|
+
sx: {
|
|
124
|
+
marginTop: 1
|
|
125
|
+
},
|
|
126
|
+
onClick: handleAddValueMappingEditor,
|
|
127
|
+
children: "Add value mappings"
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
_export_star(require("./ValueMappingsEditor"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return from;
|
|
30
|
+
}
|
|
@@ -87,7 +87,7 @@ function useTimeZone() {
|
|
|
87
87
|
const timeZone = (0, _react.useContext)(TimeZoneContext);
|
|
88
88
|
return {
|
|
89
89
|
// fallback to "local" timezone if TimeZoneProvider is not present in the React tree
|
|
90
|
-
timeZone: timeZone
|
|
90
|
+
timeZone: timeZone ?? 'local',
|
|
91
91
|
formatWithUserTimeZone (date, formatString) {
|
|
92
92
|
return (0, _utils.formatWithTimeZone)(date, formatString, timeZone);
|
|
93
93
|
},
|
|
@@ -36,7 +36,7 @@ const TextField = /*#__PURE__*/ (0, _react.forwardRef)(function({ debounceMs = 2
|
|
|
36
36
|
debounceFn(event.target.value);
|
|
37
37
|
}
|
|
38
38
|
const handleDebounceFn = (0, _react.useCallback)((inputValue)=>{
|
|
39
|
-
onChange
|
|
39
|
+
onChange?.(inputValue);
|
|
40
40
|
}, [
|
|
41
41
|
onChange
|
|
42
42
|
]);
|
package/dist/cjs/index.js
CHANGED
|
@@ -57,6 +57,7 @@ _export_star(require("./TransformsEditor"), exports);
|
|
|
57
57
|
_export_star(require("./RefreshIntervalPicker"), exports);
|
|
58
58
|
_export_star(require("./PieChart"), exports);
|
|
59
59
|
_export_star(require("./StatusHistoryChart"), exports);
|
|
60
|
+
_export_star(require("./ValueMappingEditor"), exports);
|
|
60
61
|
function _export_star(from, to) {
|
|
61
62
|
Object.keys(from).forEach(function(k) {
|
|
62
63
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -138,8 +138,7 @@ function batchDispatchNearbySeriesActions(chart, nearbySeriesIndexes, emphasized
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
function checkCrosshairPinnedStatus(seriesMapping) {
|
|
141
|
-
|
|
142
|
-
const isCrosshairPinned = ((_seriesMapping_ = seriesMapping[seriesMapping.length - 1]) === null || _seriesMapping_ === void 0 ? void 0 : _seriesMapping_.name) === _model.PINNED_CROSSHAIR_SERIES_NAME;
|
|
141
|
+
const isCrosshairPinned = seriesMapping[seriesMapping.length - 1]?.name === _model.PINNED_CROSSHAIR_SERIES_NAME;
|
|
143
142
|
return isCrosshairPinned;
|
|
144
143
|
}
|
|
145
144
|
function getClosestTimestamp(timeSeriesValues, cursorX) {
|
package/dist/cjs/utils/format.js
CHANGED
|
@@ -60,7 +60,7 @@ function formatWithTimeZone(date, formatString, timeZone) {
|
|
|
60
60
|
* if timeZone is provided, and is not local|browser,
|
|
61
61
|
* then format using timeZone option (recognize UTC regardless of uppercase/lowercase)
|
|
62
62
|
* otherwise, format without timeZone option, defaulting to browser timeZone setting
|
|
63
|
-
*/ const lowerTimeZone = timeZone
|
|
63
|
+
*/ const lowerTimeZone = timeZone?.toLowerCase();
|
|
64
64
|
if (!timeZone || lowerTimeZone === 'local' || lowerTimeZone === 'browser') {
|
|
65
65
|
return (0, _datefns.format)(date, formatString);
|
|
66
66
|
} else {
|