@perses-dev/components 0.54.0-beta.0 → 0.54.0-beta.10
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/AlignSelector/AlignSelector.js +1 -1
- package/dist/AlignSelector/AlignSelector.js.map +1 -1
- package/dist/ColorPicker/ColorPicker.js +1 -1
- package/dist/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.d.ts +2 -1
- package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -1
- package/dist/ColorPicker/OptionsColorPicker.js +3 -3
- package/dist/ColorPicker/OptionsColorPicker.js.map +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js +1 -1
- package/dist/ContentWithLegend/ContentWithLegend.js.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.d.ts.map +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js +1 -1
- package/dist/ContentWithLegend/model/content-with-legend-model.js.map +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js +1 -1
- package/dist/Dialog/DiscardChangesConfirmationDialog.js.map +1 -1
- package/dist/DragAndDrop/DragAndDropList.js +1 -1
- package/dist/DragAndDrop/DragAndDropList.js.map +1 -1
- package/dist/DragAndDrop/DragButton.js +1 -1
- package/dist/DragAndDrop/DragButton.js.map +1 -1
- package/dist/DragAndDrop/DropIndicator.js +1 -1
- package/dist/DragAndDrop/DropIndicator.js.map +1 -1
- package/dist/Drawer/Drawer.js +1 -1
- package/dist/Drawer/Drawer.js.map +1 -1
- package/dist/EChart/EChart.js +1 -1
- package/dist/EChart/EChart.js.map +1 -1
- package/dist/ErrorAlert.js +1 -1
- package/dist/ErrorAlert.js.map +1 -1
- package/dist/FormEditor/FormActions.d.ts +1 -1
- package/dist/FormEditor/FormActions.d.ts.map +1 -1
- package/dist/FormEditor/FormActions.js +1 -1
- package/dist/FormEditor/FormActions.js.map +1 -1
- package/dist/FormatControls/FormatControls.d.ts +1 -1
- package/dist/FormatControls/FormatControls.d.ts.map +1 -1
- package/dist/FormatControls/FormatControls.js +2 -2
- package/dist/FormatControls/FormatControls.js.map +1 -1
- package/dist/FormatControls/UnitSelector.d.ts +1 -1
- package/dist/FormatControls/UnitSelector.d.ts.map +1 -1
- package/dist/FormatControls/UnitSelector.js +1 -1
- package/dist/FormatControls/UnitSelector.js.map +1 -1
- package/dist/JSONEditor.js +1 -1
- package/dist/JSONEditor.js.map +1 -1
- package/dist/Legend/CompactLegend.js +1 -1
- package/dist/Legend/CompactLegend.js.map +1 -1
- package/dist/Legend/Legend.js +2 -2
- package/dist/Legend/Legend.js.map +1 -1
- package/dist/Legend/LegendColorBadge.js +1 -1
- package/dist/Legend/LegendColorBadge.js.map +1 -1
- package/dist/Legend/ListLegend.js +1 -1
- package/dist/Legend/ListLegend.js.map +1 -1
- package/dist/Legend/ListLegendItem.js +1 -1
- package/dist/Legend/ListLegendItem.js.map +1 -1
- package/dist/Legend/TableLegend.d.ts.map +1 -1
- package/dist/Legend/TableLegend.js +18 -4
- package/dist/Legend/TableLegend.js.map +1 -1
- package/dist/Legend/legend-model.d.ts +1 -1
- package/dist/Legend/legend-model.d.ts.map +1 -1
- package/dist/Legend/legend-model.js.map +1 -1
- package/dist/LinksEditor/LinkEditorForm.js +1 -1
- package/dist/LinksEditor/LinkEditorForm.js.map +1 -1
- package/dist/LinksEditor/LinksEditor.js +1 -1
- package/dist/LinksEditor/LinksEditor.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorColumn.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorControl.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGrid.js.map +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js +1 -1
- package/dist/OptionsEditorLayout/OptionsEditorGroup.js.map +1 -1
- package/dist/Overlay/Overlay.js +1 -1
- package/dist/Overlay/Overlay.js.map +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js +1 -1
- package/dist/RefreshIntervalPicker/RefreshIntervalPicker.js.map +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js +1 -1
- package/dist/SettingsAutocomplete/SettingsAutocomplete.js.map +1 -1
- package/dist/SortSelector/SortSelectorButtons.js +1 -1
- package/dist/SortSelector/SortSelectorButtons.js.map +1 -1
- package/dist/Table/InnerTable.js +1 -1
- package/dist/Table/InnerTable.js.map +1 -1
- package/dist/Table/Table.d.ts +1 -1
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +47 -14
- package/dist/Table/Table.js.map +1 -1
- package/dist/Table/TableBody.js +1 -1
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableCell.js +1 -1
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableCheckbox.js +1 -1
- package/dist/Table/TableCheckbox.js.map +1 -1
- package/dist/Table/TableFoot.js +1 -1
- package/dist/Table/TableFoot.js.map +1 -1
- package/dist/Table/TableHead.js +1 -1
- package/dist/Table/TableHead.js.map +1 -1
- package/dist/Table/TableHeaderCell.d.ts +20 -1
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +56 -24
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/TableRow.js +1 -1
- package/dist/Table/TableRow.js.map +1 -1
- package/dist/Table/TableToolbar.d.ts +46 -0
- package/dist/Table/TableToolbar.d.ts.map +1 -0
- package/dist/Table/TableToolbar.js +138 -0
- package/dist/Table/TableToolbar.js.map +1 -0
- package/dist/Table/VirtualizedTable.d.ts +7 -3
- package/dist/Table/VirtualizedTable.d.ts.map +1 -1
- package/dist/Table/VirtualizedTable.js +157 -123
- package/dist/Table/VirtualizedTable.js.map +1 -1
- package/dist/Table/VirtualizedTableContainer.d.ts.map +1 -1
- package/dist/Table/VirtualizedTableContainer.js +6 -2
- package/dist/Table/VirtualizedTableContainer.js.map +1 -1
- package/dist/Table/hooks/useFuzzySearch.d.ts +14 -0
- package/dist/Table/hooks/useFuzzySearch.d.ts.map +1 -0
- package/dist/Table/hooks/useFuzzySearch.js +62 -0
- package/dist/Table/hooks/useFuzzySearch.js.map +1 -0
- package/dist/Table/model/table-model.d.ts +78 -4
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js +37 -19
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.d.ts +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
- package/dist/TimeRangeSelector/TimeRangeSelector.js +25 -2
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js +1 -1
- package/dist/TimeSeriesTooltip/SeriesInfo.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js +1 -1
- package/dist/TimeSeriesTooltip/SeriesLabelsStack.js.map +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js +1 -1
- package/dist/TimeSeriesTooltip/SeriesMarker.js.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +1 -2
- package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js +1 -1
- package/dist/TimeSeriesTooltip/TimeChartTooltip.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js +1 -1
- package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js +1 -1
- package/dist/TimeSeriesTooltip/TooltipHeader.js.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.d.ts +2 -2
- package/dist/TimeSeriesTooltip/nearby-series.d.ts.map +1 -1
- package/dist/TimeSeriesTooltip/nearby-series.js +1 -2
- package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
- package/dist/TimeZoneSelector.js +1 -1
- package/dist/TimeZoneSelector.js.map +1 -1
- package/dist/ToolbarIconButton/ToolbarIconButton.js +1 -1
- package/dist/ToolbarIconButton/ToolbarIconButton.js.map +1 -1
- package/dist/TransformsEditor/TransformEditor.d.ts +1 -1
- package/dist/TransformsEditor/TransformEditor.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformEditor.js +1 -1
- package/dist/TransformsEditor/TransformEditor.js.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformEditorContainer.js +2 -2
- package/dist/TransformsEditor/TransformEditorContainer.js.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.d.ts +1 -1
- package/dist/TransformsEditor/TransformsEditor.d.ts.map +1 -1
- package/dist/TransformsEditor/TransformsEditor.js +1 -1
- package/dist/TransformsEditor/TransformsEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.d.ts +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.d.ts.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.js +1 -1
- package/dist/ValueMappingEditor/ValueMappingEditor.js.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.d.ts.map +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.js +1 -1
- package/dist/ValueMappingEditor/ValueMappingsEditor.js.map +1 -1
- package/dist/YAxisLabel.js +1 -1
- package/dist/YAxisLabel.js.map +1 -1
- package/dist/cjs/ColorPicker/OptionsColorPicker.js +2 -2
- package/dist/cjs/ContentWithLegend/ContentWithLegend.js +2 -2
- package/dist/cjs/ContentWithLegend/model/content-with-legend-model.js +2 -2
- package/dist/cjs/FormatControls/FormatControls.js +4 -4
- package/dist/cjs/FormatControls/UnitSelector.js +3 -3
- package/dist/cjs/Legend/Legend.js +2 -2
- package/dist/cjs/Legend/TableLegend.js +16 -2
- package/dist/cjs/Table/Table.js +44 -11
- package/dist/cjs/Table/TableHeaderCell.js +54 -22
- package/dist/cjs/Table/TableToolbar.js +151 -0
- package/dist/cjs/Table/VirtualizedTable.js +155 -121
- package/dist/cjs/Table/VirtualizedTableContainer.js +5 -1
- package/dist/cjs/Table/hooks/useFuzzySearch.js +67 -0
- package/dist/cjs/Table/model/table-model.js +43 -19
- package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +23 -0
- package/dist/cjs/TimeSeriesTooltip/nearby-series.js +2 -3
- package/dist/cjs/TransformsEditor/TransformEditorContainer.js +2 -2
- package/dist/cjs/model/action.js +43 -0
- package/dist/cjs/model/bits.js +113 -0
- package/dist/cjs/model/bytes.js +115 -0
- package/dist/cjs/model/constants.js +23 -0
- package/dist/cjs/model/currency.js +126 -0
- package/dist/cjs/model/date.js +297 -0
- package/dist/cjs/model/decimal.js +72 -0
- package/dist/cjs/model/formatterCache.js +120 -0
- package/dist/cjs/model/index.js +17 -0
- package/dist/cjs/model/legend.js +101 -0
- package/dist/cjs/model/percent.js +82 -0
- package/dist/cjs/model/temperature.js +72 -0
- package/dist/cjs/model/thresholds.js +16 -0
- package/dist/cjs/model/throughput.js +161 -0
- package/dist/cjs/model/time.js +178 -0
- package/dist/cjs/model/transforms.js +29 -0
- package/dist/cjs/model/types.js +16 -0
- package/dist/cjs/model/units.js +186 -0
- package/dist/cjs/model/utils.js +48 -0
- package/dist/cjs/model/value-mapping.js +16 -0
- package/dist/cjs/theme/typography.js +1 -1
- package/dist/cjs/utils/axis.js +5 -5
- package/dist/cjs/utils/format.js +23 -5
- package/dist/cjs/utils/index.js +8 -0
- package/dist/cjs/utils/mathjs.js +14 -3
- package/dist/cjs/utils/regexp.js +54 -0
- package/dist/cjs/utils/request-interpolation.js +99 -0
- package/dist/cjs/utils/text.js +52 -0
- package/dist/cjs/utils/time-series-data.js +141 -0
- package/dist/cjs/utils/trace-data.js +25 -0
- package/dist/cjs/utils/transform-data.js +157 -0
- package/dist/cjs/utils/types.js +16 -0
- package/dist/cjs/utils/value-mapping.js +105 -0
- package/dist/context/ChartsProvider.js +1 -1
- package/dist/context/ChartsProvider.js.map +1 -1
- package/dist/context/ItemActionsProvider.js +1 -1
- package/dist/context/ItemActionsProvider.js.map +1 -1
- package/dist/context/SelectionProvider.js +1 -1
- package/dist/context/SelectionProvider.js.map +1 -1
- package/dist/context/SnackbarProvider.js +1 -1
- package/dist/context/SnackbarProvider.js.map +1 -1
- 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/model/action.d.ts +4 -0
- package/dist/model/action.d.ts.map +1 -0
- package/dist/model/action.js +27 -0
- package/dist/model/action.js.map +1 -0
- package/dist/model/bits.d.ts +12 -0
- package/dist/model/bits.d.ts.map +1 -0
- package/dist/model/bits.js +89 -0
- package/dist/model/bits.js.map +1 -0
- package/dist/model/bytes.d.ts +12 -0
- package/dist/model/bytes.d.ts.map +1 -0
- package/dist/model/bytes.js +91 -0
- package/dist/model/bytes.js.map +1 -0
- package/dist/model/constants.d.ts +2 -0
- package/dist/model/constants.d.ts.map +1 -0
- package/dist/model/constants.js +15 -0
- package/dist/model/constants.js.map +1 -0
- package/dist/model/currency.d.ts +11 -0
- package/dist/model/currency.d.ts.map +1 -0
- package/dist/model/currency.js +107 -0
- package/dist/model/currency.js.map +1 -0
- package/dist/model/date.d.ts +28 -0
- package/dist/model/date.d.ts.map +1 -0
- package/dist/model/date.js +278 -0
- package/dist/model/date.js.map +1 -0
- package/dist/model/decimal.d.ts +12 -0
- package/dist/model/decimal.d.ts.map +1 -0
- package/dist/model/decimal.js +53 -0
- package/dist/model/decimal.js.map +1 -0
- package/dist/model/formatterCache.d.ts +11 -0
- package/dist/model/formatterCache.d.ts.map +1 -0
- package/dist/model/formatterCache.js +104 -0
- package/dist/model/formatterCache.js.map +1 -0
- package/dist/model/index.d.ts +17 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +17 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/legend.d.ts +19 -0
- package/dist/model/legend.d.ts.map +1 -0
- package/dist/model/legend.js +61 -0
- package/dist/model/legend.js.map +1 -0
- package/dist/model/percent.d.ts +11 -0
- package/dist/model/percent.d.ts.map +1 -0
- package/dist/model/percent.js +63 -0
- package/dist/model/percent.js.map +1 -0
- package/dist/model/temperature.d.ts +11 -0
- package/dist/model/temperature.d.ts.map +1 -0
- package/dist/model/temperature.js +53 -0
- package/dist/model/temperature.js.map +1 -0
- package/dist/model/theme.d.ts +1 -1
- package/dist/model/theme.d.ts.map +1 -1
- package/dist/model/theme.js.map +1 -1
- package/dist/model/thresholds.d.ts +16 -0
- package/dist/model/thresholds.d.ts.map +1 -0
- package/dist/model/thresholds.js +15 -0
- package/dist/model/thresholds.js.map +1 -0
- package/dist/model/throughput.d.ts +12 -0
- package/dist/model/throughput.d.ts.map +1 -0
- package/dist/model/throughput.js +142 -0
- package/dist/model/throughput.js.map +1 -0
- package/dist/model/time.d.ts +23 -0
- package/dist/model/time.d.ts.map +1 -0
- package/dist/model/time.js +158 -0
- package/dist/model/time.js.map +1 -0
- package/dist/model/transforms.d.ts +43 -0
- package/dist/model/transforms.d.ts.map +1 -0
- package/dist/model/transforms.js +22 -0
- package/dist/model/transforms.js.map +1 -0
- package/dist/model/types.d.ts +56 -0
- package/dist/model/types.d.ts.map +1 -0
- package/dist/model/types.js +15 -0
- package/dist/model/types.js.map +1 -0
- package/dist/model/units.d.ts +105 -0
- package/dist/model/units.d.ts.map +1 -0
- package/dist/model/units.js +132 -0
- package/dist/model/units.js.map +1 -0
- package/dist/model/utils.d.ts +4 -0
- package/dist/model/utils.d.ts.map +1 -0
- package/dist/model/utils.js +32 -0
- package/dist/model/utils.js.map +1 -0
- package/dist/model/value-mapping.d.ts +35 -0
- package/dist/model/value-mapping.d.ts.map +1 -0
- package/dist/model/value-mapping.js +15 -0
- package/dist/model/value-mapping.js.map +1 -0
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/theme/typography.js +1 -1
- package/dist/theme/typography.js.map +1 -1
- package/dist/utils/axis.d.ts +1 -1
- package/dist/utils/axis.d.ts.map +1 -1
- package/dist/utils/axis.js +1 -1
- package/dist/utils/axis.js.map +1 -1
- package/dist/utils/format.d.ts +2 -1
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +20 -5
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/mathjs.d.ts +8 -1
- package/dist/utils/mathjs.d.ts.map +1 -1
- package/dist/utils/mathjs.js +5 -2
- package/dist/utils/mathjs.js.map +1 -1
- package/dist/utils/regexp.d.ts +11 -0
- package/dist/utils/regexp.d.ts.map +1 -0
- package/dist/utils/regexp.js +42 -0
- package/dist/utils/regexp.js.map +1 -0
- package/dist/utils/request-interpolation.d.ts +6 -0
- package/dist/utils/request-interpolation.d.ts.map +1 -0
- package/dist/utils/request-interpolation.js +83 -0
- package/dist/utils/request-interpolation.js.map +1 -0
- package/dist/utils/text.d.ts +8 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +39 -0
- package/dist/utils/text.js.map +1 -0
- package/dist/utils/time-series-data.d.ts +15 -0
- package/dist/utils/time-series-data.d.ts.map +1 -0
- package/dist/utils/time-series-data.js +130 -0
- package/dist/utils/time-series-data.js.map +1 -0
- package/dist/utils/trace-data.d.ts +37 -0
- package/dist/utils/trace-data.d.ts.map +1 -0
- package/dist/utils/trace-data.js +17 -0
- package/dist/utils/trace-data.js.map +1 -0
- package/dist/utils/transform-data.d.ts +7 -0
- package/dist/utils/transform-data.d.ts.map +1 -0
- package/dist/utils/transform-data.js +214 -0
- package/dist/utils/transform-data.js.map +1 -0
- package/dist/utils/types.d.ts +2 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +15 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/value-mapping.d.ts +3 -0
- package/dist/utils/value-mapping.d.ts.map +1 -0
- package/dist/utils/value-mapping.js +97 -0
- package/dist/utils/value-mapping.js.map +1 -0
- package/dist/utils/variable-interpolation.d.ts +1 -0
- package/dist/utils/variable-interpolation.d.ts.map +1 -1
- package/dist/utils/variable-interpolation.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Copyright 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
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get interpolateHeaders () {
|
|
25
|
+
return interpolateHeaders;
|
|
26
|
+
},
|
|
27
|
+
get interpolateQueryParams () {
|
|
28
|
+
return interpolateQueryParams;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const _variableinterpolation = require("./variable-interpolation");
|
|
32
|
+
const _regexp = require("./regexp");
|
|
33
|
+
function expandQueryParamValue(value, variableState) {
|
|
34
|
+
// If value is an array, process each element
|
|
35
|
+
if (Array.isArray(value)) {
|
|
36
|
+
return value.map((v)=>expandQueryParamValue(v, variableState));
|
|
37
|
+
}
|
|
38
|
+
// Now we know value is a string, so we can safely use string methods
|
|
39
|
+
const valueString = value;
|
|
40
|
+
const variablesMap = (0, _variableinterpolation.parseVariablesAndFormat)(valueString);
|
|
41
|
+
// Find the first multi-value variable that should expand to repeated keys
|
|
42
|
+
for (const [varName, format] of variablesMap){
|
|
43
|
+
const varState = variableState[varName];
|
|
44
|
+
if (!varState) continue;
|
|
45
|
+
const options = varState.options ?? [];
|
|
46
|
+
const allOptionValues = options.map((o)=>o.value);
|
|
47
|
+
const isArray = Array.isArray(varState.value);
|
|
48
|
+
const isCustomAllValue = varState.customAllValue !== undefined;
|
|
49
|
+
let expandValues;
|
|
50
|
+
if (isArray) {
|
|
51
|
+
expandValues = varState.value;
|
|
52
|
+
} else if (isCustomAllValue) {
|
|
53
|
+
try {
|
|
54
|
+
const regex = (0, _regexp.createRegexFromString)(varState.customAllValue);
|
|
55
|
+
const matched = options.filter((o)=>regex.test(o.value)).map((o)=>o.value);
|
|
56
|
+
expandValues = matched.length > 0 ? matched : allOptionValues;
|
|
57
|
+
} catch {
|
|
58
|
+
expandValues = allOptionValues;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (!expandValues) continue;
|
|
62
|
+
// If format is queryparam or not specified (default for query params), expand to array
|
|
63
|
+
if (!format || format === _variableinterpolation.InterpolationFormat.QUERYPARAM) {
|
|
64
|
+
// Build syntax patterns for this variable reference
|
|
65
|
+
const simpleSyntax = '$' + varName;
|
|
66
|
+
const bracketSyntax = format ? '${' + varName + ':' + format + '}' : '${' + varName + '}';
|
|
67
|
+
return expandValues.map((singleValue)=>{
|
|
68
|
+
let text = valueString;
|
|
69
|
+
// Replace the variable reference with the raw value directly.
|
|
70
|
+
// We cannot use replaceVariables here because it would apply QUERYPARAM format
|
|
71
|
+
// to the single value, producing "varName=val" instead of just "val".
|
|
72
|
+
text = text.replaceAll(bracketSyntax, singleValue);
|
|
73
|
+
text = text.replaceAll(simpleSyntax, singleValue);
|
|
74
|
+
// Replace any remaining variables (other than the expanded one) using standard interpolation
|
|
75
|
+
return (0, _variableinterpolation.replaceVariables)(text, variableState);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// No multi-value expansion needed — use standard interpolation
|
|
80
|
+
return (0, _variableinterpolation.replaceVariables)(valueString, variableState);
|
|
81
|
+
}
|
|
82
|
+
function interpolateHeaders(headers, variableState) {
|
|
83
|
+
const result = {};
|
|
84
|
+
for (const [key, value] of Object.entries(headers)){
|
|
85
|
+
result[key] = (0, _variableinterpolation.replaceVariables)(value, variableState);
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
function interpolateQueryParams(queryParams, variableState) {
|
|
90
|
+
const result = {};
|
|
91
|
+
for (const [key, value] of Object.entries(queryParams)){
|
|
92
|
+
if (Array.isArray(value)) {
|
|
93
|
+
result[key] = value.map((v)=>(0, _variableinterpolation.replaceVariables)(v, variableState));
|
|
94
|
+
} else {
|
|
95
|
+
result[key] = expandQueryParamValue(value, variableState);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Copyright 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
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get getResourceDisplayName () {
|
|
25
|
+
return getResourceDisplayName;
|
|
26
|
+
},
|
|
27
|
+
get getResourceExtendedDisplayName () {
|
|
28
|
+
return getResourceExtendedDisplayName;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
function getResourceDisplayName(resource) {
|
|
32
|
+
// Variables
|
|
33
|
+
if (resource.spec?.spec?.display?.name) {
|
|
34
|
+
return resource.spec.spec.display.name;
|
|
35
|
+
}
|
|
36
|
+
// Other resources with display
|
|
37
|
+
if (resource.spec?.display?.name) {
|
|
38
|
+
return resource.spec.display.name;
|
|
39
|
+
}
|
|
40
|
+
return resource.metadata.name;
|
|
41
|
+
}
|
|
42
|
+
function getResourceExtendedDisplayName(resource) {
|
|
43
|
+
// Variables
|
|
44
|
+
if (resource.spec?.spec?.display?.name) {
|
|
45
|
+
return `${resource.spec.spec.display.name} (ID: ${resource.metadata.name})`;
|
|
46
|
+
}
|
|
47
|
+
// Other resources with display
|
|
48
|
+
if (resource.spec?.display?.name) {
|
|
49
|
+
return `${resource.spec.display.name} (ID: ${resource.metadata.name})`;
|
|
50
|
+
}
|
|
51
|
+
return resource.metadata.name;
|
|
52
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Copyright 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
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get MIN_STEP_INTERVAL_MS () {
|
|
25
|
+
return MIN_STEP_INTERVAL_MS;
|
|
26
|
+
},
|
|
27
|
+
get getCommonTimeScale () {
|
|
28
|
+
return getCommonTimeScale;
|
|
29
|
+
},
|
|
30
|
+
get getTimeSeriesValues () {
|
|
31
|
+
return getTimeSeriesValues;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _mathjs = require("./mathjs");
|
|
35
|
+
const MIN_STEP_INTERVAL_MS = 10;
|
|
36
|
+
function getTimeSeriesValues(series, timeScale) {
|
|
37
|
+
let timestamp = timeScale.startMs;
|
|
38
|
+
const values = series.values;
|
|
39
|
+
const processedValues = [];
|
|
40
|
+
for (const valueTuple of values){
|
|
41
|
+
// Fill in values up to the current series value timestamp with nulls
|
|
42
|
+
while(timestamp < valueTuple[0]){
|
|
43
|
+
processedValues.push([
|
|
44
|
+
timestamp,
|
|
45
|
+
null
|
|
46
|
+
]);
|
|
47
|
+
timestamp += timeScale.stepMs;
|
|
48
|
+
}
|
|
49
|
+
// Now add the current value since timestamp should match
|
|
50
|
+
processedValues.push([
|
|
51
|
+
timestamp,
|
|
52
|
+
valueTuple[1]
|
|
53
|
+
]);
|
|
54
|
+
timestamp += timeScale.stepMs;
|
|
55
|
+
}
|
|
56
|
+
// Add null values at the end of the series if necessary
|
|
57
|
+
while(timestamp <= timeScale.endMs){
|
|
58
|
+
processedValues.push([
|
|
59
|
+
timestamp,
|
|
60
|
+
null
|
|
61
|
+
]);
|
|
62
|
+
timestamp += timeScale.stepMs;
|
|
63
|
+
}
|
|
64
|
+
return processedValues;
|
|
65
|
+
}
|
|
66
|
+
function getCommonTimeScale(seriesData) {
|
|
67
|
+
let timeRange = undefined;
|
|
68
|
+
const steps = [];
|
|
69
|
+
for (const data of seriesData){
|
|
70
|
+
if (data && 'timeRange' in data) {
|
|
71
|
+
if (data === undefined || data.timeRange === undefined || data.stepMs === undefined) continue;
|
|
72
|
+
// Keep track of query steps so we can calculate a common one for the graph
|
|
73
|
+
steps.push(data.stepMs);
|
|
74
|
+
// If we don't have an overall time range yet, just start with this one
|
|
75
|
+
if (timeRange === undefined) {
|
|
76
|
+
timeRange = data.timeRange;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
// Otherwise, see if this query has a start or end outside of the current
|
|
80
|
+
// time range
|
|
81
|
+
if (data.timeRange.start < timeRange.start) {
|
|
82
|
+
timeRange.start = data.timeRange.start;
|
|
83
|
+
}
|
|
84
|
+
if (data.timeRange.end > timeRange.end) {
|
|
85
|
+
timeRange.end = data.timeRange.end;
|
|
86
|
+
}
|
|
87
|
+
} else if (data && 'values' in data) {
|
|
88
|
+
for(let i = 0; i < data.values.length; i++){
|
|
89
|
+
const values = data.values[i];
|
|
90
|
+
if (values === undefined) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const [timestamp] = values;
|
|
94
|
+
const start = new Date(timestamp);
|
|
95
|
+
const end = new Date(timestamp);
|
|
96
|
+
if (timeRange === undefined) {
|
|
97
|
+
timeRange = {
|
|
98
|
+
start,
|
|
99
|
+
end
|
|
100
|
+
};
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (start < timeRange.start) {
|
|
104
|
+
timeRange.start = start;
|
|
105
|
+
}
|
|
106
|
+
if (end > timeRange.end) {
|
|
107
|
+
timeRange.end = end;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (timeRange === undefined) return undefined;
|
|
111
|
+
const startMs = timeRange.start.valueOf();
|
|
112
|
+
const endMs = timeRange.end.valueOf();
|
|
113
|
+
const rangeMs = endMs - startMs;
|
|
114
|
+
return {
|
|
115
|
+
startMs,
|
|
116
|
+
endMs,
|
|
117
|
+
rangeMs,
|
|
118
|
+
stepMs: MIN_STEP_INTERVAL_MS
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (timeRange === undefined) return undefined;
|
|
123
|
+
// Use the greatest common divisor of all step values as the overall step
|
|
124
|
+
// for the x axis (or if only one query, just use that query's step value)
|
|
125
|
+
let stepMs;
|
|
126
|
+
if (steps.length === 1) {
|
|
127
|
+
stepMs = steps[0];
|
|
128
|
+
} else {
|
|
129
|
+
const calculatedStepMs = (0, _mathjs.gcd)(...steps);
|
|
130
|
+
stepMs = calculatedStepMs < MIN_STEP_INTERVAL_MS ? MIN_STEP_INTERVAL_MS : calculatedStepMs;
|
|
131
|
+
}
|
|
132
|
+
const startMs = timeRange.start.valueOf();
|
|
133
|
+
const endMs = timeRange.end.valueOf();
|
|
134
|
+
const rangeMs = endMs - startMs;
|
|
135
|
+
return {
|
|
136
|
+
startMs,
|
|
137
|
+
endMs,
|
|
138
|
+
stepMs,
|
|
139
|
+
rangeMs
|
|
140
|
+
};
|
|
141
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright 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, "isValidTraceId", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return isValidTraceId;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function isValidTraceId(traceId) {
|
|
24
|
+
return /^[0-9a-fA-F]+$/.test(traceId);
|
|
25
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Copyright 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
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get applyJoinTransform () {
|
|
25
|
+
return applyJoinTransform;
|
|
26
|
+
},
|
|
27
|
+
get applyMergeColumnsTransform () {
|
|
28
|
+
return applyMergeColumnsTransform;
|
|
29
|
+
},
|
|
30
|
+
get applyMergeIndexedColumnsTransform () {
|
|
31
|
+
return applyMergeIndexedColumnsTransform;
|
|
32
|
+
},
|
|
33
|
+
get applyMergeSeriesTransform () {
|
|
34
|
+
return applyMergeSeriesTransform;
|
|
35
|
+
},
|
|
36
|
+
get transformData () {
|
|
37
|
+
return transformData;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
function applyJoinTransform(data, columns) {
|
|
41
|
+
// If column is undefined or empty, return data as is
|
|
42
|
+
if (columns.length === 0) {
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
const rowHashed = {};
|
|
46
|
+
for (const row of data){
|
|
47
|
+
const rowHash = Object.keys(row).filter((k)=>columns.includes(k)).map((k)=>row[k]).join('|');
|
|
48
|
+
const rowHashedValue = rowHashed[rowHash];
|
|
49
|
+
if (rowHashedValue) {
|
|
50
|
+
rowHashed[rowHash] = {
|
|
51
|
+
...rowHashedValue,
|
|
52
|
+
...row
|
|
53
|
+
};
|
|
54
|
+
} else {
|
|
55
|
+
rowHashed[rowHash] = {
|
|
56
|
+
...row
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return Object.values(rowHashed);
|
|
61
|
+
}
|
|
62
|
+
function applyMergeColumnsTransform(data, selectedColumns, outputName) {
|
|
63
|
+
const result = [];
|
|
64
|
+
for (const row of data){
|
|
65
|
+
const columns = Object.keys(row).filter((k)=>selectedColumns.includes(k));
|
|
66
|
+
const selectedColumnValues = {};
|
|
67
|
+
for (const column of columns){
|
|
68
|
+
selectedColumnValues[column] = row[column];
|
|
69
|
+
delete row[column];
|
|
70
|
+
}
|
|
71
|
+
for (const column of columns){
|
|
72
|
+
result.push({
|
|
73
|
+
...row,
|
|
74
|
+
[outputName]: selectedColumnValues[column]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (columns.length === 0) {
|
|
78
|
+
result.push(row);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
function applyMergeIndexedColumnsTransform(data, column) {
|
|
84
|
+
const result = [];
|
|
85
|
+
for (const entry of data){
|
|
86
|
+
const indexedColumns = Object.keys(entry).filter((k)=>new RegExp('^((' + column + ' #\\d+)|(' + column + '))$').test(k));
|
|
87
|
+
const indexedColumnValues = {};
|
|
88
|
+
for (const indexedColumn of indexedColumns){
|
|
89
|
+
indexedColumnValues[indexedColumn] = entry[indexedColumn];
|
|
90
|
+
delete entry[indexedColumn];
|
|
91
|
+
}
|
|
92
|
+
for (const indexedColumn of indexedColumns){
|
|
93
|
+
result.push({
|
|
94
|
+
...entry,
|
|
95
|
+
[column]: indexedColumnValues[indexedColumn]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (indexedColumns.length === 0) {
|
|
99
|
+
result.push(entry);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return result;
|
|
103
|
+
}
|
|
104
|
+
function applyMergeSeriesTransform(data) {
|
|
105
|
+
let result = [
|
|
106
|
+
...data
|
|
107
|
+
];
|
|
108
|
+
const labelColumns = Array.from(new Set(data.flatMap(Object.keys).map((label)=>label.replace(/ #\d+/, '')).filter((label)=>label !== 'value')));
|
|
109
|
+
for (const label of labelColumns){
|
|
110
|
+
result = applyMergeIndexedColumnsTransform(result, label);
|
|
111
|
+
}
|
|
112
|
+
result = applyJoinTransform(result, labelColumns);
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
function transformData(data, transforms) {
|
|
116
|
+
let result = data;
|
|
117
|
+
// Apply transforms by their orders
|
|
118
|
+
for (const transform of transforms ?? []){
|
|
119
|
+
if (transform.spec.disabled) continue;
|
|
120
|
+
switch(transform.kind){
|
|
121
|
+
case 'JoinByColumnValue':
|
|
122
|
+
{
|
|
123
|
+
if (transform.spec.columns && transform.spec.columns.length > 0) {
|
|
124
|
+
result = applyJoinTransform(result, transform.spec.columns);
|
|
125
|
+
}
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case 'MergeIndexedColumns':
|
|
129
|
+
{
|
|
130
|
+
if (transform.spec.column) {
|
|
131
|
+
result = applyMergeIndexedColumnsTransform(result, transform.spec.column);
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
case 'MergeColumns':
|
|
136
|
+
{
|
|
137
|
+
if (transform.spec.columns && transform.spec.columns.length > 0 && transform.spec.name) {
|
|
138
|
+
result = applyMergeColumnsTransform(result, transform.spec.columns, transform.spec.name);
|
|
139
|
+
}
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
case 'MergeSeries':
|
|
143
|
+
{
|
|
144
|
+
result = applyMergeSeriesTransform(result);
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// Ordering data column alphabetically
|
|
150
|
+
result = result.map((row)=>{
|
|
151
|
+
return Object.keys(row).sort().reduce((obj, key)=>{
|
|
152
|
+
obj[key] = row[key];
|
|
153
|
+
return obj;
|
|
154
|
+
}, {});
|
|
155
|
+
});
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 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
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Copyright 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, "applyValueMapping", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return applyValueMapping;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _regexp = require("./regexp");
|
|
24
|
+
function applyValueMapping(value, mappings = []) {
|
|
25
|
+
if (!mappings.length) {
|
|
26
|
+
return {
|
|
27
|
+
value
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const mappedItem = {
|
|
31
|
+
value
|
|
32
|
+
};
|
|
33
|
+
mappings.forEach((mapping)=>{
|
|
34
|
+
switch(mapping.kind){
|
|
35
|
+
case 'Value':
|
|
36
|
+
{
|
|
37
|
+
const valueOptions = mapping.spec;
|
|
38
|
+
if (String(valueOptions.value) === String(value)) {
|
|
39
|
+
mappedItem.value = valueOptions.result.value || mappedItem.value;
|
|
40
|
+
mappedItem.color = valueOptions.result.color;
|
|
41
|
+
}
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case 'Range':
|
|
45
|
+
{
|
|
46
|
+
const rangeOptions = mapping.spec;
|
|
47
|
+
const newValue = value;
|
|
48
|
+
if (rangeOptions.from === undefined && rangeOptions.to === undefined) {
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
const from = rangeOptions.from !== undefined ? rangeOptions.from : -Infinity;
|
|
52
|
+
const to = rangeOptions.to !== undefined ? rangeOptions.to : Infinity;
|
|
53
|
+
if (newValue >= from && newValue <= to) {
|
|
54
|
+
mappedItem.value = rangeOptions.result.value || mappedItem.value;
|
|
55
|
+
mappedItem.color = rangeOptions.result.color;
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case 'Regex':
|
|
60
|
+
{
|
|
61
|
+
const regexOptions = mapping.spec;
|
|
62
|
+
const stringValue = value.toString();
|
|
63
|
+
if (!regexOptions.pattern) {
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
const regex = (0, _regexp.createRegexFromString)(regexOptions.pattern);
|
|
67
|
+
if (stringValue.match(regex)) {
|
|
68
|
+
if (regexOptions.result.value !== null) {
|
|
69
|
+
mappedItem.value = stringValue.replace(regex, regexOptions.result.value.toString() || '') || mappedItem.value;
|
|
70
|
+
mappedItem.color = regexOptions.result.color;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case 'Misc':
|
|
76
|
+
{
|
|
77
|
+
const miscOptions = mapping.spec;
|
|
78
|
+
if (isMiscValueMatch(miscOptions.value, value)) {
|
|
79
|
+
mappedItem.value = miscOptions.result.value || mappedItem.value;
|
|
80
|
+
mappedItem.color = miscOptions.result.color;
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
default:
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return mappedItem;
|
|
89
|
+
}
|
|
90
|
+
function isMiscValueMatch(miscValue, value) {
|
|
91
|
+
switch(miscValue){
|
|
92
|
+
case 'empty':
|
|
93
|
+
return value === '';
|
|
94
|
+
case 'null':
|
|
95
|
+
return value === null || value === undefined;
|
|
96
|
+
case 'NaN':
|
|
97
|
+
return Number.isNaN(value);
|
|
98
|
+
case 'true':
|
|
99
|
+
return value === true;
|
|
100
|
+
case 'false':
|
|
101
|
+
return value === false;
|
|
102
|
+
default:
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import React, { createContext, useContext, useMemo, useState } from 'react';
|
|
15
15
|
export function ChartsProvider(props) {
|
|
16
16
|
const { children, chartsTheme, enablePinning = false, enableSyncGrouping = true } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/ChartsProvider.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { createContext, ReactElement, useContext, useMemo, useState } from 'react';\nimport { PersesChartsTheme } from '../model';\nimport { CursorCoordinates } from '../TimeSeriesTooltip';\n\nexport interface ChartsProviderProps {\n chartsTheme: PersesChartsTheme;\n enablePinning?: boolean;\n enableSyncGrouping?: boolean;\n children?: React.ReactNode;\n}\n\nexport interface SharedChartsState {\n chartsTheme: PersesChartsTheme;\n enablePinning: boolean;\n enableSyncGrouping: boolean;\n lastTooltipPinnedCoords: CursorCoordinates | null;\n setLastTooltipPinnedCoords: (lastTooltipPinnedCoords: CursorCoordinates | null) => void;\n}\n\nexport function ChartsProvider(props: ChartsProviderProps): ReactElement {\n const { children, chartsTheme, enablePinning = false, enableSyncGrouping = true } = props;\n\n const [lastTooltipPinnedCoords, setLastTooltipPinnedCoords] = useState<CursorCoordinates | null>(null);\n\n const ctx = useMemo(() => {\n return {\n chartsTheme,\n enablePinning,\n lastTooltipPinnedCoords,\n enableSyncGrouping,\n setLastTooltipPinnedCoords,\n };\n }, [chartsTheme, enablePinning, enableSyncGrouping, lastTooltipPinnedCoords, setLastTooltipPinnedCoords]);\n\n return <ChartsThemeContext.Provider value={ctx}>{children}</ChartsThemeContext.Provider>;\n}\n\nexport const ChartsThemeContext = createContext<SharedChartsState | undefined>(undefined);\n\nexport function useChartsContext(): SharedChartsState {\n const ctx = useContext(ChartsThemeContext);\n if (ctx === undefined) {\n throw new Error('No ChartsThemeContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useChartsTheme(): PersesChartsTheme {\n const ctx = useChartsContext();\n return ctx.chartsTheme;\n}\n"],"names":["React","createContext","useContext","useMemo","useState","ChartsProvider","props","children","chartsTheme","enablePinning","enableSyncGrouping","lastTooltipPinnedCoords","setLastTooltipPinnedCoords","ctx","ChartsThemeContext","Provider","value","undefined","useChartsContext","Error","useChartsTheme"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC
|
|
1
|
+
{"version":3,"sources":["../../src/context/ChartsProvider.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { createContext, ReactElement, useContext, useMemo, useState } from 'react';\nimport { PersesChartsTheme } from '../model';\nimport { CursorCoordinates } from '../TimeSeriesTooltip';\n\nexport interface ChartsProviderProps {\n chartsTheme: PersesChartsTheme;\n enablePinning?: boolean;\n enableSyncGrouping?: boolean;\n children?: React.ReactNode;\n}\n\nexport interface SharedChartsState {\n chartsTheme: PersesChartsTheme;\n enablePinning: boolean;\n enableSyncGrouping: boolean;\n lastTooltipPinnedCoords: CursorCoordinates | null;\n setLastTooltipPinnedCoords: (lastTooltipPinnedCoords: CursorCoordinates | null) => void;\n}\n\nexport function ChartsProvider(props: ChartsProviderProps): ReactElement {\n const { children, chartsTheme, enablePinning = false, enableSyncGrouping = true } = props;\n\n const [lastTooltipPinnedCoords, setLastTooltipPinnedCoords] = useState<CursorCoordinates | null>(null);\n\n const ctx = useMemo(() => {\n return {\n chartsTheme,\n enablePinning,\n lastTooltipPinnedCoords,\n enableSyncGrouping,\n setLastTooltipPinnedCoords,\n };\n }, [chartsTheme, enablePinning, enableSyncGrouping, lastTooltipPinnedCoords, setLastTooltipPinnedCoords]);\n\n return <ChartsThemeContext.Provider value={ctx}>{children}</ChartsThemeContext.Provider>;\n}\n\nexport const ChartsThemeContext = createContext<SharedChartsState | undefined>(undefined);\n\nexport function useChartsContext(): SharedChartsState {\n const ctx = useContext(ChartsThemeContext);\n if (ctx === undefined) {\n throw new Error('No ChartsThemeContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useChartsTheme(): PersesChartsTheme {\n const ctx = useChartsContext();\n return ctx.chartsTheme;\n}\n"],"names":["React","createContext","useContext","useMemo","useState","ChartsProvider","props","children","chartsTheme","enablePinning","enableSyncGrouping","lastTooltipPinnedCoords","setLastTooltipPinnedCoords","ctx","ChartsThemeContext","Provider","value","undefined","useChartsContext","Error","useChartsTheme"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAOA,SAASC,aAAa,EAAgBC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAmB1F,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,gBAAgB,KAAK,EAAEC,qBAAqB,IAAI,EAAE,GAAGJ;IAEpF,MAAM,CAACK,yBAAyBC,2BAA2B,GAAGR,SAAmC;IAEjG,MAAMS,MAAMV,QAAQ;QAClB,OAAO;YACLK;YACAC;YACAE;YACAD;YACAE;QACF;IACF,GAAG;QAACJ;QAAaC;QAAeC;QAAoBC;QAAyBC;KAA2B;IAExG,qBAAO,KAACE,mBAAmBC,QAAQ;QAACC,OAAOH;kBAAMN;;AACnD;AAEA,OAAO,MAAMO,mCAAqBb,cAA6CgB,WAAW;AAE1F,OAAO,SAASC;IACd,MAAML,MAAMX,WAAWY;IACvB,IAAID,QAAQI,WAAW;QACrB,MAAM,IAAIE,MAAM;IAClB;IACA,OAAON;AACT;AAEA,OAAO,SAASO;IACd,MAAMP,MAAMK;IACZ,OAAOL,IAAIL,WAAW;AACxB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { createContext, useCallback, useContext, useMemo, useState } from 'react';
|
|
15
15
|
const ItemActionsContext = /*#__PURE__*/ createContext(undefined);
|
|
16
16
|
export function ItemActionsProvider({ children }) {
|