@perses-dev/plugin-system 0.53.0-rc.1 → 0.53.0-rc.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/cjs/components/CalculationSelector/CalculationSelector.js +1 -1
- package/dist/cjs/components/CalculationSelector/index.js +1 -1
- package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +1 -1
- package/dist/cjs/components/DatasourceEditorForm/index.js +1 -1
- package/dist/cjs/components/DatasourceSelect/DatasourceSelect.js +1 -1
- package/dist/cjs/components/DatasourceSelect/index.js +1 -1
- package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +1 -1
- package/dist/cjs/components/HTTPSettingsEditor/index.js +1 -1
- package/dist/cjs/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +1175 -0
- package/dist/cjs/components/ItemSelectionActionsOptionsEditor/index.js +30 -0
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +1 -1
- package/dist/cjs/components/LegendOptionsEditor/index.js +1 -1
- package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +1 -1
- package/dist/cjs/components/MetricLabelInput/index.js +1 -1
- package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
- package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +1 -1
- package/dist/cjs/components/MultiQueryEditor/index.js +1 -1
- package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +1 -1
- package/dist/cjs/components/OptionsEditorRadios/index.js +1 -1
- package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
- package/dist/cjs/components/OptionsEditorTabPanel/index.js +1 -1
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +1 -1
- package/dist/cjs/components/OptionsEditorTabs/index.js +1 -1
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +1 -1
- package/dist/cjs/components/PanelSpecEditor/index.js +1 -1
- package/dist/cjs/components/PluginEditor/PluginEditor.js +1 -1
- package/dist/cjs/components/PluginEditor/index.js +1 -1
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +1 -1
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +1 -1
- package/dist/cjs/components/PluginKindSelect/index.js +1 -1
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +1 -1
- package/dist/cjs/components/PluginRegistry/index.js +1 -1
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +1 -1
- package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
- package/dist/cjs/components/PluginSpecEditor/index.js +1 -1
- package/dist/cjs/components/SelectionOptionsEditor/SelectionOptionsEditor.js +43 -0
- package/dist/cjs/components/SelectionOptionsEditor/index.js +30 -0
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +11 -3
- package/dist/cjs/components/TimeRangeControls/index.js +1 -1
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +1 -1
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +1 -1
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +1 -1
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
- package/dist/cjs/components/Variables/index.js +1 -1
- package/dist/cjs/components/Variables/variable-model.js +1 -1
- package/dist/cjs/components/index.js +2 -1
- package/dist/cjs/constants/index.js +1 -1
- package/dist/cjs/constants/user-interface-text.js +1 -1
- package/dist/cjs/context/ValidationProvider.js +1 -1
- package/dist/cjs/context/index.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/model/datasource.js +1 -1
- package/dist/cjs/model/explore.js +1 -1
- package/dist/cjs/model/index.js +1 -1
- package/dist/cjs/model/legend.js +1 -1
- package/dist/cjs/model/log-queries.js +1 -1
- package/dist/cjs/model/panels.js +1 -1
- package/dist/cjs/model/plugin-base.js +1 -1
- package/dist/cjs/model/plugin-loading.js +1 -1
- package/dist/cjs/model/plugins.js +1 -1
- package/dist/cjs/model/profile-queries.js +1 -1
- package/dist/cjs/model/time-series-queries.js +1 -1
- package/dist/cjs/model/trace-queries.js +1 -1
- package/dist/cjs/model/variables.js +1 -1
- package/dist/cjs/remote/PersesPlugin.types.js +1 -1
- package/dist/cjs/remote/PluginLoaderComponent.js +13 -1
- package/dist/cjs/remote/PluginRuntime.js +13 -1
- package/dist/cjs/remote/index.js +1 -1
- package/dist/cjs/remote/remotePluginLoader.js +1 -1
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +1 -1
- package/dist/cjs/runtime/DataQueriesProvider/index.js +1 -1
- package/dist/cjs/runtime/DataQueriesProvider/model.js +1 -1
- package/dist/cjs/runtime/QueryCountProvider.js +1 -1
- package/dist/cjs/runtime/RouterProvider.js +1 -1
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviders.js +7 -2
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +1 -1
- package/dist/cjs/runtime/TimeRangeProvider/index.js +1 -1
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +28 -1
- package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +1 -1
- package/dist/cjs/runtime/UsageMetricsProvider.js +1 -1
- package/dist/cjs/runtime/builtin-variables.js +1 -1
- package/dist/cjs/runtime/datasources.js +1 -1
- package/dist/cjs/runtime/index.js +2 -1
- package/dist/cjs/runtime/item-actions.js +303 -0
- package/dist/cjs/runtime/log-queries.js +1 -1
- package/dist/cjs/runtime/plugin-registry.js +1 -1
- package/dist/cjs/runtime/profile-queries.js +1 -1
- package/dist/cjs/runtime/time-series-queries.js +1 -1
- package/dist/cjs/runtime/trace-queries.js +1 -1
- package/dist/cjs/runtime/utils.js +1 -1
- package/dist/cjs/runtime/variables.js +6 -6
- package/dist/cjs/test/index.js +1 -1
- package/dist/cjs/test/mock-data.js +1 -1
- package/dist/cjs/test/render-hook.js +1 -1
- package/dist/cjs/test/render.js +1 -1
- package/dist/cjs/test/setup-tests.js +1 -1
- package/dist/cjs/test/test-plugins/bert/index.js +1 -1
- package/dist/cjs/test/test-plugins/ernie/index.js +1 -1
- package/dist/cjs/test/test-plugins/index.js +1 -1
- package/dist/cjs/test/utils.js +1 -1
- package/dist/cjs/test-utils/index.js +1 -1
- package/dist/cjs/test-utils/mock-plugin-registry.js +1 -1
- package/dist/cjs/utils/action.js +1 -1
- package/dist/cjs/utils/event.js +1 -1
- package/dist/cjs/utils/index.js +1 -1
- package/dist/cjs/utils/variables.js +9 -146
- package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
- package/dist/components/CalculationSelector/index.js +1 -1
- package/dist/components/CalculationSelector/index.js.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/DatasourceEditorForm/index.js +1 -1
- package/dist/components/DatasourceEditorForm/index.js.map +1 -1
- package/dist/components/DatasourceSelect/DatasourceSelect.js +1 -1
- package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -1
- package/dist/components/DatasourceSelect/index.js +1 -1
- package/dist/components/DatasourceSelect/index.js.map +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
- package/dist/components/HTTPSettingsEditor/index.js +1 -1
- package/dist/components/HTTPSettingsEditor/index.js.map +1 -1
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts +49 -0
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts.map +1 -0
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +1154 -0
- package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -0
- package/dist/components/ItemSelectionActionsOptionsEditor/index.d.ts +2 -0
- package/dist/components/ItemSelectionActionsOptionsEditor/index.d.ts.map +1 -0
- package/dist/components/ItemSelectionActionsOptionsEditor/index.js +15 -0
- package/dist/components/ItemSelectionActionsOptionsEditor/index.js.map +1 -0
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/LegendOptionsEditor/index.js +1 -1
- package/dist/components/LegendOptionsEditor/index.js.map +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.js +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -1
- package/dist/components/MetricLabelInput/index.js +1 -1
- package/dist/components/MetricLabelInput/index.js.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js +1 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
- package/dist/components/MultiQueryEditor/index.js +1 -1
- package/dist/components/MultiQueryEditor/index.js.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
- package/dist/components/OptionsEditorRadios/index.js +1 -1
- package/dist/components/OptionsEditorRadios/index.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/index.js +1 -1
- package/dist/components/OptionsEditorTabPanel/index.js.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/OptionsEditorTabs/index.js +1 -1
- package/dist/components/OptionsEditorTabs/index.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PanelSpecEditor/index.js +1 -1
- package/dist/components/PanelSpecEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +1 -1
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/index.js +1 -1
- package/dist/components/PluginEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginKindSelect/index.js +1 -1
- package/dist/components/PluginKindSelect/index.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/index.js +1 -1
- package/dist/components/PluginRegistry/index.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/PluginSpecEditor/index.js +1 -1
- package/dist/components/PluginSpecEditor/index.js.map +1 -1
- package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts +10 -0
- package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts.map +1 -0
- package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js +35 -0
- package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js.map +1 -0
- package/dist/components/SelectionOptionsEditor/index.d.ts +2 -0
- package/dist/components/SelectionOptionsEditor/index.d.ts.map +1 -0
- package/dist/components/SelectionOptionsEditor/index.js +15 -0
- package/dist/components/SelectionOptionsEditor/index.js.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +4 -2
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js +12 -4
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
- package/dist/components/TimeRangeControls/index.js +1 -1
- package/dist/components/TimeRangeControls/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/index.js +1 -1
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/components/Variables/variable-model.js +1 -1
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -1
- package/dist/components/index.js.map +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/user-interface-text.js +1 -1
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/ValidationProvider.js +1 -1
- package/dist/context/ValidationProvider.js.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/datasource.js +1 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/explore.js +1 -1
- package/dist/model/explore.js.map +1 -1
- package/dist/model/index.js +1 -1
- package/dist/model/index.js.map +1 -1
- package/dist/model/legend.js +1 -1
- package/dist/model/legend.js.map +1 -1
- package/dist/model/log-queries.js +1 -1
- package/dist/model/log-queries.js.map +1 -1
- package/dist/model/panels.js +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugin-base.js +1 -1
- package/dist/model/plugin-base.js.map +1 -1
- package/dist/model/plugin-loading.js +1 -1
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/model/plugins.js +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/model/profile-queries.js +1 -1
- package/dist/model/profile-queries.js.map +1 -1
- package/dist/model/time-series-queries.js +1 -1
- package/dist/model/time-series-queries.js.map +1 -1
- package/dist/model/trace-queries.js +1 -1
- package/dist/model/trace-queries.js.map +1 -1
- package/dist/model/variables.d.ts +4 -7
- package/dist/model/variables.d.ts.map +1 -1
- package/dist/model/variables.js +1 -1
- package/dist/model/variables.js.map +1 -1
- package/dist/remote/PersesPlugin.types.js +1 -1
- package/dist/remote/PersesPlugin.types.js.map +1 -1
- package/dist/remote/PluginLoaderComponent.d.ts.map +1 -1
- package/dist/remote/PluginLoaderComponent.js +13 -1
- package/dist/remote/PluginLoaderComponent.js.map +1 -1
- package/dist/remote/PluginRuntime.d.ts.map +1 -1
- package/dist/remote/PluginRuntime.js +13 -1
- package/dist/remote/PluginRuntime.js.map +1 -1
- package/dist/remote/index.js +1 -1
- package/dist/remote/index.js.map +1 -1
- package/dist/remote/remotePluginLoader.js +1 -1
- package/dist/remote/remotePluginLoader.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/index.js +1 -1
- package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +1 -1
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/QueryCountProvider.js +1 -1
- package/dist/runtime/QueryCountProvider.js.map +1 -1
- package/dist/runtime/RouterProvider.js +1 -1
- package/dist/runtime/RouterProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js +8 -3
- package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/index.js +1 -1
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts +11 -0
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +26 -2
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.js +1 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
- package/dist/runtime/UsageMetricsProvider.js +1 -1
- package/dist/runtime/UsageMetricsProvider.js.map +1 -1
- package/dist/runtime/builtin-variables.js +1 -1
- package/dist/runtime/builtin-variables.js.map +1 -1
- package/dist/runtime/datasources.js +1 -1
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +2 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/item-actions.d.ts +35 -0
- package/dist/runtime/item-actions.d.ts.map +1 -0
- package/dist/runtime/item-actions.js +300 -0
- package/dist/runtime/item-actions.js.map +1 -0
- package/dist/runtime/log-queries.js +1 -1
- package/dist/runtime/log-queries.js.map +1 -1
- package/dist/runtime/plugin-registry.js +1 -1
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/profile-queries.js +1 -1
- package/dist/runtime/profile-queries.js.map +1 -1
- package/dist/runtime/time-series-queries.js +1 -1
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.js +1 -1
- package/dist/runtime/trace-queries.js.map +1 -1
- package/dist/runtime/utils.js +1 -1
- package/dist/runtime/utils.js.map +1 -1
- package/dist/runtime/variables.d.ts +2 -18
- package/dist/runtime/variables.d.ts.map +1 -1
- package/dist/runtime/variables.js +3 -3
- package/dist/runtime/variables.js.map +1 -1
- package/dist/test/index.js +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/mock-data.js +1 -1
- package/dist/test/mock-data.js.map +1 -1
- package/dist/test/render-hook.js +1 -1
- package/dist/test/render-hook.js.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/test-plugins/bert/index.js +1 -1
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test/test-plugins/ernie/index.js +1 -1
- package/dist/test/test-plugins/ernie/index.js.map +1 -1
- package/dist/test/test-plugins/index.js +1 -1
- package/dist/test/test-plugins/index.js.map +1 -1
- package/dist/test/utils.js +1 -1
- package/dist/test/utils.js.map +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +1 -1
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/dist/utils/action.js +1 -1
- package/dist/utils/action.js.map +1 -1
- package/dist/utils/event.js +1 -1
- package/dist/utils/event.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/variables.d.ts +2 -30
- package/dist/utils/variables.d.ts.map +1 -1
- package/dist/utils/variables.js +3 -144
- package/dist/utils/variables.js.map +1 -1
- package/package.json +3 -3
package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.tsx"],"sourcesContent":["// Copyright 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 {\n Box,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n FormControl,\n FormControlLabel,\n FormLabel,\n IconButton,\n InputLabel,\n MenuItem,\n Radio,\n RadioGroup,\n Select,\n Stack,\n Switch,\n SwitchProps,\n TextField,\n Typography,\n} from '@mui/material';\nimport { SelectChangeEvent } from '@mui/material/Select';\nimport {\n DragAndDropElement,\n DragButton,\n handleMoveDown,\n handleMoveUp,\n InfoTooltip,\n JSONEditor,\n OptionsEditorControl,\n OptionsEditorGroup,\n useDragAndDropMonitor,\n} from '@perses-dev/components';\nimport AlertIcon from 'mdi-material-ui/Alert';\nimport CheckIcon from 'mdi-material-ui/Check';\nimport ChevronDown from 'mdi-material-ui/ChevronDown';\nimport ChevronRight from 'mdi-material-ui/ChevronRight';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport SettingsIcon from 'mdi-material-ui/Cog';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport DownloadIcon from 'mdi-material-ui/Download';\nimport InfoIcon from 'mdi-material-ui/InformationOutline';\nimport LinkIcon from 'mdi-material-ui/Link';\nimport MagnifyScan from 'mdi-material-ui/MagnifyScan';\nimport PauseIcon from 'mdi-material-ui/Pause';\nimport PlayIcon from 'mdi-material-ui/Play';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport RefreshIcon from 'mdi-material-ui/Refresh';\nimport RobotOutline from 'mdi-material-ui/RobotOutline';\nimport SendIcon from 'mdi-material-ui/Send';\nimport StopIcon from 'mdi-material-ui/Stop';\nimport SyncIcon from 'mdi-material-ui/Sync';\nimport UploadIcon from 'mdi-material-ui/Upload';\nimport { ReactElement, useCallback, useMemo, useState } from 'react';\n\nexport type ActionIcon =\n | 'play'\n | 'pause'\n | 'stop'\n | 'delete'\n | 'refresh'\n | 'send'\n | 'download'\n | 'upload'\n | 'check'\n | 'close'\n | 'alert'\n | 'info'\n | 'settings'\n | 'link'\n | 'sync'\n | 'troubleshoot'\n | 'ask-ai';\n\nexport interface BaseAction {\n type: 'event' | 'webhook';\n name: string;\n confirmMessage?: string;\n icon?: ActionIcon;\n enabled?: boolean;\n batchMode: BatchMode;\n bodyTemplate?: string;\n}\n\nexport type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport type BatchMode = 'batch' | 'individual';\n\nexport type ContentType = 'none' | 'json' | 'text';\n\nexport interface WebhookAction extends BaseAction {\n type: 'webhook';\n url: string;\n method: HttpMethod;\n contentType: ContentType;\n headers?: Record<string, string>;\n}\n\nexport interface EventAction extends BaseAction {\n type: 'event';\n eventName: string;\n}\n\nexport type ItemAction = EventAction | WebhookAction;\n\nexport interface ActionOptions {\n enabled?: boolean;\n actionsList?: ItemAction[];\n displayInHeader?: boolean;\n displayWithItem?: boolean;\n}\n\nexport interface SelectionOptions {\n enabled?: boolean;\n}\n\nexport interface ItemSelectionActionsEditorProps {\n actionOptions?: ActionOptions;\n selectionOptions?: SelectionOptions;\n onChangeActions: (actions?: ActionOptions) => void;\n onChangeSelection: (selection?: SelectionOptions) => void;\n}\n\nconst HTTP_METHODS: HttpMethod[] = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];\nconst BATCH_MODES: Array<{ value: BatchMode; label: string }> = [\n { value: 'individual', label: 'Individual (one request per selection)' },\n { value: 'batch', label: 'Batch (single request with all selections)' },\n];\nconst CONTENT_TYPES: Array<{ value: ContentType; label: string }> = [\n { value: 'none', label: 'None' },\n { value: 'json', label: 'JSON' },\n { value: 'text', label: 'Text' },\n];\nconst BODY_METHODS: HttpMethod[] = ['POST', 'PUT', 'PATCH'];\nconst BODY_CLEAR_CONFIRM_MESSAGE = 'Changing this option will remove the current body template. Continue?';\n\n/** Available action icons with their display components */\nexport const ACTION_ICONS: Array<{ value: ActionIcon; label: string; icon: ReactElement }> = [\n { value: 'play', label: 'Play', icon: <PlayIcon fontSize=\"inherit\" /> },\n { value: 'pause', label: 'Pause', icon: <PauseIcon fontSize=\"inherit\" /> },\n { value: 'stop', label: 'Stop', icon: <StopIcon fontSize=\"inherit\" /> },\n { value: 'delete', label: 'Delete', icon: <DeleteIcon fontSize=\"inherit\" /> },\n { value: 'refresh', label: 'Refresh', icon: <RefreshIcon fontSize=\"inherit\" /> },\n { value: 'send', label: 'Send', icon: <SendIcon fontSize=\"inherit\" /> },\n { value: 'download', label: 'Download', icon: <DownloadIcon fontSize=\"inherit\" /> },\n { value: 'upload', label: 'Upload', icon: <UploadIcon fontSize=\"inherit\" /> },\n { value: 'check', label: 'Check', icon: <CheckIcon fontSize=\"inherit\" /> },\n { value: 'close', label: 'Close', icon: <CloseIcon fontSize=\"inherit\" /> },\n { value: 'alert', label: 'Alert', icon: <AlertIcon fontSize=\"inherit\" /> },\n { value: 'info', label: 'Info', icon: <InfoIcon fontSize=\"inherit\" /> },\n { value: 'settings', label: 'Settings', icon: <SettingsIcon fontSize=\"inherit\" /> },\n { value: 'link', label: 'Link', icon: <LinkIcon fontSize=\"inherit\" /> },\n { value: 'sync', label: 'Sync', icon: <SyncIcon fontSize=\"inherit\" /> },\n { value: 'troubleshoot', label: 'Troubleshoot', icon: <MagnifyScan fontSize=\"inherit\" /> },\n { value: 'ask-ai', label: 'Ask AI', icon: <RobotOutline fontSize=\"inherit\" /> },\n];\n\nconst URL_HELPER_TEXT = 'Supports interpolation: ${__data.fields[\"fieldName\"]}, ${__data.index}, ${__data.count}';\n\nfunction createDefaultEventAction(): EventAction {\n return {\n type: 'event',\n name: 'New Event Action',\n eventName: 'selection-action',\n batchMode: 'individual',\n enabled: true,\n };\n}\n\nfunction createDefaultWebhookAction(): WebhookAction {\n return {\n type: 'webhook',\n name: 'New Webhook Action',\n url: '',\n method: 'POST',\n contentType: 'none',\n batchMode: 'individual',\n enabled: true,\n };\n}\n\ninterface ItemActionEditorProps {\n action: ItemAction;\n index: number;\n onChange: (index: number, action: ItemAction) => void;\n onRemove: (index: number) => void;\n onMoveUp: () => void;\n onMoveDown: () => void;\n}\n\ninterface InterpolationHelperProps {\n batchMode: BatchMode;\n}\n\nfunction InterpolationHelper({ batchMode }: InterpolationHelperProps): ReactElement {\n let content: ReactElement = (\n <div>\n Individual mode patterns: <code>{'${__data.fields[\"field\"]}'}</code>, <code>{'${__data.index}'}</code>,{' '}\n <code>{'${__data.count}'}</code>\n </div>\n );\n\n if (batchMode === 'batch') {\n content = (\n <div>\n Batch mode patterns: <code>{'${__data}'}</code>, <code>{\"${__data[0].fields['field']}\"}</code>,{' '}\n <code>{\"${__data.fields['field']:csv}\"}</code>, <code>{'${__data.count}'}</code>\n </div>\n );\n }\n\n return (\n <Typography variant=\"caption\" color=\"text.secondary\" sx={{ mb: 1, display: 'block' }}>\n {content}\n </Typography>\n );\n}\n\nfunction EventActionEditor({\n action,\n index,\n onChange,\n onRemove,\n onMoveDown,\n onMoveUp,\n}: ItemActionEditorProps): ReactElement {\n const eventAction = action as EventAction;\n\n const [isCollapsed, setIsCollapsed] = useState(true);\n const hasBodyTemplate = (eventAction.bodyTemplate ?? '').trim().length > 0;\n\n const handleIncludesTemplateChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const nextContentType = event.target.value as 'custom' | 'none';\n\n const bodyTemplate = nextContentType === 'custom' ? JSON.stringify({}) : undefined;\n\n onChange(index, { ...eventAction, bodyTemplate: bodyTemplate });\n },\n [index, onChange, eventAction]\n );\n\n const handleBodyTemplateChange = useCallback(\n (template: string) => {\n onChange(index, { ...eventAction, bodyTemplate: template || undefined });\n },\n [index, onChange, eventAction]\n );\n\n const jsonDataTemplate = useMemo(() => {\n if (eventAction.bodyTemplate) {\n try {\n return JSON.parse(eventAction.bodyTemplate);\n } catch {\n return {};\n }\n }\n }, [eventAction.bodyTemplate]);\n\n return (\n <DragAndDropElement data={eventAction as unknown as Record<string, unknown>}>\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" gap={4}>\n <Stack direction=\"row\" gap={1}>\n <IconButton\n data-testid={`event-action-toggle#${eventAction.name}`}\n size=\"small\"\n onClick={() => setIsCollapsed(!isCollapsed)}\n >\n {isCollapsed ? <ChevronRight /> : <ChevronDown />}\n </IconButton>\n <Typography variant=\"overline\" component=\"h4\" sx={{ textTransform: 'none' }}>\n EVENT ACTION:{' '}\n {eventAction.name ? (\n <span>\n <strong>{eventAction.name}</strong>\n </span>\n ) : (\n <strong>{eventAction.name}</strong>\n )}\n </Typography>\n </Stack>\n\n <Stack direction=\"row\" gap={1}>\n <InfoTooltip description=\"Remove action settings\" placement=\"top\">\n <IconButton\n size=\"small\"\n sx={{ marginLeft: 'auto' }}\n onClick={() => onRemove(index)}\n key=\"delete-action-button\"\n >\n <DeleteIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description=\"Reorder action settings\" placement=\"top\">\n <DragButton\n onMoveUp={onMoveUp}\n onMoveDown={onMoveDown}\n menuSx={{\n '.MuiPaper-root': { backgroundColor: (theme) => theme.palette.background.lighter },\n }}\n key=\"reorder-action-button\"\n />\n </InfoTooltip>\n </Stack>\n </Stack>\n\n {!isCollapsed && (\n <Stack spacing={2}>\n <OptionsEditorControl\n label=\"Enabled\"\n control={\n <Switch\n checked={eventAction?.enabled ?? false}\n onChange={(e) => onChange(index, { ...eventAction, enabled: e.target.checked })}\n />\n }\n />\n\n <Stack direction=\"row\" spacing={2}>\n <TextField\n label=\"Action Name\"\n size=\"small\"\n value={eventAction.name}\n onChange={(e) => onChange(index, { ...eventAction, name: e.target.value })}\n sx={{ flexGrow: 1 }}\n />\n\n <FormControl size=\"small\" sx={{ minWidth: 120 }}>\n <InputLabel>Icon</InputLabel>\n <Select\n value={eventAction.icon || ''}\n label=\"Icon\"\n onChange={(e) => onChange(index, { ...eventAction, icon: (e.target.value as ActionIcon) || undefined })}\n >\n <MenuItem value=\"\">\n <em>None</em>\n </MenuItem>\n {ACTION_ICONS.map((iconOption) => (\n <MenuItem key={iconOption.value} value={iconOption.value}>\n <Stack direction=\"row\" alignItems=\"center\" spacing={1}>\n {iconOption.icon}\n <span>{iconOption.label}</span>\n </Stack>\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </Stack>\n\n <Stack direction=\"row\" spacing={2}>\n <TextField\n label=\"Event Name\"\n size=\"small\"\n value={eventAction.eventName}\n onChange={(e) => onChange(index, { ...eventAction, eventName: e.target.value })}\n helperText=\"Name of the CustomEvent to dispatch (e.g., 'selection-action')\"\n fullWidth\n />\n\n <FormControl size=\"small\" sx={{ flexGrow: 1, minWidth: 280 }}>\n <InputLabel>Batch Mode</InputLabel>\n <Select\n value={eventAction.batchMode ?? 'individual'}\n label=\"Batch Mode\"\n onChange={(e) => onChange(index, { ...eventAction, batchMode: e.target.value as BatchMode })}\n >\n {BATCH_MODES.map((mode) => (\n <MenuItem key={mode.value} value={mode.value}>\n {mode.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </Stack>\n\n <FormControl component=\"fieldset\" size=\"small\">\n <FormLabel component=\"legend\">Template</FormLabel>\n <RadioGroup row value={hasBodyTemplate ? 'custom' : 'none'} onChange={handleIncludesTemplateChange}>\n <FormControlLabel value=\"none\" control={<Radio size=\"small\" />} label=\"None\" />\n <FormControlLabel value=\"custom\" control={<Radio size=\"small\" />} label=\"JSON template\" />\n </RadioGroup>\n </FormControl>\n\n {hasBodyTemplate && (\n <>\n <InterpolationHelper batchMode={eventAction.batchMode} />\n <JSONEditor\n value={jsonDataTemplate || ''}\n onChange={handleBodyTemplateChange}\n minHeight=\"100px\"\n maxHeight=\"200px\"\n />\n </>\n )}\n\n <TextField\n label=\"Confirmation Message (optional)\"\n size=\"small\"\n value={eventAction.confirmMessage || ''}\n onChange={(e) => onChange(index, { ...eventAction, confirmMessage: e.target.value || undefined })}\n helperText=\"If set, shows a confirmation dialog before executing the action\"\n fullWidth\n multiline\n rows={2}\n />\n </Stack>\n )}\n </DragAndDropElement>\n );\n}\n\nfunction WebhookActionEditor({\n action,\n index,\n onChange,\n onRemove,\n onMoveUp,\n onMoveDown,\n}: ItemActionEditorProps): ReactElement {\n const webhookAction = action as WebhookAction;\n const [pendingChange, setPendingChange] = useState<\n { kind: 'contentType'; value: ContentType } | { kind: 'method'; value: HttpMethod } | null\n >(null);\n const contentTypeValue = webhookAction.contentType ?? 'none';\n const hasBodyTemplate = (webhookAction.bodyTemplate ?? '').trim().length > 0;\n const supportsBody = BODY_METHODS.includes(webhookAction.method);\n\n const [isCollapsed, setIsCollapsed] = useState(true);\n\n const handleBodyTemplateChange = useCallback(\n (template: string) => {\n onChange(index, { ...webhookAction, bodyTemplate: template || undefined });\n },\n [index, onChange, webhookAction]\n );\n\n const handleTextTemplateChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange(index, { ...webhookAction, bodyTemplate: event.target.value || undefined });\n },\n [index, onChange, webhookAction]\n );\n\n const handleContentTypeChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const nextContentType = event.target.value as ContentType;\n if (nextContentType === contentTypeValue) {\n return;\n }\n\n if (hasBodyTemplate) {\n setPendingChange({ kind: 'contentType', value: nextContentType });\n return;\n }\n\n onChange(index, { ...webhookAction, contentType: nextContentType });\n },\n [contentTypeValue, hasBodyTemplate, index, onChange, webhookAction]\n );\n\n const handleMethodChange = useCallback(\n (event: SelectChangeEvent<HttpMethod>) => {\n const nextMethod = event.target.value as HttpMethod;\n if (nextMethod === webhookAction.method) {\n return;\n }\n\n const nextSupportsBody = BODY_METHODS.includes(nextMethod);\n if (!nextSupportsBody && hasBodyTemplate) {\n setPendingChange({ kind: 'method', value: nextMethod });\n return;\n }\n\n onChange(index, { ...webhookAction, method: nextMethod });\n },\n [hasBodyTemplate, index, onChange, webhookAction]\n );\n\n const handleConfirmClose = useCallback(() => {\n setPendingChange(null);\n }, []);\n\n const handleConfirmApply = useCallback(() => {\n if (!pendingChange) {\n return;\n }\n\n if (pendingChange.kind === 'contentType') {\n onChange(index, { ...webhookAction, contentType: pendingChange.value, bodyTemplate: undefined });\n } else {\n onChange(index, { ...webhookAction, method: pendingChange.value, bodyTemplate: undefined });\n }\n\n setPendingChange(null);\n }, [index, onChange, pendingChange, webhookAction]);\n\n const jsonBodyTemplate = useMemo(() => {\n if (webhookAction.contentType === 'json' && webhookAction.bodyTemplate) {\n try {\n return JSON.parse(webhookAction.bodyTemplate);\n } catch {\n return {};\n }\n }\n }, [webhookAction.bodyTemplate, webhookAction.contentType]);\n\n return (\n <DragAndDropElement data={webhookAction as unknown as Record<string, unknown>}>\n <Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" gap={4}>\n <Stack direction=\"row\" gap={1}>\n <IconButton\n data-testid={`column-toggle#${webhookAction.name}`}\n size=\"small\"\n onClick={() => setIsCollapsed(!isCollapsed)}\n >\n {isCollapsed ? <ChevronRight /> : <ChevronDown />}\n </IconButton>\n <Typography variant=\"overline\" component=\"h4\" sx={{ textTransform: 'none' }}>\n WEBHOOK ACTION: <strong>{webhookAction.name}</strong>\n </Typography>\n </Stack>\n\n <Stack direction=\"row\" gap={1}>\n <InfoTooltip description=\"Remove action settings\" placement=\"top\">\n <IconButton\n size=\"small\"\n sx={{ marginLeft: 'auto' }}\n onClick={() => onRemove(index)}\n key=\"delete-action-button\"\n >\n <DeleteIcon />\n </IconButton>\n </InfoTooltip>\n <InfoTooltip description=\"Reorder action settings\" placement=\"top\">\n <DragButton\n onMoveUp={onMoveUp}\n onMoveDown={onMoveDown}\n menuSx={{\n '.MuiPaper-root': { backgroundColor: (theme) => theme.palette.background.lighter },\n }}\n key=\"reorder-action-button\"\n />\n </InfoTooltip>\n </Stack>\n </Stack>\n\n {!isCollapsed && (\n <Stack spacing={2}>\n <OptionsEditorControl\n label=\"Enabled\"\n control={\n <Switch\n checked={action?.enabled ?? false}\n onChange={(e) => onChange(index, { ...webhookAction, enabled: e.target.checked })}\n />\n }\n />\n\n <Stack direction=\"row\" spacing={2}>\n <TextField\n label=\"Action Name\"\n size=\"small\"\n value={webhookAction.name}\n onChange={(e) => onChange(index, { ...webhookAction, name: e.target.value })}\n sx={{ flexGrow: 1 }}\n />\n\n <FormControl size=\"small\" sx={{ minWidth: 120 }}>\n <InputLabel>Icon</InputLabel>\n <Select\n value={webhookAction.icon || ''}\n label=\"Icon\"\n onChange={(e) =>\n onChange(index, { ...webhookAction, icon: (e.target.value as ActionIcon) || undefined })\n }\n >\n <MenuItem value=\"\">\n <em>None</em>\n </MenuItem>\n {ACTION_ICONS.map((iconOption) => (\n <MenuItem key={iconOption.value} value={iconOption.value}>\n <Stack direction=\"row\" alignItems=\"center\" spacing={1}>\n {iconOption.icon}\n <span>{iconOption.label}</span>\n </Stack>\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </Stack>\n\n <TextField\n label=\"URL\"\n size=\"small\"\n value={webhookAction.url}\n onChange={(e) => onChange(index, { ...webhookAction, url: e.target.value })}\n helperText={URL_HELPER_TEXT}\n fullWidth\n />\n\n <Stack direction=\"row\" spacing={2}>\n <FormControl size=\"small\" sx={{ minWidth: 120 }}>\n <InputLabel>Method</InputLabel>\n <Select value={webhookAction.method} label=\"Method\" onChange={handleMethodChange}>\n {HTTP_METHODS.map((method) => (\n <MenuItem key={method} value={method}>\n {method}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n\n <FormControl size=\"small\" sx={{ flexGrow: 1 }}>\n <InputLabel>Batch Mode</InputLabel>\n <Select\n value={webhookAction.batchMode}\n label=\"Batch Mode\"\n onChange={(e) => onChange(index, { ...webhookAction, batchMode: e.target.value as BatchMode })}\n >\n {BATCH_MODES.map((mode) => (\n <MenuItem key={mode.value} value={mode.value}>\n {mode.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n </Stack>\n\n <FormControl component=\"fieldset\" size=\"small\">\n <FormLabel component=\"legend\">Content Type</FormLabel>\n <RadioGroup row value={contentTypeValue} onChange={handleContentTypeChange}>\n {CONTENT_TYPES.map((option) => (\n <FormControlLabel\n key={option.value}\n value={option.value}\n control={<Radio size=\"small\" />}\n label={option.label}\n />\n ))}\n </RadioGroup>\n </FormControl>\n\n {supportsBody && contentTypeValue !== 'none' && (\n <Box>\n <Typography variant=\"body2\" color=\"text.secondary\" sx={{ mb: 1 }}>\n {contentTypeValue === 'json' ? 'Body Template (JSON)' : 'Body Template (Text)'}\n </Typography>\n <InterpolationHelper batchMode={webhookAction.batchMode} />\n {contentTypeValue === 'json' ? (\n <JSONEditor\n value={jsonBodyTemplate || ''}\n onChange={handleBodyTemplateChange}\n minHeight=\"100px\"\n maxHeight=\"200px\"\n />\n ) : (\n <TextField\n value={webhookAction.bodyTemplate || ''}\n onChange={handleTextTemplateChange}\n fullWidth\n multiline\n rows={5}\n />\n )}\n </Box>\n )}\n\n <TextField\n label=\"Confirmation Message (optional)\"\n size=\"small\"\n value={webhookAction.confirmMessage || ''}\n onChange={(e) => onChange(index, { ...webhookAction, confirmMessage: e.target.value || undefined })}\n helperText=\"If set, shows a confirmation dialog before executing the action\"\n fullWidth\n multiline\n rows={2}\n />\n </Stack>\n )}\n\n <Dialog open={Boolean(pendingChange)} onClose={handleConfirmClose} aria-labelledby=\"selection-body-clear-title\">\n <DialogTitle id=\"selection-body-clear-title\">Remove Body Template?</DialogTitle>\n <DialogContent>\n <DialogContentText>{BODY_CLEAR_CONFIRM_MESSAGE}</DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button onClick={handleConfirmClose}>Cancel</Button>\n <Button onClick={handleConfirmApply} variant=\"contained\" color=\"primary\">\n Continue\n </Button>\n </DialogActions>\n </Dialog>\n </DragAndDropElement>\n );\n}\n\nexport function ItemSelectionActionsEditor({\n actionOptions,\n selectionOptions,\n onChangeActions,\n onChangeSelection,\n}: ItemSelectionActionsEditorProps): ReactElement {\n const actions = useMemo(\n () => actionOptions || { enabled: true, displayInHeader: true, displayWithItem: false },\n [actionOptions]\n );\n\n const handleEnableActionsChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n onChangeActions({ ...actions, enabled: checked ? true : undefined });\n };\n\n const handleEnableSelectionChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n onChangeSelection({ ...selectionOptions, enabled: checked ? true : undefined });\n };\n\n const handleDisplayInHeaderChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n onChangeActions({ ...actions, displayInHeader: checked ? true : undefined });\n };\n\n const handleDisplayWithItemChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n onChangeActions({ ...actions, displayWithItem: checked ? true : undefined });\n };\n\n const handleAddEventAction = useCallback(() => {\n onChangeActions({ ...actions, actionsList: [...(actions.actionsList ?? []), createDefaultEventAction()] });\n }, [actions, onChangeActions]);\n\n const handleAddWebhookAction = useCallback(() => {\n onChangeActions({ ...actions, actionsList: [...(actions.actionsList ?? []), createDefaultWebhookAction()] });\n }, [actions, onChangeActions]);\n\n const handleActionChange = useCallback(\n (index: number, updatedAction: ItemAction) => {\n const newActions = actions.actionsList ? [...actions.actionsList] : [];\n newActions[index] = updatedAction;\n onChangeActions({ ...actions, actionsList: newActions });\n },\n [actions, onChangeActions]\n );\n\n const handleRemoveAction = useCallback(\n (index: number) => {\n const newActions = actions.actionsList ? actions.actionsList.filter((_, i) => i !== index) : [];\n onChangeActions(newActions.length > 0 ? { ...actions, actionsList: newActions } : undefined);\n },\n [actions, onChangeActions]\n );\n\n useDragAndDropMonitor({\n elements: actions.actionsList as unknown as Array<Record<string, unknown>>,\n accessKey: 'name',\n onChange: (newElements) => {\n onChangeActions({ ...actions, actionsList: newElements as unknown as ItemAction[] });\n },\n });\n\n return (\n <Stack spacing={1}>\n <OptionsEditorControl\n label=\"Enable Item Selection\"\n description=\"Allow selecting items\"\n control={<Switch checked={selectionOptions?.enabled ?? false} onChange={handleEnableSelectionChange} />}\n />\n <OptionsEditorControl\n label=\"Enable Item Actions\"\n description=\"Allow executing actions on selected items\"\n control={<Switch checked={actionOptions?.enabled ?? false} onChange={handleEnableActionsChange} />}\n />\n <OptionsEditorControl\n label=\"Display Actions in Panel Header\"\n description=\"Show action buttons in the panel header when items are selected\"\n control={<Switch checked={actionOptions?.displayInHeader ?? false} onChange={handleDisplayInHeaderChange} />}\n />\n <OptionsEditorControl\n label=\"Display Actions with Each Item\"\n description=\"Show action buttons alongside each item when selected\"\n control={<Switch checked={actionOptions?.displayWithItem ?? false} onChange={handleDisplayWithItemChange} />}\n />\n <OptionsEditorGroup title=\"Actions\">\n <Stack spacing={3}>\n {!actions.actionsList || actions.actionsList.length === 0 ? (\n <Typography variant=\"body2\" color=\"text.secondary\" fontStyle=\"italic\">\n No actions defined. Add an action to enable triggering events or webhooks on selected data.\n </Typography>\n ) : (\n <Stack spacing={1} border=\"none\">\n {actions.actionsList &&\n actions.actionsList.map((action, index) => (\n <Box key={index} borderBottom={1} borderColor={(theme) => theme.palette.divider} pb={1}>\n {action.type === 'event' ? (\n <EventActionEditor\n action={action}\n index={index}\n onChange={handleActionChange}\n onRemove={handleRemoveAction}\n onMoveDown={() =>\n onChangeActions({ ...actions, actionsList: handleMoveDown(action, actions.actionsList!) })\n }\n onMoveUp={() =>\n onChangeActions({ ...actions, actionsList: handleMoveUp(action, actions.actionsList!) })\n }\n />\n ) : (\n <WebhookActionEditor\n action={action}\n index={index}\n onChange={handleActionChange}\n onRemove={handleRemoveAction}\n onMoveDown={() =>\n onChangeActions({ ...actions, actionsList: handleMoveDown(action, actions.actionsList!) })\n }\n onMoveUp={() =>\n onChangeActions({ ...actions, actionsList: handleMoveUp(action, actions.actionsList!) })\n }\n />\n )}\n </Box>\n ))}\n </Stack>\n )}\n\n <Stack direction=\"row\" spacing={1}>\n <Button variant=\"contained\" startIcon={<PlusIcon />} onClick={handleAddEventAction}>\n Add Event Action\n </Button>\n <Button variant=\"contained\" startIcon={<PlusIcon />} onClick={handleAddWebhookAction}>\n Add Webhook Action\n </Button>\n </Stack>\n </Stack>\n </OptionsEditorGroup>\n </Stack>\n );\n}\n"],"names":["Box","Button","Dialog","DialogActions","DialogContent","DialogContentText","DialogTitle","FormControl","FormControlLabel","FormLabel","IconButton","InputLabel","MenuItem","Radio","RadioGroup","Select","Stack","Switch","TextField","Typography","DragAndDropElement","DragButton","handleMoveDown","handleMoveUp","InfoTooltip","JSONEditor","OptionsEditorControl","OptionsEditorGroup","useDragAndDropMonitor","AlertIcon","CheckIcon","ChevronDown","ChevronRight","CloseIcon","SettingsIcon","DeleteIcon","DownloadIcon","InfoIcon","LinkIcon","MagnifyScan","PauseIcon","PlayIcon","PlusIcon","RefreshIcon","RobotOutline","SendIcon","StopIcon","SyncIcon","UploadIcon","useCallback","useMemo","useState","HTTP_METHODS","BATCH_MODES","value","label","CONTENT_TYPES","BODY_METHODS","BODY_CLEAR_CONFIRM_MESSAGE","ACTION_ICONS","icon","fontSize","URL_HELPER_TEXT","createDefaultEventAction","type","name","eventName","batchMode","enabled","createDefaultWebhookAction","url","method","contentType","InterpolationHelper","content","div","code","variant","color","sx","mb","display","EventActionEditor","action","index","onChange","onRemove","onMoveDown","onMoveUp","eventAction","isCollapsed","setIsCollapsed","hasBodyTemplate","bodyTemplate","trim","length","handleIncludesTemplateChange","event","nextContentType","target","JSON","stringify","undefined","handleBodyTemplateChange","template","jsonDataTemplate","parse","data","direction","alignItems","justifyContent","gap","data-testid","size","onClick","component","textTransform","span","strong","description","placement","marginLeft","menuSx","backgroundColor","theme","palette","background","lighter","spacing","control","checked","e","flexGrow","minWidth","em","map","iconOption","helperText","fullWidth","mode","row","minHeight","maxHeight","confirmMessage","multiline","rows","WebhookActionEditor","webhookAction","pendingChange","setPendingChange","contentTypeValue","supportsBody","includes","handleTextTemplateChange","handleContentTypeChange","kind","handleMethodChange","nextMethod","nextSupportsBody","handleConfirmClose","handleConfirmApply","jsonBodyTemplate","option","open","Boolean","onClose","aria-labelledby","id","ItemSelectionActionsEditor","actionOptions","selectionOptions","onChangeActions","onChangeSelection","actions","displayInHeader","displayWithItem","handleEnableActionsChange","_","handleEnableSelectionChange","handleDisplayInHeaderChange","handleDisplayWithItemChange","handleAddEventAction","actionsList","handleAddWebhookAction","handleActionChange","updatedAction","newActions","handleRemoveAction","filter","i","elements","accessKey","newElements","title","fontStyle","border","borderBottom","borderColor","divider","pb","startIcon"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SACEA,GAAG,EACHC,MAAM,EACNC,MAAM,EACNC,aAAa,EACbC,aAAa,EACbC,iBAAiB,EACjBC,WAAW,EACXC,WAAW,EACXC,gBAAgB,EAChBC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,QAAQ,EACRC,KAAK,EACLC,UAAU,EACVC,MAAM,EACNC,KAAK,EACLC,MAAM,EAENC,SAAS,EACTC,UAAU,QACL,gBAAgB;AAEvB,SACEC,kBAAkB,EAClBC,UAAU,EACVC,cAAc,EACdC,YAAY,EACZC,WAAW,EACXC,UAAU,EACVC,oBAAoB,EACpBC,kBAAkB,EAClBC,qBAAqB,QAChB,yBAAyB;AAChC,OAAOC,eAAe,wBAAwB;AAC9C,OAAOC,eAAe,wBAAwB;AAC9C,OAAOC,iBAAiB,8BAA8B;AACtD,OAAOC,kBAAkB,+BAA+B;AACxD,OAAOC,eAAe,wBAAwB;AAC9C,OAAOC,kBAAkB,sBAAsB;AAC/C,OAAOC,gBAAgB,gCAAgC;AACvD,OAAOC,kBAAkB,2BAA2B;AACpD,OAAOC,cAAc,qCAAqC;AAC1D,OAAOC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CAAO4E,SAAQ;oCAAY2H,yBAAW,KAAC9J;oCAAawE,SAASqE;8CAAwB;;;;;;;;;AAQlG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ItemSelectionActionsOptionsEditor/index.ts"],"names":[],"mappings":"AAaA,cAAc,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export * from './ItemSelectionActionsOptionsEditor';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ItemSelectionActionsOptionsEditor/index.ts"],"sourcesContent":["// Copyright 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 './ItemSelectionActionsOptionsEditor';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sCAAsC"}
|
|
@@ -1 +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, ToggleButtonGroup, ToggleButton } 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 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 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\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 {value && (\n <>\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 disableClearable\n />\n }\n />\n <OptionsEditorControl\n label=\"Mode\"\n control={\n <ToggleButtonGroup\n color=\"primary\"\n exclusive\n value={currentMode}\n aria-label=\"Mode\"\n onChange={(__, newValue) => {\n onChange({\n ...value,\n position: currentPosition,\n mode: newValue,\n });\n }}\n >\n {Object.entries(LEGEND_MODE_CONFIG).map(([modeId, config]) => (\n <ToggleButton\n key={modeId}\n value={modeId}\n selected={currentMode === modeId}\n aria-label={`display ${modeId} mode`}\n >\n {config.label}\n </ToggleButton>\n ))}\n </ToggleButtonGroup>\n }\n />\n {currentMode === 'table' && (\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 disableClearable\n />\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 limitTags={1}\n ChipProps={{\n size: 'small',\n }}\n />\n }\n />\n )}\n </>\n )}\n </>\n )}\n </OptionsEditorGroup>\n );\n}\n"],"names":["Switch","ToggleButtonGroup","ToggleButton","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","SIZE_OPTIONS","LegendOptionsEditor","value","onChange","showValuesEditor","calculation","handleLegendShowChange","_","checked","legendValue","position","undefined","handleLegendPositionChange","newValue","handleLegendSizeChange","currentPosition","size","handleLegendValueChange","values","isValidLegend","legendPositionConfig","currentMode","mode","currentSize","legendSizeConfig","legendValuesConfig","currentValues","length","reduce","result","item","push","label","description","valueOptions","title","error","name","message","control","options","disableClearable","color","exclusive","aria-label","__","modeId","selected","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,EAAeC,iBAAiB,EAAEC,YAAY,QAAQ,gBAAgB;AACrF,SAASC,cAAc,EAAEC,aAAa,EAAEC,iBAAiB,EAAEC,aAAa,QAAQ,mBAAmB;AACnG,SAASC,UAAU,EAAEC,oBAAoB,EAAEC,kBAAkB,EAAEC,oBAAoB,QAAQ,yBAAyB;AACpH,SAAuBC,OAAO,QAAQ,QAAQ;AAC9C,SACEC,kBAAkB,EAClBC,uBAAuB,EAGvBC,kBAAkB,EAClBC,mBAAmB,EAEnBC,kBAAkB,EAClBC,iBAAiB,QAEZ,cAAc;AAIrB,MAAMC,mBAA2CC,OAA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TS,UAAUS;4BACV6B,gBAAgB;;;kCAItB,KAACzD;wBACCgD,OAAM;wBACNO,uBACE,KAAC9D;4BACCiE,OAAM;4BACNC,SAAS;4BACTzC,OAAOmB;4BACPuB,cAAW;4BACXzC,UAAU,CAAC0C,IAAIhC;gCACbV,SAAS;oCACP,GAAGD,KAAK;oCACRQ,UAAUK;oCACVO,MAAMT;gCACR;4BACF;sCAEClB,OAAOC,OAAO,CAACR,oBAAoBS,GAAG,CAAC,CAAC,CAACiD,QAAQ/C,OAAO,iBACvD,KAACrB;oCAECwB,OAAO4C;oCACPC,UAAU1B,gBAAgByB;oCAC1BF,cAAY,CAAC,QAAQ,EAAEE,OAAO,KAAK,CAAC;8CAEnC/C,OAAOiC,KAAK;mCALRc;;;oBAWdzB,gBAAgB,yBACf;;0CACE,KAACrC;gCACCgD,OAAM;gCACNO,uBACE,KAACrD;oCACCgB,OAAO;wCACL,GAAGsB,gBAAgB;wCACnB1B,IAAIyB;oCACN;oCACAiB,SAASxC;oCACTG,UAAUW;oCACV,mEAAmE;oCACnE,sCAAsC;oCACtC2B,gBAAgB;;;4BAIrBrC,kCACC,KAACpB;gCACCgD,OAAM;gCACNO,SACE,wEAAwE;gCACxE,uEAAuE;gCACvE,uBAAuB;8CACvB,KAACrD;oCACC8D,UAAU;oCACVC,oBAAoB;oCACpBR,gBAAgB;oCAChBvC,OAAOuB;oCACPe,SAASN;oCACT/B,UAAUc;oCACViC,WAAW;oCACXC,WAAW;wCACTnC,MAAM;oCACR;;;;;;;;;AAWtB"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/LegendOptionsEditor/LegendOptionsEditor.tsx"],"sourcesContent":["// Copyright 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, ToggleButtonGroup, ToggleButton } 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 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 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\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 {value && (\n <>\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 disableClearable\n />\n }\n />\n <OptionsEditorControl\n label=\"Mode\"\n control={\n <ToggleButtonGroup\n color=\"primary\"\n exclusive\n value={currentMode}\n aria-label=\"Mode\"\n onChange={(__, newValue) => {\n onChange({\n ...value,\n position: currentPosition,\n mode: newValue,\n });\n }}\n >\n {Object.entries(LEGEND_MODE_CONFIG).map(([modeId, config]) => (\n <ToggleButton\n key={modeId}\n value={modeId}\n selected={currentMode === modeId}\n aria-label={`display ${modeId} mode`}\n >\n {config.label}\n </ToggleButton>\n ))}\n </ToggleButtonGroup>\n }\n />\n {currentMode === 'table' && (\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 disableClearable\n />\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 limitTags={1}\n ChipProps={{\n size: 'small',\n }}\n />\n }\n />\n )}\n </>\n )}\n </>\n )}\n </OptionsEditorGroup>\n );\n}\n"],"names":["Switch","ToggleButtonGroup","ToggleButton","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","SIZE_OPTIONS","LegendOptionsEditor","value","onChange","showValuesEditor","calculation","handleLegendShowChange","_","checked","legendValue","position","undefined","handleLegendPositionChange","newValue","handleLegendSizeChange","currentPosition","size","handleLegendValueChange","values","isValidLegend","legendPositionConfig","currentMode","mode","currentSize","legendSizeConfig","legendValuesConfig","currentValues","length","reduce","result","item","push","label","description","valueOptions","title","error","name","message","control","options","disableClearable","color","exclusive","aria-label","__","modeId","selected","multiple","disableCloseOnSelect","limitTags","ChipProps"],"mappings":"AAAA,+BAA+B;AAC/B,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,iBAAiB,EAAEC,YAAY,QAAQ,gBAAgB;AACrF,SAASC,cAAc,EAAEC,aAAa,EAAEC,iBAAiB,EAAEC,aAAa,QAAQ,mBAAmB;AACnG,SAASC,UAAU,EAAEC,oBAAoB,EAAEC,kBAAkB,EAAEC,oBAAoB,QAAQ,yBAAyB;AACpH,SAAuBC,OAAO,QAAQ,QAAQ;AAC9C,SACEC,kBAAkB,EAClBC,uBAAuB,EAGvBC,kBAAkB,EAClBC,mBAAmB,EAEnBC,kBAAkB,EAClBC,iBAAiB,QAEZ,cAAc;AAIrB,MAAMC,mBAA2CC,OAAOC,OAAO,CAACP,yBAAyBQ,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO;IACxG,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF;AAIA,MAAMC,eAAmCL,OAAOC,OAAO,CAACJ,oBAAoBK,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO;IAC3F,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF;AAWA,OAAO,SAASE,oBAAoB,EAClCC,KAAK,EACLC,QAAQ,EACRC,mBAAmB,IAAI,EACvBC,cAAc,aAAa,EACF;IACzB,MAAMC,yBAAkD,CAACC,GAAYC;QACnE,gDAAgD;QAChD,MAAMC,cA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AK,CAAC;8CAEnC/C,OAAOiC,KAAK;mCALRc;;;oBAWdzB,gBAAgB,yBACf;;0CACE,KAACrC;gCACCgD,OAAM;gCACNO,uBACE,KAACrD;oCACCgB,OAAO;wCACL,GAAGsB,gBAAgB;wCACnB1B,IAAIyB;oCACN;oCACAiB,SAASxC;oCACTG,UAAUW;oCACV,mEAAmE;oCACnE,sCAAsC;oCACtC2B,gBAAgB;;;4BAIrBrC,kCACC,KAACpB;gCACCgD,OAAM;gCACNO,SACE,wEAAwE;gCACxE,uEAAuE;gCACvE,uBAAuB;8CACvB,KAACrD;oCACC8D,UAAU;oCACVC,oBAAoB;oCACpBR,gBAAgB;oCAChBvC,OAAOuB;oCACPe,SAASN;oCACT/B,UAAUc;oCACViC,WAAW;oCACXC,WAAW;wCACTnC,MAAM;oCACR;;;;;;;;;AAWtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/LegendOptionsEditor/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/LegendOptionsEditor/index.ts"],"sourcesContent":["// Copyright 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,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MetricLabelInput/MetricLabelInput.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MetricLabelInput/MetricLabelInput.tsx"],"sourcesContent":["// Copyright 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,+BAA+B;AAC/B,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MetricLabelInput/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MetricLabelInput/index.ts"],"sourcesContent":["// Copyright 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,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MultiQueryEditor/MultiQueryEditor.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MultiQueryEditor/MultiQueryEditor.tsx"],"sourcesContent":["// Copyright 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 { forwardRef, 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 { QueryData, useListPluginMetadata, usePlugin, usePluginRegistry } from '../../runtime';\nimport { PluginEditorRef } from '../PluginEditor';\nimport { QueryEditorContainer } from './QueryEditorContainer';\n\nexport interface MultiQueryEditorProps {\n queryTypes: QueryPluginType[];\n filteredQueryPlugins?: string[];\n queries?: QueryDefinition[];\n queryResults?: QueryData[];\n onChange: (queries: QueryDefinition[]) => void;\n onQueryRun: (index: number, query: QueryDefinition) => void;\n}\n\nfunction useDefaultQueryDefinition(\n queryTypes: QueryPluginType[],\n filteredQueryPlugins?: string[]\n): {\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 // 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\n let defaultQueryKind: string = '';\n\n if (filteredQueryPlugins?.length) {\n defaultQueryKind = queryPlugins?.find((i) => filteredQueryPlugins.includes(i.spec.name))!.spec.name ?? '';\n } else {\n defaultQueryKind = defaultPluginKinds?.[defaultQueryType] ?? queryPlugins?.[0]?.spec.name ?? '';\n }\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 */\n\nexport const MultiQueryEditor = forwardRef<PluginEditorRef, MultiQueryEditorProps>((props, ref): ReactElement => {\n const { queryTypes, queries = [], queryResults, filteredQueryPlugins, onChange, onQueryRun } = props;\n const { defaultInitialQueryDefinition, isLoading } = useDefaultQueryDefinition(queryTypes, filteredQueryPlugins);\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 handleQueryRun = (index: number, queryDef: QueryDefinition): void => {\n onQueryRun(index, queryDef);\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 ref={ref}\n queryTypes={queryTypes}\n key={i}\n index={i}\n query={query}\n queryResult={queryResults?.[i]}\n filteredQueryPlugins={filteredQueryPlugins}\n isCollapsed={!!queriesCollapsed[i]}\n onChange={handleQueryChange}\n onQueryRun={handleQueryRun}\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\nMultiQueryEditor.displayName = 'MultiQueryEditor';\n"],"names":["forwardRef","useState","produce","Button","Stack","AddIcon","useListPluginMetadata","usePlugin","usePluginRegistry","QueryEditorContainer","useDefaultQueryDefinition","queryTypes","filteredQueryPlugins","defaultQueryType","data","queryPlugins","isLoading","defaultPluginKinds","defaultQueryKind","length","find","i","includes","spec","name","defaultQueryPlugin","useErrorBoundary","enabled","defaultInitialQueryDefinition","kind","plugin","createInitialOptions","MultiQueryEditor","props","ref","queries","queryResults","onChange","onQueryRun","queriesCollapsed","setQueriesCollapsed","map","handleQueryChange","index","queryDef","draft","handleQueryRun","handleQueryAdd","push","handleQueryDelete","splice","handleQueryCollapseExpand","queryDefinitions","spacing","query","queryResult","isCollapsed","onDelete","undefined","onCollapseExpand","variant","startIcon","sx","marginTop","onClick","displayName"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,UAAU,EAAgBC,QAAQ,QAAQ,QAAQ;AAC3D,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,MAAM,EAAEC,KAAK,QAAQ,gBAAgB;AAC9C,OAAOC,aAAa,uBAAuB;AAE3C,SAAoBC,qBAAqB,EAAEC,SAAS,EAAEC,iBAAiB,QAAQ,gBAAgB;AAE/F,SA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UK;wBACVJ,YAAYQ;wBACZW,UAAUtB,QAAQhB,MAAM,GAAG,IAAI8B,oBAAoBS;wBACnDC,kBAAkBR;uBATb9B;;0BAaX,KAAClB;gBAAOyD,SAAQ;gBAAYC,yBAAW,KAACxD;gBAAYyD,IAAI;oBAAEC,WAAW;gBAAE;gBAAGC,SAASjB;0BAAgB;;;;AAKzG,GAAG;AAEHf,iBAAiBiC,WAAW,GAAG"}
|
|
@@ -1 +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, CircularProgress } 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 { forwardRef, ReactElement } from 'react';\nimport AlertIcon from 'mdi-material-ui/Alert';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { QueryData } from '../../runtime';\nimport { PluginEditor, PluginEditorProps, PluginEditorRef } from '../PluginEditor';\n\n/**\n * Properties for {@link QueryEditorContainer}\n */\ninterface QueryEditorContainerProps {\n queryTypes: QueryPluginType[];\n index: number;\n query: QueryDefinition;\n queryResult?: QueryData;\n filteredQueryPlugins?: string[];\n onChange: (index: number, query: QueryDefinition) => void;\n onQueryRun: (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 */\n\nexport const QueryEditorContainer = forwardRef<PluginEditorRef, QueryEditorContainerProps>(\n (props, ref): ReactElement => {\n const {\n queryTypes,\n index,\n query,\n queryResult,\n filteredQueryPlugins,\n isCollapsed,\n onDelete,\n onChange,\n onQueryRun,\n onCollapseExpand,\n } = props;\n return (\n <Stack key={index} spacing={1}>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n borderBottom={1}\n borderColor={(theme) => theme.palette.divider}\n >\n <Stack direction=\"row\">\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 </Stack>\n <Stack direction=\"row\" alignItems=\"center\">\n {queryResult?.isFetching && <CircularProgress aria-label=\"loading\" size=\"1.125rem\" />}\n {queryResult?.error && (\n <InfoTooltip description={queryResult.error.message}>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n sx={{\n color: (theme) => theme.palette.error.main,\n }}\n >\n <IconButton\n aria-label=\"query error\"\n size=\"small\"\n sx={{\n color: (theme) => theme.palette.error.main,\n }}\n >\n <AlertIcon />\n </IconButton>\n <Typography\n sx={{\n maxWidth: 300,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n '&:hover ::after': { content: '\"Click to copy\"' },\n }}\n >\n {queryResult.error.message}\n </Typography>\n </Stack>\n </InfoTooltip>\n )}\n {onDelete && (\n <IconButton aria-label=\"delete query\" size=\"small\" onClick={() => onDelete && onDelete(index)}>\n <DeleteIcon />\n </IconButton>\n )}\n </Stack>\n </Stack>\n {!isCollapsed && (\n <QueryEditor\n ref={ref}\n queryTypes={queryTypes}\n value={query}\n filteredQueryPlugins={filteredQueryPlugins}\n onChange={(next) => onChange(index, next)}\n onQueryRun={() => onQueryRun(index, query)}\n />\n )}\n </Stack>\n );\n }\n);\n\nQueryEditorContainer.displayName = 'QueryEditorContainer';\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 filteredQueryPlugins?: string[];\n onChange: (next: QueryDefinition) => void;\n onQueryRun: () => 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 */\n\nconst QueryEditor = forwardRef<PluginEditorRef, QueryEditorProps>((props, ref): ReactElement => {\n const { queryTypes, value, filteredQueryPlugins, onChange, onQueryRun, ...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 ref={ref}\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 filteredQueryPlugins={filteredQueryPlugins}\n withRunQueryButton\n onRunQuery={onQueryRun}\n onChange={handlePluginChange}\n />\n </Box>\n );\n});\n\nQueryEditor.displayName = 'QueryEditor';\n"],"names":["produce","Stack","IconButton","Typography","Box","CircularProgress","DeleteIcon","ChevronDown","ChevronRight","forwardRef","AlertIcon","InfoTooltip","PluginEditor","QueryEditorContainer","props","ref","queryTypes","index","query","queryResult","filteredQueryPlugins","isCollapsed","onDelete","onChange","onQueryRun","onCollapseExpand","spacing","direction","alignItems","justifyContent","borderBottom","borderColor","theme","palette","divider","size","onClick","variant","component","isFetching","aria-label","error","description","message","sx","color","main","maxWidth","whiteSpace","overflow","textOverflow","content","QueryEditor","value","next","displayName","others","handlePluginChange","draft","kind","selection","type","spec","plugin","pluginTypes","pluginKindLabel","withRunQueryButton","onRunQuery"],"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;AAEhC,SAASC,KAAK,EAAEC,UAAU,EAAEC,UAAU,EAAYC,GAAG,EAAEC,gBAAgB,QAAQ,gBAAgB;AAC/F,OAAOC,gBAAgB,gCAAgC;AACvD,OAAOC,iBAAiB,8BAA8B;AACtD,OAAOC,kBAAkB,+BAA+B;AACxD,SAASC,UAAU,QAAsB,QAAQ;AACjD,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,WAAW,QAAQ,yBAAyB;AAErD,SAASC,YAAY,QAA4C,kBAAkB;AAkBnF;;;;;;;;;;;CAWC,GAED,OAAO,MAAMC,qCAAuBJ,WAClC,CAACK,OAAOC;IACN,MAAM,EACJC,UAAU,EACVC,KAAK,EACLC,KAAK,EACLC,WAAW,EACXC,oBAAoB,EACpBC,WAAW,EACXC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,gBAAgB,EACjB,GAAGX;IACJ,qBACE,MAACb;QAAkByB,SAAS;;0BAC1B,MAACzB;gBACC0B,WAAU;gBACVC,YAAW;gBACXC,gBAAe;gBACfC,cAAc;gBACdC,aAAa,CAACC,QAAUA,MAAMC,OAAO,CAACC,OAAO;;kCAE7C,MAACjC;wBAAM0B,WAAU;;0CAC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EC,UAAU,EAAEqC,KAAK,EAAEjC,oBAAoB,EAAEG,QAAQ,EAAEC,UAAU,EAAE,GAAGgC,QAAQ,GAAG1C;IAErF,MAAM2C,qBAAoD,CAACH;QACzD/B,SACEvB,QAAQqD,OAAO,CAACK;YACdA,MAAMC,IAAI,GAAGL,KAAKM,SAAS,CAACC,IAAI;YAChCH,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,KAAC1D;QAAK,GAAGoD,MAAM;kBACb,cAAA,KAAC5C;YACCG,KAAKA;YACLiD,aAAahD;YACbiD,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;YACA1C,sBAAsBA;YACtB8C,kBAAkB;YAClBC,YAAY3C;YACZD,UAAUkC;;;AAIlB;AAEAL,YAAYG,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MultiQueryEditor/QueryEditorContainer.tsx"],"sourcesContent":["// Copyright 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, CircularProgress } 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 { forwardRef, ReactElement } from 'react';\nimport AlertIcon from 'mdi-material-ui/Alert';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { QueryData } from '../../runtime';\nimport { PluginEditor, PluginEditorProps, PluginEditorRef } from '../PluginEditor';\n\n/**\n * Properties for {@link QueryEditorContainer}\n */\ninterface QueryEditorContainerProps {\n queryTypes: QueryPluginType[];\n index: number;\n query: QueryDefinition;\n queryResult?: QueryData;\n filteredQueryPlugins?: string[];\n onChange: (index: number, query: QueryDefinition) => void;\n onQueryRun: (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 */\n\nexport const QueryEditorContainer = forwardRef<PluginEditorRef, QueryEditorContainerProps>(\n (props, ref): ReactElement => {\n const {\n queryTypes,\n index,\n query,\n queryResult,\n filteredQueryPlugins,\n isCollapsed,\n onDelete,\n onChange,\n onQueryRun,\n onCollapseExpand,\n } = props;\n return (\n <Stack key={index} spacing={1}>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n borderBottom={1}\n borderColor={(theme) => theme.palette.divider}\n >\n <Stack direction=\"row\">\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 </Stack>\n <Stack direction=\"row\" alignItems=\"center\">\n {queryResult?.isFetching && <CircularProgress aria-label=\"loading\" size=\"1.125rem\" />}\n {queryResult?.error && (\n <InfoTooltip description={queryResult.error.message}>\n <Stack\n direction=\"row\"\n alignItems=\"center\"\n sx={{\n color: (theme) => theme.palette.error.main,\n }}\n >\n <IconButton\n aria-label=\"query error\"\n size=\"small\"\n sx={{\n color: (theme) => theme.palette.error.main,\n }}\n >\n <AlertIcon />\n </IconButton>\n <Typography\n sx={{\n maxWidth: 300,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n '&:hover ::after': { content: '\"Click to copy\"' },\n }}\n >\n {queryResult.error.message}\n </Typography>\n </Stack>\n </InfoTooltip>\n )}\n {onDelete && (\n <IconButton aria-label=\"delete query\" size=\"small\" onClick={() => onDelete && onDelete(index)}>\n <DeleteIcon />\n </IconButton>\n )}\n </Stack>\n </Stack>\n {!isCollapsed && (\n <QueryEditor\n ref={ref}\n queryTypes={queryTypes}\n value={query}\n filteredQueryPlugins={filteredQueryPlugins}\n onChange={(next) => onChange(index, next)}\n onQueryRun={() => onQueryRun(index, query)}\n />\n )}\n </Stack>\n );\n }\n);\n\nQueryEditorContainer.displayName = 'QueryEditorContainer';\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 filteredQueryPlugins?: string[];\n onChange: (next: QueryDefinition) => void;\n onQueryRun: () => 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 */\n\nconst QueryEditor = forwardRef<PluginEditorRef, QueryEditorProps>((props, ref): ReactElement => {\n const { queryTypes, value, filteredQueryPlugins, onChange, onQueryRun, ...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 ref={ref}\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 filteredQueryPlugins={filteredQueryPlugins}\n withRunQueryButton\n onRunQuery={onQueryRun}\n onChange={handlePluginChange}\n />\n </Box>\n );\n});\n\nQueryEditor.displayName = 'QueryEditor';\n"],"names":["produce","Stack","IconButton","Typography","Box","CircularProgress","DeleteIcon","ChevronDown","ChevronRight","forwardRef","AlertIcon","InfoTooltip","PluginEditor","QueryEditorContainer","props","ref","queryTypes","index","query","queryResult","filteredQueryPlugins","isCollapsed","onDelete","onChange","onQueryRun","onCollapseExpand","spacing","direction","alignItems","justifyContent","borderBottom","borderColor","theme","palette","divider","size","onClick","variant","component","isFetching","aria-label","error","description","message","sx","color","main","maxWidth","whiteSpace","overflow","textOverflow","content","QueryEditor","value","next","displayName","others","handlePluginChange","draft","kind","selection","type","spec","plugin","pluginTypes","pluginKindLabel","withRunQueryButton","onRunQuery"],"mappings":"AAAA,+BAA+B;AAC/B,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;AAEhC,SAASC,KAAK,EAAEC,UAAU,EAAEC,UAAU,EAAYC,GAAG,EAAEC,gBAAgB,QAAQ,gBAAgB;AAC/F,OAAOC,gBAAgB,gCAAgC;AACvD,OAAOC,iBAAiB,8BAA8B;AACtD,OAAOC,kBAAkB,+BAA+B;AACxD,SAASC,UAAU,QAAsB,QAAQ;AACjD,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,WAAW,QAAQ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-1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MultiQueryEditor/index.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MultiQueryEditor/index.tsx"],"sourcesContent":["// Copyright 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,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/OptionsEditorRadios/OptionsEditorRadios.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorRadios/OptionsEditorRadios.tsx"],"sourcesContent":["// Copyright 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,+BAA+B;AAC/B,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/OptionsEditorRadios/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorRadios/index.ts"],"sourcesContent":["// Copyright 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,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/OptionsEditorTabPanel/OptionsEditorTabPanel.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorTabPanel/OptionsEditorTabPanel.tsx"],"sourcesContent":["// Copyright 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,+BAA+B;AAC/B,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/OptionsEditorTabPanel/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorTabPanel/index.ts"],"sourcesContent":["// Copyright 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,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,0BAA0B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/OptionsEditorTabs/OptionsEditorTabs.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorTabs/OptionsEditorTabs.tsx"],"sourcesContent":["// Copyright 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,+BAA+B;AAC/B,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":["../../../src/components/OptionsEditorTabs/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorTabs/index.ts"],"sourcesContent":["// Copyright 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,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sBAAsB"}
|