@perses-dev/plugin-system 0.52.0-beta.2 → 0.52.0-beta.3
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/components/CalculationSelector/CalculationSelector.js.map +1 -0
- package/dist/{src/components/MetricLabelInput → components/CalculationSelector}/index.js.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -0
- package/dist/{src/components/MultiQueryEditor → components/DatasourceEditorForm}/index.js.map +1 -1
- package/dist/components/DatasourceSelect.js.map +1 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -0
- package/dist/components/HTTPSettingsEditor/index.js.map +1 -0
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -0
- package/dist/{src/components/PanelSpecEditor → components/LegendOptionsEditor}/index.js.map +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -0
- package/dist/components/MetricLabelInput/index.js.map +1 -0
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -0
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -0
- package/dist/{src/components/PluginRegistry → components/MultiQueryEditor}/index.js.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -0
- package/dist/{src/runtime/DataQueriesProvider → components/OptionsEditorRadios}/index.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -0
- package/dist/{src/components/HTTPSettingsEditor → components/OptionsEditorTabPanel}/index.js.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -0
- package/dist/{src/runtime/TimeRangeProvider → components/OptionsEditorTabs}/index.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -0
- package/dist/components/PanelSpecEditor/index.js.map +1 -0
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -0
- package/dist/{src/components/Variables → components/PluginEditor}/index.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -0
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -0
- package/dist/components/PluginKindSelect/index.js.map +1 -0
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -0
- package/dist/components/PluginRegistry/index.js.map +1 -0
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -0
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -0
- package/dist/components/PluginSpecEditor/index.js.map +1 -0
- package/dist/components/ProjectSelect.js.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
- package/dist/components/TimeRangeControls/index.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -0
- package/dist/components/Variables/index.js.map +1 -0
- package/dist/components/Variables/variable-model.js.map +1 -0
- package/dist/components/index.js.map +1 -0
- package/dist/{src/remote → constants}/index.js.map +1 -1
- package/dist/constants/user-interface-text.js.map +1 -0
- package/dist/context/ProjectStoreProvider.js.map +1 -0
- package/dist/context/ValidationProvider.js.map +1 -0
- package/dist/{src/test → context}/index.js.map +1 -1
- package/dist/context/query-params.js.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/model/datasource.js.map +1 -0
- package/dist/model/explore.js.map +1 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/legend.js.map +1 -0
- package/dist/model/panels.js.map +1 -0
- package/dist/model/plugin-base.js.map +1 -0
- package/dist/model/plugin-loading.js.map +1 -0
- package/dist/model/plugins.js.map +1 -0
- package/dist/model/profile-queries.js.map +1 -0
- package/dist/model/time-series-queries.js.map +1 -0
- package/dist/model/trace-queries.js.map +1 -0
- package/dist/model/variables.js.map +1 -0
- package/dist/remote/PersesPlugin.types.js.map +1 -0
- package/dist/remote/PluginLoaderComponent.js.map +1 -0
- package/dist/remote/PluginRuntime.js.map +1 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/remotePluginLoader.js.map +1 -0
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -0
- package/dist/runtime/DataQueriesProvider/index.js.map +1 -0
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -0
- package/dist/runtime/QueryCountProvider.js.map +1 -0
- package/dist/runtime/RouterProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -0
- package/dist/runtime/UsageMetricsProvider.js.map +1 -0
- package/dist/runtime/builtin-variables.js.map +1 -0
- package/dist/runtime/datasources.js.map +1 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/plugin-registry.js.map +1 -0
- package/dist/runtime/profile-queries.js.map +1 -0
- package/dist/runtime/time-series-queries.js.map +1 -0
- package/dist/runtime/trace-queries.js.map +1 -0
- package/dist/runtime/utils.js.map +1 -0
- package/dist/runtime/variables.js.map +1 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/mock-data.js.map +1 -0
- package/dist/test/render-hook.js.map +1 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/test/test-plugins/bert/index.js.map +1 -0
- package/dist/test/test-plugins/ernie/index.js.map +1 -0
- package/dist/test/test-plugins/index.js.map +1 -0
- package/dist/test/utils.js.map +1 -0
- package/dist/{src/context → test-utils}/index.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js.map +1 -0
- package/dist/utils/action.js.map +1 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/variables.js.map +1 -0
- package/package.json +5 -5
- package/dist/src/components/CalculationSelector/CalculationSelector.js.map +0 -1
- package/dist/src/components/CalculationSelector/index.js.map +0 -1
- package/dist/src/components/DatasourceEditorForm/DatasourceEditorForm.js.map +0 -1
- package/dist/src/components/DatasourceEditorForm/index.js.map +0 -1
- package/dist/src/components/DatasourceSelect.js.map +0 -1
- package/dist/src/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +0 -1
- package/dist/src/components/LegendOptionsEditor/LegendOptionsEditor.js.map +0 -1
- package/dist/src/components/LegendOptionsEditor/index.js.map +0 -1
- package/dist/src/components/MetricLabelInput/MetricLabelInput.js.map +0 -1
- package/dist/src/components/MultiQueryEditor/MultiQueryEditor.js.map +0 -1
- package/dist/src/components/MultiQueryEditor/QueryEditorContainer.js.map +0 -1
- package/dist/src/components/OptionsEditorRadios/OptionsEditorRadios.js.map +0 -1
- package/dist/src/components/OptionsEditorRadios/index.js.map +0 -1
- package/dist/src/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +0 -1
- package/dist/src/components/OptionsEditorTabPanel/index.js.map +0 -1
- package/dist/src/components/OptionsEditorTabs/OptionsEditorTabs.js.map +0 -1
- package/dist/src/components/OptionsEditorTabs/index.js.map +0 -1
- package/dist/src/components/PanelSpecEditor/PanelSpecEditor.js.map +0 -1
- package/dist/src/components/PluginEditor/PluginEditor.js.map +0 -1
- package/dist/src/components/PluginEditor/index.js.map +0 -1
- package/dist/src/components/PluginEditor/plugin-editor-api.js.map +0 -1
- package/dist/src/components/PluginKindSelect/PluginKindSelect.js.map +0 -1
- package/dist/src/components/PluginKindSelect/index.js.map +0 -1
- package/dist/src/components/PluginRegistry/PluginRegistry.js.map +0 -1
- package/dist/src/components/PluginRegistry/plugin-indexes.js.map +0 -1
- package/dist/src/components/PluginSpecEditor/PluginSpecEditor.js.map +0 -1
- package/dist/src/components/PluginSpecEditor/index.js.map +0 -1
- package/dist/src/components/ProjectSelect.js.map +0 -1
- package/dist/src/components/TimeRangeControls/TimeRangeControls.js.map +0 -1
- package/dist/src/components/TimeRangeControls/index.js.map +0 -1
- package/dist/src/components/Variables/VariableEditorForm/VariableEditorForm.js.map +0 -1
- package/dist/src/components/Variables/VariableEditorForm/VariablePreview.js.map +0 -1
- package/dist/src/components/Variables/VariableEditorForm/index.js.map +0 -1
- package/dist/src/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +0 -1
- package/dist/src/components/Variables/variable-model.js.map +0 -1
- package/dist/src/components/index.js.map +0 -1
- package/dist/src/constants/index.js.map +0 -1
- package/dist/src/constants/user-interface-text.js.map +0 -1
- package/dist/src/context/ProjectStoreProvider.js.map +0 -1
- package/dist/src/context/ValidationProvider.js.map +0 -1
- package/dist/src/context/query-params.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/model/datasource.js.map +0 -1
- package/dist/src/model/explore.js.map +0 -1
- package/dist/src/model/index.js.map +0 -1
- package/dist/src/model/legend.js.map +0 -1
- package/dist/src/model/panels.js.map +0 -1
- package/dist/src/model/plugin-base.js.map +0 -1
- package/dist/src/model/plugin-loading.js.map +0 -1
- package/dist/src/model/plugins.js.map +0 -1
- package/dist/src/model/profile-queries.js.map +0 -1
- package/dist/src/model/time-series-queries.js.map +0 -1
- package/dist/src/model/trace-queries.js.map +0 -1
- package/dist/src/model/variables.js.map +0 -1
- package/dist/src/remote/PersesPlugin.types.js.map +0 -1
- package/dist/src/remote/PluginLoaderComponent.js.map +0 -1
- package/dist/src/remote/PluginRuntime.js.map +0 -1
- package/dist/src/remote/remotePluginLoader.js.map +0 -1
- package/dist/src/runtime/DataQueriesProvider/DataQueriesProvider.js.map +0 -1
- package/dist/src/runtime/DataQueriesProvider/model.js.map +0 -1
- package/dist/src/runtime/QueryCountProvider.js.map +0 -1
- package/dist/src/runtime/RouterProvider.js.map +0 -1
- package/dist/src/runtime/TimeRangeProvider/TimeRangeProvider.js.map +0 -1
- package/dist/src/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +0 -1
- package/dist/src/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +0 -1
- package/dist/src/runtime/TimeRangeProvider/query-params.js.map +0 -1
- package/dist/src/runtime/TimeRangeProvider/refresh-interval.js.map +0 -1
- package/dist/src/runtime/UsageMetricsProvider.js.map +0 -1
- package/dist/src/runtime/builtin-variables.js.map +0 -1
- package/dist/src/runtime/datasources.js.map +0 -1
- package/dist/src/runtime/index.js.map +0 -1
- package/dist/src/runtime/plugin-registry.js.map +0 -1
- package/dist/src/runtime/profile-queries.js.map +0 -1
- package/dist/src/runtime/time-series-queries.js.map +0 -1
- package/dist/src/runtime/trace-queries.js.map +0 -1
- package/dist/src/runtime/utils.js.map +0 -1
- package/dist/src/runtime/variables.js.map +0 -1
- package/dist/src/test/mock-data.js.map +0 -1
- package/dist/src/test/render-hook.js.map +0 -1
- package/dist/src/test/render.js.map +0 -1
- package/dist/src/test/setup-tests.js.map +0 -1
- package/dist/src/test/test-plugins/bert/index.js.map +0 -1
- package/dist/src/test/test-plugins/ernie/index.js.map +0 -1
- package/dist/src/test/test-plugins/index.js.map +0 -1
- package/dist/src/test/utils.js.map +0 -1
- package/dist/src/test-utils/index.js.map +0 -1
- package/dist/src/test-utils/mock-plugin-registry.js.map +0 -1
- package/dist/src/utils/action.js.map +0 -1
- package/dist/src/utils/index.js.map +0 -1
- package/dist/src/utils/variables.js.map +0 -1
- /package/dist/cjs/{src/components → components}/CalculationSelector/CalculationSelector.js +0 -0
- /package/dist/cjs/{src/components → components}/CalculationSelector/index.js +0 -0
- /package/dist/cjs/{src/components → components}/DatasourceEditorForm/DatasourceEditorForm.js +0 -0
- /package/dist/cjs/{src/components → components}/DatasourceEditorForm/index.js +0 -0
- /package/dist/cjs/{src/components → components}/DatasourceSelect.js +0 -0
- /package/dist/cjs/{src/components → components}/HTTPSettingsEditor/HTTPSettingsEditor.js +0 -0
- /package/dist/cjs/{src/components → components}/HTTPSettingsEditor/index.js +0 -0
- /package/dist/cjs/{src/components → components}/LegendOptionsEditor/LegendOptionsEditor.js +0 -0
- /package/dist/cjs/{src/components → components}/LegendOptionsEditor/index.js +0 -0
- /package/dist/cjs/{src/components → components}/MetricLabelInput/MetricLabelInput.js +0 -0
- /package/dist/cjs/{src/components → components}/MetricLabelInput/index.js +0 -0
- /package/dist/cjs/{src/components → components}/MultiQueryEditor/MultiQueryEditor.js +0 -0
- /package/dist/cjs/{src/components → components}/MultiQueryEditor/QueryEditorContainer.js +0 -0
- /package/dist/cjs/{src/components → components}/MultiQueryEditor/index.js +0 -0
- /package/dist/cjs/{src/components → components}/OptionsEditorRadios/OptionsEditorRadios.js +0 -0
- /package/dist/cjs/{src/components → components}/OptionsEditorRadios/index.js +0 -0
- /package/dist/cjs/{src/components → components}/OptionsEditorTabPanel/OptionsEditorTabPanel.js +0 -0
- /package/dist/cjs/{src/components → components}/OptionsEditorTabPanel/index.js +0 -0
- /package/dist/cjs/{src/components → components}/OptionsEditorTabs/OptionsEditorTabs.js +0 -0
- /package/dist/cjs/{src/components → components}/OptionsEditorTabs/index.js +0 -0
- /package/dist/cjs/{src/components → components}/PanelSpecEditor/PanelSpecEditor.js +0 -0
- /package/dist/cjs/{src/components → components}/PanelSpecEditor/index.js +0 -0
- /package/dist/cjs/{src/components → components}/PluginEditor/PluginEditor.js +0 -0
- /package/dist/cjs/{src/components → components}/PluginEditor/index.js +0 -0
- /package/dist/cjs/{src/components → components}/PluginEditor/plugin-editor-api.js +0 -0
- /package/dist/cjs/{src/components → components}/PluginKindSelect/PluginKindSelect.js +0 -0
- /package/dist/cjs/{src/components → components}/PluginKindSelect/index.js +0 -0
- /package/dist/cjs/{src/components → components}/PluginRegistry/PluginRegistry.js +0 -0
- /package/dist/cjs/{src/components → components}/PluginRegistry/index.js +0 -0
- /package/dist/cjs/{src/components → components}/PluginRegistry/plugin-indexes.js +0 -0
- /package/dist/cjs/{src/components → components}/PluginSpecEditor/PluginSpecEditor.js +0 -0
- /package/dist/cjs/{src/components → components}/PluginSpecEditor/index.js +0 -0
- /package/dist/cjs/{src/components → components}/ProjectSelect.js +0 -0
- /package/dist/cjs/{src/components → components}/TimeRangeControls/TimeRangeControls.js +0 -0
- /package/dist/cjs/{src/components → components}/TimeRangeControls/index.js +0 -0
- /package/dist/cjs/{src/components → components}/Variables/VariableEditorForm/VariableEditorForm.js +0 -0
- /package/dist/cjs/{src/components → components}/Variables/VariableEditorForm/VariablePreview.js +0 -0
- /package/dist/cjs/{src/components → components}/Variables/VariableEditorForm/index.js +0 -0
- /package/dist/cjs/{src/components → components}/Variables/VariableEditorForm/variable-editor-form-model.js +0 -0
- /package/dist/cjs/{src/components → components}/Variables/index.js +0 -0
- /package/dist/cjs/{src/components → components}/Variables/variable-model.js +0 -0
- /package/dist/cjs/{src/components → components}/index.js +0 -0
- /package/dist/cjs/{src/constants → constants}/index.js +0 -0
- /package/dist/cjs/{src/constants → constants}/user-interface-text.js +0 -0
- /package/dist/cjs/{src/context → context}/ProjectStoreProvider.js +0 -0
- /package/dist/cjs/{src/context → context}/ValidationProvider.js +0 -0
- /package/dist/cjs/{src/context → context}/index.js +0 -0
- /package/dist/cjs/{src/context → context}/query-params.js +0 -0
- /package/dist/cjs/{src/index.js → index.js} +0 -0
- /package/dist/cjs/{src/model → model}/datasource.js +0 -0
- /package/dist/cjs/{src/model → model}/explore.js +0 -0
- /package/dist/cjs/{src/model → model}/index.js +0 -0
- /package/dist/cjs/{src/model → model}/legend.js +0 -0
- /package/dist/cjs/{src/model → model}/panels.js +0 -0
- /package/dist/cjs/{src/model → model}/plugin-base.js +0 -0
- /package/dist/cjs/{src/model → model}/plugin-loading.js +0 -0
- /package/dist/cjs/{src/model → model}/plugins.js +0 -0
- /package/dist/cjs/{src/model → model}/profile-queries.js +0 -0
- /package/dist/cjs/{src/model → model}/time-series-queries.js +0 -0
- /package/dist/cjs/{src/model → model}/trace-queries.js +0 -0
- /package/dist/cjs/{src/model → model}/variables.js +0 -0
- /package/dist/cjs/{src/remote → remote}/PersesPlugin.types.js +0 -0
- /package/dist/cjs/{src/remote → remote}/PluginLoaderComponent.js +0 -0
- /package/dist/cjs/{src/remote → remote}/PluginRuntime.js +0 -0
- /package/dist/cjs/{src/remote → remote}/index.js +0 -0
- /package/dist/cjs/{src/remote → remote}/remotePluginLoader.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/DataQueriesProvider/DataQueriesProvider.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/DataQueriesProvider/index.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/DataQueriesProvider/model.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/QueryCountProvider.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/RouterProvider.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/TimeRangeProvider/TimeRangeProvider.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/TimeRangeProvider/TimeRangeSettingsProvider.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/TimeRangeProvider/index.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/TimeRangeProvider/query-params.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/TimeRangeProvider/refresh-interval.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/UsageMetricsProvider.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/builtin-variables.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/datasources.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/index.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/plugin-registry.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/profile-queries.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/time-series-queries.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/trace-queries.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/utils.js +0 -0
- /package/dist/cjs/{src/runtime → runtime}/variables.js +0 -0
- /package/dist/cjs/{src/test → test}/index.js +0 -0
- /package/dist/cjs/{src/test → test}/mock-data.js +0 -0
- /package/dist/cjs/{src/test → test}/render-hook.js +0 -0
- /package/dist/cjs/{src/test → test}/render.js +0 -0
- /package/dist/cjs/{src/test → test}/setup-tests.js +0 -0
- /package/dist/cjs/{src/test → test}/test-plugins/bert/index.js +0 -0
- /package/dist/cjs/{src/test → test}/test-plugins/ernie/index.js +0 -0
- /package/dist/cjs/{src/test → test}/test-plugins/index.js +0 -0
- /package/dist/cjs/{src/test → test}/utils.js +0 -0
- /package/dist/cjs/{src/test-utils → test-utils}/index.js +0 -0
- /package/dist/cjs/{src/test-utils → test-utils}/mock-plugin-registry.js +0 -0
- /package/dist/cjs/{src/utils → utils}/action.js +0 -0
- /package/dist/cjs/{src/utils → utils}/index.js +0 -0
- /package/dist/cjs/{src/utils → utils}/variables.js +0 -0
- /package/dist/{src/components → components}/CalculationSelector/CalculationSelector.js +0 -0
- /package/dist/{src/components → components}/CalculationSelector/index.js +0 -0
- /package/dist/{src/components → components}/DatasourceEditorForm/DatasourceEditorForm.js +0 -0
- /package/dist/{src/components → components}/DatasourceEditorForm/index.js +0 -0
- /package/dist/{src/components → components}/DatasourceSelect.js +0 -0
- /package/dist/{src/components → components}/HTTPSettingsEditor/HTTPSettingsEditor.js +0 -0
- /package/dist/{src/components → components}/HTTPSettingsEditor/index.js +0 -0
- /package/dist/{src/components → components}/LegendOptionsEditor/LegendOptionsEditor.js +0 -0
- /package/dist/{src/components → components}/LegendOptionsEditor/index.js +0 -0
- /package/dist/{src/components → components}/MetricLabelInput/MetricLabelInput.js +0 -0
- /package/dist/{src/components → components}/MetricLabelInput/index.js +0 -0
- /package/dist/{src/components → components}/MultiQueryEditor/MultiQueryEditor.js +0 -0
- /package/dist/{src/components → components}/MultiQueryEditor/QueryEditorContainer.js +0 -0
- /package/dist/{src/components → components}/MultiQueryEditor/index.js +0 -0
- /package/dist/{src/components → components}/OptionsEditorRadios/OptionsEditorRadios.js +0 -0
- /package/dist/{src/components → components}/OptionsEditorRadios/index.js +0 -0
- /package/dist/{src/components → components}/OptionsEditorTabPanel/OptionsEditorTabPanel.js +0 -0
- /package/dist/{src/components → components}/OptionsEditorTabPanel/index.js +0 -0
- /package/dist/{src/components → components}/OptionsEditorTabs/OptionsEditorTabs.js +0 -0
- /package/dist/{src/components → components}/OptionsEditorTabs/index.js +0 -0
- /package/dist/{src/components → components}/PanelSpecEditor/PanelSpecEditor.js +0 -0
- /package/dist/{src/components → components}/PanelSpecEditor/index.js +0 -0
- /package/dist/{src/components → components}/PluginEditor/PluginEditor.js +0 -0
- /package/dist/{src/components → components}/PluginEditor/index.js +0 -0
- /package/dist/{src/components → components}/PluginEditor/plugin-editor-api.js +0 -0
- /package/dist/{src/components → components}/PluginKindSelect/PluginKindSelect.js +0 -0
- /package/dist/{src/components → components}/PluginKindSelect/index.js +0 -0
- /package/dist/{src/components → components}/PluginRegistry/PluginRegistry.js +0 -0
- /package/dist/{src/components → components}/PluginRegistry/index.js +0 -0
- /package/dist/{src/components → components}/PluginRegistry/plugin-indexes.js +0 -0
- /package/dist/{src/components → components}/PluginSpecEditor/PluginSpecEditor.js +0 -0
- /package/dist/{src/components → components}/PluginSpecEditor/index.js +0 -0
- /package/dist/{src/components → components}/ProjectSelect.js +0 -0
- /package/dist/{src/components → components}/TimeRangeControls/TimeRangeControls.js +0 -0
- /package/dist/{src/components → components}/TimeRangeControls/index.js +0 -0
- /package/dist/{src/components → components}/Variables/VariableEditorForm/VariableEditorForm.js +0 -0
- /package/dist/{src/components → components}/Variables/VariableEditorForm/VariablePreview.js +0 -0
- /package/dist/{src/components → components}/Variables/VariableEditorForm/index.js +0 -0
- /package/dist/{src/components → components}/Variables/VariableEditorForm/variable-editor-form-model.js +0 -0
- /package/dist/{src/components → components}/Variables/index.js +0 -0
- /package/dist/{src/components → components}/Variables/variable-model.js +0 -0
- /package/dist/{src/components → components}/index.js +0 -0
- /package/dist/{src/constants → constants}/index.js +0 -0
- /package/dist/{src/constants → constants}/user-interface-text.js +0 -0
- /package/dist/{src/context → context}/ProjectStoreProvider.js +0 -0
- /package/dist/{src/context → context}/ValidationProvider.js +0 -0
- /package/dist/{src/context → context}/index.js +0 -0
- /package/dist/{src/context → context}/query-params.js +0 -0
- /package/dist/{src/index.js → index.js} +0 -0
- /package/dist/{src/model → model}/datasource.js +0 -0
- /package/dist/{src/model → model}/explore.js +0 -0
- /package/dist/{src/model → model}/index.js +0 -0
- /package/dist/{src/model → model}/legend.js +0 -0
- /package/dist/{src/model → model}/panels.js +0 -0
- /package/dist/{src/model → model}/plugin-base.js +0 -0
- /package/dist/{src/model → model}/plugin-loading.js +0 -0
- /package/dist/{src/model → model}/plugins.js +0 -0
- /package/dist/{src/model → model}/profile-queries.js +0 -0
- /package/dist/{src/model → model}/time-series-queries.js +0 -0
- /package/dist/{src/model → model}/trace-queries.js +0 -0
- /package/dist/{src/model → model}/variables.js +0 -0
- /package/dist/{src/remote → remote}/PersesPlugin.types.js +0 -0
- /package/dist/{src/remote → remote}/PluginLoaderComponent.js +0 -0
- /package/dist/{src/remote → remote}/PluginRuntime.js +0 -0
- /package/dist/{src/remote → remote}/index.js +0 -0
- /package/dist/{src/remote → remote}/remotePluginLoader.js +0 -0
- /package/dist/{src/runtime → runtime}/DataQueriesProvider/DataQueriesProvider.js +0 -0
- /package/dist/{src/runtime → runtime}/DataQueriesProvider/index.js +0 -0
- /package/dist/{src/runtime → runtime}/DataQueriesProvider/model.js +0 -0
- /package/dist/{src/runtime → runtime}/QueryCountProvider.js +0 -0
- /package/dist/{src/runtime → runtime}/RouterProvider.js +0 -0
- /package/dist/{src/runtime → runtime}/TimeRangeProvider/TimeRangeProvider.js +0 -0
- /package/dist/{src/runtime → runtime}/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +0 -0
- /package/dist/{src/runtime → runtime}/TimeRangeProvider/TimeRangeSettingsProvider.js +0 -0
- /package/dist/{src/runtime → runtime}/TimeRangeProvider/index.js +0 -0
- /package/dist/{src/runtime → runtime}/TimeRangeProvider/query-params.js +0 -0
- /package/dist/{src/runtime → runtime}/TimeRangeProvider/refresh-interval.js +0 -0
- /package/dist/{src/runtime → runtime}/UsageMetricsProvider.js +0 -0
- /package/dist/{src/runtime → runtime}/builtin-variables.js +0 -0
- /package/dist/{src/runtime → runtime}/datasources.js +0 -0
- /package/dist/{src/runtime → runtime}/index.js +0 -0
- /package/dist/{src/runtime → runtime}/plugin-registry.js +0 -0
- /package/dist/{src/runtime → runtime}/profile-queries.js +0 -0
- /package/dist/{src/runtime → runtime}/time-series-queries.js +0 -0
- /package/dist/{src/runtime → runtime}/trace-queries.js +0 -0
- /package/dist/{src/runtime → runtime}/utils.js +0 -0
- /package/dist/{src/runtime → runtime}/variables.js +0 -0
- /package/dist/{src/test → test}/index.js +0 -0
- /package/dist/{src/test → test}/mock-data.js +0 -0
- /package/dist/{src/test → test}/render-hook.js +0 -0
- /package/dist/{src/test → test}/render.js +0 -0
- /package/dist/{src/test → test}/setup-tests.js +0 -0
- /package/dist/{src/test → test}/test-plugins/bert/index.js +0 -0
- /package/dist/{src/test → test}/test-plugins/ernie/index.js +0 -0
- /package/dist/{src/test → test}/test-plugins/index.js +0 -0
- /package/dist/{src/test → test}/utils.js +0 -0
- /package/dist/{src/test-utils → test-utils}/index.js +0 -0
- /package/dist/{src/test-utils → test-utils}/mock-plugin-registry.js +0 -0
- /package/dist/{src/utils → utils}/action.js +0 -0
- /package/dist/{src/utils → utils}/index.js +0 -0
- /package/dist/{src/utils → utils}/variables.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';\nimport { CALCULATIONS_CONFIG, CalculationConfig, CalculationType } from '@perses-dev/core';\nimport { ReactElement } from 'react';\n\ntype AutocompleteCalculationOption = CalculationConfig & { id: CalculationType };\nconst CALC_OPTIONS: AutocompleteCalculationOption[] = Object.entries(CALCULATIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as CalculationType,\n ...config,\n };\n});\n\nexport interface CalculationSelectorProps {\n value: CalculationType;\n onChange: (unit: CalculationType) => void;\n}\n\nexport function CalculationSelector({ value, onChange }: CalculationSelectorProps): ReactElement {\n const handleCalculationChange = (_: unknown, newValue: AutocompleteCalculationOption): void => {\n onChange(newValue.id);\n };\n\n const calcConfig = CALCULATIONS_CONFIG[value];\n\n return (\n <OptionsEditorControl\n label=\"Calculation\"\n control={\n <SettingsAutocomplete\n value={{\n ...calcConfig,\n id: value,\n }}\n options={CALC_OPTIONS}\n onChange={handleCalculationChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","CALCULATIONS_CONFIG","CALC_OPTIONS","Object","entries","map","id","config","CalculationSelector","value","onChange","handleCalculationChange","_","newValue","calcConfig","label","control","options","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,oBAAoB,EAAEC,oBAAoB,QAAQ,yBAAyB;AACpF,SAASC,mBAAmB,QAA4C,mBAAmB;AAI3F,MAAMC,eAAgDC,OAAOC,OAAO,CAACH,qBAAqBI,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO;IACzG,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF;AAOA,OAAO,SAASC,oBAAoB,EAAEC,KAAK,EAAEC,QAAQ,EAA4B;IAC/E,MAAMC,0BAA0B,CAACC,GAAYC;QAC3CH,SAASG,SAASP,EAAE;IACtB;IAEA,MAAMQ,aAAab,mBAAmB,CAACQ,MAAM;IAE7C,qBACE,KAACV;QACCgB,OAAM;QACNC,uBACE,KAAChB;YACCS,OAAO;gBACL,GAAGK,UAAU;gBACbR,IAAIG;YACN;YACAQ,SAASf;YACTQ,UAAUC;YACVO,gBAAgB;;;AAK1B"}
|
package/dist/{src/components/MetricLabelInput → components/CalculationSelector}/index.js.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/CalculationSelector/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './CalculationSelector';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DatasourceEditorForm/DatasourceEditorForm.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { Box, Divider, FormControlLabel, Grid, Stack, Switch, TextField, Typography } from '@mui/material';\nimport { DiscardChangesConfirmationDialog, FormActions } from '@perses-dev/components';\nimport { Action, DatasourceDefinition } from '@perses-dev/core';\nimport { DispatchWithoutAction, ReactElement, useState } from 'react';\nimport { Controller, FormProvider, SubmitHandler, useForm } from 'react-hook-form';\nimport { useValidationSchemas } from '../../context';\nimport { getSubmitText, getTitleAction } from '../../utils';\nimport { PluginEditor } from '../PluginEditor';\n\ninterface DatasourceEditorFormProps {\n initialDatasourceDefinition: DatasourceDefinition;\n action: Action;\n isDraft: boolean;\n isReadonly?: boolean;\n onActionChange?: (action: Action) => void;\n onSave: (def: DatasourceDefinition) => void;\n onClose: DispatchWithoutAction;\n onDelete?: DispatchWithoutAction;\n}\n\nexport function DatasourceEditorForm(props: DatasourceEditorFormProps): ReactElement {\n const { initialDatasourceDefinition, action, isDraft, isReadonly, onActionChange, onSave, onClose, onDelete } = props;\n\n const [isDiscardDialogOpened, setDiscardDialogOpened] = useState<boolean>(false);\n const titleAction = getTitleAction(action, isDraft);\n const submitText = getSubmitText(action, isDraft);\n\n const { datasourceEditorSchema } = useValidationSchemas();\n const form = useForm<DatasourceDefinition>({\n resolver: zodResolver(datasourceEditorSchema),\n mode: 'onBlur',\n defaultValues: initialDatasourceDefinition,\n });\n\n /*\n * Remove empty fields that are optional\n */\n function clearFormData(data: DatasourceDefinition): DatasourceDefinition {\n const result = { ...data };\n if (result.spec.display?.name === undefined && result.spec.display?.description === undefined) {\n delete result.spec.display;\n }\n return result;\n }\n\n const processForm: SubmitHandler<DatasourceDefinition> = (data: DatasourceDefinition) => {\n onSave(clearFormData(data));\n };\n\n // When user click on cancel, several possibilities:\n // - create action: ask for discard approval\n // - update action: ask for discard approval if changed\n // - read action: don´t ask for discard approval\n function handleCancel(): void {\n if (JSON.stringify(initialDatasourceDefinition) !== JSON.stringify(clearFormData(form.getValues()))) {\n setDiscardDialogOpened(true);\n } else {\n onClose();\n }\n }\n\n return (\n <FormProvider {...form}>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n padding: (theme) => theme.spacing(1, 2),\n borderBottom: (theme) => `1px solid ${theme.palette.divider}`,\n }}\n >\n <Typography variant=\"h2\">{titleAction} Datasource</Typography>\n <FormActions\n action={action}\n submitText={submitText}\n isReadonly={isReadonly}\n isValid={form.formState.isValid}\n onActionChange={onActionChange}\n onSubmit={form.handleSubmit(processForm)}\n onDelete={onDelete}\n onCancel={handleCancel}\n />\n </Box>\n <Box padding={2} sx={{ overflowY: 'scroll' }}>\n <Grid container spacing={2} mb={2}>\n <Grid item xs={4}>\n <Controller\n control={form.control}\n name=\"name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n required\n fullWidth\n name=\"name\"\n label=\"Name\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n disabled: action === 'update' && !isDraft,\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={8}>\n <Controller\n control={form.control}\n name=\"spec.display.name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n name=\"title\"\n label=\"Display Label\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={12}>\n <Controller\n control={form.control}\n name=\"spec.display.description\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n name=\"description\"\n label=\"Description\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={6} sx={{ paddingTop: '5px !important' }}>\n <Stack>\n <Controller\n control={form.control}\n name=\"spec.default\"\n render={({ field }) => (\n <FormControlLabel\n label=\"Set as default\"\n control={\n <Switch\n {...field}\n checked={!!field.value}\n readOnly={action === 'read'}\n onChange={(event) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n field.onChange(event);\n }}\n />\n }\n />\n )}\n />\n <Typography variant=\"caption\">\n Whether this datasource should be the default {form.getValues().spec.plugin.kind} to be used\n </Typography>\n </Stack>\n </Grid>\n </Grid>\n <Divider />\n <Typography py={1} variant=\"h3\">\n Plugin Options\n </Typography>\n <Controller\n control={form.control}\n name=\"spec.plugin\"\n render={({ field }) => (\n <PluginEditor\n width=\"100%\"\n pluginTypes={['Datasource']}\n pluginKindLabel=\"Source\"\n value={{\n selection: {\n type: 'Datasource',\n kind: field.value.kind,\n },\n spec: field.value.spec,\n }}\n isReadonly={action === 'read'}\n onChange={(v) => {\n field.onChange({ kind: v.selection.kind, spec: v.spec });\n }}\n />\n )}\n />\n </Box>\n <DiscardChangesConfirmationDialog\n description=\"Are you sure you want to discard your changes? Changes cannot be recovered.\"\n isOpen={isDiscardDialogOpened}\n onCancel={() => setDiscardDialogOpened(false)}\n onDiscardChanges={() => {\n setDiscardDialogOpened(false);\n onClose();\n }}\n />\n </FormProvider>\n );\n}\n"],"names":["zodResolver","Box","Divider","FormControlLabel","Grid","Stack","Switch","TextField","Typography","DiscardChangesConfirmationDialog","FormActions","useState","Controller","FormProvider","useForm","useValidationSchemas","getSubmitText","getTitleAction","PluginEditor","DatasourceEditorForm","props","initialDatasourceDefinition","action","isDraft","isReadonly","onActionChange","onSave","onClose","onDelete","isDiscardDialogOpened","setDiscardDialogOpened","titleAction","submitText","datasourceEditorSchema","form","resolver","mode","defaultValues","clearFormData","data","result","spec","display","name","undefined","description","processForm","handleCancel","JSON","stringify","getValues","sx","alignItems","padding","theme","spacing","borderBottom","palette","divider","variant","isValid","formState","onSubmit","handleSubmit","onCancel","overflowY","container","mb","item","xs","control","render","field","fieldState","required","fullWidth","label","InputLabelProps","shrink","InputProps","disabled","readOnly","error","helperText","message","value","onChange","event","paddingTop","checked","plugin","kind","py","width","pluginTypes","pluginKindLabel","selection","type","v","isOpen","onDiscardChanges"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,WAAW,QAAQ,0BAA0B;AACtD,SAASC,GAAG,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,IAAI,EAAEC,KAAK,EAAEC,MAAM,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAgB;AAC3G,SAASC,gCAAgC,EAAEC,WAAW,QAAQ,yBAAyB;AAEvF,SAA8CC,QAAQ,QAAQ,QAAQ;AACtE,SAASC,UAAU,EAAEC,YAAY,EAAiBC,OAAO,QAAQ,kBAAkB;AACnF,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,aAAa,EAAEC,cAAc,QAAQ,cAAc;AAC5D,SAASC,YAAY,QAAQ,kBAAkB;AAa/C,OAAO,SAASC,qBAAqBC,KAAgC;IACnE,MAAM,EAAEC,2BAA2B,EAAEC,MAAM,EAAEC,OAAO,EAAEC,UAAU,EAAEC,cAAc,EAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGR;IAEhH,MAAM,CAACS,uBAAuBC,uBAAuB,GAAGnB,SAAkB;IAC1E,MAAMoB,cA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;oCAAC;iCAAa;gCAC3BC,iBAAgB;gCAChBV,OAAO;oCACLW,WAAW;wCACTC,MAAM;wCACNN,MAAMnB,MAAMa,KAAK,CAACM,IAAI;oCACxB;oCACAlD,MAAM+B,MAAMa,KAAK,CAAC5C,IAAI;gCACxB;gCACAjB,YAAYF,WAAW;gCACvBgE,UAAU,CAACY;oCACT1B,MAAMc,QAAQ,CAAC;wCAAEK,MAAMO,EAAEF,SAAS,CAACL,IAAI;wCAAElD,MAAMyD,EAAEzD,IAAI;oCAAC;gCACxD;;;;;0BAKR,KAAChC;gBACCoC,aAAY;gBACZsD,QAAQtE;gBACRmC,UAAU,IAAMlC,uBAAuB;gBACvCsE,kBAAkB;oBAChBtE,uBAAuB;oBACvBH;gBACF;;;;AAIR"}
|
package/dist/{src/components/MultiQueryEditor → components/DatasourceEditorForm}/index.js.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DatasourceEditorForm/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DatasourceEditorForm';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,yBAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/DatasourceSelect.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport OpenInNewIcon from 'mdi-material-ui/OpenInNew';\nimport {\n Stack,\n ListItemText,\n Chip,\n IconButton,\n Box,\n OutlinedSelectProps,\n BaseSelectProps,\n Autocomplete,\n TextField,\n} from '@mui/material';\nimport { DatasourceSelector, VariableName } from '@perses-dev/core';\nimport { ReactElement, useMemo } from 'react';\nimport {\n DatasourceSelectItem,\n DatasourceSelectItemGroup,\n DatasourceSelectItemSelector,\n useListDatasourceSelectItems,\n useVariableValues,\n VariableStateMap,\n} from '../runtime';\nimport { parseVariables } from '../utils';\n\nconst DATASOURCE_VARIABLE_VALUE_PREFIX = '__DATASOURCE_VARIABLE_VALUE__';\nconst VARIABLE_IDENTIFIER = '$';\n// Props on MUI Select that we don't want people to pass because we're either redefining them or providing them in\n// this component\ntype OmittedMuiProps = 'children' | 'value' | 'onChange';\n\ntype DataSourceOption = {\n groupEditLink?: string;\n groupLabel?: string;\n value: string;\n} & Omit<DatasourceSelectItem, 'selector'> &\n Omit<DatasourceSelectItem['selector'], 'kind'>;\n\nconst emptyDatasourceOption: DataSourceOption = { name: '', value: '' };\n\nexport type DatasourceSelectValue<T = DatasourceSelector> = T | VariableName;\n\nexport interface DatasourceSelectProps extends Omit<OutlinedSelectProps & BaseSelectProps<string>, OmittedMuiProps> {\n value: DatasourceSelectValue;\n onChange: (next: DatasourceSelectValue) => void;\n datasourcePluginKind: string;\n project?: string;\n}\n\n/**\n * Displays a MUI input for selecting a Datasource of a particular kind. Note: The 'value' and `onChange` handler for\n * the input deal with a `DatasourceSelector`.\n */\nexport function DatasourceSelect(props: DatasourceSelectProps): ReactElement {\n const { datasourcePluginKind, value, project, onChange, ...others } = props;\n const { data, isLoading } = useListDatasourceSelectItems(datasourcePluginKind, project);\n const variables = useVariableValues();\n\n const defaultValue = useMemo<VariableName | DatasourceSelectItemSelector>(() => {\n if (isVariableDatasource(value)) {\n return value;\n }\n\n const group = (data ?? [])\n .flatMap((itemGroup) => itemGroup.items)\n .find((item) => {\n return value.kind === item.selector.kind && value.name === item.selector.name && !item.overridden;\n })?.selector.group;\n return { ...value, group };\n }, [value, data]);\n\n const options = useMemo<DataSourceOption[]>(() => {\n const datasourceOptions = (data || []).flatMap<DataSourceOption>((itemGroup) =>\n itemGroup.items.map<DataSourceOption>((item) => ({\n groupLabel: itemGroup.group,\n groupEditLink: itemGroup.editLink,\n name: item.name,\n overriding: item.overriding,\n overridden: item.overridden,\n saved: item.saved ?? true,\n group: item.selector.group,\n value: selectorToOptionValue(item.selector),\n }))\n );\n\n const datasourceOptionsMap = new Map(datasourceOptions.map((option) => [option.name, option]));\n\n const variableOptions = Object.entries(variables).flatMap<DataSourceOption>(([name, variable]) => {\n if (Array.isArray(variable.value)) return [];\n\n const associatedDatasource = datasourceOptionsMap.get(variable.value ?? '');\n if (!associatedDatasource) return [];\n\n return {\n groupLabel: 'Variables',\n name: `${VARIABLE_IDENTIFIER}${name}`,\n saved: true,\n value: `${DATASOURCE_VARIABLE_VALUE_PREFIX}${VARIABLE_IDENTIFIER}${name}`,\n };\n });\n\n return [...datasourceOptions, ...variableOptions];\n }, [data, variables]);\n\n // While loading available values, just use an empty datasource option so MUI select doesn't warn about values out of range\n const optionValue = isLoading\n ? emptyDatasourceOption\n : options.find((option) => option.value === selectorToOptionValue(defaultValue));\n\n // When the user makes a selection, convert the string option value back to a DatasourceSelector\n const handleChange = (selectedOption: DataSourceOption | null): void => {\n if (selectedOption) {\n const next = optionValueToSelector(selectedOption?.value || '');\n onChange(next);\n } else {\n onChange({ kind: datasourcePluginKind });\n }\n };\n\n // We use a fake action event when we click on the action of the chip (hijack the \"delete\" feature).\n // This is because the href link action is on the `deleteIcon` property already, but the `onDelete` property\n // controls its visibility.\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const fakeActionEvent = (): void => {};\n\n return (\n <Autocomplete<DataSourceOption>\n options={options}\n renderInput={(params) => <TextField {...params} label={others.label} placeholder=\"\" />}\n groupBy={(option) => option.groupLabel || 'No group'}\n getOptionLabel={(option) => {\n return option.name;\n }}\n onChange={(_, v) => handleChange(v)}\n value={optionValue}\n renderOption={(props, option) => {\n return (\n <li {...props} key={option.value}>\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" width=\"100%\">\n <ListItemText>\n <DatasourceName name={option.name} overridden={option.overridden} overriding={option.overriding} />\n </ListItemText>\n {!option.saved && <ListItemText>Save the dashboard to enable this datasource</ListItemText>}\n <ListItemText style={{ textAlign: 'right' }}>\n {option.groupLabel && option.groupLabel.length > 0 && (\n <Chip\n disabled={false}\n label={option.groupLabel}\n size=\"small\"\n onDelete={option.groupEditLink ? fakeActionEvent : undefined}\n deleteIcon={\n option.groupEditLink ? (\n <IconButton href={option.groupEditLink} target=\"_blank\">\n <OpenInNewIcon fontSize=\"small\" />\n </IconButton>\n ) : undefined\n }\n />\n )}\n </ListItemText>\n </Stack>\n </li>\n );\n }}\n />\n );\n}\n\nexport function DatasourceName(props: { name: string; overridden?: boolean; overriding?: boolean }): ReactElement {\n const { name, overridden, overriding } = props;\n return (\n <>\n {`${name} `}\n {!overridden && overriding && (\n <Box display=\"inline\" fontWeight=\"normal\" color={(theme) => theme.palette.primary.main}>\n (overriding)\n </Box>\n )}\n {overridden && '(overridden)'}\n </>\n );\n}\n\n// Delimiter used to stringify/parse option values\nconst OPTION_VALUE_DELIMITER = '_____';\n\n/**\n * Given a DatasourceSelectItemSelector,\n * returns a string value like `{kind}_____{group}_____{name}` that can be used as a Select input value.\n * @param selector\n */\nexport function selectorToOptionValue(selector: DatasourceSelectItemSelector | VariableName): string {\n if (isVariableDatasource(selector)) {\n return `${DATASOURCE_VARIABLE_VALUE_PREFIX}${selector}`;\n }\n return [selector.kind, selector.group ?? '', selector.name ?? ''].join(OPTION_VALUE_DELIMITER);\n}\n\n/**\n * Given an option value name like `{kind}_____{group}_____{name}`,\n * returns a DatasourceSelector to be used by the query data model.\n * @param optionValue\n */\nexport function optionValueToSelector(optionValue: string): DatasourceSelectValue {\n if (optionValue.startsWith(DATASOURCE_VARIABLE_VALUE_PREFIX)) {\n return optionValue.split(DATASOURCE_VARIABLE_VALUE_PREFIX)[1]!;\n }\n\n const words = optionValue.split(OPTION_VALUE_DELIMITER);\n const kind = words[0];\n const name = words[2];\n if (kind === undefined || name === undefined) {\n throw new Error('Invalid optionValue string');\n }\n return {\n kind,\n name: name === '' ? undefined : name,\n };\n}\n\nexport function isVariableDatasource(value: DatasourceSelectValue | undefined): value is VariableName {\n return typeof value === 'string' && value.startsWith(VARIABLE_IDENTIFIER);\n}\n\nexport const datasourceSelectValueToSelector = (\n value: DatasourceSelectValue | undefined,\n variables: VariableStateMap,\n datasourceSelectItemGroups: DatasourceSelectItemGroup[] | undefined\n): DatasourceSelector | undefined => {\n if (!isVariableDatasource(value)) {\n return value;\n }\n\n const [variableName] = parseVariables(value);\n const variable = variables[variableName ?? ''];\n\n // If the variable is not defined or if its value is an array, we cannot determine a selector and return undefined\n if (!variable || Array.isArray(variable.value)) {\n return undefined;\n }\n\n const associatedDatasource = (datasourceSelectItemGroups || [])\n .flatMap((itemGroup) => itemGroup.items)\n .find((datasource) => datasource.name === variable.value);\n\n // If the variable value is not a datasource, we cannot determine a selector and return undefined\n if (associatedDatasource === undefined) {\n return undefined;\n }\n\n const datasourceSelector: DatasourceSelector = {\n kind: associatedDatasource.selector.kind,\n name: associatedDatasource.selector.name,\n };\n\n return datasourceSelector;\n};\n\nexport const useDatasourceSelectValueToSelector = (\n value: DatasourceSelectValue,\n datasourcePluginKind: string\n): DatasourceSelector => {\n const { data } = useListDatasourceSelectItems(datasourcePluginKind);\n const variables = useVariableValues();\n if (!isVariableDatasource(value)) {\n return value;\n }\n\n return datasourceSelectValueToSelector(value, variables, data) ?? { kind: datasourcePluginKind };\n};\n"],"names":["OpenInNewIcon","Stack","ListItemText","Chip","IconButton","Box","Autocomplete","TextField","useMemo","useListDatasourceSelectItems","useVariableValues","parseVariables","DATASOURCE_VARIABLE_VALUE_PREFIX","VARIABLE_IDENTIFIER","emptyDatasourceOption","name","value","DatasourceSelect","props","datasourcePluginKind","project","onChange","others","data","isLoading","variables","defaultValue","isVariableDatasource","group","flatMap","itemGroup","items","find","item","kind","selector","overridden","options","datasourceOptions","map","groupLabel","groupEditLink","editLink","overriding","saved","selectorToOptionValue","datasourceOptionsMap","Map","option","variableOptions","Object","entries","variable","Array","isArray","associatedDatasource","get","optionValue","handleChange","selectedOption","next","optionValueToSelector","fakeActionEvent","renderInput","params","label","placeholder","groupBy","getOptionLabel","_","v","renderOption","li","key","direction","alignItems","justifyContent","width","DatasourceName","style","textAlign","length","disabled","size","onDelete","undefined","deleteIcon","href","target","fontSize","display","fontWeight","color","theme","palette","primary","main","OPTION_VALUE_DELIMITER","join","startsWith","split","words","Error","datasourceSelectValueToSelector","datasourceSelectItemGroups","variableName","datasource","datasourceSelector","useDatasourceSelectValueToSelector"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,OAAOA,mBAAmB,4BAA4B;AACtD,SACEC,KAAK,EACLC,YAAY,EACZC,IAAI,EACJC,UAAU,EACVC,GAAG,EAGHC,YAAY,EACZC,SAAS,QACJ,gBAAgB;AAEvB,SAAuBC,OAAO,QAAQ,QAAQ;AAC9C,SAIEC,4BAA4B,EAC5BC,iBAAiB,QAEZ,aAAa;AACpB,SAASC,cAAc,QAAQ,WAAW;AA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A,MAAMsB,qBAAyC;QAC7CzE,MAAMqB,qBAAqBpB,QAAQ,CAACD,IAAI;QACxCnB,MAAMwC,qBAAqBpB,QAAQ,CAACpB,IAAI;IAC1C;IAEA,OAAO4F;AACT,EAAE;AAEF,OAAO,MAAMC,qCAAqC,CAChD5F,OACAG;IAEA,MAAM,EAAEI,IAAI,EAAE,GAAGd,6BAA6BU;IAC9C,MAAMM,YAAYf;IAClB,IAAI,CAACiB,qBAAqBX,QAAQ;QAChC,OAAOA;IACT;IAEA,OAAOuF,gCAAgCvF,OAAOS,WAAWF,SAAS;QAAEW,MAAMf;IAAqB;AACjG,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/HTTPSettingsEditor/HTTPSettingsEditor.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { RequestHeaders, HTTPDatasourceSpec } from '@perses-dev/core';\nimport { Grid, IconButton, MenuItem, TextField, Typography } from '@mui/material';\nimport React, { Fragment, ReactElement, useState } from 'react';\nimport { produce } from 'immer';\nimport { Controller } from 'react-hook-form';\nimport MinusIcon from 'mdi-material-ui/Minus';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport { OptionsEditorRadios } from '../OptionsEditorRadios';\n\nexport interface HTTPSettingsEditor {\n value: HTTPDatasourceSpec;\n onChange: (next: HTTPDatasourceSpec) => void;\n isReadonly?: boolean;\n initialSpecDirect: HTTPDatasourceSpec;\n initialSpecProxy: HTTPDatasourceSpec;\n}\n\nexport function HTTPSettingsEditor(props: HTTPSettingsEditor): ReactElement {\n const { value, onChange, isReadonly, initialSpecDirect, initialSpecProxy } = props;\n const strDirect = 'Direct access';\n const strProxy = 'Proxy';\n\n // Initialize Proxy mode by default, if neither direct nor proxy mode is selected.\n if (value.directUrl === undefined && value.proxy === undefined) {\n Object.assign(value, initialSpecProxy);\n }\n\n // utilitary function used for headers when renaming a property\n // -> TODO it would be cleaner to manipulate headers as an intermediary list instead, to avoid doing this.\n const buildNewHeaders = (\n oldHeaders: RequestHeaders | undefined,\n oldName: string,\n newName: string\n ): RequestHeaders | undefined => {\n if (oldHeaders === undefined) return oldHeaders;\n const keys = Object.keys(oldHeaders);\n const newHeaders = keys.reduce<Record<string, string>>((acc, val) => {\n if (val === oldName) {\n acc[newName] = oldHeaders[oldName] || '';\n } else {\n acc[val] = oldHeaders[val] || '';\n }\n return acc;\n }, {});\n\n return { ...newHeaders };\n };\n\n const tabs = [\n {\n label: strProxy,\n content: (\n <>\n <Controller\n name=\"URL\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"URL\"\n value={value.proxy?.spec.url || ''}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.url = e.target.value;\n }\n })\n );\n }}\n sx={{ mb: 2 }}\n />\n )}\n />\n <Typography variant=\"h4\" mb={2}>\n Allowed endpoints\n </Typography>\n <Grid container spacing={2} mb={2}>\n {value.proxy?.spec.allowedEndpoints && value.proxy?.spec.allowedEndpoints.length !== 0 ? (\n value.proxy.spec.allowedEndpoints.map(({ endpointPattern, method }, i) => {\n return (\n <Fragment key={i}>\n <Grid item xs={8}>\n <Controller\n name={`Endpoint pattern ${i}`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Endpoint pattern\"\n value={endpointPattern}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.allowedEndpoints = draft.proxy.spec.allowedEndpoints?.map(\n (item, itemIndex) => {\n if (i === itemIndex) {\n return {\n endpointPattern: e.target.value,\n method: item.method,\n };\n } else {\n return item;\n }\n }\n );\n }\n })\n );\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={3}>\n <Controller\n name={`Method ${i}`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n select\n fullWidth\n label=\"Method\"\n value={method}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.allowedEndpoints = draft.proxy.spec.allowedEndpoints?.map(\n (item, itemIndex) => {\n if (i === itemIndex) {\n return {\n endpointPattern: item.endpointPattern,\n method: e.target.value,\n };\n } else {\n return item;\n }\n }\n );\n }\n })\n );\n }}\n >\n <MenuItem value=\"GET\">GET</MenuItem>\n <MenuItem value=\"POST\">POST</MenuItem>\n <MenuItem value=\"PUT\">PUT</MenuItem>\n <MenuItem value=\"PATCH\">PATCH</MenuItem>\n <MenuItem value=\"DELETE\">DELETE</MenuItem>\n </TextField>\n )}\n />\n </Grid>\n <Grid item xs={1}>\n <Controller\n name={`Remove Endpoint ${i}`}\n render={({ field }) => (\n <IconButton\n {...field}\n disabled={isReadonly}\n // Remove the given allowed endpoint from the list\n onClick={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.allowedEndpoints = [\n ...(draft.proxy.spec.allowedEndpoints?.filter((item, itemIndex) => {\n return itemIndex !== i;\n }) || []),\n ];\n }\n })\n );\n }}\n >\n <MinusIcon />\n </IconButton>\n )}\n />\n </Grid>\n </Fragment>\n );\n })\n ) : (\n <Grid item xs={4}>\n <Typography sx={{ fontStyle: 'italic' }}>None</Typography>\n </Grid>\n )}\n <Grid item xs={12} sx={{ paddingTop: '0px !important', paddingLeft: '5px !important' }}>\n <IconButton\n disabled={isReadonly}\n // Add a new (empty) allowed endpoint to the list\n onClick={() =>\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.allowedEndpoints = [\n ...(draft.proxy.spec.allowedEndpoints ?? []),\n { endpointPattern: '', method: '' },\n ];\n }\n })\n )\n }\n >\n <PlusIcon />\n </IconButton>\n </Grid>\n </Grid>\n <Typography variant=\"h4\" mb={2}>\n Request Headers\n </Typography>\n <Grid container spacing={2} mb={2}>\n {value.proxy?.spec.headers &&\n Object.keys(value.proxy.spec.headers).map((headerName, i) => {\n return (\n <Fragment key={i}>\n <Grid item xs={4}>\n <Controller\n name={`Header name ${i}`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Header name\"\n value={headerName}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.headers = buildNewHeaders(\n draft.proxy.spec.headers,\n headerName,\n e.target.value\n );\n }\n })\n );\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={7}>\n <Controller\n name={`Header value ${i}`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Header value\"\n value={value.proxy?.spec.headers?.[headerName]}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.headers = {\n ...draft.proxy.spec.headers,\n [headerName]: e.target.value,\n };\n }\n })\n );\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={1}>\n <Controller\n name={`Remove Header ${i}`}\n render={({ field }) => (\n <IconButton\n {...field}\n disabled={isReadonly}\n // Remove the given header from the list\n onClick={(e) => {\n field.onChange(e);\n const newHeaders = { ...value.proxy?.spec.headers };\n delete newHeaders[headerName];\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.headers = newHeaders;\n }\n })\n );\n }}\n >\n <MinusIcon />\n </IconButton>\n )}\n />\n </Grid>\n </Fragment>\n );\n })}\n <Grid item xs={12} sx={{ paddingTop: '0px !important', paddingLeft: '5px !important' }}>\n <IconButton\n disabled={isReadonly}\n // Add a new (empty) header to the list\n onClick={() =>\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.headers = { ...draft.proxy.spec.headers, '': '' };\n }\n })\n )\n }\n >\n <PlusIcon />\n </IconButton>\n </Grid>\n </Grid>\n\n <Controller\n name=\"Secret\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Secret\"\n value={value.proxy?.spec.secret || ''}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n if (draft.proxy !== undefined) {\n draft.proxy.spec.secret = e.target.value;\n }\n })\n );\n }}\n />\n )}\n />\n </>\n ),\n },\n {\n label: strDirect,\n content: (\n <Controller\n name=\"URL\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"URL\"\n value={value.directUrl || ''}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n InputProps={{\n readOnly: isReadonly,\n }}\n InputLabelProps={{ shrink: isReadonly ? true : undefined }}\n onChange={(e) => {\n field.onChange(e);\n onChange(\n produce(value, (draft) => {\n draft.directUrl = e.target.value;\n })\n );\n }}\n />\n )}\n />\n ),\n },\n ];\n\n // Use of findIndex instead of providing hardcoded values to avoid desynchronisatio or\n // bug in case the tabs get eventually swapped in the future.\n const directModeId = tabs.findIndex((tab) => tab.label === strDirect);\n const proxyModeId = tabs.findIndex((tab) => tab.label === strProxy);\n\n // Set defaultTab to the mode that this datasource is currently relying on.\n const defaultTab = value.proxy ? proxyModeId : directModeId;\n\n // For better user experience, save previous states in mind for both mode.\n // This avoids losing everything when the user changes their mind back.\n const [previousSpecDirect, setPreviousSpecDirect] = useState(initialSpecDirect);\n const [previousSpecProxy, setPreviousSpecProxy] = useState(initialSpecProxy);\n\n // When changing mode, remove previous mode's config + append default values for the new mode.\n const handleModeChange = (v: number): void => {\n if (tabs[v]?.label === strDirect) {\n setPreviousSpecProxy(value);\n\n // Copy all settings (for example, scrapeInterval), except 'proxy'\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { proxy, ...newValue } = value;\n onChange({ ...newValue, directUrl: previousSpecDirect.directUrl });\n } else if (tabs[v]?.label === strProxy) {\n setPreviousSpecDirect(value);\n\n // Copy all settings (for example, scrapeInterval), except 'directUrl'\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { directUrl, ...newValue } = value;\n onChange({ ...newValue, proxy: previousSpecProxy.proxy });\n }\n };\n\n return (\n <>\n <Typography variant=\"h4\" mt={2}>\n HTTP Settings\n </Typography>\n <OptionsEditorRadios\n isReadonly={isReadonly}\n tabs={tabs}\n defaultTab={defaultTab}\n onModeChange={handleModeChange}\n />\n </>\n );\n}\n"],"names":["Grid","IconButton","MenuItem","TextField","Typography","React","Fragment","useState","produce","Controller","MinusIcon","PlusIcon","OptionsEditorRadios","HTTPSettingsEditor","props","value","onChange","isReadonly","initialSpecDirect","initialSpecProxy","strDirect","strProxy","directUrl","undefined","proxy","Object","assign","buildNewHeaders","oldHeaders","oldName","newName","keys","newHeaders","reduce","acc","val","tabs","label","content","name","render","field","fieldState","fullWidth","spec","url","error","helperText","message","InputProps","readOnly","InputLabelProps","shrink","e","draft","target","sx","mb","variant","container","spacing","allowedEndpoints","length","map","endpointPattern","method","i","item","xs","itemIndex","select","disabled","onClick","filter","fontStyle","paddingTop","paddingLeft","headers","headerName","secret","directModeId","findIndex","tab","proxyModeId","defaultTab","previousSpecDirect","setPreviousSpecDirect","previousSpecProxy","setPreviousSpecProxy","handleModeChange","v","newValue","mt","onModeChange"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,IAAI,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAgB;AAClF,OAAOC,SAASC,QAAQ,EAAgBC,QAAQ,QAAQ,QAAQ;AAChE,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,OAAOC,eAAe,wBAAwB;AAC9C,OAAOC,cAAc,uBAAuB;AAC5C,SAASC,mBAAmB,QAAQ,yBAAyB;AAU7D,OAAO,SAASC,mBAAmBC,KAAyB;IAC1D,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAE,GAAGL;IAC7E,MAAMM,YAAY;IAClB,MAAMC,WAAW;IAEjB,kFAAkF;IAClF,IAAIN,MAAMO,SAAS,KAAKC,aAAaR,MAAMS,KAAK,KAAKD,WAAW;QAC9DE,OAAOC,MAAM,CAACX,OAAOI;IACvB;IAEA,+DAA+D;IAC/D,0GAA0G;IAC1G,MAAMQ,kBAAkB,CACtBC,YACAC,SACAC;QAEA,IAAIF,eAAeL,WAAW,OAAOK;QACrC,MAAMG,O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H;IAE/C,0EAA0E;IAC1E,uEAAuE;IACvE,MAAM,CAACK,oBAAoBC,sBAAsB,GAAG/E,SAASW;IAC7D,MAAM,CAACqE,mBAAmBC,qBAAqB,GAAGjF,SAASY;IAE3D,8FAA8F;IAC9F,MAAMsE,mBAAmB,CAACC;QACxB,IAAItD,IAAI,CAACsD,EAAE,EAAErD,UAAUjB,WAAW;YAChCoE,qBAAqBzE;YAErB,kEAAkE;YAClE,6DAA6D;YAC7D,MAAM,EAAES,KAAK,EAAE,GAAGmE,UAAU,GAAG5E;YAC/BC,SAAS;gBAAE,GAAG2E,QAAQ;gBAAErE,WAAW+D,mBAAmB/D,SAAS;YAAC;QAClE,OAAO,IAAIc,IAAI,CAACsD,EAAE,EAAErD,UAAUhB,UAAU;YACtCiE,sBAAsBvE;YAEtB,sEAAsE;YACtE,6DAA6D;YAC7D,MAAM,EAAEO,SAAS,EAAE,GAAGqE,UAAU,GAAG5E;YACnCC,SAAS;gBAAE,GAAG2E,QAAQ;gBAAEnE,OAAO+D,kBAAkB/D,KAAK;YAAC;QACzD;IACF;IAEA,qBACE;;0BACE,KAACpB;gBAAWsD,SAAQ;gBAAKkC,IAAI;0BAAG;;0BAGhC,KAAChF;gBACCK,YAAYA;gBACZmB,MAAMA;gBACNgD,YAAYA;gBACZS,cAAcJ;;;;AAItB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/HTTPSettingsEditor/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './HTTPSettingsEditor';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,uBAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/LegendOptionsEditor/LegendOptionsEditor.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Switch, SwitchProps } from '@mui/material';\nimport { DEFAULT_LEGEND, getLegendMode, getLegendPosition, getLegendSize } from '@perses-dev/core';\nimport { ErrorAlert, OptionsEditorControl, OptionsEditorGroup, SettingsAutocomplete } from '@perses-dev/components';\nimport { ReactElement, useMemo } from 'react';\nimport {\n LEGEND_MODE_CONFIG,\n LEGEND_POSITIONS_CONFIG,\n LegendSpecOptions,\n LegendSingleSelectConfig,\n validateLegendSpec,\n LEGEND_VALUE_CONFIG,\n LegendValue,\n LEGEND_SIZE_CONFIG,\n comparisonLegends,\n ComparisonValues,\n} from '../../model';\n\ntype LegendPositionOption = LegendSingleSelectConfig & { id: LegendSpecOptions['position'] };\n\nconst POSITION_OPTIONS: LegendPositionOption[] = Object.entries(LEGEND_POSITIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as LegendSpecOptions['position'],\n ...config,\n };\n});\n\ntype LegendModeOption = LegendSingleSelectConfig & { id: Required<LegendSpecOptions>['mode'] };\n\nconst MODE_OPTIONS: LegendModeOption[] = Object.entries(LEGEND_MODE_CONFIG).map(([id, config]) => {\n return {\n id: id as Required<LegendSpecOptions>['mode'],\n ...config,\n };\n});\n\ntype LegendSizeOption = LegendSingleSelectConfig & { id: Required<LegendSpecOptions>['size'] };\n\nconst SIZE_OPTIONS: LegendSizeOption[] = Object.entries(LEGEND_SIZE_CONFIG).map(([id, config]) => {\n return {\n id: id as Required<LegendSpecOptions>['size'],\n ...config,\n };\n});\n\ntype LegendValueOption = LegendSingleSelectConfig & { id: LegendValue | ComparisonValues };\n\nexport interface LegendOptionsEditorProps {\n value?: LegendSpecOptions;\n onChange: (legend?: LegendSpecOptions) => void;\n showValuesEditor?: boolean;\n calculation?: 'aggregation' | 'comparison';\n}\n\nexport function LegendOptionsEditor({\n value,\n onChange,\n showValuesEditor = true,\n calculation = 'aggregation',\n}: LegendOptionsEditorProps): ReactElement {\n const handleLegendShowChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n // legend is hidden when legend obj is undefined\n const legendValue = checked === true ? { position: DEFAULT_LEGEND.position } : undefined;\n onChange(legendValue);\n };\n\n const handleLegendPositionChange = (_: unknown, newValue: LegendPositionOption): void => {\n onChange({\n ...value,\n position: newValue.id,\n });\n };\n\n const handleLegendModeChange = (_: unknown, newValue: LegendModeOption): void => {\n onChange({\n ...value,\n position: currentPosition,\n mode: newValue.id,\n });\n };\n\n const handleLegendSizeChange = (_: unknown, newValue: LegendSizeOption): void => {\n onChange({\n ...value,\n position: currentPosition,\n size: newValue.id,\n });\n };\n\n const handleLegendValueChange = (_: unknown, newValue: LegendValueOption[]): void => {\n onChange({\n ...value,\n position: currentPosition,\n values: newValue.map((value) => {\n return value.id;\n }),\n });\n };\n\n const isValidLegend = validateLegendSpec(value);\n const currentPosition = getLegendPosition(value?.position);\n const legendPositionConfig = LEGEND_POSITIONS_CONFIG[currentPosition];\n\n const currentMode = getLegendMode(value?.mode);\n const legendModeConfig = LEGEND_MODE_CONFIG[currentMode];\n\n const currentSize = getLegendSize(value?.size);\n const legendSizeConfig = LEGEND_SIZE_CONFIG[currentSize];\n\n const legendValuesConfig = useMemo(() => {\n const currentValues = value?.values;\n if (!currentValues?.length) return [];\n\n if (calculation === 'aggregation') {\n return currentValues.reduce((result, item) => {\n const config = LEGEND_VALUE_CONFIG[item as LegendValue];\n if (config) {\n result.push({ ...config, id: item });\n }\n return result;\n }, [] as LegendValueOption[]);\n }\n\n return currentValues.map((id) => {\n const { label, description } = comparisonLegends[id as ComparisonValues];\n return {\n id,\n label,\n description,\n };\n });\n }, [calculation, value?.values]);\n\n const valueOptions = useMemo(() => {\n if (calculation === 'aggregation') {\n return Object.entries(LEGEND_VALUE_CONFIG || {}).map(([id, config]) => {\n return {\n id: id as LegendValue,\n ...config,\n };\n });\n }\n\n return Object.entries(comparisonLegends).map(([id, config]) => ({\n id: id as ComparisonValues,\n ...config,\n }));\n }, [calculation]);\n\n return (\n <OptionsEditorGroup title=\"Legend\">\n {!isValidLegend && <ErrorAlert error={{ name: 'invalid-legend', message: 'Invalid legend spec' }} />}\n <OptionsEditorControl label=\"Show\" control={<Switch checked={!!value} onChange={handleLegendShowChange} />} />\n <OptionsEditorControl\n label=\"Position\"\n control={\n <SettingsAutocomplete\n value={{\n ...legendPositionConfig,\n id: currentPosition,\n }}\n options={POSITION_OPTIONS}\n onChange={handleLegendPositionChange}\n disabled={value === undefined}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n <OptionsEditorControl\n label=\"Mode\"\n control={\n <SettingsAutocomplete\n value={{\n ...legendModeConfig,\n id: currentMode,\n }}\n options={MODE_OPTIONS}\n onChange={handleLegendModeChange}\n disabled={!value}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n <OptionsEditorControl\n label=\"Size\"\n control={\n <SettingsAutocomplete\n value={{\n ...legendSizeConfig,\n id: currentSize,\n }}\n options={SIZE_OPTIONS}\n onChange={handleLegendSizeChange}\n // TODO: enable sizes for list mode when we normalize the layout of\n // lists to more closely match tables.\n disabled={!value || currentMode !== 'table'}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n {showValuesEditor && (\n <OptionsEditorControl\n label=\"Values\"\n control={\n // For some reason, the inferred option type doesn't always seem to work\n // quite right when `multiple` is true. Explicitly setting the generics\n // to work around this.\n <SettingsAutocomplete<LegendValueOption, true, true>\n multiple={true}\n disableCloseOnSelect\n disableClearable\n value={legendValuesConfig}\n options={valueOptions}\n onChange={handleLegendValueChange}\n disabled={!value || currentMode !== 'table'}\n limitTags={1}\n ChipProps={{\n size: 'small',\n }}\n />\n }\n />\n )}\n </OptionsEditorGroup>\n );\n}\n"],"names":["Switch","DEFAULT_LEGEND","getLegendMode","getLegendPosition","getLegendSize","ErrorAlert","OptionsEditorControl","OptionsEditorGroup","SettingsAutocomplete","useMemo","LEGEND_MODE_CONFIG","LEGEND_POSITIONS_CONFIG","validateLegendSpec","LEGEND_VALUE_CONFIG","LEGEND_SIZE_CONFIG","comparisonLegends","POSITION_OPTIONS","Object","entries","map","id","config","MODE_OPTIONS","SIZE_OPTIONS","LegendOptionsEditor","value","onChange","showValuesEditor","calculation","handleLegendShowChange","_","checked","legendValue","position","undefined","handleLegendPositionChange","newValue","handleLegendModeChange","currentPosition","mode","handleLegendSizeChange","size","handleLegendValueChange","values","isValidLegend","legendPositionConfig","currentMode","legendModeConfig","currentSize","legendSizeConfig","legendValuesConfig","currentValues","length","reduce","result","item","push","label","description","valueOptions","title","error","name","message","control","options","disabled","disableClearable","multiple","disableCloseOnSelect","limitTags","ChipProps"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAqB,gBAAgB;AACpD,SAASC,cAAc,EAAEC,aAAa,EAAEC,iBAAiB,EAAEC,aAAa,QAAQ,mBAAmB;AACnG,SAASC,UAAU,EAAEC,oBAAoB,EAAEC,kBAAkB,EAAEC,o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MAAM;oBACR;;;;;AAOd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/LegendOptionsEditor/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './LegendOptionsEditor';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MetricLabelInput/MetricLabelInput.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TextField } from '@mui/material';\nimport { OptionsEditorControl } from '@perses-dev/components';\nimport { FC } from 'react';\n\nexport interface MetricLabelInputProps {\n value?: string;\n onChange: (metricLabel?: string) => void;\n}\n\nexport const MetricLabelInput: FC<MetricLabelInputProps> = ({ value, onChange }) => {\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {\n const newValue = event.target.value;\n onChange(newValue || undefined);\n };\n\n return (\n <OptionsEditorControl\n label=\"Metric label\"\n description=\"Specify label to display\"\n control={<TextField fullWidth name=\"Metric label\" value={value || ''} onChange={handleChange} />}\n />\n );\n};\n"],"names":["TextField","OptionsEditorControl","MetricLabelInput","value","onChange","handleChange","event","newValue","target","undefined","label","description","control","fullWidth","name"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,oBAAoB,QAAQ,yBAAyB;AAQ9D,OAAO,MAAMC,mBAA8C,CAAC,EAAEC,KAAK,EAAEC,QAAQ,EAAE;IAC7E,MAAMC,eAAe,CAACC;QACpB,MAAMC,WAAWD,MAAME,MAAM,CAACL,KAAK;QACnCC,SAASG,YAAYE;IACvB;IAEA,qBACE,KAACR;QACCS,OAAM;QACNC,aAAY;QACZC,uBAAS,KAACZ;YAAUa,SAAS;YAACC,MAAK;YAAeX,OAAOA,SAAS;YAAIC,UAAUC;;;AAGtF,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MetricLabelInput/index.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './MetricLabelInput';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MultiQueryEditor/MultiQueryEditor.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useState } from 'react';\nimport { produce } from 'immer';\nimport { Button, Stack } from '@mui/material';\nimport AddIcon from 'mdi-material-ui/Plus';\nimport { QueryDefinition, QueryPluginType } from '@perses-dev/core';\nimport { useListPluginMetadata, usePlugin, usePluginRegistry } from '../../runtime';\nimport { QueryEditorContainer } from './QueryEditorContainer';\n\nexport interface MultiQueryEditorProps {\n queryTypes: QueryPluginType[];\n queries?: QueryDefinition[];\n onChange: (queries: QueryDefinition[]) => void;\n}\n\nfunction useDefaultQueryDefinition(queryTypes: QueryPluginType[]): {\n defaultInitialQueryDefinition: QueryDefinition;\n isLoading: boolean;\n} {\n // Build the default query plugin\n // This will be used only if the queries are empty, to open a starting query\n\n // Firs the default query type\n const defaultQueryType = queryTypes[0]!;\n\n // Then the default plugin kind\n // Use as default the plugin kind explicitly set as default or the first in the list\n const { data: queryPlugins, isLoading } = useListPluginMetadata(queryTypes);\n const { defaultPluginKinds } = usePluginRegistry();\n const defaultQueryKind = defaultPluginKinds?.[defaultQueryType] ?? queryPlugins?.[0]?.spec.name ?? '';\n\n const { data: defaultQueryPlugin } = usePlugin(defaultQueryType, defaultQueryKind, {\n useErrorBoundary: true,\n enabled: true,\n });\n\n // This default query definition is used if no query is provided initially or when we add a new query\n return {\n defaultInitialQueryDefinition: {\n kind: defaultQueryType,\n spec: {\n plugin: { kind: defaultQueryKind, spec: defaultQueryPlugin?.createInitialOptions() || {} },\n },\n },\n isLoading,\n };\n}\n\n/**\n * A component render a list of {@link QueryEditorContainer} for the given query definitions.\n * It allows adding, removing and editing queries.\n * @param queryTypes The list of query types that the underlying editor will propose\n * @param queries The list of query definitions to render\n * @param onChange The callback to call when the queries are modified\n * @constructor\n */\nexport function MultiQueryEditor({ queryTypes, queries = [], onChange }: MultiQueryEditorProps): ReactElement {\n const { defaultInitialQueryDefinition, isLoading } = useDefaultQueryDefinition(queryTypes);\n\n // State for which queries are collapsed\n const [queriesCollapsed, setQueriesCollapsed] = useState(queries.map(() => false));\n\n // Query handlers\n const handleQueryChange = (index: number, queryDef: QueryDefinition): void => {\n onChange(\n produce(queries, (draft) => {\n if (draft) {\n draft[index] = queryDef;\n } else {\n draft = [queryDef];\n }\n })\n );\n };\n\n const handleQueryAdd = (): void => {\n onChange(\n produce(queries, (draft) => {\n if (draft) {\n draft.push(defaultInitialQueryDefinition);\n } else {\n draft = [...queries, defaultInitialQueryDefinition];\n }\n })\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.push(false);\n return [...queriesCollapsed];\n });\n };\n\n const handleQueryDelete = (index: number): void => {\n onChange(\n produce(queries, (draft) => {\n draft.splice(index, 1);\n })\n );\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed.splice(index, 1);\n return [...queriesCollapsed];\n });\n };\n\n const handleQueryCollapseExpand = (index: number): void => {\n setQueriesCollapsed((queriesCollapsed) => {\n queriesCollapsed[index] = !queriesCollapsed[index];\n return [...queriesCollapsed];\n });\n };\n\n // show one query input if queries is empty\n const queryDefinitions: QueryDefinition[] = queries.length\n ? queries\n : !isLoading\n ? [defaultInitialQueryDefinition]\n : [];\n\n return (\n <>\n <Stack spacing={1}>\n {queryDefinitions.map((query: QueryDefinition, i: number) => (\n <QueryEditorContainer\n queryTypes={queryTypes}\n key={i}\n index={i}\n query={query}\n isCollapsed={!!queriesCollapsed[i]}\n onChange={handleQueryChange}\n onDelete={queries.length > 1 ? handleQueryDelete : undefined}\n onCollapseExpand={handleQueryCollapseExpand}\n />\n ))}\n </Stack>\n <Button variant=\"contained\" startIcon={<AddIcon />} sx={{ marginTop: 1 }} onClick={handleQueryAdd}>\n Add Query\n </Button>\n </>\n );\n}\n"],"names":["useState","produce","Button","Stack","AddIcon","useListPluginMetadata","usePlugin","usePluginRegistry","QueryEditorContainer","useDefaultQueryDefinition","queryTypes","defaultQueryType","data","queryPlugins","isLoading","defaultPluginKinds","defaultQueryKind","spec","name","defaultQueryPlugin","useErrorBoundary","enabled","defaultInitialQueryDefinition","kind","plugin","createInitialOptions","MultiQueryEditor","queries","onChange","queriesCollapsed","setQueriesCollapsed","map","handleQueryChange","index","queryDef","draft","handleQueryAdd","push","handleQueryDelete","splice","handleQueryCollapseExpand","queryDefinitions","length","spacing","query","i","isCollapsed","onDelete","undefined","onCollapseExpand","variant","startIcon","sx","marginTop","onClick"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,QAAQ,QAAQ,QAAQ;AAC/C,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,MAAM,EAAEC,KAAK,QAAQ,gBAAgB;AAC9C,OAAOC,aAAa,uBAAuB;AAE3C,SAASC,qBAAqB,EAAEC,SAAS,EAAEC,iBAAiB,QAAQ,gBAAgB;AACpF,SAASC,oBAAoB,QAAQ,yBAAyB;AAQ9D,SAASC,0BAA0BC,UAA6B;IAI9D,iCAAiC;IACjC,4EAA4E;IAE5E,8BAA8B;IAC9B,MAA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O;mBAAIR;aAAiB;QAC9B;IACF;IAEA,MAAMS,oBAAoB,CAACL;QACzBL,SACE3B,QAAQ0B,SAAS,CAACQ;YAChBA,MAAMI,MAAM,CAACN,OAAO;QACtB;QAEFH,oBAAoB,CAACD;YACnBA,iBAAiBU,MAAM,CAACN,OAAO;YAC/B,OAAO;mBAAIJ;aAAiB;QAC9B;IACF;IAEA,MAAMW,4BAA4B,CAACP;QACjCH,oBAAoB,CAACD;YACnBA,gBAAgB,CAACI,MAAM,GAAG,CAACJ,gBAAgB,CAACI,MAAM;YAClD,OAAO;mBAAIJ;aAAiB;QAC9B;IACF;IAEA,2CAA2C;IAC3C,MAAMY,mBAAsCd,QAAQe,MAAM,GACtDf,UACA,CAACb,YACC;QAACQ;KAA8B,GAC/B,EAAE;IAER,qBACE;;0BACE,KAACnB;gBAAMwC,SAAS;0BACbF,iBAAiBV,GAAG,CAAC,CAACa,OAAwBC,kBAC7C,KAACrC;wBACCE,YAAYA;wBAEZuB,OAAOY;wBACPD,OAAOA;wBACPE,aAAa,CAAC,CAACjB,gBAAgB,CAACgB,EAAE;wBAClCjB,UAAUI;wBACVe,UAAUpB,QAAQe,MAAM,GAAG,IAAIJ,oBAAoBU;wBACnDC,kBAAkBT;uBANbK;;0BAUX,KAAC3C;gBAAOgD,SAAQ;gBAAYC,yBAAW,KAAC/C;gBAAYgD,IAAI;oBAAEC,WAAW;gBAAE;gBAAGC,SAASlB;0BAAgB;;;;AAKzG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MultiQueryEditor/QueryEditorContainer.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { produce } from 'immer';\nimport { QueryDefinition, QueryPluginType } from '@perses-dev/core';\nimport { Stack, IconButton, Typography, BoxProps, Box } from '@mui/material';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport ChevronDown from 'mdi-material-ui/ChevronDown';\nimport ChevronRight from 'mdi-material-ui/ChevronRight';\nimport { ReactElement } from 'react';\nimport { PluginEditor, PluginEditorProps } from '../PluginEditor';\n\n/**\n * Properties for {@link QueryEditorContainer}\n */\ninterface QueryEditorContainerProps {\n queryTypes: QueryPluginType[];\n index: number;\n query: QueryDefinition;\n onChange: (index: number, query: QueryDefinition) => void;\n onCollapseExpand: (index: number) => void;\n isCollapsed?: boolean;\n onDelete?: (index: number) => void;\n}\n\n/**\n * Container for a query editor. This component is responsible for rendering the query editor, and make it collapsible\n * to not take too much space.\n * @param queryTypes the supported query types\n * @param index the index of the query in the list\n * @param query the query definition\n * @param isCollapsed whether the query editor is collapsed or not\n * @param onDelete callback when the query is deleted\n * @param onChange callback when the query is changed\n * @param onCollapseExpand callback when the query is collapsed or expanded\n * @constructor\n */\nexport const QueryEditorContainer = ({\n queryTypes,\n index,\n query,\n isCollapsed,\n onDelete,\n onChange,\n onCollapseExpand,\n}: QueryEditorContainerProps): ReactElement => {\n return (\n <Stack key={index} spacing={1}>\n <Stack direction=\"row\" alignItems=\"center\" borderBottom={1} borderColor={(theme) => theme.palette.divider}>\n <IconButton size=\"small\" onClick={() => onCollapseExpand(index)}>\n {isCollapsed ? <ChevronRight /> : <ChevronDown />}\n </IconButton>\n <Typography variant=\"overline\" component=\"h4\">\n Query #{index + 1}\n </Typography>\n <IconButton\n size=\"small\"\n // Use `visibility` to ensure that the row has the same height when delete button is visible or not visible\n sx={{ marginLeft: 'auto', visibility: `${onDelete ? 'visible' : 'hidden'}` }}\n onClick={() => onDelete && onDelete(index)}\n >\n <DeleteIcon />\n </IconButton>\n </Stack>\n {!isCollapsed && <QueryEditor queryTypes={queryTypes} value={query} onChange={(next) => onChange(index, next)} />}\n </Stack>\n );\n};\n\n// Props on MUI Box that we don't want people to pass because we're either redefining them or providing them in\n// this component\ntype OmittedMuiProps = 'children' | 'value' | 'onChange';\ninterface QueryEditorProps extends Omit<BoxProps, OmittedMuiProps> {\n queryTypes: QueryPluginType[];\n value: QueryDefinition;\n onChange: (next: QueryDefinition) => void;\n}\n\n/**\n * Editor for a query definition. This component is responsible for rendering the plugin editor for the given query.\n * This will allow user to select a plugin extending from the given supported query types, and then edit the plugin\n * spec for this plugin.\n * @param props\n * @constructor\n */\nfunction QueryEditor(props: QueryEditorProps): ReactElement {\n const { value, onChange, queryTypes, ...others } = props;\n\n const handlePluginChange: PluginEditorProps['onChange'] = (next) => {\n onChange(\n produce(value, (draft) => {\n draft.kind = next.selection.type;\n draft.spec.plugin.kind = next.selection.kind;\n draft.spec.plugin.spec = next.spec;\n })\n );\n };\n\n return (\n <Box {...others}>\n <PluginEditor\n pluginTypes={queryTypes}\n pluginKindLabel=\"Query Type\"\n value={{\n selection: {\n kind: value.spec.plugin.kind,\n type: value.kind,\n },\n spec: value.spec.plugin.spec,\n }}\n onChange={handlePluginChange}\n />\n </Box>\n );\n}\n"],"names":["produce","Stack","IconButton","Typography","Box","DeleteIcon","ChevronDown","ChevronRight","PluginEditor","QueryEditorContainer","queryTypes","index","query","isCollapsed","onDelete","onChange","onCollapseExpand","spacing","direction","alignItems","borderBottom","borderColor","theme","palette","divider","size","onClick","variant","component","sx","marginLeft","visibility","QueryEditor","value","next","props","others","handlePluginChange","draft","kind","selection","type","spec","plugin","pluginTypes","pluginKindLabel"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,OAAO,QAAQ,QAAQ;A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ChCH,MAAMI,IAAI,CAACC,MAAM,CAACJ,IAAI,GAAGL,KAAKM,SAAS,CAACD,IAAI;YAC5CD,MAAMI,IAAI,CAACC,MAAM,CAACD,IAAI,GAAGR,KAAKQ,IAAI;QACpC;IAEJ;IAEA,qBACE,KAACtC;QAAK,GAAGgC,MAAM;kBACb,cAAA,KAAC5B;YACCoC,aAAalC;YACbmC,iBAAgB;YAChBZ,OAAO;gBACLO,WAAW;oBACTD,MAAMN,MAAMS,IAAI,CAACC,MAAM,CAACJ,IAAI;oBAC5BE,MAAMR,MAAMM,IAAI;gBAClB;gBACAG,MAAMT,MAAMS,IAAI,CAACC,MAAM,CAACD,IAAI;YAC9B;YACA3B,UAAUsB;;;AAIlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MultiQueryEditor/index.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './MultiQueryEditor';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorRadios/OptionsEditorRadios.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { FormControl, FormControlLabel, Radio, RadioGroup, RadioGroupProps, Box } from '@mui/material';\nimport { ReactElement, ReactNode, useState } from 'react';\nimport { OptionsEditorTabPanel } from '../OptionsEditorTabPanel';\n\nexport type OptionsEditorRadio = {\n label: string;\n /**\n * Content rendered when the tab is active.\n */\n content: ReactNode;\n};\n\nexport type OptionsEditorRadiosProps = {\n tabs: OptionsEditorRadio[];\n defaultTab: number;\n onModeChange: (value: number) => void;\n isReadonly?: boolean;\n};\n\nexport const OptionsEditorRadios = (props: OptionsEditorRadiosProps): ReactElement => {\n const { tabs, defaultTab, onModeChange, isReadonly } = props;\n const [activeTab, setActiveTab] = useState(defaultTab);\n\n const handleChange: RadioGroupProps['onChange'] = (_, value) => {\n const v = parseInt(value);\n setActiveTab(v);\n onModeChange(v);\n };\n\n return (\n <>\n <Box sx={{ borderBottom: 1, borderColor: (theme) => theme.palette.divider }}>\n <FormControl>\n <RadioGroup\n row\n defaultValue={defaultTab}\n value={activeTab}\n onChange={handleChange}\n aria-labelledby=\"Configuration radio\"\n >\n {tabs.map(({ label }, i) => {\n return <FormControlLabel disabled={isReadonly} key={label} value={i} control={<Radio />} label={label} />;\n })}\n </RadioGroup>\n </FormControl>\n </Box>\n {tabs.map(({ label, content }, i) => {\n return (\n <OptionsEditorTabPanel key={label} value={activeTab} index={i}>\n {content}\n </OptionsEditorTabPanel>\n );\n })}\n </>\n );\n};\n"],"names":["FormControl","FormControlLabel","Radio","RadioGroup","Box","useState","OptionsEditorTabPanel","OptionsEditorRadios","props","tabs","defaultTab","onModeChange","isReadonly","activeTab","setActiveTab","handleChange","_","value","v","parseInt","sx","borderBottom","borderColor","theme","palette","divider","row","defaultValue","onChange","aria-labelledby","map","label","i","disabled","control","content","index"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,WAAW,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,UAAU,EAAmBC,GAAG,QAAQ,gBAAgB;AACvG,SAAkCC,QAAQ,QAAQ,QAAQ;AAC1D,SAASC,qBAAqB,QAAQ,2BAA2B;AAiBjE,OAAO,MAAMC,sBAAsB,CAACC;IAClC,MAAM,EAAEC,IAAI,EAAEC,UAAU,EAAEC,YAAY,EAAEC,UAAU,EAAE,GAAGJ;IACvD,MAAM,CAACK,WAAWC,aAAa,GAAGT,SAASK;IAE3C,MAAMK,eAA4C,CAACC,GAAGC;QACpD,MAAMC,IAAIC,SAASF;QACnBH,aAAaI;QACbP,aAAaO;IACf;IAEA,qBACE;;0BACE,KAACd;gBAAIgB,IAAI;oBAAEC,cAAc;oBAAGC,aAAa,CAACC,QAAUA,MAAMC,OAAO,CAACC,OAAO;gBAAC;0BACxE,cAAA,KAACzB;8BACC,cAAA,KAACG;wBACCuB,GAAG;wBACHC,cAAcjB;wBACdO,OAAOJ;wBACPe,UAAUb;wBACVc,mBAAgB;kCAEfpB,KAAKqB,GAAG,CAAC,CAAC,EAAEC,KAAK,EAAE,EAAEC;4BACpB,qBAAO,KAAC/B;gCAAiBgC,UAAUrB;gCAAwBK,OAAOe;gCAAGE,uBAAS,KAAChC;gCAAU6B,OAAOA;+BAA5CA;wBACtD;;;;YAILtB,KAAKqB,GAAG,CAAC,CAAC,EAAEC,KAAK,EAAEI,OAAO,EAAE,EAAEH;gBAC7B,qBACE,KAAC1B;oBAAkCW,OAAOJ;oBAAWuB,OAAOJ;8BACzDG;mBADyBJ;YAIhC;;;AAGN,EAAE"}
|
package/dist/{src/runtime/DataQueriesProvider → components/OptionsEditorRadios}/index.js.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorRadios/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './OptionsEditorRadios';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorTabPanel/OptionsEditorTabPanel.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { ReactElement } from 'react';\n\ninterface OptionsEditorTabPanelProps {\n children: React.ReactNode;\n index: number;\n value: number;\n}\n\nexport function OptionsEditorTabPanel(props: OptionsEditorTabPanelProps): ReactElement {\n const { children, value, index, ...other } = props;\n\n const isActive = value === index;\n\n return (\n <div\n role=\"tabpanel\"\n hidden={!isActive}\n id={`options-editor-tabpanel-${index}`}\n aria-labelledby={`options-editor-tab-${index}`}\n {...other}\n >\n {isActive && <Box mt={2}>{children}</Box>}\n </div>\n );\n}\n"],"names":["Box","OptionsEditorTabPanel","props","children","value","index","other","isActive","div","role","hidden","id","aria-labelledby","mt"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AASpC,OAAO,SAASC,sBAAsBC,KAAiC;IACrE,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGC,OAAO,GAAGJ;IAE7C,MAAMK,WAAWH,UAAUC;IAE3B,qBACE,KAACG;QACCC,MAAK;QACLC,QAAQ,CAACH;QACTI,IAAI,CAAC,wBAAwB,EAAEN,OAAO;QACtCO,mBAAiB,CAAC,mBAAmB,EAAEP,OAAO;QAC7C,GAAGC,KAAK;kBAERC,0BAAY,KAACP;YAAIa,IAAI;sBAAIV;;;AAGhC"}
|
package/dist/{src/components/HTTPSettingsEditor → components/OptionsEditorTabPanel}/index.js.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorTabPanel/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './OptionsEditorTabPanel';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,0BAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorTabs/OptionsEditorTabs.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Tab, Tabs, TabsProps, Box } from '@mui/material';\nimport { ReactElement, ReactNode, useState } from 'react';\nimport { OptionsEditorTabPanel } from '../OptionsEditorTabPanel';\n\nexport type OptionsEditorTab = {\n label: string;\n /**\n * Content rendered when the tab is active.\n */\n content: ReactNode;\n};\n\nexport type OptionsEditorTabsProps = {\n tabs: OptionsEditorTab[];\n};\n\nexport const OptionsEditorTabs = ({ tabs }: OptionsEditorTabsProps): ReactElement => {\n const [activeTab, setActiveTab] = useState(0);\n\n const handleChange: TabsProps['onChange'] = (_, newValue) => {\n setActiveTab(newValue);\n };\n\n return (\n <>\n <Box sx={{ borderBottom: 1, borderColor: (theme) => theme.palette.divider }}>\n <Tabs value={activeTab} onChange={handleChange} aria-label=\"Panel configuration tabs\">\n {tabs.map(({ label }, i) => {\n return (\n <Tab\n key={label}\n label={label}\n id={`options-editor-tab-${i}`}\n aria-controls={`options-editor-tabpanel-${i}`}\n />\n );\n })}\n </Tabs>\n </Box>\n {tabs.map(({ label, content }, i) => {\n return (\n <OptionsEditorTabPanel key={label} value={activeTab} index={i}>\n {content}\n </OptionsEditorTabPanel>\n );\n })}\n </>\n );\n};\n"],"names":["Tab","Tabs","Box","useState","OptionsEditorTabPanel","OptionsEditorTabs","tabs","activeTab","setActiveTab","handleChange","_","newValue","sx","borderBottom","borderColor","theme","palette","divider","value","onChange","aria-label","map","label","i","id","aria-controls","content","index"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,IAAI,EAAaC,GAAG,QAAQ,gBAAgB;AAC1D,SAAkCC,QAAQ,QAAQ,QAAQ;AAC1D,SAASC,qBAAqB,QAAQ,2BAA2B;AAcjE,OAAO,MAAMC,oBAAoB,CAAC,EAAEC,IAAI,EAA0B;IAChE,MAAM,CAACC,WAAWC,aAAa,GAAGL,SAAS;IAE3C,MAAMM,eAAsC,CAACC,GAAGC;QAC9CH,aAAaG;IACf;IAEA,qBACE;;0BACE,KAACT;gBAAIU,IAAI;oBAAEC,cAAc;oBAAGC,aAAa,CAACC,QAAUA,MAAMC,OAAO,CAACC,OAAO;gBAAC;0BACxE,cAAA,KAAChB;oBAAKiB,OAAOX;oBAAWY,UAAUV;oBAAcW,cAAW;8BACxDd,KAAKe,GAAG,CAAC,CAAC,EAAEC,KAAK,EAAE,EAAEC;wBACpB,qBACE,KAACvB;4BAECsB,OAAOA;4BACPE,IAAI,CAAC,mBAAmB,EAAED,GAAG;4BAC7BE,iBAAe,CAAC,wBAAwB,EAAEF,GAAG;2BAHxCD;oBAMX;;;YAGHhB,KAAKe,GAAG,CAAC,CAAC,EAAEC,KAAK,EAAEI,OAAO,EAAE,EAAEH;gBAC7B,qBACE,KAACnB;oBAAkCc,OAAOX;oBAAWoB,OAAOJ;8BACzDG;mBADyBJ;YAIhC;;;AAGN,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorTabs/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './OptionsEditorTabs';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sBAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PanelSpecEditor/PanelSpecEditor.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ErrorAlert, JSONEditor, LinksEditor } from '@perses-dev/components';\nimport { PanelDefinition, PanelEditorValues, QueryDefinition, UnknownSpec } from '@perses-dev/core';\nimport { Control, Controller } from 'react-hook-form';\nimport { ReactElement } from 'react';\nimport { QueryCountProvider, usePlugin } from '../../runtime';\nimport { PanelPlugin } from '../../model';\nimport { OptionsEditorTabsProps, OptionsEditorTabs } from '../OptionsEditorTabs';\nimport { MultiQueryEditor } from '../MultiQueryEditor';\n\nexport interface PanelSpecEditorProps {\n control: Control<PanelEditorValues>;\n panelDefinition: PanelDefinition;\n onQueriesChange: (queries: QueryDefinition[]) => void;\n onPluginSpecChange: (spec: UnknownSpec) => void;\n onJSONChange: (panelDefinitionStr: string) => void;\n}\n\nexport function PanelSpecEditor(props: PanelSpecEditorProps): ReactElement | null {\n const { control, panelDefinition, onJSONChange, onQueriesChange, onPluginSpecChange } = props;\n const { kind } = panelDefinition.spec.plugin;\n const { data: plugin, isLoading, error } = usePlugin('Panel', kind);\n\n if (error) {\n return <ErrorAlert error={error} />;\n }\n\n // TODO: Proper loading indicator\n if (isLoading) {\n return null;\n }\n\n if (plugin === undefined) {\n throw new Error(`Missing implementation for panel plugin with kind '${kind}'`);\n }\n\n const { panelOptionsEditorComponents, hideQueryEditor } = plugin as PanelPlugin;\n let tabs: OptionsEditorTabsProps['tabs'] = [];\n\n if (!hideQueryEditor) {\n tabs.push({\n label: 'Query',\n content: (\n <Controller\n control={control}\n name=\"panelDefinition.spec.queries\"\n render={({ field }) => (\n <MultiQueryEditor\n queryTypes={plugin.supportedQueryTypes ?? []}\n queries={panelDefinition.spec.queries ?? []}\n onChange={(queries) => {\n field.onChange(queries);\n onQueriesChange(queries);\n }}\n />\n )}\n />\n ),\n });\n }\n\n if (panelOptionsEditorComponents !== undefined) {\n tabs = tabs.concat(\n panelOptionsEditorComponents.map(({ label, content: OptionsEditorComponent }) => ({\n label,\n content: (\n <Controller\n control={control}\n name=\"panelDefinition.spec.plugin.spec\"\n render={({ field }) => (\n <OptionsEditorComponent\n value={panelDefinition.spec.plugin.spec}\n onChange={(spec) => {\n field.onChange(spec);\n onPluginSpecChange(spec);\n }}\n />\n )}\n />\n ),\n }))\n );\n }\n\n // always show json editor and links editor by default\n tabs.push({\n label: 'Links',\n content: <LinksEditor control={control} />,\n });\n tabs.push({\n label: 'JSON',\n content: (\n <Controller\n control={control}\n name=\"panelDefinition\"\n render={({ field }) => (\n <JSONEditor\n maxHeight=\"80vh\"\n value={panelDefinition}\n onChange={(json) => {\n field.onChange(JSON.parse(json));\n onJSONChange(json);\n }}\n />\n )}\n />\n ),\n });\n\n return (\n <QueryCountProvider queryCount={(panelDefinition.spec.queries ?? []).length}>\n <OptionsEditorTabs key={tabs.length} tabs={tabs} />\n </QueryCountProvider>\n );\n}\n"],"names":["ErrorAlert","JSONEditor","LinksEditor","Controller","QueryCountProvider","usePlugin","OptionsEditorTabs","MultiQueryEditor","PanelSpecEditor","props","control","panelDefinition","onJSONChange","onQueriesChange","onPluginSpecChange","kind","spec","plugin","data","isLoading","error","undefined","Error","panelOptionsEditorComponents","hideQueryEditor","tabs","push","label","content","name","render","field","queryTypes","supportedQueryTypes","queries","onChange","concat","map","OptionsEditorComponent","value","maxHeight","json","JSON","parse","queryCount","length"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,UAAU,EAAEC,UAAU,EAAEC,WAAW,QAAQ,yBAAyB;AAE7E,SAAkBC,UAAU,QAAQ,kBAAkB;AAEtD,SAASC,kBAAkB,EAAEC,SAAS,QAAQ,gBAAgB;AAE9D,SAAiCC,iBAAiB,QAAQ,uBAAuB;AACjF,SAASC,gBAAgB,QAAQ,sBAAsB;AAUvD,OAAO,SAASC,gBAAgBC,KAA2B;IACzD,MAAM,EAAEC,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAEC,eAAe,EAAEC,kBAAkB,EAAE,GAAGL;IACxF,MAAM,EAAEM,IAAI,EAAE,GAAGJ,gBAAgBK,IAAI,CAACC,MAAM;IAC5C,MAAM,EAAEC,MAAMD,MAA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CAAC;QACRC,OAAO;QACPC,uBACE,KAACzB;YACCO,SAASA;YACTmB,MAAK;YACLC,QAAQ,CAAC,EAAEC,KAAK,EAAE,iBAChB,KAAC9B;oBACCuC,WAAU;oBACVD,OAAO5B;oBACPwB,UAAU,CAACM;wBACTV,MAAMI,QAAQ,CAACO,KAAKC,KAAK,CAACF;wBAC1B7B,aAAa6B;oBACf;;;IAKV;IAEA,qBACE,KAACrC;QAAmBwC,YAAY,AAACjC,CAAAA,gBAAgBK,IAAI,CAACkB,OAAO,IAAI,EAAE,AAAD,EAAGW,MAAM;kBACzE,cAAA,KAACvC;YAAoCmB,MAAMA;WAAnBA,KAAKoB,MAAM;;AAGzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PanelSpecEditor/index.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './PanelSpecEditor';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,oBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginEditor/PluginEditor.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Button } from '@mui/material';\nimport Reload from 'mdi-material-ui/Reload';\nimport { ErrorAlert, ErrorBoundary } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { PluginKindSelect } from '../PluginKindSelect';\nimport { PluginSpecEditor } from '../PluginSpecEditor';\nimport { PluginEditorProps, usePluginEditor } from './plugin-editor-api';\n\n/**\n * A combination `PluginKindSelect` and `PluginSpecEditor` component. This is meant for editing the `plugin` property\n * that's common in our JSON specs where a user selects a plugin `kind` and then edits the `spec` via that plugin's\n * editor component. It takes care of transitioning from one plugin kind to another \"all at once\" so that when the\n * plugin's kind changes, the spec is also changed at the same time so those options editor components don't see a\n * previous plugin's spec state. If you just want this behavior, but in a different UI layout from this, try the\n * `usePluginEditor` hook that powers this component.\n */\nexport function PluginEditor(props: PluginEditorProps): ReactElement {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { value, pluginTypes, pluginKindLabel, onChange: _, isReadonly, ...others } = props;\n const { pendingSelection, isLoading, error, onSelectionChange, onSpecChange } = usePluginEditor(props);\n return (\n <Box {...others}>\n <Box sx={{ display: 'flex', flexDirection: 'row' }}>\n <PluginKindSelect\n fullWidth={false}\n sx={{ mb: 2, minWidth: 120 }}\n margin=\"dense\"\n label={pluginKindLabel}\n pluginTypes={pluginTypes}\n disabled={isLoading}\n value={pendingSelection ? pendingSelection : value.selection}\n InputProps={{ readOnly: isReadonly }}\n error={!!error}\n helperText={error?.message}\n onChange={onSelectionChange}\n />\n\n <Button\n variant=\"contained\"\n sx={{ marginTop: 1.5, marginBottom: 1.5, paddingTop: 0.5, marginLeft: 'auto' }}\n startIcon={<Reload />}\n onClick={() => onSpecChange(value.spec)}\n >\n Run Query\n </Button>\n </Box>\n\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <PluginSpecEditor\n pluginSelection={value.selection}\n value={value.spec}\n onChange={onSpecChange}\n isReadonly={isReadonly}\n />\n </ErrorBoundary>\n </Box>\n );\n}\n"],"names":["Box","Button","Reload","ErrorAlert","ErrorBoundary","PluginKindSelect","PluginSpecEditor","usePluginEditor","PluginEditor","props","value","pluginTypes","pluginKindLabel","onChange","_","isReadonly","others","pendingSelection","isLoading","error","onSelectionChange","onSpecChange","sx","display","flexDirection","fullWidth","mb","minWidth","margin","label","disabled","selection","InputProps","readOnly","helperText","message","variant","marginTop","marginBottom","paddingTop","marginLeft","startIcon","onClick","spec","FallbackComponent","pluginSelection"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,EAAEC,MAAM,QAAQ,gBAAgB;AAC5C,OAAOC,YAAY,yBAAyB;AAC5C,SAASC,UAAU,EAAEC,aAAa,QAAQ,yBAAyB;AAEnE,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAA4BC,eAAe,QAAQ,sBAAsB;AAEzE;;;;;;;CAOC,GACD,OAAO,SAASC,aAAaC,KAAwB;IACnD,6DAA6D;IAC7D,MAAM,EAAEC,KAAK,EAAEC,WAAW,EAAEC,eAAe,EAAEC,UAAUC,CAAC,EAAEC,UAAU,EAAE,GAAGC,QAAQ,GAAGP;IACpF,MAAM,EAAEQ,gBAAgB,EAAEC,SAAS,EAAEC,KAAK,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGd,gBAAgBE;IAChG,qBACE,MAACT;QAAK,GAAGgB,MAAM;;0BACb,MAAChB;gBAAIsB,IAAI;oBAAEC,SAAS;oBAAQC,eAAe;gBAAM;;kCAC/C,KAACnB;wBACCoB,WAAW;wBACXH,IAAI;4BAAEI,IAAI;4BAAGC,UAAU;wBAAI;wBAC3BC,QAAO;wBACPC,OAAOjB;wBACPD,aAAaA;wBACbmB,UAAUZ;wBACVR,OAAOO,mBAAmBA,mBAAmBP,MAAMqB,SAAS;wBAC5DC,YAAY;4BAAEC,UAAUlB;wBAAW;wBACnCI,OAAO,CAAC,CAACA;wBACTe,YAAYf,OAAOgB;wBACnBtB,UAAUO;;kCAGZ,KAACnB;wBACCmC,SAAQ;wBACRd,IAAI;4BAAEe,WAAW;4BAAKC,cAAc;4BAAKC,YAAY;4BAAKC,YAAY;wBAAO;wBAC7EC,yBAAW,KAACvC;wBACZwC,SAAS,IAAMrB,aAAaX,MAAMiC,IAAI;kCACvC;;;;0BAKH,KAACvC;gBAAcwC,mBAAmBzC;0BAChC,cAAA,KAACG;oBACCuC,iBAAiBnC,MAAMqB,SAAS;oBAChCrB,OAAOA,MAAMiC,IAAI;oBACjB9B,UAAUQ;oBACVN,YAAYA;;;;;AAKtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginEditor/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './PluginEditor';\nexport * from './plugin-editor-api';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,iBAAiB;AAC/B,cAAc,sBAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginEditor/plugin-editor-api.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { BoxProps } from '@mui/material';\nimport { UnknownSpec, useEvent } from '@perses-dev/core';\nimport { useState, useRef, useEffect } from 'react';\nimport { produce } from 'immer';\nimport { PanelPlugin, PluginType } from '../../model';\nimport { PluginKindSelectProps } from '../PluginKindSelect/PluginKindSelect';\nimport { PluginSpecEditorProps } from '../PluginSpecEditor/PluginSpecEditor';\nimport { usePlugin, usePluginRegistry } from '../../runtime';\n\nexport interface PluginEditorSelection {\n type: PluginType;\n kind: string;\n}\n\nexport interface PluginEditorValue {\n selection: PluginEditorSelection;\n spec: UnknownSpec;\n}\n\n// Props on MUI Box that we don't want people to pass because we're either redefining them or providing them in\n// this component\ntype OmittedMuiProps = 'children' | 'value' | 'onChange';\n\nexport interface PluginEditorProps extends Omit<BoxProps, OmittedMuiProps> {\n pluginTypes: PluginType[];\n pluginKindLabel: string;\n value: PluginEditorValue;\n isReadonly?: boolean;\n onChange: (next: PluginEditorValue) => void;\n}\n\ntype PreviousSpecState = Record<string, Record<string, UnknownSpec>>;\ntype HideQueryEditorState = Record<string, boolean>;\n\n/**\n * Props needed by the usePluginEditor hook.\n */\nexport type UsePluginEditorProps = Pick<PluginEditorProps, 'pluginTypes' | 'value' | 'onChange'> & {\n onHideQueryEditorChange?: (isHidden: boolean) => void;\n};\n\n/**\n * Returns the state/handlers that power the `PluginEditor` component. Useful for custom components that want to provide\n * a different UI, but want the same behavior of changing `kind` and `spec` together on plugin kind changes. Also\n * remembers previous `spec` values that it's seen, allowing and restores those values if a user switches the plugin\n * kind back.\n */\nexport function usePluginEditor(props: UsePluginEditorProps): {\n pendingSelection?: PluginEditorSelection;\n isLoading: boolean;\n error: Error | null;\n onSelectionChange: (s: PluginEditorSelection) => void;\n onSpecChange: (next: UnknownSpec) => void;\n rememberCurrentSpecState: () => void;\n} {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const { pluginTypes, value, onHideQueryEditorChange = (): void => {} } = props; // setting onHideQueryEditorChange to empty function here because useEvent requires a function\n\n // Keep a stable reference, so we don't run the effect below when we don't need to\n const onChange = useEvent(props.onChange);\n const onHideQuery = useEvent(onHideQueryEditorChange);\n\n // The previous spec state for PluginType and kind and a helper function for remembering current values\n const prevSpecState = useRef<PreviousSpecState>({\n [value.selection.type]: { [value.selection.kind]: value.spec },\n });\n const rememberCurrentSpecState = useEvent(() => {\n let byPluginType = prevSpecState.current[value.selection.type];\n if (byPluginType === undefined) {\n byPluginType = {};\n prevSpecState.current[value.selection.type] = byPluginType;\n }\n byPluginType[value.selection.kind] = value.spec;\n });\n\n // The previous hide query state for each panel kind\n const hideQueryState = useRef<HideQueryEditorState>({\n [value.selection.kind]: false,\n });\n\n const { defaultPluginKinds } = usePluginRegistry();\n const defaultPluginType = pluginTypes[0];\n const defaultPluginKind = defaultPluginType ? defaultPluginKinds?.[defaultPluginType] : undefined;\n const defaultPluginSelection =\n defaultPluginType && defaultPluginKind\n ? {\n type: defaultPluginType,\n kind: defaultPluginKind,\n }\n : undefined;\n const initPendingSelection = !value.selection && defaultPluginSelection ? defaultPluginSelection : undefined;\n\n // When kind changes and we haven't loaded that plugin before, we will need to enter a \"pending\" state so that we\n // can generate proper initial spec values that match the new plugin kind\n const [pendingSelection, setPendingSelection] = useState<PluginEditorSelection | undefined>(initPendingSelection);\n\n // Take a default kind in case user write explicitly an empty kind in the initial value\n useEffect(() => {\n if (value.selection.kind === '') {\n value.selection.kind = defaultPluginKind || '';\n }\n }, [value.selection, defaultPluginKind]);\n\n const { data: plugin, isFetching, error } = usePlugin(pendingSelection?.type, pendingSelection?.kind || '');\n\n useEffect(() => {\n // Nothing to do if no new plugin kind is pending\n if (!pendingSelection) return;\n\n // Can't get spec value until we have a plugin\n if (plugin === undefined) return;\n\n // Fire an onChange to change to the pending kind with initial values from the plugin\n rememberCurrentSpecState();\n onChange({\n selection: pendingSelection,\n spec: plugin.createInitialOptions ? plugin.createInitialOptions() : {},\n });\n\n if (pendingSelection.type === 'Panel') {\n const panelPlugin = plugin as PanelPlugin;\n hideQueryState.current[pendingSelection.kind] = !!panelPlugin.hideQueryEditor;\n if (!!panelPlugin.hideQueryEditor !== hideQueryState.current[value.selection.kind]) {\n onHideQuery(!!panelPlugin.hideQueryEditor);\n }\n }\n setPendingSelection(undefined);\n }, [pendingSelection, plugin, rememberCurrentSpecState, onChange, onHideQuery, hideQueryState, value.selection]);\n\n /**\n * When the user tries to change the plugin kind, make sure we have the correct spec for that plugin kind before we\n * make the switch.\n */\n const onSelectionChange: PluginKindSelectProps['onChange'] = (nextSelection) => {\n // If we already have state for this plugin type/kind from a previous selection, just use it\n const previousState = prevSpecState.current[nextSelection.type]?.[nextSelection.kind];\n if (previousState !== undefined) {\n rememberCurrentSpecState();\n onChange({\n selection: nextSelection,\n spec: previousState,\n });\n } else {\n // Otherwise, kick off the async loading process\n setPendingSelection(nextSelection);\n }\n\n if (\n nextSelection.type === 'Panel' &&\n hideQueryState.current[nextSelection.kind] !== undefined &&\n hideQueryState.current[value.selection.kind] !== hideQueryState.current[nextSelection.kind]\n ) {\n onHideQuery(!!hideQueryState.current[nextSelection.kind]);\n }\n };\n\n /**\n * Spec changes are independent and always just set the spec state.\n */\n const onSpecChange: PluginSpecEditorProps['onChange'] = (next) => {\n onChange(\n produce(value, (draft) => {\n draft.spec = next;\n })\n );\n };\n\n return {\n pendingSelection,\n isLoading: isFetching,\n error,\n onSelectionChange,\n onSpecChange,\n rememberCurrentSpecState,\n };\n}\n"],"names":["useEvent","useState","useRef","useEffect","produce","usePlugin","usePluginRegistry","usePluginEditor","props","pluginTypes","value","onHideQueryEditorChange","onChange","onHideQuery","prevSpecState","selection","type","kind","spec","rememberCurrentSpecState","byPluginType","current","undefined","hideQueryState","defaultPluginKinds","defaultPluginType","defaultPluginKind","defaultPluginSelection","initPendingSelection","pendingSelection","setPendingSelection","data","plugin","isFetching","error","createInitialOptions","panelPlugin","hideQueryEditor","onSelectionChange","nextSelection","previousState","onSpecChange","next","draft","isLoading"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAAsBA,QAAQ,QAAQ,mBAAmB;AACzD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,SAAS,QAAQ,QAAQ;AACpD,SAASC,OAAO,QAAQ,QAAQ;AAIhC,SAASC,SAAS,EAAEC,iBAAiB,QAAQ,gBAAgB;AAkC7D;;;;;CAKC,GACD,OAAO,SAASC,gBAAgBC,KAA2B;IAQzD,gEAAgE;IAChE,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,0BAA0B,KAAa,CAAC,EAAE,GAAGH,OAAO,8FAA8F;IAE9K,kFAAkF;IAClF,MAAMI,WAAWZ,SAASQ,MAAMI,QAAQ;IACxC,MAAMC,cAAcb,SAASW;IAE7B,uGAAuG;IACvG,MAAMG,gBAAgBZ,OAA0B;QAC9C,CAACQ,MAAMK,SAAS,CAACC,IAAI,CAAC,EAAE;YAAE,CAACN,MAAMK,SAAS,CAACE,IAAI,CAAC,EAAEP,MAAMQ,IAAI;QAAC;IAC/D;IACA,MAAMC,2BAA2BnB,SAAS;QACxC,IAAIoB,eAAeN,cAAcO,OA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ect.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { MenuItem, TextField, TextFieldProps } from '@mui/material';\nimport { forwardRef, ReactElement, useCallback } from 'react';\nimport { PluginType } from '../../model';\nimport { useListPluginMetadata } from '../../runtime';\nimport { PluginEditorSelection } from '../PluginEditor';\n\nexport interface PluginKindSelectProps extends Omit<TextFieldProps, 'value' | 'onChange' | 'children'> {\n pluginTypes: PluginType[];\n value?: PluginEditorSelection;\n onChange?: (s: PluginEditorSelection) => void;\n}\n\n/**\n * Displays a MUI Select input for selecting a plugin's kind from a list of all the available plugins of some specific\n * plugin types. (e.g. \"Show a list of all the Panel plugins\", or \"Show a list of all the Variable plugins\", or \"Show\n * a list of all the TimeSeriesQuery, TraceQuery, ProfileQuery, and LogQuery plugins\").\n * The value of the select is the kind of the plugin, but you can also listen to the `onPluginTypeChange` event to know\n * when the user changes the plugin type (it fires at start for the default value.)\n */\nexport const PluginKindSelect = forwardRef((props: PluginKindSelectProps, ref): ReactElement => {\n const { pluginTypes, value: propValue, onChange, ...others } = props;\n const { data, isLoading } = useListPluginMetadata(pluginTypes);\n\n // Pass an empty value while options are still loading so MUI doesn't complain about us using an \"out of range\" value\n const value = !propValue || isLoading ? '' : selectionToOptionValue(propValue);\n\n const handleChange = (event: { target: { value: string } }): void => {\n onChange?.(optionValueToSelection(event.target.value));\n };\n\n const renderValue = useCallback(\n (selected: unknown) => {\n if (selected === '') {\n return '';\n }\n const selectedValue = optionValueToSelection(selected as string);\n return data?.find((v) => v.kind === selectedValue.type && v.spec.name === selectedValue.kind)?.spec.display.name;\n },\n [data]\n );\n\n // TODO: Does this need a loading indicator of some kind?\n return (\n <TextField\n select\n inputRef={ref}\n {...others}\n value={value}\n aria-label={value}\n onChange={handleChange}\n SelectProps={{ renderValue }}\n data-testid=\"plugin-kind-select\"\n >\n {isLoading && <MenuItem value=\"\">Loading...</MenuItem>}\n {data?.map((metadata) => (\n <MenuItem\n data-testid=\"option\"\n key={metadata.kind + metadata.spec.name}\n value={selectionToOptionValue({ type: metadata.kind, kind: metadata.spec.name })}\n >\n {metadata.spec.display.name}\n </MenuItem>\n ))}\n </TextField>\n );\n});\nPluginKindSelect.displayName = 'PluginKindSelect';\n\n// Delimiter used to stringify/parse option values\nconst OPTION_VALUE_DELIMITER = '_____';\n\n/**\n * Given a PluginEditorSelection,\n * returns a string value like `{type}_____{kind}` that can be used as a Select input value.\n * @param selector\n */\nfunction selectionToOptionValue(selector: PluginEditorSelection): string {\n return [selector.type, selector.kind].join(OPTION_VALUE_DELIMITER);\n}\n\n/**\n * Given an option value name like `{type}_____{kind}`,\n * returns a PluginEditorSelection to be used by the query data model.\n * @param optionValue\n */\nfunction optionValueToSelection(optionValue: string): PluginEditorSelection {\n const words = optionValue.split(OPTION_VALUE_DELIMITER);\n const type = words[0] as PluginType | undefined;\n const kind = words[1];\n if (type === undefined || kind === undefined) {\n throw new Error('Invalid optionValue string');\n }\n return {\n type,\n kind,\n };\n}\n"],"names":["MenuItem","TextField","forwardRef","useCallback","useListPluginMetadata","PluginKindSelect","props","ref","pluginTypes","value","propValue","onChange","others","data","isLoading","selectionToOptionValue","handleChange","event","optionValueToSelection","target","renderValue","selected","selectedValue","find","v","kind","type","spec","name","display","select","inputRef","aria-label","SelectProps","data-testid","map","metadata","displayName","OPTION_VALUE_DELIMITER","selector","join","optionValue","words","split","undefined","Error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE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,IAAI;mBAHtBQ,SAASX,IAAI,GAAGW,SAAST,IAAI,CAACC,IAAI;;;AAQjD,GAAG;AACHvB,iBAAiBgC,WAAW,GAAG;AAE/B,kDAAkD;AAClD,MAAMC,yBAAyB;AAE/B;;;;CAIC,GACD,SAASvB,uBAAuBwB,QAA+B;IAC7D,OAAO;QAACA,SAASb,IAAI;QAAEa,SAASd,IAAI;KAAC,CAACe,IAAI,CAACF;AAC7C;AAEA;;;;CAIC,GACD,SAASpB,uBAAuBuB,WAAmB;IACjD,MAAMC,QAAQD,YAAYE,KAAK,CAACL;IAChC,MAAMZ,OAAOgB,KAAK,CAAC,EAAE;IACrB,MAAMjB,OAAOiB,KAAK,CAAC,EAAE;IACrB,IAAIhB,SAASkB,aAAanB,SAASmB,WAAW;QAC5C,MAAM,IAAIC,MAAM;IAClB;IACA,OAAO;QACLnB;QACAD;IACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginKindSelect/index.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './PluginKindSelect';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginRegistry/PluginRegistry.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec, useEvent } from '@perses-dev/core';\nimport { useRef, useCallback, useMemo, ReactNode, ReactElement } from 'react';\nimport {\n PluginModuleResource,\n PluginType,\n PluginImplementation,\n Plugin,\n PluginLoader,\n DefaultPluginKinds,\n} from '../../model';\nimport { PluginRegistryContext } from '../../runtime';\nimport { usePluginIndexes, getTypeAndKindKey } from './plugin-indexes';\n\nexport interface PluginRegistryProps {\n pluginLoader: PluginLoader;\n defaultPluginKinds?: DefaultPluginKinds;\n children?: ReactNode;\n}\n\n/**\n * PluginRegistryContext provider that keeps track of all available plugins and provides an API for getting them or\n * querying the metadata about them.\n */\nexport function PluginRegistry(props: PluginRegistryProps): ReactElement {\n const {\n pluginLoader: { getInstalledPlugins, importPluginModule },\n children,\n defaultPluginKinds,\n } = props;\n\n const getPluginIndexes = usePluginIndexes(getInstalledPlugins);\n\n // De-dupe calls to import plugin modules\n const importCache = useRef(new Map<PluginModuleResource, Promise<unknown>>());\n\n // Do useEvent here since this accesses the importPluginModule prop and we want a stable reference to it for the\n // callback below\n const loadPluginModule = useEvent((resource: PluginModuleResource) => {\n let request = importCache.current.get(resource);\n if (request === undefined) {\n request = importPluginModule(resource);\n importCache.current.set(resource, request);\n\n // Remove failed requests from the cache so they can potentially be retried\n request.catch(() => importCache.current.delete(resource));\n }\n return request;\n });\n\n const getPlugin = useCallback(\n async <T extends PluginType>(kind: T, name: string): Promise<PluginImplementation<T>> => {\n // Get the indexes of the installed plugins\n const pluginIndexes = await getPluginIndexes();\n\n // Figure out what module the plugin is in by looking in the index\n const typeAndKindKey = getTypeAndKindKey(kind, name);\n const resource = pluginIndexes.pluginResourcesByNameAndKind.get(typeAndKindKey);\n if (resource === undefined) {\n throw new Error(`A ${name} plugin for kind '${kind}' is not installed`);\n }\n\n // Treat the plugin module as a bunch of named exports that have plugins\n const pluginModule = (await loadPluginModule(resource)) as Record<string, Plugin<UnknownSpec>>;\n\n // We currently assume that plugin modules will have named exports that match the kinds they handle\n const plugin = pluginModule[name];\n if (plugin === undefined) {\n throw new Error(\n `The ${name} plugin for kind '${kind}' is missing from the ${resource.metadata.name} plugin module`\n );\n }\n\n return plugin as PluginImplementation<T>;\n },\n [getPluginIndexes, loadPluginModule]\n );\n\n const listPluginMetadata = useCallback(\n async (pluginTypes: PluginType[]) => {\n const pluginIndexes = await getPluginIndexes();\n return pluginTypes.flatMap((type) => pluginIndexes.pluginMetadataByKind.get(type) ?? []);\n },\n [getPluginIndexes]\n );\n\n // Create the registry's context value and render\n const context = useMemo(\n () => ({ getPlugin, listPluginMetadata, defaultPluginKinds }),\n [getPlugin, listPluginMetadata, defaultPluginKinds]\n );\n return <PluginRegistryContext.Provider value={context}>{children}</PluginRegistryContext.Provider>;\n}\n"],"names":["useEvent","useRef","useCallback","useMemo","PluginRegistryContext","usePluginIndexes","getTypeAndKindKey","PluginRegistry","props","pluginLoader","getInstalledPlugins","importPluginModule","children","defaultPluginKinds","getPluginIndexes","importCache","Map","loadPluginModule","resource","request","current","get","undefined","set","catch","delete","getPlugin","kind","name","pluginIndexes","typeAndKindKey","pluginResourcesByNameAndKind","Error","pluginModule","plugin","metadata","listPluginMetadata","pluginTypes","flatMap","type","pluginMetadataByKind","context","Provider","value"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAsBA,QAAQ,QAA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EAAED,KAAK,sBAAsB,EAAET,SAASiB,QAAQ,CAACP,IAAI,CAAC,cAAc,CAAC;QAEvG;QAEA,OAAOM;IACT,GACA;QAACpB;QAAkBG;KAAiB;IAGtC,MAAMmB,qBAAqBlC,YACzB,OAAOmC;QACL,MAAMR,gBAAgB,MAAMf;QAC5B,OAAOuB,YAAYC,OAAO,CAAC,CAACC,OAASV,cAAcW,oBAAoB,CAACnB,GAAG,CAACkB,SAAS,EAAE;IACzF,GACA;QAACzB;KAAiB;IAGpB,iDAAiD;IACjD,MAAM2B,UAAUtC,QACd,IAAO,CAAA;YAAEuB;YAAWU;YAAoBvB;QAAmB,CAAA,GAC3D;QAACa;QAAWU;QAAoBvB;KAAmB;IAErD,qBAAO,KAACT,sBAAsBsC,QAAQ;QAACC,OAAOF;kBAAU7B;;AAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginRegistry/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './PluginRegistry';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginRegistry/plugin-indexes.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useEvent } from '@perses-dev/core';\nimport { useCallback, useRef } from 'react';\nimport { PluginLoader, PluginMetadataWithModule, PluginModuleResource, PluginType } from '../../model';\n\nexport interface PluginIndexes {\n // Plugin resources by plugin type and kind (i.e. look up what module a plugin type and kind is in)\n pluginResourcesByNameAndKind: Map<string, PluginModuleResource>;\n // Plugin metadata by plugin type\n pluginMetadataByKind: Map<PluginType, PluginMetadataWithModule[]>;\n}\n\n/**\n * Returns an async callback for getting indexes of the installed plugin data.\n */\nexport function usePluginIndexes(\n getInstalledPlugins: PluginLoader['getInstalledPlugins']\n): () => Promise<PluginIndexes> {\n // Creates indexes from the installed plugins data (does useEvent because this accesses the getInstalledPlugins prop\n // and we want a stable reference for the callback below)\n const createPluginIndexes = useEvent(async (): Promise<PluginIndexes> => {\n const installedPlugins = await getInstalledPlugins();\n\n // Create the two indexes from the installed plugins\n const pluginResourcesByNameAndKind = new Map<string, PluginModuleResource>();\n const pluginMetadataByKind = new Map<PluginType, PluginMetadataWithModule[]>();\n\n for (const resource of installedPlugins) {\n for (const pluginMetadata of resource.spec.plugins) {\n const {\n kind,\n spec: { name },\n } = pluginMetadata;\n\n // Index the plugin by type and kind to point at the module that contains it\n const key = getTypeAndKindKey(kind, name);\n if (pluginResourcesByNameAndKind.has(key)) {\n console.warn(`Got more than one ${kind} plugin for kind ${name}`);\n }\n pluginResourcesByNameAndKind.set(key, resource);\n\n // Index the metadata by plugin type\n let list = pluginMetadataByKind.get(kind);\n if (list === undefined) {\n list = [];\n pluginMetadataByKind.set(kind, list);\n }\n list.push({ ...pluginMetadata, module: resource.metadata });\n }\n }\n\n return {\n pluginResourcesByNameAndKind,\n pluginMetadataByKind,\n };\n });\n\n // De-dupe creating plugin indexes (i.e. requests to get installed plugins)\n const pluginIndexesCache = useRef<Promise<PluginIndexes> | undefined>(undefined);\n const getPluginIndexes = useCallback(() => {\n let request = pluginIndexesCache.current;\n if (request === undefined) {\n request = createPluginIndexes();\n pluginIndexesCache.current = request;\n\n // Remove failed requests from the cache so they can potentially be retried\n request.catch(() => pluginIndexesCache.current === undefined);\n }\n return request;\n }, [createPluginIndexes]);\n\n return getPluginIndexes;\n}\n\n/**\n * Gets a unique key for a plugin type/kind that can be used as a cache key.\n */\nexport function getTypeAndKindKey(kind: PluginType, name: string): string {\n return `${kind}:${name}`;\n}\n"],"names":["useEvent","useCallback","useRef","usePluginIndexes","getInstalledPlugins","createPluginIndexes","installedPlugins","pluginResourcesByNameAndKind","Map","pluginMetadataByKind","resource","pluginMetadata","spec","plugins","kind","name","key","getTypeAndKindKey","has","console","warn","set","list","get","undefined","push","module","metadata","pluginIndexesCache","getPluginIndexes","request","current","catch"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,WAAW,EAAEC,MAAM,QAAQ,QAAQ;AAU5C;;CAEC,GACD,OAAO,SAASC,iBACdC,mBAAwD;IAExD,oHAAoH;IACpH,yDAAyD;IACzD,MAAMC,sBAAsBL,SAAS;QACnC,MAAMM,mBAAmB,MAAMF;QAE/B,oDAAoD;QACpD,MAAMG,+BAA+B,IAAIC;QACzC,MAAMC,uBAAuB,IAAID;QAEjC,KAAK,MAAME,YAAYJ,iBAAkB;YACvC,KAAK,MAAMK,kBAAkBD,SAASE,IAAI,CAACC,OAAO,CAAE;gBAClD,MAAM,EACJC,IAAI,EACJF,MAAM,EAAEG,IAAI,EAAE,EACf,GAAGJ;gBAEJ,4EAA4E;gBAC5E,MAAMK,MAAMC,kBAAkBH,MAAMC;gBACpC,IAAIR,6BAA6BW,GAAG,CAACF,MAAM;oBACzCG,QAAQC,IAAI,CAAC,CAAC,kBAAkB,EAAEN,KAAK,iBAAiB,EAAEC,MAAM;gBAClE;gBACAR,6BAA6Bc,GAAG,CAACL,KAAKN;gBAEtC,oCAAoC;gBACpC,IAAIY,OAAOb,qBAAqBc,GAAG,CAACT;gBACpC,IAAIQ,SAASE,WAAW;oBACtBF,OAAO,EAAE;oBACTb,qBAAqBY,GAAG,CAACP,MAAMQ;gBACjC;gBACAA,KAAKG,IAAI,CAAC;oBAAE,GAAGd,cAAc;oBAAEe,QAAQhB,SAASiB,QAAQ;gBAAC;YAC3D;QACF;QAEA,OAAO;YACLpB;YACAE;QACF;IACF;IAEA,2EAA2E;IAC3E,MAAMmB,qBAAqB1B,OAA2CsB;IACtE,MAAMK,mBAAmB5B,YAAY;QACnC,IAAI6B,UAAUF,mBAAmBG,OAAO;QACxC,IAAID,YAAYN,WAAW;YACzBM,UAAUzB;YACVuB,mBAAmBG,OAAO,GAAGD;YAE7B,2EAA2E;YAC3EA,QAAQE,KAAK,CAAC,IAAMJ,mBAAmBG,OAAO,KAAKP;QACrD;QACA,OAAOM;IACT,GAAG;QAACzB;KAAoB;IAExB,OAAOwB;AACT;AAEA;;CAEC,GACD,OAAO,SAASZ,kBAAkBH,IAAgB,EAAEC,IAAY;IAC9D,OAAO,GAAGD,KAAK,CAAC,EAAEC,MAAM;AAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginSpecEditor/PluginSpecEditor.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ErrorAlert } from '@perses-dev/components';\nimport { UnknownSpec } from '@perses-dev/core';\nimport { ReactElement } from 'react';\nimport { OptionsEditorProps } from '../../model';\nimport { usePlugin } from '../../runtime';\nimport { PluginEditorSelection } from '../PluginEditor';\n\nexport interface PluginSpecEditorProps extends OptionsEditorProps<UnknownSpec> {\n pluginSelection: PluginEditorSelection;\n isEditor?: boolean;\n}\n\nexport function PluginSpecEditor(props: PluginSpecEditorProps): ReactElement | null {\n const {\n pluginSelection: { type: pluginType, kind: pluginKind },\n ...others\n } = props;\n const { data: plugin, isLoading, error } = usePlugin(pluginType, pluginKind);\n\n if (error) {\n return <ErrorAlert error={error} />;\n }\n\n // TODO: Proper loading indicator\n if (isLoading) {\n return null;\n }\n\n if (plugin === undefined) {\n throw new Error(`Missing implementation for ${pluginType} plugin with kind '${pluginKind}'`);\n }\n\n if (pluginType === 'Panel') {\n throw new Error('This editor should not be used for panel type. Please use Panel Spec Editor instead.');\n }\n\n const { OptionsEditorComponent } = plugin;\n\n if (OptionsEditorComponent !== undefined) {\n return <OptionsEditorComponent {...others} />;\n }\n\n return null;\n}\n"],"names":["ErrorAlert","usePlugin","PluginSpecEditor","props","pluginSelection","type","pluginType","kind","pluginKind","others","data","plugin","isLoading","error","undefined","Error","OptionsEditorComponent"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,UAAU,QAAQ,yBAAyB;AAIpD,SAASC,SAAS,QAAQ,gBAAgB;AAQ1C,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EACJC,iBAAiB,EAAEC,MAAMC,UAAU,EAAEC,MAAMC,UAAU,EAAE,EACvD,GAAGC,QACJ,GAAGN;IACJ,MAAM,EAAEO,MAAMC,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGZ,UAAUK,YAAYE;IAEjE,IAAIK,OAAO;QACT,qBAAO,KAACb;YAAWa,OAAOA;;IAC5B;IAEA,iCAAiC;IACjC,IAAID,WAAW;QACb,OAAO;IACT;IAEA,IAAID,WAAWG,WAAW;QACxB,MAAM,IAAIC,MAAM,CAAC,2BAA2B,EAAET,WAAW,mBAAmB,EAAEE,WAAW,CAAC,CAAC;IAC7F;IAEA,IAAIF,eAAe,SAAS;QAC1B,MAAM,IAAIS,MAAM;IAClB;IAEA,MAAM,EAAEC,sBAAsB,EAAE,GAAGL;IAEnC,IAAIK,2BAA2BF,WAAW;QACxC,qBAAO,KAACE;YAAwB,GAAGP,MAAM;;IAC3C;IAEA,OAAO;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginSpecEditor/index.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './PluginSpecEditor';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/ProjectSelect.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Select, SelectProps, MenuItem, Stack, ListItemText } from '@mui/material';\nimport { ProjectResource } from '@perses-dev/core';\nimport { ReactElement } from 'react';\nimport { useProjectList } from '../context';\n\n// Props on MUI Select that we don't want people to pass because we're either redefining them or providing them in\n// this component\ntype OmittedMuiProps = 'children' | 'value' | 'onChange';\n\nexport interface ProjectSelectProps extends Omit<SelectProps<string>, OmittedMuiProps> {\n onChange: (next: ProjectResource) => void;\n value: ProjectResource;\n}\n\n/**\n * Displays a MUI input for selecting a Project of a particular kind. Note: The 'value' and `onChange` handler for\n * the input deal with a `ProjectSelector`.\n */\nexport function ProjectSelect(props: ProjectSelectProps): ReactElement {\n const { onChange, value, ...others } = props;\n\n const { data, isLoading } = useProjectList();\n\n // While loading available values, just use an empty string so MUI select doesn't warn about values out of range\n const optionValue = isLoading ? '' : projectToOptionValue(value);\n\n // When the user makes a selection, convert the string option value back to a DatasourceSelector\n const handleChange: SelectProps<string>['onChange'] = (e) => {\n const next = optionValueToSelector(e.target.value);\n onChange(next);\n };\n\n // TODO:\n // - Does this need a loading indicator of some kind?\n // - The group's edit link is not clickable once selected.\n // - The group's edit link is disabled if datasource is overridden.\n // Ref: https://github.com/mui/material-ui/issues/36572\n return (\n <Select {...others} value={optionValue} onChange={handleChange}>\n <MenuItem value=\"none\">\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" width=\"100%\" height={32}>\n <ListItemText>None</ListItemText>\n </Stack>\n </MenuItem>\n {data?.map((project: ProjectResource) => [\n <MenuItem key={project.metadata.name} value={project.metadata.name}>\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" width=\"100%\" height={32}>\n <ListItemText>{project.metadata.name}</ListItemText>\n </Stack>\n </MenuItem>,\n ])}\n </Select>\n );\n}\n\n/**\n * Given a ProjectSelectItemSelector,\n * returns a string value that can be used as a Select input value.\n * @param selector\n */\nfunction projectToOptionValue(project: ProjectResource): string {\n return project.metadata.name ?? 'none';\n}\n\n/**\n * Given an option value name,\n * returns a ProjectResource to be used by the query data model.\n * @param optionValue\n */\nfunction optionValueToSelector(optionValue: string): ProjectResource {\n return {\n kind: 'Project',\n metadata: {\n name: optionValue,\n },\n spec: {},\n };\n}\n"],"names":["Select","MenuItem","Stack","ListItemText","useProjectList","ProjectSelect","props","onChange","value","others","data","isLoading","optionValue","projectToOptionValue","handleChange","e","next","optionValueToSelector","target","direction","alignItems","justifyContent","width","height","map","project","metadata","name","kind","spec"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,EAAeC,QAAQ,EAAEC,KAAK,EAAEC,YAAY,QAAQ,gBAAgB;AAGnF,SAASC,cAAc,QAAQ,aAAa;AAW5C;;;CAGC,GACD,OAAO,SAASC,cAAcC,KAAyB;IACrD,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGC,QAAQ,GAAGH;IAEvC,MAAM,EAAEI,IAAI,EAAEC,SAAS,EAAE,GAAGP;IAE5B,gHAAgH;IAChH,MAAMQ,cAAcD,YAAY,KAAKE,qBAAqBL;IAE1D,gGAAgG;IAChG,MAAMM,eAAgD,CAACC;QACrD,MAAMC,OAAOC,sBAAsBF,EAAEG,MAAM,CAACV,KAAK;QACjDD,SAASS;IAC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