@perses-dev/plugin-system 0.0.0-snapshot-scatter-chart-embed-8efdfab → 0.0.0-snapshot-explorer-plugin-c4a7621
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/CalculationSelector/CalculationSelector.js +1 -1
- package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +83 -163
- package/dist/cjs/components/DatasourceSelect.js +12 -15
- package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +528 -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/{validation/resource.js → components/MetricLabelInput/index.js} +15 -9
- package/dist/cjs/components/{TraceQueryEditor/TraceQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +39 -40
- package/dist/cjs/components/{TimeSeriesQueryEditor/TimeSeriesQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +23 -11
- package/dist/cjs/components/MultiQueryEditor/index.js +30 -0
- package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +3 -3
- package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +3 -3
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +54 -62
- package/dist/cjs/components/PluginEditor/PluginEditor.js +16 -13
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +44 -33
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +55 -7
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +9 -10
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +20 -17
- package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +3 -3
- package/dist/cjs/components/ProjectSelect.js +7 -7
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +131 -0
- package/dist/cjs/components/{TraceQueryEditor → TimeRangeControls}/index.js +1 -1
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +394 -439
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +17 -15
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +7 -12
- package/dist/cjs/components/Variables/variable-model.js +35 -37
- package/dist/cjs/components/index.js +4 -1
- package/dist/cjs/constants/user-interface-text.js +4 -1
- package/dist/cjs/context/ProjectStoreProvider.js +12 -9
- 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/model/legend.js +5 -5
- package/dist/cjs/remote/PersesPlugin.types.js +16 -0
- package/dist/cjs/remote/PluginLoaderComponent.js +75 -0
- package/dist/cjs/remote/PluginRuntime.js +267 -0
- package/dist/cjs/{validation → remote}/index.js +2 -4
- package/dist/cjs/remote/remotePluginLoader.js +61 -0
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +23 -14
- package/dist/cjs/runtime/DataQueriesProvider/model.js +10 -9
- package/dist/cjs/runtime/QueryCountProvider.js +83 -0
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +37 -13
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +3 -3
- 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 +20 -23
- package/dist/cjs/runtime/UsageMetricsProvider.js +99 -0
- package/dist/cjs/runtime/builtin-variables.js +7 -7
- package/dist/cjs/runtime/datasources.js +30 -21
- package/dist/cjs/runtime/index.js +4 -2
- package/dist/cjs/runtime/plugin-registry.js +48 -36
- package/dist/cjs/runtime/time-series-queries.js +35 -40
- package/dist/cjs/runtime/trace-queries.js +9 -6
- package/dist/cjs/runtime/{template-variables.js → variables.js} +38 -48
- package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +1 -1
- package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +1 -65
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +1 -1
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +5 -5
- package/dist/cjs/stories/shared-utils/decorators/{WithPluginSystemTemplateVariables.js → WithPluginSystemVariables.js} +9 -9
- package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +1 -1
- package/dist/cjs/stories/shared-utils/decorators/index.js +2 -2
- 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 +21 -20
- package/dist/cjs/test/test-plugins/ernie/index.js +2 -2
- package/dist/cjs/test/test-plugins/index.js +3 -1
- package/dist/cjs/test-utils/mock-plugin-registry.js +13 -13
- package/dist/cjs/utils/action.js +3 -3
- package/dist/cjs/utils/variables.js +24 -24
- package/dist/components/CalculationSelector/CalculationSelector.d.ts +2 -2
- package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +7 -7
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +86 -166
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/DatasourceSelect.d.ts +4 -4
- package/dist/components/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect.js +9 -12
- 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 +474 -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 -2
- 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} +42 -39
- 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/{TimeSeriesQueryEditor/TimeSeriesQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +33 -10
- 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 +4 -4
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +3 -3
- 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 +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +5 -5
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +3 -3
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +5 -3
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +56 -64
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts +2 -2
- 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 +16 -10
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +44 -33
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +11 -5
- 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 +4 -4
- package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +9 -10
- 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 -5
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js +3 -3
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/ProjectSelect.d.ts +3 -3
- package/dist/components/ProjectSelect.d.ts.map +1 -1
- package/dist/components/ProjectSelect.js +7 -7
- package/dist/components/ProjectSelect.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +14 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.js +110 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
- package/dist/components/TimeRangeControls/index.d.ts +2 -0
- package/dist/components/TimeRangeControls/index.d.ts.map +1 -0
- package/dist/components/{TraceQueryEditor → TimeRangeControls}/index.js +1 -1
- package/dist/components/TimeRangeControls/index.js.map +1 -0
- 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 -442
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +3 -3
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +11 -11
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +3 -3
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +7 -12
- 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 +29 -31
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/index.d.ts +4 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -1
- package/dist/components/index.js.map +1 -1
- package/dist/constants/user-interface-text.d.ts +2 -0
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +4 -1
- package/dist/constants/user-interface-text.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 +9 -6
- 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/datasource.js +3 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/explore.d.ts +13 -0
- package/dist/model/explore.d.ts.map +1 -0
- package/dist/{validation/resource.js → model/explore.js} +4 -3
- package/dist/model/explore.js.map +1 -0
- package/dist/model/legend.d.ts +2 -2
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js.map +1 -1
- package/dist/model/panels.d.ts +17 -5
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugin-base.d.ts +0 -1
- package/dist/model/plugin-base.d.ts.map +1 -1
- package/dist/model/plugin-base.js.map +1 -1
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/model/plugins.d.ts +35 -21
- 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 +4 -3
- package/dist/model/time-series-queries.d.ts.map +1 -1
- package/dist/model/time-series-queries.js.map +1 -1
- package/dist/model/trace-queries.d.ts +1 -1
- package/dist/model/trace-queries.d.ts.map +1 -1
- package/dist/model/trace-queries.js.map +1 -1
- package/dist/model/variables.d.ts +2 -2
- package/dist/model/variables.d.ts.map +1 -1
- package/dist/model/variables.js +3 -1
- package/dist/model/variables.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/remote/PersesPlugin.types.js +15 -0
- 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 +11 -0
- package/dist/remote/PluginRuntime.d.ts.map +1 -0
- package/dist/remote/PluginRuntime.js +202 -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/{validation → remote}/index.js +2 -4
- 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 +19 -10
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +6 -7
- 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/datasource.js → runtime/QueryCountProvider.js} +14 -10
- package/dist/runtime/QueryCountProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +6 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +30 -9
- 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 +3 -3
- 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 +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +8 -11
- 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 +2 -2
- package/dist/runtime/builtin-variables.d.ts.map +1 -1
- package/dist/runtime/builtin-variables.js +4 -4
- 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 +24 -15
- 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 +11 -11
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +40 -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 +28 -33
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.d.ts +5 -4
- package/dist/runtime/trace-queries.d.ts.map +1 -1
- package/dist/runtime/trace-queries.js +10 -7
- package/dist/runtime/trace-queries.js.map +1 -1
- package/dist/runtime/{template-variables.d.ts → variables.d.ts} +7 -7
- package/dist/runtime/variables.d.ts.map +1 -0
- package/dist/runtime/{template-variables.js → variables.js} +35 -44
- package/dist/runtime/variables.js.map +1 -0
- package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts +3 -3
- package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.js +1 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +2 -2
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +2 -22
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +3 -3
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts +3 -3
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +5 -5
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts +13 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts.map +1 -0
- package/dist/stories/shared-utils/decorators/{WithPluginSystemTemplateVariables.js → WithPluginSystemVariables.js} +10 -10
- package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.js.map +1 -0
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +3 -3
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.js +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
- package/dist/stories/shared-utils/decorators/index.d.ts +1 -1
- package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/index.js +2 -2
- package/dist/stories/shared-utils/decorators/index.js.map +1 -1
- 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 +4 -4
- 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/setup-tests.js.map +1 -1
- package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
- package/dist/test/test-plugins/bert/index.js +21 -20
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test/test-plugins/ernie/index.js +2 -2
- package/dist/test/test-plugins/ernie/index.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.d.ts +6 -4
- 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 +7 -6
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +0 -146
- package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +0 -96
- package/dist/cjs/validation/datasource.js +0 -30
- package/dist/cjs/validation/role.js +0 -85
- package/dist/cjs/validation/rolebinding.js +0 -55
- package/dist/cjs/validation/secret.js +0 -176
- package/dist/cjs/validation/variable.js +0 -48
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +0 -8
- 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 -13
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +0 -1
- 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 -9
- 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 -13
- package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryInput.js +0 -83
- 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/WithPluginSystemTemplateVariables.d.ts +0 -13
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.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.map +0 -1
- package/dist/validation/index.d.ts +0 -5
- 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.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 -66
- 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/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
|
|
@@ -24,21 +24,21 @@ _export(exports, {
|
|
|
24
24
|
TIME_SERIES_QUERY_KEY: function() {
|
|
25
25
|
return TIME_SERIES_QUERY_KEY;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
29
|
-
},
|
|
30
|
-
useTimeSeriesQueries: function() {
|
|
31
|
-
return useTimeSeriesQueries;
|
|
27
|
+
getActiveTimeSeriesQueries: function() {
|
|
28
|
+
return getActiveTimeSeriesQueries;
|
|
32
29
|
},
|
|
33
30
|
useActiveTimeSeriesQueries: function() {
|
|
34
31
|
return useActiveTimeSeriesQueries;
|
|
35
32
|
},
|
|
36
|
-
|
|
37
|
-
return
|
|
33
|
+
useTimeSeriesQueries: function() {
|
|
34
|
+
return useTimeSeriesQueries;
|
|
35
|
+
},
|
|
36
|
+
useTimeSeriesQuery: function() {
|
|
37
|
+
return useTimeSeriesQuery;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
const _reactquery = require("@tanstack/react-query");
|
|
41
|
-
const
|
|
41
|
+
const _variables = require("./variables");
|
|
42
42
|
const _TimeRangeProvider = require("./TimeRangeProvider");
|
|
43
43
|
const _datasources = require("./datasources");
|
|
44
44
|
const _pluginregistry = require("./plugin-registry");
|
|
@@ -54,10 +54,10 @@ function filterVariableStateMap(v, names) {
|
|
|
54
54
|
}
|
|
55
55
|
return Object.fromEntries(Object.entries(v).filter(([name])=>names.includes(name)));
|
|
56
56
|
}
|
|
57
|
-
function getQueryOptions({ plugin
|
|
58
|
-
const { timeRange
|
|
59
|
-
const dependencies =
|
|
60
|
-
const variableDependencies = dependencies
|
|
57
|
+
function getQueryOptions({ plugin, definition, context }) {
|
|
58
|
+
const { timeRange, datasourceStore, suggestedStepMs, mode, variableState, refreshKey } = context;
|
|
59
|
+
const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};
|
|
60
|
+
const variableDependencies = dependencies?.variables;
|
|
61
61
|
// Determine queryKey
|
|
62
62
|
const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);
|
|
63
63
|
const variablesValueKey = getVariableValuesKey(filteredVariabledState);
|
|
@@ -66,16 +66,14 @@ function getQueryOptions({ plugin , definition , context }) {
|
|
|
66
66
|
timeRange,
|
|
67
67
|
datasourceStore,
|
|
68
68
|
suggestedStepMs,
|
|
69
|
+
mode,
|
|
69
70
|
variablesValueKey,
|
|
70
71
|
refreshKey
|
|
71
72
|
];
|
|
72
73
|
// Determine queryEnabled
|
|
73
74
|
let waitToLoad = false;
|
|
74
75
|
if (variableDependencies) {
|
|
75
|
-
waitToLoad = variableDependencies.some((v)=>
|
|
76
|
-
var _variableState_v;
|
|
77
|
-
return (_variableState_v = variableState[v]) === null || _variableState_v === void 0 ? void 0 : _variableState_v.loading;
|
|
78
|
-
});
|
|
76
|
+
waitToLoad = variableDependencies.some((v)=>variableState[v]?.loading);
|
|
79
77
|
}
|
|
80
78
|
const queryEnabled = plugin !== undefined && !waitToLoad;
|
|
81
79
|
return {
|
|
@@ -84,18 +82,16 @@ function getQueryOptions({ plugin , definition , context }) {
|
|
|
84
82
|
};
|
|
85
83
|
}
|
|
86
84
|
const useTimeSeriesQuery = (definition, options, queryOptions)=>{
|
|
87
|
-
const { data: plugin
|
|
85
|
+
const { data: plugin } = (0, _pluginregistry.usePlugin)(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);
|
|
88
86
|
const context = useTimeSeriesQueryContext();
|
|
89
|
-
const { queryEnabled
|
|
87
|
+
const { queryEnabled, queryKey } = getQueryOptions({
|
|
90
88
|
plugin,
|
|
91
89
|
definition,
|
|
92
90
|
context
|
|
93
91
|
});
|
|
94
|
-
var _queryOptions_enabled;
|
|
95
92
|
return (0, _reactquery.useQuery)({
|
|
96
|
-
enabled: (
|
|
93
|
+
enabled: (queryOptions?.enabled ?? true) || queryEnabled,
|
|
97
94
|
queryKey: queryKey,
|
|
98
|
-
refetchInterval: context.refreshIntervalInMs > 0 ? context.refreshIntervalInMs : false,
|
|
99
95
|
queryFn: ()=>{
|
|
100
96
|
// The 'enabled' option should prevent this from happening, but make TypeScript happy by checking
|
|
101
97
|
if (plugin === undefined) {
|
|
@@ -104,37 +100,38 @@ const useTimeSeriesQuery = (definition, options, queryOptions)=>{
|
|
|
104
100
|
// Keep options out of query key so we don't re-run queries because suggested step changes
|
|
105
101
|
const ctx = {
|
|
106
102
|
...context,
|
|
107
|
-
suggestedStepMs: options
|
|
103
|
+
suggestedStepMs: options?.suggestedStepMs
|
|
108
104
|
};
|
|
109
105
|
return plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx);
|
|
110
106
|
}
|
|
111
107
|
});
|
|
112
108
|
};
|
|
113
109
|
function useTimeSeriesQueries(definitions, options, queryOptions) {
|
|
114
|
-
const { getPlugin
|
|
115
|
-
const context =
|
|
110
|
+
const { getPlugin } = (0, _pluginregistry.usePluginRegistry)();
|
|
111
|
+
const context = {
|
|
112
|
+
...useTimeSeriesQueryContext(),
|
|
113
|
+
// We need mode to be part query key because this drives the type of query done (instant VS range query)
|
|
114
|
+
mode: options?.mode
|
|
115
|
+
};
|
|
116
116
|
const pluginLoaderResponse = (0, _pluginregistry.usePlugins)(TIME_SERIES_QUERY_KEY, definitions.map((d)=>({
|
|
117
117
|
kind: d.spec.plugin.kind
|
|
118
118
|
})));
|
|
119
119
|
return (0, _reactquery.useQueries)({
|
|
120
120
|
queries: definitions.map((definition, idx)=>{
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
const { queryEnabled , queryKey } = getQueryOptions({
|
|
121
|
+
const plugin = pluginLoaderResponse[idx]?.data;
|
|
122
|
+
const { queryEnabled, queryKey } = getQueryOptions({
|
|
124
123
|
plugin,
|
|
125
124
|
definition,
|
|
126
125
|
context
|
|
127
126
|
});
|
|
128
|
-
var _queryOptions_enabled;
|
|
129
127
|
return {
|
|
130
|
-
enabled: (
|
|
128
|
+
enabled: (queryOptions?.enabled ?? true) && queryEnabled,
|
|
131
129
|
queryKey: queryKey,
|
|
132
|
-
refetchInterval: context.refreshIntervalInMs > 0 ? context.refreshIntervalInMs : undefined,
|
|
133
130
|
queryFn: async ()=>{
|
|
134
|
-
// Keep options out of query key so we don't re-run queries because suggested step changes
|
|
135
131
|
const ctx = {
|
|
136
132
|
...context,
|
|
137
|
-
|
|
133
|
+
// Keep suggested step changes out of the query key, so we don´t have to run again query when it changes
|
|
134
|
+
suggestedStepMs: options?.suggestedStepMs
|
|
138
135
|
};
|
|
139
136
|
const plugin = await getPlugin(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);
|
|
140
137
|
const data = await plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx);
|
|
@@ -147,15 +144,14 @@ function useTimeSeriesQueries(definitions, options, queryOptions) {
|
|
|
147
144
|
/**
|
|
148
145
|
* Build the time series query context object from data available at runtime
|
|
149
146
|
*/ function useTimeSeriesQueryContext() {
|
|
150
|
-
const { absoluteTimeRange
|
|
151
|
-
const variableState = (0,
|
|
147
|
+
const { absoluteTimeRange, refreshKey } = (0, _TimeRangeProvider.useTimeRange)();
|
|
148
|
+
const variableState = (0, _variables.useAllVariableValues)();
|
|
152
149
|
const datasourceStore = (0, _datasources.useDatasourceStore)();
|
|
153
150
|
return {
|
|
154
151
|
timeRange: absoluteTimeRange,
|
|
155
152
|
variableState,
|
|
156
153
|
datasourceStore,
|
|
157
|
-
refreshKey
|
|
158
|
-
refreshIntervalInMs: refreshIntervalInMs
|
|
154
|
+
refreshKey
|
|
159
155
|
};
|
|
160
156
|
}
|
|
161
157
|
function useActiveTimeSeriesQueries() {
|
|
@@ -168,9 +164,8 @@ function getActiveTimeSeriesQueries(cache) {
|
|
|
168
164
|
for (const query of cache.findAll({
|
|
169
165
|
type: 'active'
|
|
170
166
|
})){
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if ((firstPart === null || firstPart === void 0 ? void 0 : firstPart.kind) && firstPart.kind.startsWith(TIME_SERIES_QUERY_KEY)) {
|
|
167
|
+
const firstPart = query.queryKey?.[0];
|
|
168
|
+
if (firstPart?.kind && firstPart.kind.startsWith(TIME_SERIES_QUERY_KEY)) {
|
|
174
169
|
queries.push(query);
|
|
175
170
|
}
|
|
176
171
|
}
|
|
@@ -38,16 +38,16 @@ const _pluginregistry = require("./plugin-registry");
|
|
|
38
38
|
const _TimeRangeProvider = require("./TimeRangeProvider");
|
|
39
39
|
const TRACE_QUERY_KEY = 'TraceQuery';
|
|
40
40
|
function getUnixTimeRange(timeRange) {
|
|
41
|
-
const { start
|
|
41
|
+
const { start, end } = timeRange;
|
|
42
42
|
return {
|
|
43
43
|
start: Math.ceil((0, _datefns.getUnixTime)(start)),
|
|
44
44
|
end: Math.ceil((0, _datefns.getUnixTime)(end))
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
function useTraceQueries(definitions) {
|
|
48
|
-
const { getPlugin
|
|
48
|
+
const { getPlugin } = (0, _pluginregistry.usePluginRegistry)();
|
|
49
49
|
const datasourceStore = (0, _datasources.useDatasourceStore)();
|
|
50
|
-
const { absoluteTimeRange
|
|
50
|
+
const { absoluteTimeRange } = (0, _TimeRangeProvider.useTimeRange)();
|
|
51
51
|
const context = {
|
|
52
52
|
datasourceStore,
|
|
53
53
|
absoluteTimeRange
|
|
@@ -56,20 +56,23 @@ function useTraceQueries(definitions) {
|
|
|
56
56
|
// https://tanstack.com/query/v4/docs/react/reference/useQuery
|
|
57
57
|
return (0, _reactquery.useQueries)({
|
|
58
58
|
queries: definitions.map((definition)=>{
|
|
59
|
-
var _definition_spec, _definition_spec_plugin;
|
|
60
59
|
const queryKey = [
|
|
61
60
|
definition,
|
|
62
61
|
datasourceStore,
|
|
63
62
|
absoluteTimeRange
|
|
64
63
|
]; // `queryKey` watches and reruns `queryFn` if keys in the array change
|
|
65
|
-
const traceQueryKind = definition
|
|
64
|
+
const traceQueryKind = definition?.spec?.plugin?.kind;
|
|
66
65
|
return {
|
|
67
66
|
queryKey: queryKey,
|
|
68
67
|
queryFn: async ()=>{
|
|
69
68
|
const plugin = await getPlugin(TRACE_QUERY_KEY, traceQueryKind);
|
|
70
69
|
const data = await plugin.getTraceData(definition.spec.plugin.spec, context);
|
|
71
70
|
return data;
|
|
72
|
-
}
|
|
71
|
+
},
|
|
72
|
+
// The data returned by getTraceData() contains circular dependencies (a span has a reference to the parent span, and the parent span has an array of child spans)
|
|
73
|
+
// Therefore structuralSharing must be turned off, otherwise the query is stuck in the 'fetching' state on re-fetch.
|
|
74
|
+
// Ref: https://github.com/TanStack/query/issues/6954#issuecomment-1962321426
|
|
75
|
+
structuralSharing: false
|
|
73
76
|
};
|
|
74
77
|
})
|
|
75
78
|
});
|
|
@@ -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,42 +21,34 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
+
VariableContext: function() {
|
|
25
|
+
return VariableContext;
|
|
26
|
+
},
|
|
24
27
|
VariableStoreStateMap: function() {
|
|
25
28
|
return VariableStoreStateMap;
|
|
26
29
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
30
|
+
useAllVariableValues: function() {
|
|
31
|
+
return useAllVariableValues;
|
|
29
32
|
},
|
|
30
|
-
|
|
31
|
-
return
|
|
33
|
+
useReplaceVariablesInString: function() {
|
|
34
|
+
return useReplaceVariablesInString;
|
|
32
35
|
},
|
|
33
36
|
useVariableValues: function() {
|
|
34
37
|
return useVariableValues;
|
|
35
|
-
},
|
|
36
|
-
useReplaceVariablesInString: function() {
|
|
37
|
-
return useReplaceVariablesInString;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
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,14 +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
|
-
return
|
|
130
|
+
return (0, _react.useMemo)(()=>{
|
|
131
|
+
return {
|
|
132
|
+
...variableValues,
|
|
133
|
+
...builtinVariableValues
|
|
134
|
+
};
|
|
135
|
+
}, [
|
|
136
|
+
variableValues,
|
|
137
|
+
builtinVariableValues
|
|
138
|
+
]);
|
|
149
139
|
}
|
|
150
140
|
function useReplaceVariablesInString(str) {
|
|
151
|
-
const variablesInString = str ? (0, _utils.
|
|
152
|
-
const variableValues =
|
|
141
|
+
const variablesInString = str ? (0, _utils.parseVariables)(str) : [];
|
|
142
|
+
const variableValues = useAllVariableValues(variablesInString);
|
|
153
143
|
if (!str) return undefined;
|
|
154
|
-
return (0, _utils.
|
|
144
|
+
return (0, _utils.replaceVariables)(str, variableValues);
|
|
155
145
|
}
|
|
@@ -33,7 +33,7 @@ const WithDataQueries = (Story, context)=>{
|
|
|
33
33
|
definitions: []
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
const props = parameter
|
|
36
|
+
const props = parameter?.props;
|
|
37
37
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DataQueriesProvider, {
|
|
38
38
|
...props,
|
|
39
39
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Story, {})
|
|
@@ -22,73 +22,9 @@ Object.defineProperty(exports, "WithPluginRegistry", {
|
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
25
|
-
const _pluginjson = /*#__PURE__*/ _interop_require_default(require("@perses-dev/prometheus-plugin/plugin.json"));
|
|
26
|
-
const _pluginjson1 = /*#__PURE__*/ _interop_require_default(require("@perses-dev/panels-plugin/plugin.json"));
|
|
27
|
-
function _interop_require_default(obj) {
|
|
28
|
-
return obj && obj.__esModule ? obj : {
|
|
29
|
-
default: obj
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
33
|
-
if (typeof WeakMap !== "function") return null;
|
|
34
|
-
var cacheBabelInterop = new WeakMap();
|
|
35
|
-
var cacheNodeInterop = new WeakMap();
|
|
36
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
37
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
38
|
-
})(nodeInterop);
|
|
39
|
-
}
|
|
40
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
41
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
42
|
-
return obj;
|
|
43
|
-
}
|
|
44
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
45
|
-
return {
|
|
46
|
-
default: obj
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
50
|
-
if (cache && cache.has(obj)) {
|
|
51
|
-
return cache.get(obj);
|
|
52
|
-
}
|
|
53
|
-
var newObj = {};
|
|
54
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
55
|
-
for(var key in obj){
|
|
56
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
57
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
58
|
-
if (desc && (desc.get || desc.set)) {
|
|
59
|
-
Object.defineProperty(newObj, key, desc);
|
|
60
|
-
} else {
|
|
61
|
-
newObj[key] = obj[key];
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
newObj.default = obj;
|
|
66
|
-
if (cache) {
|
|
67
|
-
cache.set(obj, newObj);
|
|
68
|
-
}
|
|
69
|
-
return newObj;
|
|
70
|
-
}
|
|
71
|
-
const bundledPluginLoader = (0, _pluginsystem.dynamicImportPluginLoader)([
|
|
72
|
-
{
|
|
73
|
-
resource: _pluginjson.default,
|
|
74
|
-
// This throws an error in CI (but not locally for some reason), likely because
|
|
75
|
-
// this package isn't a dependency for dashboards. We probably do not want to
|
|
76
|
-
// make it one solely for type-checking in storybook.
|
|
77
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
78
|
-
// @ts-ignore
|
|
79
|
-
importPlugin: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@perses-dev/prometheus-plugin")))
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
resource: _pluginjson1.default,
|
|
83
|
-
// Same comment as above.
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
85
|
-
// @ts-ignore
|
|
86
|
-
importPlugin: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("@perses-dev/panels-plugin")))
|
|
87
|
-
}
|
|
88
|
-
]);
|
|
89
25
|
const WithPluginRegistry = (Story)=>{
|
|
90
26
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PluginRegistry, {
|
|
91
|
-
pluginLoader:
|
|
27
|
+
pluginLoader: (0, _pluginsystem.remotePluginLoader)(),
|
|
92
28
|
defaultPluginKinds: {
|
|
93
29
|
TimeSeriesQuery: 'PrometheusTimeSeriesQuery',
|
|
94
30
|
TraceQuery: 'TempoTraceQuery'
|
|
@@ -34,7 +34,7 @@ const WithPluginSystemBuiltinVariables = (Story, context)=>{
|
|
|
34
34
|
const parameter = isWithBuiltinVariableParameter(initParameter) ? initParameter : {
|
|
35
35
|
props: defaultValue
|
|
36
36
|
};
|
|
37
|
-
const props = parameter
|
|
37
|
+
const props = parameter?.props;
|
|
38
38
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_runtime.BuiltinVariableContext.Provider, {
|
|
39
39
|
value: props,
|
|
40
40
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Story, {})
|
|
@@ -28,7 +28,7 @@ function isWithDatastoreStoreParameter(parameter) {
|
|
|
28
28
|
return !!parameter && typeof parameter === 'object' && 'props' in parameter;
|
|
29
29
|
}
|
|
30
30
|
const WithPluginSystemDatasourceStore = (Story, context)=>{
|
|
31
|
-
const { getPlugin
|
|
31
|
+
const { getPlugin } = (0, _pluginsystem.usePluginRegistry)();
|
|
32
32
|
const initParameter = context.parameters.withPluginSystemDatasourceStore;
|
|
33
33
|
// This currently provides a very simplified default to enable use in some
|
|
34
34
|
// basic stories. It likely will need expanding in the future.
|
|
@@ -60,8 +60,8 @@ const WithPluginSystemDatasourceStore = (Story, context)=>{
|
|
|
60
60
|
}
|
|
61
61
|
throw new Error(`WithDatasourceStore is not configured to support kind: ${selector.kind}`);
|
|
62
62
|
},
|
|
63
|
-
listDatasourceSelectItems: async (
|
|
64
|
-
if (
|
|
63
|
+
listDatasourceSelectItems: async (datasourcePluginName)=>{
|
|
64
|
+
if (datasourcePluginName === 'PrometheusDatasource') {
|
|
65
65
|
return Promise.resolve([
|
|
66
66
|
{
|
|
67
67
|
items: [
|
|
@@ -75,7 +75,7 @@ const WithPluginSystemDatasourceStore = (Story, context)=>{
|
|
|
75
75
|
}
|
|
76
76
|
]);
|
|
77
77
|
}
|
|
78
|
-
throw new Error(`WithDatasourceStore is not configured to support kind: ${
|
|
78
|
+
throw new Error(`WithDatasourceStore is not configured to support kind: ${datasourcePluginName}`);
|
|
79
79
|
},
|
|
80
80
|
getSavedDatasources: ()=>{
|
|
81
81
|
return {};
|
|
@@ -93,7 +93,7 @@ const WithPluginSystemDatasourceStore = (Story, context)=>{
|
|
|
93
93
|
const parameter = isWithDatastoreStoreParameter(initParameter) ? initParameter : {
|
|
94
94
|
props: defaultValue
|
|
95
95
|
};
|
|
96
|
-
const props = parameter
|
|
96
|
+
const props = parameter?.props;
|
|
97
97
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceStoreContext.Provider, {
|
|
98
98
|
value: props,
|
|
99
99
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Story, {})
|
|
@@ -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
|
|
@@ -14,28 +14,28 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "WithPluginSystemVariables", {
|
|
18
18
|
enumerable: true,
|
|
19
19
|
get: function() {
|
|
20
|
-
return
|
|
20
|
+
return WithPluginSystemVariables;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _runtime = require("../../../runtime");
|
|
25
25
|
// Type guard because storybook types parameters as `any`
|
|
26
|
-
function
|
|
26
|
+
function isWithVariableParameter(parameter) {
|
|
27
27
|
return !!parameter && typeof parameter === 'object' && 'props' in parameter;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
const initParameter = context.parameters.
|
|
29
|
+
const WithPluginSystemVariables = (Story, context)=>{
|
|
30
|
+
const initParameter = context.parameters.withPluginSystemVariables;
|
|
31
31
|
const defaultValue = {
|
|
32
32
|
state: {}
|
|
33
33
|
};
|
|
34
|
-
const parameter =
|
|
34
|
+
const parameter = isWithVariableParameter(initParameter) ? initParameter : {
|
|
35
35
|
props: defaultValue
|
|
36
36
|
};
|
|
37
|
-
const props = parameter
|
|
38
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_runtime.
|
|
37
|
+
const props = parameter?.props;
|
|
38
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_runtime.VariableContext.Provider, {
|
|
39
39
|
value: props,
|
|
40
40
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(Story, {})
|
|
41
41
|
});
|
|
@@ -29,7 +29,7 @@ function isWithTimeRangeParameter(parameter) {
|
|
|
29
29
|
const WithTimeRange = (Story, context)=>{
|
|
30
30
|
const initParameter = context.parameters.withTimeRange;
|
|
31
31
|
const parameter = isWithTimeRangeParameter(initParameter) ? initParameter : undefined;
|
|
32
|
-
const props = parameter
|
|
32
|
+
const props = parameter?.props;
|
|
33
33
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.TimeRangeProvider, {
|
|
34
34
|
refreshInterval: "0s",
|
|
35
35
|
timeRange: {
|
|
@@ -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
|
|
@@ -18,7 +18,7 @@ _export_star(require("./WithDataQueries"), exports);
|
|
|
18
18
|
_export_star(require("./WithPluginRegistry"), exports);
|
|
19
19
|
_export_star(require("./WithPluginSystemBuiltinVariables"), exports);
|
|
20
20
|
_export_star(require("./WithPluginSystemDatasourceStore"), exports);
|
|
21
|
-
_export_star(require("./
|
|
21
|
+
_export_star(require("./WithPluginSystemVariables"), exports);
|
|
22
22
|
_export_star(require("./WithTimeRange"), exports);
|
|
23
23
|
function _export_star(from, to) {
|
|
24
24
|
Object.keys(from).forEach(function(k) {
|
|
@@ -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
|