@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
|
@@ -91,7 +91,7 @@ function VariablePreview(props) {
|
|
|
91
91
|
setMaxValues(undefined);
|
|
92
92
|
};
|
|
93
93
|
let notShown = 0;
|
|
94
|
-
if (values &&
|
|
94
|
+
if (values && values?.length > 0 && maxValues) {
|
|
95
95
|
notShown = values.length - maxValues;
|
|
96
96
|
}
|
|
97
97
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
@@ -118,7 +118,7 @@ function VariablePreview(props) {
|
|
|
118
118
|
description: _constants.TOOLTIP_TEXT.copyVariableValues,
|
|
119
119
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
120
120
|
onClick: async ()=>{
|
|
121
|
-
if (values
|
|
121
|
+
if (values?.length) {
|
|
122
122
|
await navigator.clipboard.writeText(values.map((value)=>value).join(', '));
|
|
123
123
|
infoSnackbar('Preview values copied to clipboard!');
|
|
124
124
|
}
|
|
@@ -143,7 +143,7 @@ function VariablePreview(props) {
|
|
|
143
143
|
severity: "error",
|
|
144
144
|
children: error
|
|
145
145
|
}),
|
|
146
|
-
|
|
146
|
+
values?.length === 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Alert, {
|
|
147
147
|
severity: "info",
|
|
148
148
|
children: "No results"
|
|
149
149
|
}),
|
|
@@ -155,10 +155,10 @@ function VariablePreview(props) {
|
|
|
155
155
|
},
|
|
156
156
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CircularProgress, {})
|
|
157
157
|
}),
|
|
158
|
-
values
|
|
158
|
+
values?.slice(0, maxValues).map((val, index)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Chip, {
|
|
159
159
|
size: "small",
|
|
160
160
|
label: val
|
|
161
|
-
},
|
|
161
|
+
}, index)),
|
|
162
162
|
notShown > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Chip, {
|
|
163
163
|
onClick: showAll,
|
|
164
164
|
variant: "outlined",
|
|
@@ -174,9 +174,9 @@ function VariablePreview(props) {
|
|
|
174
174
|
function VariableListPreview(props) {
|
|
175
175
|
const { definition, onRefresh } = props;
|
|
176
176
|
const { data, isFetching, error } = (0, _variablemodel.useListVariablePluginValues)(definition);
|
|
177
|
-
const errorMessage = error
|
|
177
|
+
const errorMessage = error?.message;
|
|
178
178
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(VariablePreview, {
|
|
179
|
-
values:
|
|
179
|
+
values: data?.map((val)=>val.value) || [],
|
|
180
180
|
onRefresh: onRefresh,
|
|
181
181
|
isLoading: isFetching,
|
|
182
182
|
error: errorMessage
|
|
@@ -29,11 +29,9 @@ _export(exports, {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
function getInitialState(initialVariableDefinition) {
|
|
32
|
-
var _initialVariableDefinition_spec_display, _initialVariableDefinition_spec_display1;
|
|
33
|
-
var _initialVariableDefinition_spec_value, _initialVariableDefinition_spec_constant;
|
|
34
32
|
const textVariableFields = {
|
|
35
|
-
value:
|
|
36
|
-
constant:
|
|
33
|
+
value: initialVariableDefinition.spec.value ?? '',
|
|
34
|
+
constant: initialVariableDefinition.spec.constant ?? false
|
|
37
35
|
};
|
|
38
36
|
const listVariableFields = {
|
|
39
37
|
allowMultiple: false,
|
|
@@ -47,21 +45,18 @@ function getInitialState(initialVariableDefinition) {
|
|
|
47
45
|
}
|
|
48
46
|
};
|
|
49
47
|
if (initialVariableDefinition.kind === 'ListVariable') {
|
|
50
|
-
|
|
51
|
-
listVariableFields.
|
|
52
|
-
var _initialVariableDefinition_spec_allowAllValue;
|
|
53
|
-
listVariableFields.allowAllValue = (_initialVariableDefinition_spec_allowAllValue = initialVariableDefinition.spec.allowAllValue) !== null && _initialVariableDefinition_spec_allowAllValue !== void 0 ? _initialVariableDefinition_spec_allowAllValue : false;
|
|
48
|
+
listVariableFields.allowMultiple = initialVariableDefinition.spec.allowMultiple ?? false;
|
|
49
|
+
listVariableFields.allowAllValue = initialVariableDefinition.spec.allowAllValue ?? false;
|
|
54
50
|
listVariableFields.customAllValue = initialVariableDefinition.spec.customAllValue;
|
|
55
51
|
listVariableFields.capturingRegexp = initialVariableDefinition.spec.capturingRegexp;
|
|
56
52
|
listVariableFields.sort = initialVariableDefinition.spec.sort;
|
|
57
53
|
listVariableFields.plugin = initialVariableDefinition.spec.plugin;
|
|
58
54
|
}
|
|
59
|
-
var _initialVariableDefinition_spec_display_name, _initialVariableDefinition_spec_display_description;
|
|
60
55
|
return {
|
|
61
56
|
name: initialVariableDefinition.spec.name,
|
|
62
|
-
title:
|
|
57
|
+
title: initialVariableDefinition.spec.display?.name ?? '',
|
|
63
58
|
kind: initialVariableDefinition.kind,
|
|
64
|
-
description:
|
|
59
|
+
description: initialVariableDefinition.spec.display?.description ?? '',
|
|
65
60
|
listVariableFields,
|
|
66
61
|
textVariableFields
|
|
67
62
|
};
|
|
@@ -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
|
|
@@ -64,7 +64,7 @@ function filterVariableList(data, capturedRegexp) {
|
|
|
64
64
|
function useListVariablePluginValues(definition) {
|
|
65
65
|
const { data: variablePlugin } = (0, _runtime.usePlugin)('Variable', definition.spec.plugin.kind);
|
|
66
66
|
const datasourceStore = (0, _runtime.useDatasourceStore)();
|
|
67
|
-
const allVariables = (0, _runtime.
|
|
67
|
+
const allVariables = (0, _runtime.useAllVariableValues)();
|
|
68
68
|
const { absoluteTimeRange: timeRange, refreshKey } = (0, _runtime.useTimeRange)();
|
|
69
69
|
const variablePluginCtx = {
|
|
70
70
|
timeRange,
|
|
@@ -74,38 +74,37 @@ function useListVariablePluginValues(definition) {
|
|
|
74
74
|
const spec = definition.spec.plugin.spec;
|
|
75
75
|
const capturingRegexp = definition.spec.capturingRegexp !== undefined ? new RegExp(definition.spec.capturingRegexp, 'g') : undefined;
|
|
76
76
|
let dependsOnVariables;
|
|
77
|
-
if (variablePlugin
|
|
77
|
+
if (variablePlugin?.dependsOn) {
|
|
78
78
|
const dependencies = variablePlugin.dependsOn(spec, variablePluginCtx);
|
|
79
79
|
dependsOnVariables = dependencies.variables;
|
|
80
80
|
}
|
|
81
|
-
const variables = (0, _runtime.
|
|
81
|
+
const variables = (0, _runtime.useAllVariableValues)(dependsOnVariables);
|
|
82
82
|
let waitToLoad = false;
|
|
83
83
|
if (dependsOnVariables) {
|
|
84
|
-
waitToLoad = dependsOnVariables.some((v)=>
|
|
85
|
-
var _variables_v;
|
|
86
|
-
return (_variables_v = variables[v]) === null || _variables_v === void 0 ? void 0 : _variables_v.loading;
|
|
87
|
-
});
|
|
84
|
+
waitToLoad = dependsOnVariables.some((v)=>variables[v]?.loading);
|
|
88
85
|
}
|
|
89
86
|
const variablesValueKey = getVariableValuesKey(variables);
|
|
90
|
-
return (0, _reactquery.useQuery)(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
87
|
+
return (0, _reactquery.useQuery)({
|
|
88
|
+
queryKey: [
|
|
89
|
+
definition,
|
|
90
|
+
variablesValueKey,
|
|
91
|
+
timeRange,
|
|
92
|
+
refreshKey
|
|
93
|
+
],
|
|
94
|
+
queryFn: async ()=>{
|
|
95
|
+
const resp = await variablePlugin?.getVariableOptions(spec, {
|
|
96
|
+
datasourceStore,
|
|
97
|
+
variables,
|
|
98
|
+
timeRange
|
|
99
|
+
});
|
|
100
|
+
if (resp === undefined) {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
if (!capturingRegexp) {
|
|
104
|
+
return resp.data;
|
|
105
|
+
}
|
|
106
|
+
return filterVariableList(resp.data, capturingRegexp);
|
|
107
|
+
},
|
|
109
108
|
enabled: !!variablePlugin || waitToLoad
|
|
110
109
|
});
|
|
111
110
|
}
|
|
@@ -17,7 +17,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
17
|
_export_star(require("./CalculationSelector"), exports);
|
|
18
18
|
_export_star(require("./DatasourceEditorForm"), exports);
|
|
19
19
|
_export_star(require("./DatasourceSelect"), exports);
|
|
20
|
+
_export_star(require("./HTTPSettingsEditor"), exports);
|
|
20
21
|
_export_star(require("./LegendOptionsEditor"), exports);
|
|
22
|
+
_export_star(require("./MultiQueryEditor"), exports);
|
|
21
23
|
_export_star(require("./OptionsEditorRadios"), exports);
|
|
22
24
|
_export_star(require("./OptionsEditorTabs"), exports);
|
|
23
25
|
_export_star(require("./PanelSpecEditor"), exports);
|
|
@@ -25,10 +27,10 @@ _export_star(require("./PluginEditor"), exports);
|
|
|
25
27
|
_export_star(require("./PluginKindSelect"), exports);
|
|
26
28
|
_export_star(require("./PluginRegistry"), exports);
|
|
27
29
|
_export_star(require("./PluginSpecEditor"), exports);
|
|
28
|
-
_export_star(require("./TimeSeriesQueryEditor"), exports);
|
|
29
30
|
_export_star(require("./TimeRangeControls"), exports);
|
|
30
31
|
_export_star(require("./Variables"), exports);
|
|
31
32
|
_export_star(require("./ProjectSelect"), exports);
|
|
33
|
+
_export_star(require("./MetricLabelInput"), exports);
|
|
32
34
|
function _export_star(from, to) {
|
|
33
35
|
Object.keys(from).forEach(function(k) {
|
|
34
36
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -41,10 +41,13 @@ const _core = require("@perses-dev/core");
|
|
|
41
41
|
const _queryparams = require("./query-params");
|
|
42
42
|
const ProjectStoreContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
43
43
|
function useProjectList() {
|
|
44
|
-
return (0, _reactquery.useQuery)(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
return (0, _reactquery.useQuery)({
|
|
45
|
+
queryKey: [
|
|
46
|
+
'projects'
|
|
47
|
+
],
|
|
48
|
+
queryFn: ()=>{
|
|
49
|
+
return (0, _core.fetchJson)('/api/v1/projects');
|
|
50
|
+
}
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
53
|
function useProjectStore() {
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
ValidationProvider: function() {
|
|
25
|
+
return ValidationProvider;
|
|
26
|
+
},
|
|
27
|
+
ValidationSchemasContext: function() {
|
|
28
|
+
return ValidationSchemasContext;
|
|
29
|
+
},
|
|
30
|
+
useValidationSchemas: function() {
|
|
31
|
+
return useValidationSchemas;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
35
|
+
const _react = require("react");
|
|
36
|
+
const _core = require("@perses-dev/core");
|
|
37
|
+
const ValidationSchemasContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
38
|
+
function useValidationSchemas() {
|
|
39
|
+
const ctx = (0, _react.useContext)(ValidationSchemasContext);
|
|
40
|
+
if (ctx === undefined) {
|
|
41
|
+
throw new Error('No ValidationSchemasContext found. Did you forget a Provider?');
|
|
42
|
+
}
|
|
43
|
+
return ctx;
|
|
44
|
+
}
|
|
45
|
+
function ValidationProvider({ children }) {
|
|
46
|
+
const [datasourceEditorSchema, setDatasourceEditorSchema] = (0, _react.useState)(_core.datasourceDefinitionSchema);
|
|
47
|
+
const [panelEditorSchema, setPanelEditorSchema] = (0, _react.useState)(_core.panelEditorSchema);
|
|
48
|
+
const [variableEditorSchema, setVariableEditorSchema] = (0, _react.useState)(_core.variableDefinitionSchema);
|
|
49
|
+
function setDatasourceEditorSchemaPlugin(pluginSchema) {
|
|
50
|
+
setDatasourceEditorSchema((0, _core.buildDatasourceDefinitionSchema)(pluginSchema));
|
|
51
|
+
}
|
|
52
|
+
function setPanelEditorSchemaPlugin(pluginSchema) {
|
|
53
|
+
setPanelEditorSchema((0, _core.buildPanelEditorSchema)(pluginSchema));
|
|
54
|
+
}
|
|
55
|
+
function setVariableEditorSchemaPlugin(pluginSchema) {
|
|
56
|
+
setVariableEditorSchema((0, _core.buildVariableDefinitionSchema)(pluginSchema));
|
|
57
|
+
}
|
|
58
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(ValidationSchemasContext.Provider, {
|
|
59
|
+
value: {
|
|
60
|
+
datasourceEditorSchema,
|
|
61
|
+
panelEditorSchema,
|
|
62
|
+
variableEditorSchema,
|
|
63
|
+
setDatasourceEditorSchemaPlugin,
|
|
64
|
+
setPanelEditorSchemaPlugin,
|
|
65
|
+
setVariableEditorSchemaPlugin
|
|
66
|
+
},
|
|
67
|
+
children: children
|
|
68
|
+
});
|
|
69
|
+
}
|
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
17
|
_export_star(require("./ProjectStoreProvider"), exports);
|
|
18
|
+
_export_star(require("./ValidationProvider"), exports);
|
|
18
19
|
function _export_star(from, to) {
|
|
19
20
|
Object.keys(from).forEach(function(k) {
|
|
20
21
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -20,8 +20,8 @@ _export_star(require("./model"), exports);
|
|
|
20
20
|
_export_star(require("./runtime"), exports);
|
|
21
21
|
_export_star(require("./test-utils"), exports);
|
|
22
22
|
_export_star(require("./utils"), exports);
|
|
23
|
-
_export_star(require("./validation"), exports);
|
|
24
23
|
_export_star(require("./context"), exports);
|
|
24
|
+
_export_star(require("./remote"), exports);
|
|
25
25
|
function _export_star(from, to) {
|
|
26
26
|
Object.keys(from).forEach(function(k) {
|
|
27
27
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */ // Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "PluginLoaderComponent", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return PluginLoaderComponent;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _react = require("react");
|
|
25
|
+
const _PluginRuntime = require("./PluginRuntime");
|
|
26
|
+
function PluginContainer({ pluginFn, props }) {
|
|
27
|
+
return pluginFn(props);
|
|
28
|
+
}
|
|
29
|
+
function PluginLoaderComponent({ plugin, props, field }) {
|
|
30
|
+
const { loadPlugin } = (0, _PluginRuntime.usePluginRuntime)({
|
|
31
|
+
plugin
|
|
32
|
+
});
|
|
33
|
+
const [pluginModule, setPluginModule] = (0, _react.useState)(null);
|
|
34
|
+
const [error, setError] = (0, _react.useState)(null);
|
|
35
|
+
const name = `${plugin.moduleName}-${plugin.name}`;
|
|
36
|
+
const previousPluginName = (0, _react.useRef)(name);
|
|
37
|
+
(0, _react.useEffect)(()=>{
|
|
38
|
+
previousPluginName.current = name;
|
|
39
|
+
setError(null);
|
|
40
|
+
loadPlugin().then((module)=>{
|
|
41
|
+
setPluginModule(module);
|
|
42
|
+
}).catch((error)=>{
|
|
43
|
+
setPluginModule(null);
|
|
44
|
+
console.error(`PluginLoaderComponent: Error loading plugin ${plugin.name} from module ${plugin.moduleName}:`, error);
|
|
45
|
+
setError(new Error(`PluginLoaderComponent: Error loading plugin ${plugin.name} from module ${plugin.moduleName}`));
|
|
46
|
+
});
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
+
}, [
|
|
49
|
+
name
|
|
50
|
+
]);
|
|
51
|
+
if (error) {
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
if (!pluginModule) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
let pluginFunction = pluginModule[plugin.name];
|
|
58
|
+
if (field && pluginFunction && typeof pluginFunction === 'object' && field in pluginFunction) {
|
|
59
|
+
pluginFunction = pluginFunction[field];
|
|
60
|
+
}
|
|
61
|
+
if (!pluginFunction) {
|
|
62
|
+
throw new Error(`PluginLoaderComponent: Plugin module ${plugin.moduleName} does not have a ${plugin.name} export`);
|
|
63
|
+
}
|
|
64
|
+
if (typeof pluginFunction !== 'function') {
|
|
65
|
+
throw new Error(`PluginLoaderComponent: Plugin ${plugin.name} export is not a function`);
|
|
66
|
+
}
|
|
67
|
+
// make sure to re mount the plugin when changes, to avoid mismatch in hooks ordering when re rendering
|
|
68
|
+
if (previousPluginName.current !== name) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(PluginContainer, {
|
|
72
|
+
pluginFn: pluginFunction,
|
|
73
|
+
props: props
|
|
74
|
+
}, name);
|
|
75
|
+
}
|