@perses-dev/plugin-system 0.0.0-snapshot-scatterplot-fix-imports-95e1b59 → 0.0.0-snapshot-histogram-types-78c5104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +82 -162
- package/dist/cjs/components/DatasourceSelect.js +8 -13
- package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +534 -0
- package/dist/cjs/components/{TimeSeriesQueryEditor → HTTPSettingsEditor}/index.js +2 -2
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +8 -7
- package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +41 -0
- package/dist/cjs/components/{TraceQueryEditor → MetricLabelInput}/index.js +2 -2
- package/dist/cjs/components/{TimeSeriesQueryEditor/TimeSeriesQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +30 -23
- package/dist/cjs/components/{TimeSeriesQueryEditor/TimeSeriesQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +25 -13
- package/dist/cjs/{stories/shared-utils → components/MultiQueryEditor}/index.js +2 -2
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +51 -59
- package/dist/cjs/components/PluginEditor/PluginEditor.js +16 -13
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +43 -32
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +55 -7
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +8 -9
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +17 -14
- package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
- package/dist/cjs/components/ProjectSelect.js +5 -5
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +10 -71
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +391 -442
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +7 -7
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +6 -11
- package/dist/cjs/components/Variables/variable-model.js +26 -27
- package/dist/cjs/components/index.js +3 -1
- package/dist/cjs/context/ProjectStoreProvider.js +7 -4
- package/dist/cjs/context/ValidationProvider.js +69 -0
- package/dist/cjs/context/index.js +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/{components/TimeSeriesQueryEditor/index.js → cjs/model/explore.js} +4 -3
- package/dist/cjs/remote/PersesPlugin.types.js +16 -0
- package/dist/cjs/remote/PluginLoaderComponent.js +75 -0
- package/dist/cjs/remote/PluginRuntime.js +273 -0
- package/dist/cjs/{validation → remote}/index.js +2 -5
- package/dist/cjs/remote/remotePluginLoader.js +61 -0
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +18 -9
- package/dist/cjs/runtime/DataQueriesProvider/model.js +10 -9
- package/dist/cjs/{stories/shared-utils/decorators/WithPluginRegistry.js → runtime/QueryCountProvider.js} +22 -39
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +17 -4
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +100 -0
- package/dist/cjs/runtime/TimeRangeProvider/index.js +2 -1
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +4 -7
- package/dist/cjs/runtime/UsageMetricsProvider.js +99 -0
- package/dist/cjs/runtime/builtin-variables.js +2 -2
- package/dist/cjs/runtime/datasources.js +23 -14
- package/dist/cjs/runtime/index.js +4 -2
- package/dist/cjs/runtime/plugin-registry.js +49 -28
- package/dist/cjs/runtime/time-series-queries.js +23 -28
- package/dist/cjs/runtime/trace-queries.js +1 -2
- package/dist/cjs/runtime/{template-variables.js → variables.js} +29 -47
- package/dist/cjs/test/mock-data.js +25 -4
- package/dist/cjs/test/render.js +2 -11
- package/dist/cjs/test/test-plugins/bert/index.js +20 -19
- package/dist/cjs/test-utils/mock-plugin-registry.js +10 -10
- package/dist/cjs/utils/variables.js +24 -24
- package/dist/components/CalculationSelector/CalculationSelector.d.ts +2 -1
- package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +6 -5
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +85 -165
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/DatasourceSelect.d.ts +5 -4
- package/dist/components/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect.js +8 -13
- package/dist/components/DatasourceSelect.js.map +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +11 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +480 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -0
- package/dist/components/HTTPSettingsEditor/index.d.ts +2 -0
- package/dist/components/HTTPSettingsEditor/index.d.ts.map +1 -0
- package/dist/components/HTTPSettingsEditor/index.js +15 -0
- package/dist/components/HTTPSettingsEditor/index.js.map +1 -0
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +3 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +10 -9
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.d.ts +7 -0
- package/dist/components/MetricLabelInput/MetricLabelInput.d.ts.map +1 -0
- package/dist/components/MetricLabelInput/MetricLabelInput.js +33 -0
- package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -0
- package/dist/components/MetricLabelInput/index.d.ts +2 -0
- package/dist/components/MetricLabelInput/index.d.ts.map +1 -0
- package/dist/components/MetricLabelInput/index.js +15 -0
- package/dist/components/MetricLabelInput/index.js.map +1 -0
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +17 -0
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -0
- package/dist/components/{TimeSeriesQueryEditor/TimeSeriesQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +37 -23
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -0
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +29 -0
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -0
- package/dist/components/{TraceQueryEditor/TraceQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +35 -12
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -0
- package/dist/components/MultiQueryEditor/index.d.ts +2 -0
- package/dist/components/MultiQueryEditor/index.d.ts.map +1 -0
- package/dist/components/MultiQueryEditor/index.js +15 -0
- package/dist/components/{TraceQueryEditor → MultiQueryEditor}/index.js.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +2 -2
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +2 -2
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +3 -3
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +5 -2
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +53 -61
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts +2 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +16 -13
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +15 -8
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +43 -32
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +10 -4
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +61 -10
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.d.ts +2 -2
- package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +8 -9
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.d.ts +4 -4
- package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js +17 -14
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +5 -4
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/ProjectSelect.d.ts +2 -1
- package/dist/components/ProjectSelect.d.ts.map +1 -1
- package/dist/components/ProjectSelect.js +5 -5
- package/dist/components/ProjectSelect.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +3 -2
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +12 -70
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +4 -3
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +395 -446
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +3 -2
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +7 -7
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +2 -2
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +6 -11
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/variable-model.d.ts +2 -1
- package/dist/components/Variables/variable-model.d.ts.map +1 -1
- package/dist/components/Variables/variable-model.js +27 -28
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -1
- package/dist/components/index.js.map +1 -1
- package/dist/context/ProjectStoreProvider.d.ts +4 -4
- package/dist/context/ProjectStoreProvider.d.ts.map +1 -1
- package/dist/context/ProjectStoreProvider.js +7 -4
- package/dist/context/ProjectStoreProvider.js.map +1 -1
- package/dist/context/ValidationProvider.d.ts +19 -0
- package/dist/context/ValidationProvider.d.ts.map +1 -0
- package/dist/context/ValidationProvider.js +52 -0
- package/dist/context/ValidationProvider.js.map +1 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -0
- package/dist/context/index.js.map +1 -1
- package/dist/context/query-params.d.ts.map +1 -1
- package/dist/context/query-params.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/explore.d.ts +13 -0
- package/dist/model/explore.d.ts.map +1 -0
- package/dist/{validation/index.js → model/explore.js} +4 -6
- package/dist/model/explore.js.map +1 -0
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js.map +1 -1
- package/dist/model/panels.d.ts +27 -5
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/model/plugins.d.ts +31 -17
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/model/time-series-queries.d.ts +2 -1
- package/dist/model/time-series-queries.d.ts.map +1 -1
- package/dist/model/time-series-queries.js.map +1 -1
- package/dist/remote/PersesPlugin.types.d.ts +7 -0
- package/dist/remote/PersesPlugin.types.d.ts.map +1 -0
- package/dist/{stories/shared-utils/index.js → remote/PersesPlugin.types.js} +3 -3
- package/dist/remote/PersesPlugin.types.js.map +1 -0
- package/dist/remote/PluginLoaderComponent.d.ts +10 -0
- package/dist/remote/PluginLoaderComponent.d.ts.map +1 -0
- package/dist/remote/PluginLoaderComponent.js +67 -0
- package/dist/remote/PluginLoaderComponent.js.map +1 -0
- package/dist/remote/PluginRuntime.d.ts +10 -0
- package/dist/remote/PluginRuntime.d.ts.map +1 -0
- package/dist/remote/PluginRuntime.js +211 -0
- package/dist/remote/PluginRuntime.js.map +1 -0
- package/dist/remote/index.d.ts +3 -0
- package/dist/remote/index.d.ts.map +1 -0
- package/dist/{components/TraceQueryEditor → remote}/index.js +2 -1
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/remotePluginLoader.d.ts +3 -0
- package/dist/remote/remotePluginLoader.d.ts.map +1 -0
- package/dist/remote/remotePluginLoader.js +53 -0
- package/dist/remote/remotePluginLoader.js.map +1 -0
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +2 -2
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +18 -9
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +5 -6
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +10 -9
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/QueryCountProvider.d.ts +9 -0
- package/dist/runtime/QueryCountProvider.d.ts.map +1 -0
- package/dist/{validation/duration.js → runtime/QueryCountProvider.js} +13 -4
- package/dist/runtime/QueryCountProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +2 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +17 -4
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +2 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +32 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +82 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts +1 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/index.js +2 -1
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +4 -7
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
- package/dist/runtime/UsageMetricsProvider.d.ts +25 -0
- package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -0
- package/dist/runtime/UsageMetricsProvider.js +77 -0
- package/dist/runtime/UsageMetricsProvider.js.map +1 -0
- package/dist/runtime/builtin-variables.d.ts +1 -1
- package/dist/runtime/builtin-variables.d.ts.map +1 -1
- package/dist/runtime/builtin-variables.js +2 -2
- package/dist/runtime/builtin-variables.js.map +1 -1
- package/dist/runtime/datasources.d.ts +5 -4
- package/dist/runtime/datasources.d.ts.map +1 -1
- package/dist/runtime/datasources.js +23 -14
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +4 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/plugin-registry.d.ts +10 -10
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +49 -28
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts +5 -4
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +23 -28
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.d.ts +4 -3
- package/dist/runtime/trace-queries.d.ts.map +1 -1
- package/dist/runtime/trace-queries.js +2 -3
- package/dist/runtime/trace-queries.js.map +1 -1
- package/dist/runtime/{template-variables.d.ts → variables.d.ts} +4 -4
- package/dist/runtime/variables.d.ts.map +1 -0
- package/dist/runtime/{template-variables.js → variables.js} +28 -45
- package/dist/runtime/variables.js.map +1 -0
- package/dist/test/mock-data.d.ts.map +1 -1
- package/dist/test/mock-data.js +25 -4
- package/dist/test/mock-data.js.map +1 -1
- package/dist/test/render.d.ts +3 -3
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +2 -11
- package/dist/test/render.js.map +1 -1
- package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
- package/dist/test/test-plugins/bert/index.js +20 -19
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.d.ts +5 -3
- package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +10 -10
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/dist/utils/variables.d.ts +4 -4
- package/dist/utils/variables.d.ts.map +1 -1
- package/dist/utils/variables.js +19 -19
- package/dist/utils/variables.js.map +1 -1
- package/package.json +10 -11
- package/dist/cjs/components/TraceQueryEditor/TraceQueryEditor.js +0 -143
- package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +0 -96
- package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +0 -41
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +0 -42
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +0 -101
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js +0 -42
- package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +0 -41
- package/dist/cjs/stories/shared-utils/decorators/index.js +0 -35
- package/dist/cjs/validation/datasource.js +0 -30
- package/dist/cjs/validation/duration.js +0 -25
- package/dist/cjs/validation/resource.js +0 -24
- package/dist/cjs/validation/role.js +0 -86
- package/dist/cjs/validation/rolebinding.js +0 -55
- package/dist/cjs/validation/secret.js +0 -176
- package/dist/cjs/validation/user.js +0 -46
- package/dist/cjs/validation/variable.js +0 -48
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +0 -7
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +0 -12
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +0 -83
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/index.d.ts +0 -2
- package/dist/components/TimeSeriesQueryEditor/index.d.ts.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/index.js.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts +0 -8
- package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryEditor.js +0 -130
- package/dist/components/TraceQueryEditor/TraceQueryEditor.js.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts +0 -12
- package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryInput.js.map +0 -1
- package/dist/components/TraceQueryEditor/index.d.ts +0 -2
- package/dist/components/TraceQueryEditor/index.d.ts.map +0 -1
- package/dist/runtime/template-variables.d.ts.map +0 -1
- package/dist/runtime/template-variables.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts +0 -12
- package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.js +0 -33
- package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +0 -3
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +0 -46
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +0 -12
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +0 -39
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts +0 -12
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +0 -95
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts +0 -12
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js +0 -39
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +0 -12
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.js +0 -33
- package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +0 -1
- package/dist/stories/shared-utils/decorators/index.d.ts +0 -7
- package/dist/stories/shared-utils/decorators/index.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/index.js +0 -20
- package/dist/stories/shared-utils/decorators/index.js.map +0 -1
- package/dist/stories/shared-utils/index.d.ts +0 -2
- package/dist/stories/shared-utils/index.d.ts.map +0 -1
- package/dist/stories/shared-utils/index.js.map +0 -1
- package/dist/validation/datasource.d.ts +0 -19
- package/dist/validation/datasource.d.ts.map +0 -1
- package/dist/validation/datasource.js +0 -22
- package/dist/validation/datasource.js.map +0 -1
- package/dist/validation/duration.d.ts +0 -3
- package/dist/validation/duration.d.ts.map +0 -1
- package/dist/validation/duration.js.map +0 -1
- package/dist/validation/index.d.ts +0 -6
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/resource.d.ts +0 -3
- package/dist/validation/resource.d.ts.map +0 -1
- package/dist/validation/resource.js +0 -16
- package/dist/validation/resource.js.map +0 -1
- package/dist/validation/role.d.ts +0 -228
- package/dist/validation/role.d.ts.map +0 -1
- package/dist/validation/role.js +0 -67
- package/dist/validation/role.js.map +0 -1
- package/dist/validation/rolebinding.d.ts +0 -137
- package/dist/validation/rolebinding.d.ts.map +0 -1
- package/dist/validation/rolebinding.js +0 -47
- package/dist/validation/rolebinding.js.map +0 -1
- package/dist/validation/secret.d.ts +0 -964
- package/dist/validation/secret.d.ts.map +0 -1
- package/dist/validation/secret.js +0 -157
- package/dist/validation/secret.js.map +0 -1
- package/dist/validation/user.d.ts +0 -93
- package/dist/validation/user.d.ts.map +0 -1
- package/dist/validation/user.js +0 -38
- package/dist/validation/user.js.map +0 -1
- package/dist/validation/variable.d.ts +0 -96
- package/dist/validation/variable.d.ts.map +0 -1
- package/dist/validation/variable.js +0 -40
- package/dist/validation/variable.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "MultiQueryEditor", {
|
|
18
18
|
enumerable: true,
|
|
19
19
|
get: function() {
|
|
20
|
-
return
|
|
20
|
+
return MultiQueryEditor;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
@@ -26,36 +26,43 @@ const _immer = require("immer");
|
|
|
26
26
|
const _material = require("@mui/material");
|
|
27
27
|
const _Plus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Plus"));
|
|
28
28
|
const _runtime = require("../../runtime");
|
|
29
|
-
const
|
|
29
|
+
const _QueryEditorContainer = require("./QueryEditorContainer");
|
|
30
30
|
function _interop_require_default(obj) {
|
|
31
31
|
return obj && obj.__esModule ? obj : {
|
|
32
32
|
default: obj
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
var _timeSeriesPlugins_;
|
|
35
|
+
function useDefaultQueryDefinition(queryTypes) {
|
|
37
36
|
// Build the default query plugin
|
|
37
|
+
// This will be used only if the queries are empty, to open a starting query
|
|
38
|
+
// Firs the default query type
|
|
39
|
+
const defaultQueryType = queryTypes[0];
|
|
40
|
+
// Then the default plugin kind
|
|
38
41
|
// Use as default the plugin kind explicitly set as default or the first in the list
|
|
42
|
+
const { data: queryPlugins, isLoading } = (0, _runtime.useListPluginMetadata)(queryTypes);
|
|
39
43
|
const { defaultPluginKinds } = (0, _runtime.usePluginRegistry)();
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const { data: defaultQueryPlugin } = (0, _runtime.usePlugin)(_runtime.TIME_SERIES_QUERY_KEY, defaultTimeSeriesQueryKind, {
|
|
44
|
-
useErrorBoundary: true,
|
|
44
|
+
const defaultQueryKind = defaultPluginKinds?.[defaultQueryType] ?? queryPlugins?.[0]?.spec.name ?? '';
|
|
45
|
+
const { data: defaultQueryPlugin } = (0, _runtime.usePlugin)(defaultQueryType, defaultQueryKind, {
|
|
46
|
+
throwOnError: true,
|
|
45
47
|
enabled: true
|
|
46
48
|
});
|
|
47
49
|
// This default query definition is used if no query is provided initially or when we add a new query
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
return {
|
|
51
|
+
defaultInitialQueryDefinition: {
|
|
52
|
+
kind: defaultQueryType,
|
|
53
|
+
spec: {
|
|
54
|
+
plugin: {
|
|
55
|
+
kind: defaultQueryKind,
|
|
56
|
+
spec: defaultQueryPlugin?.createInitialOptions() || {}
|
|
57
|
+
}
|
|
54
58
|
}
|
|
55
|
-
}
|
|
59
|
+
},
|
|
60
|
+
isLoading
|
|
56
61
|
};
|
|
62
|
+
}
|
|
63
|
+
function MultiQueryEditor({ queryTypes, queries = [], onChange }) {
|
|
64
|
+
const { defaultInitialQueryDefinition, isLoading } = useDefaultQueryDefinition(queryTypes);
|
|
57
65
|
// State for which queries are collapsed
|
|
58
|
-
// TODO: Would be easier if we had IDs for queries.
|
|
59
66
|
const [queriesCollapsed, setQueriesCollapsed] = (0, _react.useState)(queries.map(()=>false));
|
|
60
67
|
// Query handlers
|
|
61
68
|
const handleQueryChange = (index, queryDef)=>{
|
|
@@ -70,7 +77,6 @@ function TimeSeriesQueryEditor({ queries = [], onChange }) {
|
|
|
70
77
|
}));
|
|
71
78
|
};
|
|
72
79
|
const handleQueryAdd = ()=>{
|
|
73
|
-
if (!defaultQueryPlugin) return;
|
|
74
80
|
onChange((0, _immer.produce)(queries, (draft)=>{
|
|
75
81
|
if (draft) {
|
|
76
82
|
draft.push(defaultInitialQueryDefinition);
|
|
@@ -108,14 +114,15 @@ function TimeSeriesQueryEditor({ queries = [], onChange }) {
|
|
|
108
114
|
});
|
|
109
115
|
};
|
|
110
116
|
// show one query input if queries is empty
|
|
111
|
-
const queryDefinitions = queries.length ? queries : [
|
|
117
|
+
const queryDefinitions = queries.length ? queries : !isLoading ? [
|
|
112
118
|
defaultInitialQueryDefinition
|
|
113
|
-
];
|
|
119
|
+
] : [];
|
|
114
120
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
115
121
|
children: [
|
|
116
122
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
117
123
|
spacing: 1,
|
|
118
|
-
children: queryDefinitions.map((query, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
124
|
+
children: queryDefinitions.map((query, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_QueryEditorContainer.QueryEditorContainer, {
|
|
125
|
+
queryTypes: queryTypes,
|
|
119
126
|
index: i,
|
|
120
127
|
query: query,
|
|
121
128
|
isCollapsed: !!queriesCollapsed[i],
|
|
@@ -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,14 +14,14 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "QueryEditorContainer", {
|
|
18
18
|
enumerable: true,
|
|
19
19
|
get: function() {
|
|
20
|
-
return
|
|
20
|
+
return QueryEditorContainer;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
-
const _immer =
|
|
24
|
+
const _immer = require("immer");
|
|
25
25
|
const _material = require("@mui/material");
|
|
26
26
|
const _DeleteOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/DeleteOutline"));
|
|
27
27
|
const _ChevronDown = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ChevronDown"));
|
|
@@ -32,7 +32,7 @@ function _interop_require_default(obj) {
|
|
|
32
32
|
default: obj
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const QueryEditorContainer = ({ queryTypes, index, query, isCollapsed, onDelete, onChange, onCollapseExpand })=>{
|
|
36
36
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
37
37
|
spacing: 1,
|
|
38
38
|
children: [
|
|
@@ -51,7 +51,7 @@ const TimeSeriesQueryInput = ({ index, query, isCollapsed, onDelete, onChange, o
|
|
|
51
51
|
variant: "overline",
|
|
52
52
|
component: "h4",
|
|
53
53
|
children: [
|
|
54
|
-
"Query ",
|
|
54
|
+
"Query #",
|
|
55
55
|
index + 1
|
|
56
56
|
]
|
|
57
57
|
}),
|
|
@@ -68,6 +68,7 @@ const TimeSeriesQueryInput = ({ index, query, isCollapsed, onDelete, onChange, o
|
|
|
68
68
|
]
|
|
69
69
|
}),
|
|
70
70
|
!isCollapsed && /*#__PURE__*/ (0, _jsxruntime.jsx)(QueryEditor, {
|
|
71
|
+
queryTypes: queryTypes,
|
|
71
72
|
value: query,
|
|
72
73
|
onChange: (next)=>onChange(index, next)
|
|
73
74
|
})
|
|
@@ -75,21 +76,32 @@ const TimeSeriesQueryInput = ({ index, query, isCollapsed, onDelete, onChange, o
|
|
|
75
76
|
}, index);
|
|
76
77
|
};
|
|
77
78
|
/**
|
|
78
|
-
*
|
|
79
|
+
* Editor for a query definition. This component is responsible for rendering the plugin editor for the given query.
|
|
80
|
+
* This will allow user to select a plugin extending from the given supported query types, and then edit the plugin
|
|
81
|
+
* spec for this plugin.
|
|
82
|
+
* @param props
|
|
83
|
+
* @constructor
|
|
79
84
|
*/ function QueryEditor(props) {
|
|
80
|
-
const { value, onChange, ...others } = props;
|
|
81
|
-
const { spec: { plugin } } = value;
|
|
85
|
+
const { value, onChange, queryTypes, ...others } = props;
|
|
82
86
|
const handlePluginChange = (next)=>{
|
|
83
|
-
onChange((0, _immer.
|
|
84
|
-
draft.
|
|
87
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
88
|
+
draft.kind = next.selection.type;
|
|
89
|
+
draft.spec.plugin.kind = next.selection.kind;
|
|
90
|
+
draft.spec.plugin.spec = next.spec;
|
|
85
91
|
}));
|
|
86
92
|
};
|
|
87
93
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
88
94
|
...others,
|
|
89
95
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginEditor.PluginEditor, {
|
|
90
|
-
|
|
96
|
+
pluginTypes: queryTypes,
|
|
91
97
|
pluginKindLabel: "Query Type",
|
|
92
|
-
value:
|
|
98
|
+
value: {
|
|
99
|
+
selection: {
|
|
100
|
+
kind: value.spec.plugin.kind,
|
|
101
|
+
type: value.kind
|
|
102
|
+
},
|
|
103
|
+
spec: value.spec.plugin.spec
|
|
104
|
+
},
|
|
93
105
|
onChange: handlePluginChange
|
|
94
106
|
})
|
|
95
107
|
});
|
|
@@ -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,7 +14,7 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
_export_star(require("./
|
|
17
|
+
_export_star(require("./MultiQueryEditor"), exports);
|
|
18
18
|
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
20
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -22,95 +22,87 @@ Object.defineProperty(exports, "PanelSpecEditor", {
|
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _components = require("@perses-dev/components");
|
|
25
|
+
const _reacthookform = require("react-hook-form");
|
|
25
26
|
const _runtime = require("../../runtime");
|
|
26
27
|
const _OptionsEditorTabs = require("../OptionsEditorTabs");
|
|
27
|
-
const
|
|
28
|
-
const _TraceQueryEditor = require("../TraceQueryEditor");
|
|
28
|
+
const _MultiQueryEditor = require("../MultiQueryEditor");
|
|
29
29
|
function PanelSpecEditor(props) {
|
|
30
|
-
const { panelDefinition, onJSONChange, onQueriesChange, onPluginSpecChange } = props;
|
|
30
|
+
const { control, panelDefinition, onJSONChange, onQueriesChange, onPluginSpecChange } = props;
|
|
31
31
|
const { kind } = panelDefinition.spec.plugin;
|
|
32
|
-
const { data: plugin,
|
|
32
|
+
const { data: plugin, isPending, error } = (0, _runtime.usePlugin)('Panel', kind);
|
|
33
33
|
if (error) {
|
|
34
34
|
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorAlert, {
|
|
35
35
|
error: error
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
// TODO: Proper loading indicator
|
|
39
|
-
if (
|
|
39
|
+
if (isPending) {
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
42
|
if (plugin === undefined) {
|
|
43
43
|
throw new Error(`Missing implementation for panel plugin with kind '${kind}'`);
|
|
44
44
|
}
|
|
45
|
-
const getQueryType = ()=>{
|
|
46
|
-
var _panelDefinition_spec, _queriesList_;
|
|
47
|
-
const queriesList = panelDefinition === null || panelDefinition === void 0 ? void 0 : (_panelDefinition_spec = panelDefinition.spec) === null || _panelDefinition_spec === void 0 ? void 0 : _panelDefinition_spec.queries;
|
|
48
|
-
if (queriesList === undefined) {
|
|
49
|
-
return '';
|
|
50
|
-
}
|
|
51
|
-
const queryType = (_queriesList_ = queriesList[0]) === null || _queriesList_ === void 0 ? void 0 : _queriesList_.kind;
|
|
52
|
-
return queryType;
|
|
53
|
-
};
|
|
54
|
-
// Get the corresponding queryEditor depending on the queryType
|
|
55
|
-
const getQueryEditorComponent = ()=>{
|
|
56
|
-
const queryType = getQueryType();
|
|
57
|
-
// default case handles cause where there is no queryType yet (e.g. UI > 'editing' mode > 'Add Panel')
|
|
58
|
-
switch(queryType){
|
|
59
|
-
case 'TimeSeriesQuery':
|
|
60
|
-
var _panelDefinition_spec_queries;
|
|
61
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TimeSeriesQueryEditor.TimeSeriesQueryEditor, {
|
|
62
|
-
queries: (_panelDefinition_spec_queries = panelDefinition.spec.queries) !== null && _panelDefinition_spec_queries !== void 0 ? _panelDefinition_spec_queries : [],
|
|
63
|
-
onChange: onQueriesChange
|
|
64
|
-
});
|
|
65
|
-
case 'TraceQuery':
|
|
66
|
-
var _panelDefinition_spec_queries1;
|
|
67
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TraceQueryEditor.TraceQueryEditor, {
|
|
68
|
-
queries: (_panelDefinition_spec_queries1 = panelDefinition.spec.queries) !== null && _panelDefinition_spec_queries1 !== void 0 ? _panelDefinition_spec_queries1 : [],
|
|
69
|
-
onChange: onQueriesChange
|
|
70
|
-
});
|
|
71
|
-
default:
|
|
72
|
-
// ScatterChart only handles trace queries for now
|
|
73
|
-
if (kind === 'ScatterChart') {
|
|
74
|
-
var _panelDefinition_spec_queries2;
|
|
75
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TraceQueryEditor.TraceQueryEditor, {
|
|
76
|
-
queries: (_panelDefinition_spec_queries2 = panelDefinition.spec.queries) !== null && _panelDefinition_spec_queries2 !== void 0 ? _panelDefinition_spec_queries2 : [],
|
|
77
|
-
onChange: onQueriesChange
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
var _panelDefinition_spec_queries3;
|
|
81
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TimeSeriesQueryEditor.TimeSeriesQueryEditor, {
|
|
82
|
-
queries: (_panelDefinition_spec_queries3 = panelDefinition.spec.queries) !== null && _panelDefinition_spec_queries3 !== void 0 ? _panelDefinition_spec_queries3 : [],
|
|
83
|
-
onChange: onQueriesChange
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
45
|
const { panelOptionsEditorComponents, hideQueryEditor } = plugin;
|
|
88
46
|
let tabs = [];
|
|
89
47
|
if (!hideQueryEditor) {
|
|
90
48
|
tabs.push({
|
|
91
49
|
label: 'Query',
|
|
92
|
-
content:
|
|
50
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
51
|
+
control: control,
|
|
52
|
+
name: "panelDefinition.spec.queries",
|
|
53
|
+
render: ({ field })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_MultiQueryEditor.MultiQueryEditor, {
|
|
54
|
+
queryTypes: plugin.supportedQueryTypes ?? [],
|
|
55
|
+
queries: panelDefinition.spec.queries ?? [],
|
|
56
|
+
onChange: (queries)=>{
|
|
57
|
+
field.onChange(queries);
|
|
58
|
+
onQueriesChange(queries);
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
})
|
|
93
62
|
});
|
|
94
63
|
}
|
|
95
64
|
if (panelOptionsEditorComponents !== undefined) {
|
|
96
65
|
tabs = tabs.concat(panelOptionsEditorComponents.map(({ label, content: OptionsEditorComponent })=>({
|
|
97
66
|
label,
|
|
98
|
-
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
99
|
-
|
|
100
|
-
|
|
67
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
68
|
+
control: control,
|
|
69
|
+
name: "panelDefinition.spec.plugin.spec",
|
|
70
|
+
render: ({ field })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(OptionsEditorComponent, {
|
|
71
|
+
value: panelDefinition.spec.plugin.spec,
|
|
72
|
+
onChange: (spec)=>{
|
|
73
|
+
field.onChange(spec);
|
|
74
|
+
onPluginSpecChange(spec);
|
|
75
|
+
}
|
|
76
|
+
})
|
|
101
77
|
})
|
|
102
78
|
})));
|
|
103
79
|
}
|
|
104
|
-
// always show json editor by default
|
|
80
|
+
// always show json editor and links editor by default
|
|
81
|
+
tabs.push({
|
|
82
|
+
label: 'Links',
|
|
83
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.LinksEditor, {
|
|
84
|
+
control: control
|
|
85
|
+
})
|
|
86
|
+
});
|
|
105
87
|
tabs.push({
|
|
106
88
|
label: 'JSON',
|
|
107
|
-
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
89
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacthookform.Controller, {
|
|
90
|
+
control: control,
|
|
91
|
+
name: "panelDefinition",
|
|
92
|
+
render: ({ field })=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.JSONEditor, {
|
|
93
|
+
maxHeight: "80vh",
|
|
94
|
+
value: panelDefinition,
|
|
95
|
+
onChange: (json)=>{
|
|
96
|
+
field.onChange(JSON.parse(json));
|
|
97
|
+
onJSONChange(json);
|
|
98
|
+
}
|
|
99
|
+
})
|
|
111
100
|
})
|
|
112
101
|
});
|
|
113
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
114
|
-
|
|
115
|
-
|
|
102
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_runtime.QueryCountProvider, {
|
|
103
|
+
queryCount: (panelDefinition.spec.queries ?? []).length,
|
|
104
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_OptionsEditorTabs.OptionsEditorTabs, {
|
|
105
|
+
tabs: tabs
|
|
106
|
+
}, tabs.length)
|
|
107
|
+
});
|
|
116
108
|
}
|
|
@@ -22,40 +22,43 @@ Object.defineProperty(exports, "PluginEditor", {
|
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _material = require("@mui/material");
|
|
25
|
+
const _components = require("@perses-dev/components");
|
|
25
26
|
const _PluginKindSelect = require("../PluginKindSelect");
|
|
26
27
|
const _PluginSpecEditor = require("../PluginSpecEditor");
|
|
27
28
|
const _plugineditorapi = require("./plugin-editor-api");
|
|
28
29
|
function PluginEditor(props) {
|
|
29
30
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
|
-
const { value,
|
|
31
|
-
const {
|
|
31
|
+
const { value, pluginTypes, pluginKindLabel, onChange: _, isReadonly, ...others } = props;
|
|
32
|
+
const { pendingSelection, isLoading, error, onSelectionChange, onSpecChange } = (0, _plugineditorapi.usePluginEditor)(props);
|
|
32
33
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
33
34
|
...others,
|
|
34
35
|
children: [
|
|
35
36
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginKindSelect.PluginKindSelect, {
|
|
36
37
|
fullWidth: false,
|
|
37
38
|
sx: {
|
|
38
|
-
mb:
|
|
39
|
+
mb: 2,
|
|
39
40
|
minWidth: 120
|
|
40
41
|
},
|
|
41
42
|
margin: "dense",
|
|
42
43
|
label: pluginKindLabel,
|
|
43
|
-
|
|
44
|
+
pluginTypes: pluginTypes,
|
|
44
45
|
disabled: isLoading,
|
|
45
|
-
value:
|
|
46
|
+
value: pendingSelection ? pendingSelection : value.selection,
|
|
46
47
|
InputProps: {
|
|
47
48
|
readOnly: isReadonly
|
|
48
49
|
},
|
|
49
50
|
error: !!error,
|
|
50
|
-
helperText: error
|
|
51
|
-
onChange:
|
|
51
|
+
helperText: error?.message,
|
|
52
|
+
onChange: onSelectionChange
|
|
52
53
|
}),
|
|
53
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorBoundary, {
|
|
55
|
+
FallbackComponent: _components.ErrorAlert,
|
|
56
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_PluginSpecEditor.PluginSpecEditor, {
|
|
57
|
+
pluginSelection: value.selection,
|
|
58
|
+
value: value.spec,
|
|
59
|
+
onChange: onSpecChange,
|
|
60
|
+
isReadonly: isReadonly
|
|
61
|
+
})
|
|
59
62
|
})
|
|
60
63
|
]
|
|
61
64
|
});
|
|
@@ -26,84 +26,95 @@ const _immer = require("immer");
|
|
|
26
26
|
const _runtime = require("../../runtime");
|
|
27
27
|
function usePluginEditor(props) {
|
|
28
28
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
29
|
-
const {
|
|
30
|
-
// Keep a stable reference so we don't run the effect below when we don't need to
|
|
29
|
+
const { pluginTypes, value, onHideQueryEditorChange = ()=>{} } = props; // setting onHideQueryEditorChange to empty function here because useEvent requires a function
|
|
30
|
+
// Keep a stable reference, so we don't run the effect below when we don't need to
|
|
31
31
|
const onChange = (0, _core.useEvent)(props.onChange);
|
|
32
32
|
const onHideQuery = (0, _core.useEvent)(onHideQueryEditorChange);
|
|
33
33
|
// The previous spec state for PluginType and kind and a helper function for remembering current values
|
|
34
34
|
const prevSpecState = (0, _react.useRef)({
|
|
35
|
-
[
|
|
36
|
-
[value.kind]: value.spec
|
|
35
|
+
[value.selection.type]: {
|
|
36
|
+
[value.selection.kind]: value.spec
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
const rememberCurrentSpecState = (0, _core.useEvent)(()=>{
|
|
40
|
-
let byPluginType = prevSpecState.current[
|
|
40
|
+
let byPluginType = prevSpecState.current[value.selection.type];
|
|
41
41
|
if (byPluginType === undefined) {
|
|
42
42
|
byPluginType = {};
|
|
43
|
-
prevSpecState.current[
|
|
43
|
+
prevSpecState.current[value.selection.type] = byPluginType;
|
|
44
44
|
}
|
|
45
|
-
byPluginType[value.kind] = value.spec;
|
|
45
|
+
byPluginType[value.selection.kind] = value.spec;
|
|
46
46
|
});
|
|
47
47
|
// The previous hide query state for each panel kind
|
|
48
48
|
const hideQueryState = (0, _react.useRef)({
|
|
49
|
-
[value.kind]: false
|
|
49
|
+
[value.selection.kind]: false
|
|
50
50
|
});
|
|
51
51
|
const { defaultPluginKinds } = (0, _runtime.usePluginRegistry)();
|
|
52
|
-
const
|
|
53
|
-
const
|
|
52
|
+
const defaultPluginType = pluginTypes[0];
|
|
53
|
+
const defaultPluginKind = defaultPluginType ? defaultPluginKinds?.[defaultPluginType] : undefined;
|
|
54
|
+
const defaultPluginSelection = defaultPluginType && defaultPluginKind ? {
|
|
55
|
+
type: defaultPluginType,
|
|
56
|
+
kind: defaultPluginKind
|
|
57
|
+
} : undefined;
|
|
58
|
+
const initPendingSelection = !value.selection && defaultPluginSelection ? defaultPluginSelection : undefined;
|
|
54
59
|
// When kind changes and we haven't loaded that plugin before, we will need to enter a "pending" state so that we
|
|
55
60
|
// can generate proper initial spec values that match the new plugin kind
|
|
56
|
-
const [
|
|
57
|
-
|
|
61
|
+
const [pendingSelection, setPendingSelection] = (0, _react.useState)(initPendingSelection);
|
|
62
|
+
// Take a default kind in case user write explicitly an empty kind in the initial value
|
|
63
|
+
(0, _react.useEffect)(()=>{
|
|
64
|
+
if (value.selection.kind === '') {
|
|
65
|
+
value.selection.kind = defaultPluginKind || '';
|
|
66
|
+
}
|
|
67
|
+
}, [
|
|
68
|
+
value.selection,
|
|
69
|
+
defaultPluginKind
|
|
70
|
+
]);
|
|
71
|
+
const { data: plugin, isFetching, error } = (0, _runtime.usePlugin)(pendingSelection?.type, pendingSelection?.kind || '');
|
|
58
72
|
(0, _react.useEffect)(()=>{
|
|
59
73
|
// Nothing to do if no new plugin kind is pending
|
|
60
|
-
if (
|
|
74
|
+
if (!pendingSelection) return;
|
|
61
75
|
// Can't get spec value until we have a plugin
|
|
62
76
|
if (plugin === undefined) return;
|
|
63
77
|
// Fire an onChange to change to the pending kind with initial values from the plugin
|
|
64
78
|
rememberCurrentSpecState();
|
|
65
79
|
onChange({
|
|
66
|
-
|
|
67
|
-
spec: plugin.createInitialOptions()
|
|
80
|
+
selection: pendingSelection,
|
|
81
|
+
spec: plugin.createInitialOptions ? plugin.createInitialOptions() : {}
|
|
68
82
|
});
|
|
69
|
-
if (
|
|
83
|
+
if (pendingSelection.type === 'Panel') {
|
|
70
84
|
const panelPlugin = plugin;
|
|
71
|
-
hideQueryState.current[
|
|
72
|
-
if (!!panelPlugin.hideQueryEditor !== hideQueryState.current[value.kind]) {
|
|
85
|
+
hideQueryState.current[pendingSelection.kind] = !!panelPlugin.hideQueryEditor;
|
|
86
|
+
if (!!panelPlugin.hideQueryEditor !== hideQueryState.current[value.selection.kind]) {
|
|
73
87
|
onHideQuery(!!panelPlugin.hideQueryEditor);
|
|
74
88
|
}
|
|
75
89
|
}
|
|
76
|
-
|
|
90
|
+
setPendingSelection(undefined);
|
|
77
91
|
}, [
|
|
78
|
-
|
|
92
|
+
pendingSelection,
|
|
79
93
|
plugin,
|
|
80
94
|
rememberCurrentSpecState,
|
|
81
95
|
onChange,
|
|
82
96
|
onHideQuery,
|
|
83
97
|
hideQueryState,
|
|
84
|
-
|
|
85
|
-
value.kind
|
|
98
|
+
value.selection
|
|
86
99
|
]);
|
|
87
100
|
/**
|
|
88
101
|
* When the user tries to change the plugin kind, make sure we have the correct spec for that plugin kind before we
|
|
89
102
|
* make the switch.
|
|
90
|
-
*/ const
|
|
91
|
-
var _prevSpecState_current_pluginType;
|
|
92
|
-
const nextKind = e.target.value;
|
|
103
|
+
*/ const onSelectionChange = (nextSelection)=>{
|
|
93
104
|
// If we already have state for this plugin type/kind from a previous selection, just use it
|
|
94
|
-
const previousState =
|
|
105
|
+
const previousState = prevSpecState.current[nextSelection.type]?.[nextSelection.kind];
|
|
95
106
|
if (previousState !== undefined) {
|
|
96
107
|
rememberCurrentSpecState();
|
|
97
108
|
onChange({
|
|
98
|
-
|
|
109
|
+
selection: nextSelection,
|
|
99
110
|
spec: previousState
|
|
100
111
|
});
|
|
101
112
|
} else {
|
|
102
113
|
// Otherwise, kick off the async loading process
|
|
103
|
-
|
|
114
|
+
setPendingSelection(nextSelection);
|
|
104
115
|
}
|
|
105
|
-
if (
|
|
106
|
-
onHideQuery(!!hideQueryState.current[
|
|
116
|
+
if (nextSelection.type === 'Panel' && hideQueryState.current[nextSelection.kind] !== undefined && hideQueryState.current[value.selection.kind] !== hideQueryState.current[nextSelection.kind]) {
|
|
117
|
+
onHideQuery(!!hideQueryState.current[nextSelection.kind]);
|
|
107
118
|
}
|
|
108
119
|
};
|
|
109
120
|
/**
|
|
@@ -114,10 +125,10 @@ function usePluginEditor(props) {
|
|
|
114
125
|
}));
|
|
115
126
|
};
|
|
116
127
|
return {
|
|
117
|
-
|
|
128
|
+
pendingSelection,
|
|
118
129
|
isLoading: isFetching,
|
|
119
130
|
error,
|
|
120
|
-
|
|
131
|
+
onSelectionChange,
|
|
121
132
|
onSpecChange,
|
|
122
133
|
rememberCurrentSpecState
|
|
123
134
|
};
|
|
@@ -25,28 +25,76 @@ const _material = require("@mui/material");
|
|
|
25
25
|
const _react = require("react");
|
|
26
26
|
const _runtime = require("../../runtime");
|
|
27
27
|
const PluginKindSelect = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
|
|
28
|
-
const {
|
|
29
|
-
const { data, isLoading } = (0, _runtime.useListPluginMetadata)(
|
|
28
|
+
const { pluginTypes, value: propValue, onChange, ...others } = props;
|
|
29
|
+
const { data, isLoading } = (0, _runtime.useListPluginMetadata)(pluginTypes);
|
|
30
30
|
// Pass an empty value while options are still loading so MUI doesn't complain about us using an "out of range" value
|
|
31
|
-
const value = propValue
|
|
31
|
+
const value = !propValue || isLoading ? '' : selectionToOptionValue(propValue);
|
|
32
|
+
const handleChange = (event)=>{
|
|
33
|
+
onChange?.(optionValueToSelection(event.target.value));
|
|
34
|
+
};
|
|
35
|
+
const renderValue = (0, _react.useCallback)((selected)=>{
|
|
36
|
+
if (selected === '') {
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
const selectedValue = optionValueToSelection(selected);
|
|
40
|
+
return data?.find((v)=>v.kind === selectedValue.type && v.spec.name === selectedValue.kind)?.spec.display.name;
|
|
41
|
+
}, [
|
|
42
|
+
data
|
|
43
|
+
]);
|
|
32
44
|
// TODO: Does this need a loading indicator of some kind?
|
|
33
45
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TextField, {
|
|
34
46
|
select: true,
|
|
35
47
|
inputRef: ref,
|
|
36
48
|
...others,
|
|
37
49
|
value: value,
|
|
50
|
+
"aria-label": value,
|
|
51
|
+
onChange: handleChange,
|
|
52
|
+
SelectProps: {
|
|
53
|
+
renderValue
|
|
54
|
+
},
|
|
38
55
|
"data-testid": "plugin-kind-select",
|
|
39
56
|
children: [
|
|
40
57
|
isLoading && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
41
58
|
value: "",
|
|
42
59
|
children: "Loading..."
|
|
43
60
|
}),
|
|
44
|
-
data
|
|
61
|
+
data?.map((metadata)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
45
62
|
"data-testid": "option",
|
|
46
|
-
value:
|
|
47
|
-
|
|
48
|
-
|
|
63
|
+
value: selectionToOptionValue({
|
|
64
|
+
type: metadata.kind,
|
|
65
|
+
kind: metadata.spec.name
|
|
66
|
+
}),
|
|
67
|
+
children: metadata.spec.display.name
|
|
68
|
+
}, metadata.kind + metadata.spec.name))
|
|
49
69
|
]
|
|
50
70
|
});
|
|
51
71
|
});
|
|
52
72
|
PluginKindSelect.displayName = 'PluginKindSelect';
|
|
73
|
+
// Delimiter used to stringify/parse option values
|
|
74
|
+
const OPTION_VALUE_DELIMITER = '_____';
|
|
75
|
+
/**
|
|
76
|
+
* Given a PluginEditorSelection,
|
|
77
|
+
* returns a string value like `{type}_____{kind}` that can be used as a Select input value.
|
|
78
|
+
* @param selector
|
|
79
|
+
*/ function selectionToOptionValue(selector) {
|
|
80
|
+
return [
|
|
81
|
+
selector.type,
|
|
82
|
+
selector.kind
|
|
83
|
+
].join(OPTION_VALUE_DELIMITER);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Given an option value name like `{type}_____{kind}`,
|
|
87
|
+
* returns a PluginEditorSelection to be used by the query data model.
|
|
88
|
+
* @param optionValue
|
|
89
|
+
*/ function optionValueToSelection(optionValue) {
|
|
90
|
+
const words = optionValue.split(OPTION_VALUE_DELIMITER);
|
|
91
|
+
const type = words[0];
|
|
92
|
+
const kind = words[1];
|
|
93
|
+
if (type === undefined || kind === undefined) {
|
|
94
|
+
throw new Error('Invalid optionValue string');
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
type,
|
|
98
|
+
kind
|
|
99
|
+
};
|
|
100
|
+
}
|