@perses-dev/plugin-system 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-histogram-types-78c5104
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/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +82 -162
- package/dist/cjs/components/DatasourceSelect.js +8 -13
- package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +534 -0
- package/dist/cjs/components/{TimeSeriesQueryEditor → HTTPSettingsEditor}/index.js +2 -2
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +8 -7
- package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +41 -0
- package/dist/cjs/components/{TraceQueryEditor → MetricLabelInput}/index.js +2 -2
- package/dist/cjs/components/{TimeSeriesQueryEditor/TimeSeriesQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +30 -23
- package/dist/cjs/components/{TimeSeriesQueryEditor/TimeSeriesQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +25 -13
- package/dist/cjs/{stories/shared-utils → components/MultiQueryEditor}/index.js +2 -2
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +51 -59
- package/dist/cjs/components/PluginEditor/PluginEditor.js +16 -13
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +43 -32
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +55 -7
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +8 -9
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +17 -14
- package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
- package/dist/cjs/components/ProjectSelect.js +5 -5
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +10 -71
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +391 -442
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +7 -7
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +6 -11
- package/dist/cjs/components/Variables/variable-model.js +26 -27
- package/dist/cjs/components/index.js +3 -1
- package/dist/cjs/context/ProjectStoreProvider.js +7 -4
- package/dist/cjs/context/ValidationProvider.js +69 -0
- package/dist/cjs/context/index.js +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/{components/TimeSeriesQueryEditor/index.js → cjs/model/explore.js} +4 -3
- package/dist/cjs/remote/PersesPlugin.types.js +16 -0
- package/dist/cjs/remote/PluginLoaderComponent.js +75 -0
- package/dist/cjs/remote/PluginRuntime.js +273 -0
- package/dist/cjs/{validation → remote}/index.js +2 -5
- package/dist/cjs/remote/remotePluginLoader.js +61 -0
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +18 -9
- package/dist/cjs/runtime/DataQueriesProvider/model.js +10 -9
- package/dist/cjs/{stories/shared-utils/decorators/WithPluginRegistry.js → runtime/QueryCountProvider.js} +22 -39
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +17 -4
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +100 -0
- package/dist/cjs/runtime/TimeRangeProvider/index.js +2 -1
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +4 -7
- package/dist/cjs/runtime/UsageMetricsProvider.js +99 -0
- package/dist/cjs/runtime/builtin-variables.js +2 -2
- package/dist/cjs/runtime/datasources.js +23 -14
- package/dist/cjs/runtime/index.js +4 -2
- package/dist/cjs/runtime/plugin-registry.js +49 -28
- package/dist/cjs/runtime/time-series-queries.js +23 -28
- package/dist/cjs/runtime/trace-queries.js +1 -2
- package/dist/cjs/runtime/{template-variables.js → variables.js} +29 -47
- package/dist/cjs/test/mock-data.js +25 -4
- package/dist/cjs/test/render.js +2 -11
- package/dist/cjs/test/test-plugins/bert/index.js +20 -19
- package/dist/cjs/test-utils/mock-plugin-registry.js +10 -10
- package/dist/cjs/utils/variables.js +24 -24
- package/dist/components/CalculationSelector/CalculationSelector.d.ts +2 -1
- package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +6 -5
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +85 -165
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/DatasourceSelect.d.ts +5 -4
- package/dist/components/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect.js +8 -13
- package/dist/components/DatasourceSelect.js.map +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +11 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +480 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -0
- package/dist/components/HTTPSettingsEditor/index.d.ts +2 -0
- package/dist/components/HTTPSettingsEditor/index.d.ts.map +1 -0
- package/dist/components/HTTPSettingsEditor/index.js +15 -0
- package/dist/components/HTTPSettingsEditor/index.js.map +1 -0
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +3 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +10 -9
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.d.ts +7 -0
- package/dist/components/MetricLabelInput/MetricLabelInput.d.ts.map +1 -0
- package/dist/components/MetricLabelInput/MetricLabelInput.js +33 -0
- package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -0
- package/dist/components/MetricLabelInput/index.d.ts +2 -0
- package/dist/components/MetricLabelInput/index.d.ts.map +1 -0
- package/dist/components/MetricLabelInput/index.js +15 -0
- package/dist/components/MetricLabelInput/index.js.map +1 -0
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +17 -0
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -0
- package/dist/components/{TimeSeriesQueryEditor/TimeSeriesQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +37 -23
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -0
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +29 -0
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -0
- package/dist/components/{TraceQueryEditor/TraceQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +35 -12
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -0
- package/dist/components/MultiQueryEditor/index.d.ts +2 -0
- package/dist/components/MultiQueryEditor/index.d.ts.map +1 -0
- package/dist/components/MultiQueryEditor/index.js +15 -0
- package/dist/components/{TraceQueryEditor → MultiQueryEditor}/index.js.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +2 -2
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +2 -2
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +3 -3
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +5 -2
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +53 -61
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts +2 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +16 -13
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +15 -8
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +43 -32
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +10 -4
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +61 -10
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.d.ts +2 -2
- package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +8 -9
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.d.ts +4 -4
- package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js +17 -14
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +5 -4
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/ProjectSelect.d.ts +2 -1
- package/dist/components/ProjectSelect.d.ts.map +1 -1
- package/dist/components/ProjectSelect.js +5 -5
- package/dist/components/ProjectSelect.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +3 -2
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +12 -70
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +4 -3
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +395 -446
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +3 -2
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +7 -7
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +2 -2
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +6 -11
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/variable-model.d.ts +2 -1
- package/dist/components/Variables/variable-model.d.ts.map +1 -1
- package/dist/components/Variables/variable-model.js +27 -28
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -1
- package/dist/components/index.js.map +1 -1
- package/dist/context/ProjectStoreProvider.d.ts +4 -4
- package/dist/context/ProjectStoreProvider.d.ts.map +1 -1
- package/dist/context/ProjectStoreProvider.js +7 -4
- package/dist/context/ProjectStoreProvider.js.map +1 -1
- package/dist/context/ValidationProvider.d.ts +19 -0
- package/dist/context/ValidationProvider.d.ts.map +1 -0
- package/dist/context/ValidationProvider.js +52 -0
- package/dist/context/ValidationProvider.js.map +1 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -0
- package/dist/context/index.js.map +1 -1
- package/dist/context/query-params.d.ts.map +1 -1
- package/dist/context/query-params.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/explore.d.ts +13 -0
- package/dist/model/explore.d.ts.map +1 -0
- package/dist/{validation/index.js → model/explore.js} +4 -6
- package/dist/model/explore.js.map +1 -0
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js.map +1 -1
- package/dist/model/panels.d.ts +27 -5
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/model/plugins.d.ts +31 -17
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/model/time-series-queries.d.ts +2 -1
- package/dist/model/time-series-queries.d.ts.map +1 -1
- package/dist/model/time-series-queries.js.map +1 -1
- package/dist/remote/PersesPlugin.types.d.ts +7 -0
- package/dist/remote/PersesPlugin.types.d.ts.map +1 -0
- package/dist/{stories/shared-utils/index.js → remote/PersesPlugin.types.js} +3 -3
- package/dist/remote/PersesPlugin.types.js.map +1 -0
- package/dist/remote/PluginLoaderComponent.d.ts +10 -0
- package/dist/remote/PluginLoaderComponent.d.ts.map +1 -0
- package/dist/remote/PluginLoaderComponent.js +67 -0
- package/dist/remote/PluginLoaderComponent.js.map +1 -0
- package/dist/remote/PluginRuntime.d.ts +10 -0
- package/dist/remote/PluginRuntime.d.ts.map +1 -0
- package/dist/remote/PluginRuntime.js +211 -0
- package/dist/remote/PluginRuntime.js.map +1 -0
- package/dist/remote/index.d.ts +3 -0
- package/dist/remote/index.d.ts.map +1 -0
- package/dist/{components/TraceQueryEditor → remote}/index.js +2 -1
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/remotePluginLoader.d.ts +3 -0
- package/dist/remote/remotePluginLoader.d.ts.map +1 -0
- package/dist/remote/remotePluginLoader.js +53 -0
- package/dist/remote/remotePluginLoader.js.map +1 -0
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +2 -2
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +18 -9
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +5 -6
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +10 -9
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/QueryCountProvider.d.ts +9 -0
- package/dist/runtime/QueryCountProvider.d.ts.map +1 -0
- package/dist/{validation/duration.js → runtime/QueryCountProvider.js} +13 -4
- package/dist/runtime/QueryCountProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +2 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +17 -4
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +2 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +32 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +82 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts +1 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/index.js +2 -1
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +4 -7
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
- package/dist/runtime/UsageMetricsProvider.d.ts +25 -0
- package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -0
- package/dist/runtime/UsageMetricsProvider.js +77 -0
- package/dist/runtime/UsageMetricsProvider.js.map +1 -0
- package/dist/runtime/builtin-variables.d.ts +1 -1
- package/dist/runtime/builtin-variables.d.ts.map +1 -1
- package/dist/runtime/builtin-variables.js +2 -2
- package/dist/runtime/builtin-variables.js.map +1 -1
- package/dist/runtime/datasources.d.ts +5 -4
- package/dist/runtime/datasources.d.ts.map +1 -1
- package/dist/runtime/datasources.js +23 -14
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +4 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/plugin-registry.d.ts +10 -10
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +49 -28
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts +5 -4
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +23 -28
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.d.ts +4 -3
- package/dist/runtime/trace-queries.d.ts.map +1 -1
- package/dist/runtime/trace-queries.js +2 -3
- package/dist/runtime/trace-queries.js.map +1 -1
- package/dist/runtime/{template-variables.d.ts → variables.d.ts} +4 -4
- package/dist/runtime/variables.d.ts.map +1 -0
- package/dist/runtime/{template-variables.js → variables.js} +28 -45
- package/dist/runtime/variables.js.map +1 -0
- package/dist/test/mock-data.d.ts.map +1 -1
- package/dist/test/mock-data.js +25 -4
- package/dist/test/mock-data.js.map +1 -1
- package/dist/test/render.d.ts +3 -3
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +2 -11
- package/dist/test/render.js.map +1 -1
- package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
- package/dist/test/test-plugins/bert/index.js +20 -19
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.d.ts +5 -3
- package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +10 -10
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/dist/utils/variables.d.ts +4 -4
- package/dist/utils/variables.d.ts.map +1 -1
- package/dist/utils/variables.js +19 -19
- package/dist/utils/variables.js.map +1 -1
- package/package.json +10 -11
- package/dist/cjs/components/TraceQueryEditor/TraceQueryEditor.js +0 -143
- package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +0 -96
- package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +0 -41
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +0 -42
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +0 -101
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js +0 -42
- package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +0 -41
- package/dist/cjs/stories/shared-utils/decorators/index.js +0 -35
- package/dist/cjs/validation/datasource.js +0 -30
- package/dist/cjs/validation/duration.js +0 -25
- package/dist/cjs/validation/resource.js +0 -24
- package/dist/cjs/validation/role.js +0 -86
- package/dist/cjs/validation/rolebinding.js +0 -55
- package/dist/cjs/validation/secret.js +0 -176
- package/dist/cjs/validation/user.js +0 -46
- package/dist/cjs/validation/variable.js +0 -48
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +0 -7
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +0 -12
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +0 -83
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/index.d.ts +0 -2
- package/dist/components/TimeSeriesQueryEditor/index.d.ts.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/index.js.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts +0 -8
- package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryEditor.js +0 -130
- package/dist/components/TraceQueryEditor/TraceQueryEditor.js.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts +0 -12
- package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryInput.js.map +0 -1
- package/dist/components/TraceQueryEditor/index.d.ts +0 -2
- package/dist/components/TraceQueryEditor/index.d.ts.map +0 -1
- package/dist/runtime/template-variables.d.ts.map +0 -1
- package/dist/runtime/template-variables.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts +0 -12
- package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.js +0 -33
- package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +0 -3
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +0 -46
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +0 -12
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +0 -39
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts +0 -12
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +0 -95
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts +0 -12
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js +0 -39
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +0 -12
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.js +0 -33
- package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +0 -1
- package/dist/stories/shared-utils/decorators/index.d.ts +0 -7
- package/dist/stories/shared-utils/decorators/index.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/index.js +0 -20
- package/dist/stories/shared-utils/decorators/index.js.map +0 -1
- package/dist/stories/shared-utils/index.d.ts +0 -2
- package/dist/stories/shared-utils/index.d.ts.map +0 -1
- package/dist/stories/shared-utils/index.js.map +0 -1
- package/dist/validation/datasource.d.ts +0 -19
- package/dist/validation/datasource.d.ts.map +0 -1
- package/dist/validation/datasource.js +0 -22
- package/dist/validation/datasource.js.map +0 -1
- package/dist/validation/duration.d.ts +0 -3
- package/dist/validation/duration.d.ts.map +0 -1
- package/dist/validation/duration.js.map +0 -1
- package/dist/validation/index.d.ts +0 -6
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/resource.d.ts +0 -3
- package/dist/validation/resource.d.ts.map +0 -1
- package/dist/validation/resource.js +0 -16
- package/dist/validation/resource.js.map +0 -1
- package/dist/validation/role.d.ts +0 -228
- package/dist/validation/role.d.ts.map +0 -1
- package/dist/validation/role.js +0 -67
- package/dist/validation/role.js.map +0 -1
- package/dist/validation/rolebinding.d.ts +0 -137
- package/dist/validation/rolebinding.d.ts.map +0 -1
- package/dist/validation/rolebinding.js +0 -47
- package/dist/validation/rolebinding.js.map +0 -1
- package/dist/validation/secret.d.ts +0 -964
- package/dist/validation/secret.d.ts.map +0 -1
- package/dist/validation/secret.js +0 -157
- package/dist/validation/secret.js.map +0 -1
- package/dist/validation/user.d.ts +0 -93
- package/dist/validation/user.d.ts.map +0 -1
- package/dist/validation/user.js +0 -38
- package/dist/validation/user.js.map +0 -1
- package/dist/validation/variable.d.ts +0 -96
- package/dist/validation/variable.d.ts.map +0 -1
- package/dist/validation/variable.js +0 -40
- package/dist/validation/variable.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -21,18 +21,18 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
VariableContext: function() {
|
|
25
|
+
return VariableContext;
|
|
26
26
|
},
|
|
27
27
|
VariableStoreStateMap: function() {
|
|
28
28
|
return VariableStoreStateMap;
|
|
29
29
|
},
|
|
30
|
+
useAllVariableValues: function() {
|
|
31
|
+
return useAllVariableValues;
|
|
32
|
+
},
|
|
30
33
|
useReplaceVariablesInString: function() {
|
|
31
34
|
return useReplaceVariablesInString;
|
|
32
35
|
},
|
|
33
|
-
useTemplateVariableValues: function() {
|
|
34
|
-
return useTemplateVariableValues;
|
|
35
|
-
},
|
|
36
36
|
useVariableValues: function() {
|
|
37
37
|
return useVariableValues;
|
|
38
38
|
}
|
|
@@ -41,22 +41,14 @@ const _react = require("react");
|
|
|
41
41
|
const _immer = require("immer");
|
|
42
42
|
const _utils = require("../utils");
|
|
43
43
|
const _builtinvariables = require("./builtin-variables");
|
|
44
|
-
function _define_property(obj, key, value) {
|
|
45
|
-
if (key in obj) {
|
|
46
|
-
Object.defineProperty(obj, key, {
|
|
47
|
-
value: value,
|
|
48
|
-
enumerable: true,
|
|
49
|
-
configurable: true,
|
|
50
|
-
writable: true
|
|
51
|
-
});
|
|
52
|
-
} else {
|
|
53
|
-
obj[key] = value;
|
|
54
|
-
}
|
|
55
|
-
return obj;
|
|
56
|
-
}
|
|
57
|
-
let _immerable = _immer.immerable;
|
|
58
44
|
class VariableStoreStateMap {
|
|
59
45
|
/**
|
|
46
|
+
* "Immerable" is mandatory to be able to use this class in an immer context.
|
|
47
|
+
* Ref: https://docs.pmnd.rs/zustand/integrations/immer-middleware#gotchas
|
|
48
|
+
*/ [_immer.immerable] = true;
|
|
49
|
+
DEFAULT_LOCAL_SOURCE_NAME = '';
|
|
50
|
+
_state = {};
|
|
51
|
+
/**
|
|
60
52
|
* Get variable state by key.
|
|
61
53
|
* @param key
|
|
62
54
|
*/ get(key) {
|
|
@@ -84,7 +76,6 @@ class VariableStoreStateMap {
|
|
|
84
76
|
* Delete variable state by key.
|
|
85
77
|
* @param key
|
|
86
78
|
*/ delete(key) {
|
|
87
|
-
var _Object_keys;
|
|
88
79
|
const result = this.has(key);
|
|
89
80
|
const sourceName = this._sourceName(key.source);
|
|
90
81
|
const sourceStates = this._state[sourceName];
|
|
@@ -93,40 +84,31 @@ class VariableStoreStateMap {
|
|
|
93
84
|
delete sourceStates[key.name];
|
|
94
85
|
}
|
|
95
86
|
// Delete source state from state if empty
|
|
96
|
-
if (
|
|
87
|
+
if (Object.keys(sourceStates ?? {})?.length === 0) {
|
|
97
88
|
delete this._state[sourceName];
|
|
98
89
|
}
|
|
99
90
|
return result;
|
|
100
91
|
}
|
|
101
92
|
_sourceName(source) {
|
|
102
|
-
return source
|
|
93
|
+
return source ?? this.DEFAULT_LOCAL_SOURCE_NAME;
|
|
103
94
|
}
|
|
104
95
|
_sourceStatesOrEmpty(source) {
|
|
105
|
-
|
|
106
|
-
return (_this__state_this__sourceName = this._state[this._sourceName(source)]) !== null && _this__state_this__sourceName !== void 0 ? _this__state_this__sourceName : {};
|
|
107
|
-
}
|
|
108
|
-
constructor(){
|
|
109
|
-
/**
|
|
110
|
-
* "Immerable" is mandatory to be able to use this class in an immer context.
|
|
111
|
-
* Ref: https://docs.pmnd.rs/zustand/integrations/immer-middleware#gotchas
|
|
112
|
-
*/ _define_property(this, _immerable, true);
|
|
113
|
-
_define_property(this, "DEFAULT_LOCAL_SOURCE_NAME", '');
|
|
114
|
-
_define_property(this, "_state", {});
|
|
96
|
+
return this._state[this._sourceName(source)] ?? {};
|
|
115
97
|
}
|
|
116
98
|
}
|
|
117
|
-
const
|
|
118
|
-
function
|
|
119
|
-
const ctx = (0, _react.useContext)(
|
|
99
|
+
const VariableContext = (0, _react.createContext)(undefined);
|
|
100
|
+
function useVariableContext() {
|
|
101
|
+
const ctx = (0, _react.useContext)(VariableContext);
|
|
120
102
|
if (ctx === undefined) {
|
|
121
|
-
throw new Error('No
|
|
103
|
+
throw new Error('No VariableContext found. Did you forget a Provider?');
|
|
122
104
|
}
|
|
123
105
|
return ctx;
|
|
124
106
|
}
|
|
125
|
-
function
|
|
126
|
-
const { state } =
|
|
107
|
+
function useVariableValues(names) {
|
|
108
|
+
const { state } = useVariableContext();
|
|
127
109
|
const values = (0, _react.useMemo)(()=>{
|
|
128
110
|
const values = {};
|
|
129
|
-
names
|
|
111
|
+
names?.forEach((name)=>{
|
|
130
112
|
const s = state[name];
|
|
131
113
|
if (s) {
|
|
132
114
|
values[name] = s;
|
|
@@ -142,22 +124,22 @@ function useTemplateVariableValues(names) {
|
|
|
142
124
|
}
|
|
143
125
|
return values;
|
|
144
126
|
}
|
|
145
|
-
function
|
|
146
|
-
const
|
|
127
|
+
function useAllVariableValues(names) {
|
|
128
|
+
const variableValues = useVariableValues(names);
|
|
147
129
|
const builtinVariableValues = (0, _builtinvariables.useBuiltinVariableValues)(names);
|
|
148
130
|
return (0, _react.useMemo)(()=>{
|
|
149
131
|
return {
|
|
150
|
-
...
|
|
132
|
+
...variableValues,
|
|
151
133
|
...builtinVariableValues
|
|
152
134
|
};
|
|
153
135
|
}, [
|
|
154
|
-
|
|
136
|
+
variableValues,
|
|
155
137
|
builtinVariableValues
|
|
156
138
|
]);
|
|
157
139
|
}
|
|
158
140
|
function useReplaceVariablesInString(str) {
|
|
159
|
-
const variablesInString = str ? (0, _utils.
|
|
160
|
-
const variableValues =
|
|
141
|
+
const variablesInString = str ? (0, _utils.parseVariables)(str) : [];
|
|
142
|
+
const variableValues = useAllVariableValues(variablesInString);
|
|
161
143
|
if (!str) return undefined;
|
|
162
|
-
return (0, _utils.
|
|
144
|
+
return (0, _utils.replaceVariables)(str, variableValues);
|
|
163
145
|
}
|
|
@@ -64,14 +64,35 @@ const MOCK_TIME_SERIES_DATA = {
|
|
|
64
64
|
]
|
|
65
65
|
};
|
|
66
66
|
const MOCK_TRACE_DATA = {
|
|
67
|
-
|
|
67
|
+
searchResult: [
|
|
68
68
|
{
|
|
69
69
|
durationMs: 1120,
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
serviceStats: {
|
|
71
|
+
'shop-backend': {
|
|
72
|
+
spanCount: 4,
|
|
73
|
+
errorCount: 0
|
|
74
|
+
},
|
|
75
|
+
'cart-service': {
|
|
76
|
+
spanCount: 2,
|
|
77
|
+
errorCount: 0
|
|
78
|
+
},
|
|
79
|
+
'article-service': {
|
|
80
|
+
spanCount: 2,
|
|
81
|
+
errorCount: 0
|
|
82
|
+
},
|
|
83
|
+
'auth-service': {
|
|
84
|
+
spanCount: 1,
|
|
85
|
+
errorCount: 0
|
|
86
|
+
},
|
|
87
|
+
postgres: {
|
|
88
|
+
spanCount: 1,
|
|
89
|
+
errorCount: 0
|
|
90
|
+
}
|
|
91
|
+
},
|
|
72
92
|
startTimeUnixMs: 1699916103945861,
|
|
73
93
|
traceId: '95ba9202315c29c801b5aa41452aa775',
|
|
74
|
-
|
|
94
|
+
rootServiceName: 'shop-backend',
|
|
95
|
+
rootTraceName: 'article-to-cart'
|
|
75
96
|
}
|
|
76
97
|
],
|
|
77
98
|
metadata: {
|
package/dist/cjs/test/render.js
CHANGED
|
@@ -25,13 +25,6 @@ const _react = require("@testing-library/react");
|
|
|
25
25
|
const _reactquery = require("@tanstack/react-query");
|
|
26
26
|
const _PluginRegistry = require("../components/PluginRegistry");
|
|
27
27
|
const _testplugins = require("./test-plugins");
|
|
28
|
-
const testLogger = {
|
|
29
|
-
log: console.log,
|
|
30
|
-
warn: console.warn,
|
|
31
|
-
error: ()=>{
|
|
32
|
-
// Don't log network errors in tests to the console
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
28
|
function renderWithContext(ui, renderOptions, contextOptions) {
|
|
36
29
|
// Create a new QueryClient for each test to avoid caching issues
|
|
37
30
|
const queryClient = new _reactquery.QueryClient({
|
|
@@ -40,15 +33,13 @@ function renderWithContext(ui, renderOptions, contextOptions) {
|
|
|
40
33
|
refetchOnWindowFocus: false,
|
|
41
34
|
retry: false
|
|
42
35
|
}
|
|
43
|
-
}
|
|
44
|
-
logger: testLogger
|
|
36
|
+
}
|
|
45
37
|
});
|
|
46
|
-
var _contextOptions_defaultPluginKinds;
|
|
47
38
|
return (0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactquery.QueryClientProvider, {
|
|
48
39
|
client: queryClient,
|
|
49
40
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginRegistry.PluginRegistry, {
|
|
50
41
|
pluginLoader: _testplugins.testPluginLoader,
|
|
51
|
-
defaultPluginKinds:
|
|
42
|
+
defaultPluginKinds: contextOptions?.defaultPluginKinds ?? {
|
|
52
43
|
TimeSeriesQuery: 'PrometheusTimeSeriesQuery'
|
|
53
44
|
},
|
|
54
45
|
children: ui
|
|
@@ -60,30 +60,31 @@ const BertPanel1 = {
|
|
|
60
60
|
option1: ''
|
|
61
61
|
})
|
|
62
62
|
};
|
|
63
|
+
function BertPanel2Editor({ value, onChange }) {
|
|
64
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
65
|
+
children: [
|
|
66
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("label", {
|
|
67
|
+
htmlFor: "editor-input",
|
|
68
|
+
children: "BertPanel2 editor"
|
|
69
|
+
}),
|
|
70
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
|
|
71
|
+
type: "text",
|
|
72
|
+
id: "editor-input",
|
|
73
|
+
value: value.option2,
|
|
74
|
+
onChange: (e)=>onChange({
|
|
75
|
+
...value,
|
|
76
|
+
option2: e.target.value
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
63
82
|
const BertPanel2 = {
|
|
64
83
|
PanelComponent: ()=>null,
|
|
65
84
|
panelOptionsEditorComponents: [
|
|
66
85
|
{
|
|
67
86
|
label: 'Settings',
|
|
68
|
-
content:
|
|
69
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
70
|
-
children: [
|
|
71
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("label", {
|
|
72
|
-
htmlFor: "editor-input",
|
|
73
|
-
children: "BertPanel2 editor"
|
|
74
|
-
}),
|
|
75
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
|
|
76
|
-
type: "text",
|
|
77
|
-
id: "editor-input",
|
|
78
|
-
value: value.option2,
|
|
79
|
-
onChange: (e)=>onChange({
|
|
80
|
-
...value,
|
|
81
|
-
option2: e.target.value
|
|
82
|
-
})
|
|
83
|
-
})
|
|
84
|
-
]
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
+
content: BertPanel2Editor
|
|
87
88
|
},
|
|
88
89
|
{
|
|
89
90
|
label: 'Custom Tab',
|
|
@@ -33,17 +33,17 @@ function mockPluginRegistry(...mockPlugins) {
|
|
|
33
33
|
kind: 'PluginModule',
|
|
34
34
|
metadata: {
|
|
35
35
|
name: 'Fake Plugin Module for Tests',
|
|
36
|
-
|
|
37
|
-
updatedAt: '',
|
|
38
|
-
version: 0
|
|
36
|
+
version: '0'
|
|
39
37
|
},
|
|
40
38
|
spec: {
|
|
41
39
|
// Add metadata for all mock plugins
|
|
42
|
-
plugins: mockPlugins.map(({
|
|
43
|
-
pluginType,
|
|
40
|
+
plugins: mockPlugins.map(({ kind, spec: { name } })=>({
|
|
44
41
|
kind,
|
|
45
|
-
|
|
46
|
-
name
|
|
42
|
+
spec: {
|
|
43
|
+
name,
|
|
44
|
+
display: {
|
|
45
|
+
name: getMockPluginName(kind, name)
|
|
46
|
+
}
|
|
47
47
|
}
|
|
48
48
|
}))
|
|
49
49
|
}
|
|
@@ -51,7 +51,7 @@ function mockPluginRegistry(...mockPlugins) {
|
|
|
51
51
|
const mockPluginModule = {};
|
|
52
52
|
for (const mockPlugin of mockPlugins){
|
|
53
53
|
// "Export" on the module under the same name as the kind the plugin handles
|
|
54
|
-
mockPluginModule[mockPlugin.
|
|
54
|
+
mockPluginModule[mockPlugin.spec.name] = mockPlugin.plugin;
|
|
55
55
|
}
|
|
56
56
|
const pluginLoader = {
|
|
57
57
|
getInstalledPlugins () {
|
|
@@ -70,6 +70,6 @@ function mockPluginRegistry(...mockPlugins) {
|
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
function getMockPluginName(
|
|
74
|
-
return `${
|
|
73
|
+
function getMockPluginName(kind, name) {
|
|
74
|
+
return `${kind} Plugin for ${name}`;
|
|
75
75
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -21,53 +21,53 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
parseVariables: function() {
|
|
25
|
+
return parseVariables;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
replaceVariable: function() {
|
|
28
|
+
return replaceVariable;
|
|
29
29
|
},
|
|
30
|
-
|
|
31
|
-
return
|
|
30
|
+
replaceVariables: function() {
|
|
31
|
+
return replaceVariables;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
function
|
|
35
|
-
const variables =
|
|
34
|
+
function replaceVariables(text, variableState) {
|
|
35
|
+
const variables = parseVariables(text);
|
|
36
36
|
let finalText = text;
|
|
37
37
|
variables// Sorting variables by their length.
|
|
38
38
|
// In order to not have a variable name have contained in another variable name.
|
|
39
39
|
// i.e.: $__range replacing $__range_ms => '3600_ms' instead of '3600000'
|
|
40
40
|
.sort((a, b)=>b.length - a.length).forEach((v)=>{
|
|
41
41
|
const variable = variableState[v];
|
|
42
|
-
if (variable &&
|
|
43
|
-
finalText =
|
|
42
|
+
if (variable && variable.value !== undefined) {
|
|
43
|
+
finalText = replaceVariable(finalText, v, variable?.value);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
return finalText;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const
|
|
50
|
-
const
|
|
48
|
+
function replaceVariable(text, varName, variableValue) {
|
|
49
|
+
const variableSyntax = '$' + varName;
|
|
50
|
+
const alternativeVariableSyntax = '${' + varName + '}';
|
|
51
51
|
let replaceString = '';
|
|
52
|
-
if (Array.isArray(
|
|
53
|
-
replaceString = `(${
|
|
52
|
+
if (Array.isArray(variableValue)) {
|
|
53
|
+
replaceString = `(${variableValue.join('|')})`; // regex style
|
|
54
54
|
}
|
|
55
|
-
if (typeof
|
|
56
|
-
replaceString =
|
|
55
|
+
if (typeof variableValue === 'string') {
|
|
56
|
+
replaceString = variableValue;
|
|
57
57
|
}
|
|
58
|
-
text = text.replaceAll(
|
|
59
|
-
return text.replaceAll(
|
|
58
|
+
text = text.replaceAll(variableSyntax, replaceString);
|
|
59
|
+
return text.replaceAll(alternativeVariableSyntax, replaceString);
|
|
60
60
|
}
|
|
61
|
-
// This regular expression is designed to identify variable references in a
|
|
61
|
+
// This regular expression is designed to identify variable references in a string.
|
|
62
62
|
// It supports two formats for referencing variables:
|
|
63
63
|
// 1. $variableName - This is a simpler format, and the regular expression captures the variable name (\w+ matches one or more word characters).
|
|
64
64
|
// 2. ${variableName} - This is a more complex format and the regular expression captures the variable name (\w+ matches one or more word characters) in the curly braces.
|
|
65
65
|
// 3. [COMING SOON] ${variableName:value} - This is a more complex format that allows specifying a format function as well.
|
|
66
66
|
// TODO: Fix this lint error
|
|
67
67
|
// eslint-disable-next-line no-useless-escape
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const regex =
|
|
68
|
+
const VARIABLE_REGEX = /\$(\w+)|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/gm;
|
|
69
|
+
const parseVariables = (text)=>{
|
|
70
|
+
const regex = VARIABLE_REGEX;
|
|
71
71
|
const matches = new Set();
|
|
72
72
|
let match;
|
|
73
73
|
while((match = regex.exec(text)) !== null){
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CalculationType } from '@perses-dev/core';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
2
3
|
export interface CalculationSelectorProps {
|
|
3
4
|
value: CalculationType;
|
|
4
5
|
onChange: (unit: CalculationType) => void;
|
|
5
6
|
}
|
|
6
|
-
export declare function CalculationSelector({ value, onChange }: CalculationSelectorProps):
|
|
7
|
+
export declare function CalculationSelector({ value, onChange }: CalculationSelectorProps): ReactElement;
|
|
7
8
|
//# sourceMappingURL=CalculationSelector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalculationSelector.d.ts","sourceRoot":"","sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"names":[],"mappings":"AAcA,OAAO,EAA0C,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"CalculationSelector.d.ts","sourceRoot":"","sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"names":[],"mappings":"AAcA,OAAO,EAA0C,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAUrC,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,wBAAwB,GAAG,YAAY,CAuB/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"sourcesContent":["// Copyright 2023 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 { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';\nimport { CALCULATIONS_CONFIG, CalculationConfig, CalculationType } from '@perses-dev/core';\n\ntype AutocompleteCalculationOption = CalculationConfig & { id: CalculationType };\nconst CALC_OPTIONS: AutocompleteCalculationOption[] = Object.entries(CALCULATIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as CalculationType,\n ...config,\n };\n});\n\nexport interface CalculationSelectorProps {\n value: CalculationType;\n onChange: (unit: CalculationType) => void;\n}\n\nexport function CalculationSelector({ value, onChange }: CalculationSelectorProps) {\n const handleCalculationChange = (_: unknown, newValue: AutocompleteCalculationOption) => {\n onChange(newValue.id);\n };\n\n const calcConfig = CALCULATIONS_CONFIG[value];\n\n return (\n <OptionsEditorControl\n label=\"Calculation\"\n control={\n <SettingsAutocomplete\n value={{\n ...calcConfig,\n id: value,\n }}\n options={CALC_OPTIONS}\n onChange={handleCalculationChange}\n disableClearable\n
|
|
1
|
+
{"version":3,"sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"sourcesContent":["// Copyright 2023 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 { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';\nimport { CALCULATIONS_CONFIG, CalculationConfig, CalculationType } from '@perses-dev/core';\nimport { ReactElement } from 'react';\n\ntype AutocompleteCalculationOption = CalculationConfig & { id: CalculationType };\nconst CALC_OPTIONS: AutocompleteCalculationOption[] = Object.entries(CALCULATIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as CalculationType,\n ...config,\n };\n});\n\nexport interface CalculationSelectorProps {\n value: CalculationType;\n onChange: (unit: CalculationType) => void;\n}\n\nexport function CalculationSelector({ value, onChange }: CalculationSelectorProps): ReactElement {\n const handleCalculationChange = (_: unknown, newValue: AutocompleteCalculationOption): void => {\n onChange(newValue.id);\n };\n\n const calcConfig = CALCULATIONS_CONFIG[value];\n\n return (\n <OptionsEditorControl\n label=\"Calculation\"\n control={\n <SettingsAutocomplete\n value={{\n ...calcConfig,\n id: value,\n }}\n options={CALC_OPTIONS}\n onChange={handleCalculationChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","CALCULATIONS_CONFIG","CALC_OPTIONS","Object","entries","map","id","config","CalculationSelector","value","onChange","handleCalculationChange","_","newValue","calcConfig","label","control","options","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,oBAAoB,EAAEC,oBAAoB,QAAQ,yBAAyB;AACpF,SAASC,mBAAmB,QAA4C,mBAAmB;AAI3F,MAAMC,eAAgDC,OAAOC,OAAO,CAACH,qBAAqBI,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO;IACzG,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF;AAOA,OAAO,SAASC,oBAAoB,EAAEC,KAAK,EAAEC,QAAQ,EAA4B;IAC/E,MAAMC,0BAA0B,CAACC,GAAYC;QAC3CH,SAASG,SAASP,EAAE;IACtB;IAEA,MAAMQ,aAAab,mBAAmB,CAACQ,MAAM;IAE7C,qBACE,KAACV;QACCgB,OAAM;QACNC,uBACE,KAAChB;YACCS,OAAO;gBACL,GAAGK,UAAU;gBACbR,IAAIG;YACN;YACAQ,SAASf;YACTQ,UAAUC;YACVO,gBAAgB;;;AAK1B"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { Action, DatasourceDefinition
|
|
2
|
-
import { DispatchWithoutAction } from 'react';
|
|
1
|
+
import { Action, DatasourceDefinition } from '@perses-dev/core';
|
|
2
|
+
import { DispatchWithoutAction, ReactElement } from 'react';
|
|
3
3
|
interface DatasourceEditorFormProps {
|
|
4
4
|
initialDatasourceDefinition: DatasourceDefinition;
|
|
5
|
-
|
|
5
|
+
action: Action;
|
|
6
6
|
isDraft: boolean;
|
|
7
7
|
isReadonly?: boolean;
|
|
8
|
-
|
|
8
|
+
onActionChange?: (action: Action) => void;
|
|
9
|
+
onSave: (def: DatasourceDefinition) => void;
|
|
9
10
|
onClose: DispatchWithoutAction;
|
|
10
11
|
onDelete?: DispatchWithoutAction;
|
|
11
12
|
}
|
|
12
|
-
export declare function DatasourceEditorForm(props: DatasourceEditorFormProps):
|
|
13
|
+
export declare function DatasourceEditorForm(props: DatasourceEditorFormProps): ReactElement;
|
|
13
14
|
export {};
|
|
14
15
|
//# sourceMappingURL=DatasourceEditorForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatasourceEditorForm.d.ts","sourceRoot":"","sources":["../../../src/components/DatasourceEditorForm/DatasourceEditorForm.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DatasourceEditorForm.d.ts","sourceRoot":"","sources":["../../../src/components/DatasourceEditorForm/DatasourceEditorForm.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAMtE,UAAU,yBAAyB;IACjC,2BAA2B,EAAE,oBAAoB,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,MAAM,EAAE,CAAC,GAAG,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC5C,OAAO,EAAE,qBAAqB,CAAC;IAC/B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,YAAY,CA6MnF"}
|