@perses-dev/plugin-system 0.0.0-snapshot-panel-extra-content-2-2767e21 → 0.0.0-snapshot-scatter-chart-embed-8efdfab
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 +6 -4
- package/dist/cjs/components/CalculationSelector/index.js +10 -8
- package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +350 -0
- package/dist/cjs/components/DatasourceEditorForm/index.js +30 -0
- package/dist/cjs/components/DatasourceSelect.js +135 -25
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +18 -16
- package/dist/cjs/components/LegendOptionsEditor/index.js +10 -8
- package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +69 -0
- package/dist/cjs/components/OptionsEditorRadios/index.js +30 -0
- package/dist/cjs/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +8 -6
- package/dist/cjs/components/OptionsEditorTabPanel/index.js +30 -0
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +10 -8
- package/dist/cjs/components/OptionsEditorTabs/index.js +10 -8
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +55 -14
- package/dist/cjs/components/PanelSpecEditor/index.js +10 -8
- package/dist/cjs/components/PluginEditor/PluginEditor.js +24 -31
- package/dist/cjs/components/PluginEditor/index.js +11 -9
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +5 -3
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +23 -12
- package/dist/cjs/components/PluginKindSelect/index.js +10 -8
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +11 -9
- package/dist/cjs/components/PluginRegistry/index.js +10 -8
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +6 -2
- package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +6 -4
- package/dist/cjs/components/PluginSpecEditor/index.js +10 -8
- package/dist/cjs/components/ProjectSelect.js +96 -0
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +27 -23
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +21 -19
- package/dist/cjs/components/TimeSeriesQueryEditor/index.js +10 -8
- package/dist/cjs/components/TraceQueryEditor/TraceQueryEditor.js +143 -0
- package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +96 -0
- package/dist/cjs/components/TraceQueryEditor/index.js +30 -0
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +438 -229
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +32 -28
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +11 -9
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +35 -36
- package/dist/cjs/components/Variables/index.js +11 -9
- package/dist/cjs/components/Variables/variable-model.js +17 -9
- package/dist/cjs/components/index.js +23 -18
- package/dist/cjs/constants/index.js +10 -8
- package/dist/cjs/constants/user-interface-text.js +3 -1
- package/dist/cjs/context/ProjectStoreProvider.js +78 -0
- package/dist/cjs/context/index.js +30 -0
- package/dist/cjs/context/query-params.js +49 -0
- package/dist/cjs/index.js +17 -13
- package/dist/cjs/model/index.js +18 -15
- package/dist/cjs/model/legend.js +32 -20
- package/dist/cjs/model/panels.js +2 -2
- package/dist/cjs/model/plugin-base.js +2 -2
- package/dist/cjs/model/plugin-loading.js +3 -1
- package/dist/cjs/model/trace-queries.js +16 -0
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +67 -35
- package/dist/cjs/runtime/DataQueriesProvider/index.js +11 -9
- package/dist/cjs/runtime/DataQueriesProvider/model.js +81 -0
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +43 -26
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +43 -0
- package/dist/cjs/runtime/TimeRangeProvider/index.js +12 -9
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +41 -55
- package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +30 -0
- package/dist/cjs/runtime/builtin-variables.js +81 -0
- package/dist/cjs/runtime/datasources.js +31 -12
- package/dist/cjs/runtime/index.js +17 -13
- package/dist/cjs/runtime/plugin-registry.js +41 -11
- package/dist/cjs/runtime/template-variables.js +96 -4
- package/dist/cjs/runtime/time-series-queries.js +39 -27
- package/dist/cjs/runtime/trace-queries.js +76 -0
- package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +7 -5
- package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +18 -15
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +42 -0
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +31 -13
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js +6 -4
- package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +9 -7
- package/dist/cjs/stories/shared-utils/decorators/index.js +15 -12
- package/dist/cjs/stories/shared-utils/index.js +10 -8
- package/dist/cjs/test/index.js +11 -8
- package/dist/cjs/test/mock-data.js +80 -0
- package/dist/cjs/test/render.js +13 -11
- package/dist/cjs/test/test-plugins/bert/index.js +14 -10
- package/dist/cjs/test/test-plugins/ernie/index.js +13 -9
- package/dist/cjs/test/test-plugins/index.js +11 -9
- package/dist/cjs/test-utils/index.js +10 -8
- package/dist/cjs/test-utils/mock-plugin-registry.js +8 -4
- package/dist/cjs/utils/action.js +43 -0
- package/dist/cjs/utils/index.js +11 -8
- package/dist/cjs/utils/variables.js +26 -8
- package/dist/cjs/validation/datasource.js +30 -0
- package/dist/cjs/validation/index.js +33 -0
- package/dist/cjs/validation/resource.js +24 -0
- package/dist/cjs/validation/role.js +85 -0
- package/dist/cjs/validation/rolebinding.js +55 -0
- package/dist/cjs/validation/secret.js +176 -0
- package/dist/cjs/validation/variable.js +48 -0
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
- package/dist/components/CalculationSelector/index.js.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +15 -0
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -0
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +342 -0
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -0
- package/dist/components/DatasourceEditorForm/index.d.ts +2 -0
- package/dist/components/DatasourceEditorForm/index.d.ts.map +1 -0
- package/dist/components/DatasourceEditorForm/index.js +15 -0
- package/dist/components/DatasourceEditorForm/index.js.map +1 -0
- package/dist/components/DatasourceSelect.d.ts +6 -0
- package/dist/components/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect.js +118 -23
- package/dist/components/DatasourceSelect.js.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +2 -2
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/LegendOptionsEditor/index.js.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +16 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +61 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -0
- package/dist/components/OptionsEditorRadios/index.d.ts +2 -0
- package/dist/components/OptionsEditorRadios/index.d.ts.map +1 -0
- package/dist/components/OptionsEditorRadios/index.js +15 -0
- package/dist/components/OptionsEditorRadios/index.js.map +1 -0
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +9 -0
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -0
- package/dist/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +2 -2
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -0
- package/dist/components/OptionsEditorTabPanel/index.d.ts +2 -0
- package/dist/components/OptionsEditorTabPanel/index.d.ts.map +1 -0
- package/dist/components/OptionsEditorTabPanel/index.js +15 -0
- package/dist/components/OptionsEditorTabPanel/index.js.map +1 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +2 -2
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/OptionsEditorTabs/index.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +45 -6
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PanelSpecEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +15 -24
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +2 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +2 -2
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +3 -3
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +21 -12
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginKindSelect/index.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +3 -3
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/index.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +1 -0
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/PluginSpecEditor/index.js.map +1 -1
- package/dist/components/ProjectSelect.d.ts +15 -0
- package/dist/components/ProjectSelect.d.ts.map +1 -0
- package/dist/components/ProjectSelect.js +91 -0
- package/dist/components/ProjectSelect.js.map +1 -0
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +19 -17
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/index.js.map +1 -1
- package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts +9 -0
- package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts.map +1 -0
- package/dist/components/TraceQueryEditor/TraceQueryEditor.js +130 -0
- package/dist/components/TraceQueryEditor/TraceQueryEditor.js.map +1 -0
- package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts +13 -0
- package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +1 -0
- package/dist/components/TraceQueryEditor/TraceQueryInput.js +83 -0
- package/dist/components/TraceQueryEditor/TraceQueryInput.js.map +1 -0
- package/dist/components/TraceQueryEditor/index.d.ts +2 -0
- package/dist/components/TraceQueryEditor/index.d.ts.map +1 -0
- package/dist/components/TraceQueryEditor/index.js +15 -0
- package/dist/components/TraceQueryEditor/index.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +10 -8
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +391 -184
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +8 -19
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +29 -34
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/index.js.map +1 -1
- package/dist/components/Variables/variable-model.js +3 -3
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -0
- package/dist/components/index.js.map +1 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/user-interface-text.js.map +1 -1
- package/dist/context/ProjectStoreProvider.d.ts +16 -0
- package/dist/context/ProjectStoreProvider.d.ts.map +1 -0
- package/dist/context/ProjectStoreProvider.js +56 -0
- package/dist/context/ProjectStoreProvider.js.map +1 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +15 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/query-params.d.ts +5 -0
- package/dist/context/query-params.d.ts.map +1 -0
- package/dist/context/query-params.js +41 -0
- package/dist/context/query-params.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/model/datasource.d.ts +2 -1
- package/dist/model/datasource.d.ts.map +1 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +1 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/legend.d.ts +1 -1
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js +14 -14
- package/dist/model/legend.js.map +1 -1
- package/dist/model/panels.d.ts +2 -1
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugin-base.d.ts +1 -0
- package/dist/model/plugin-base.d.ts.map +1 -1
- package/dist/model/plugin-base.js.map +1 -1
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/model/plugins.d.ts +2 -0
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/model/trace-queries.d.ts +19 -0
- package/dist/model/trace-queries.d.ts.map +1 -0
- package/dist/model/trace-queries.js +15 -0
- package/dist/model/trace-queries.js.map +1 -0
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +5 -5
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +52 -28
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +17 -12
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +67 -1
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +4 -3
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +28 -19
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +9 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +30 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts +1 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/index.js +1 -0
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts +4 -4
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +9 -41
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts +7 -0
- package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -0
- package/dist/runtime/TimeRangeProvider/refresh-interval.js +25 -0
- package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -0
- package/dist/runtime/builtin-variables.d.ts +11 -0
- package/dist/runtime/builtin-variables.d.ts.map +1 -0
- package/dist/runtime/builtin-variables.js +59 -0
- package/dist/runtime/builtin-variables.js.map +1 -0
- package/dist/runtime/datasources.d.ts +42 -7
- package/dist/runtime/datasources.d.ts.map +1 -1
- package/dist/runtime/datasources.js +15 -7
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/plugin-registry.d.ts +2 -0
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +19 -2
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/template-variables.d.ts +62 -2
- package/dist/runtime/template-variables.d.ts.map +1 -1
- package/dist/runtime/template-variables.js +83 -1
- package/dist/runtime/template-variables.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts +3 -3
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +14 -12
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.d.ts +14 -0
- package/dist/runtime/trace-queries.d.ts.map +1 -0
- package/dist/runtime/trace-queries.js +61 -0
- package/dist/runtime/trace-queries.js.map +1 -0
- package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +2 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +13 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +39 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +23 -7
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +2 -2
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.js +2 -2
- package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
- package/dist/stories/shared-utils/decorators/index.d.ts +1 -0
- package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/index.js +1 -0
- package/dist/stories/shared-utils/decorators/index.js.map +1 -1
- package/dist/stories/shared-utils/index.js.map +1 -1
- package/dist/test/index.d.ts +1 -0
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +1 -0
- package/dist/test/index.js.map +1 -1
- package/dist/test/mock-data.d.ts +4 -0
- package/dist/test/mock-data.d.ts.map +1 -0
- package/dist/test/mock-data.js +64 -0
- package/dist/test/mock-data.js.map +1 -0
- package/dist/test/render.js +2 -2
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test/test-plugins/ernie/index.js.map +1 -1
- package/dist/test/test-plugins/index.js.map +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +2 -2
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/dist/utils/action.d.ts +4 -0
- package/dist/utils/action.d.ts.map +1 -0
- package/dist/utils/action.js +27 -0
- package/dist/utils/action.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/variables.d.ts.map +1 -1
- package/dist/utils/variables.js +17 -5
- package/dist/utils/variables.js.map +1 -1
- package/dist/validation/datasource.d.ts +19 -0
- package/dist/validation/datasource.d.ts.map +1 -0
- package/dist/validation/datasource.js +22 -0
- package/dist/validation/datasource.js.map +1 -0
- package/dist/validation/index.d.ts +5 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +18 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/resource.d.ts +3 -0
- package/dist/validation/resource.d.ts.map +1 -0
- package/dist/validation/resource.js +16 -0
- package/dist/validation/resource.js.map +1 -0
- package/dist/validation/role.d.ts +228 -0
- package/dist/validation/role.d.ts.map +1 -0
- package/dist/validation/role.js +66 -0
- package/dist/validation/role.js.map +1 -0
- package/dist/validation/rolebinding.d.ts +137 -0
- package/dist/validation/rolebinding.d.ts.map +1 -0
- package/dist/validation/rolebinding.js +47 -0
- package/dist/validation/rolebinding.js.map +1 -0
- package/dist/validation/secret.d.ts +964 -0
- package/dist/validation/secret.d.ts.map +1 -0
- package/dist/validation/secret.js +157 -0
- package/dist/validation/secret.js.map +1 -0
- package/dist/validation/variable.d.ts +96 -0
- package/dist/validation/variable.d.ts.map +1 -0
- package/dist/validation/variable.js +40 -0
- package/dist/validation/variable.js.map +1 -0
- package/package.json +9 -6
- package/dist/components/OptionsEditorTabs/TabPanel.d.ts +0 -9
- package/dist/components/OptionsEditorTabs/TabPanel.d.ts.map +0 -1
- package/dist/components/OptionsEditorTabs/TabPanel.js.map +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "roleBindingsEditorValidationSchema", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return roleBindingsEditorValidationSchema;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _zod = require("zod");
|
|
24
|
+
const _resource = require("./resource");
|
|
25
|
+
const subjectValidationSchema = _zod.z.object({
|
|
26
|
+
kind: _zod.z.enum([
|
|
27
|
+
'User'
|
|
28
|
+
]),
|
|
29
|
+
name: _resource.resourceIdValidationSchema
|
|
30
|
+
});
|
|
31
|
+
const roleBindingValidationSchema = _zod.z.object({
|
|
32
|
+
kind: _zod.z.literal('RoleBinding'),
|
|
33
|
+
metadata: _zod.z.object({
|
|
34
|
+
name: _resource.resourceIdValidationSchema,
|
|
35
|
+
project: _resource.resourceIdValidationSchema
|
|
36
|
+
}),
|
|
37
|
+
spec: _zod.z.object({
|
|
38
|
+
role: _resource.resourceIdValidationSchema,
|
|
39
|
+
subjects: _zod.z.array(subjectValidationSchema).nonempty()
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
const globalRoleBindingValidationSchema = _zod.z.object({
|
|
43
|
+
kind: _zod.z.literal('GlobalRoleBinding'),
|
|
44
|
+
metadata: _zod.z.object({
|
|
45
|
+
name: _resource.resourceIdValidationSchema
|
|
46
|
+
}),
|
|
47
|
+
spec: _zod.z.object({
|
|
48
|
+
role: _resource.resourceIdValidationSchema,
|
|
49
|
+
subjects: _zod.z.array(subjectValidationSchema)
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
const roleBindingsEditorValidationSchema = _zod.z.discriminatedUnion('kind', [
|
|
53
|
+
roleBindingValidationSchema,
|
|
54
|
+
globalRoleBindingValidationSchema
|
|
55
|
+
]);
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
secretValidationSchema: function() {
|
|
25
|
+
return secretValidationSchema;
|
|
26
|
+
},
|
|
27
|
+
globalSecretValidationSchema: function() {
|
|
28
|
+
return globalSecretValidationSchema;
|
|
29
|
+
},
|
|
30
|
+
secretsEditorValidationSchema: function() {
|
|
31
|
+
return secretsEditorValidationSchema;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _zod = require("zod");
|
|
35
|
+
const _resource = require("./resource");
|
|
36
|
+
const secretSpecSchema = _zod.z.object({
|
|
37
|
+
basicAuth: _zod.z.object({
|
|
38
|
+
username: _zod.z.string().min(1),
|
|
39
|
+
password: _zod.z.string().optional(),
|
|
40
|
+
passwordFile: _zod.z.string().optional()
|
|
41
|
+
}).superRefine((val, ctx)=>{
|
|
42
|
+
if (val.password && val.password.length > 0 && val.passwordFile && val.passwordFile.length > 0) {
|
|
43
|
+
ctx.addIssue({
|
|
44
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
45
|
+
message: 'Only one of the fields must be defined',
|
|
46
|
+
path: [
|
|
47
|
+
'password'
|
|
48
|
+
]
|
|
49
|
+
});
|
|
50
|
+
ctx.addIssue({
|
|
51
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
52
|
+
message: 'Only one of the fields must be defined',
|
|
53
|
+
path: [
|
|
54
|
+
'passwordFile'
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}).optional(),
|
|
59
|
+
authorization: _zod.z.object({
|
|
60
|
+
type: _zod.z.string().optional(),
|
|
61
|
+
credentials: _zod.z.string().optional(),
|
|
62
|
+
credentialsFile: _zod.z.string().optional()
|
|
63
|
+
}).superRefine((val, ctx)=>{
|
|
64
|
+
if (val.credentials && val.credentials.length > 0 && val.credentialsFile && val.credentialsFile.length > 0) {
|
|
65
|
+
ctx.addIssue({
|
|
66
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
67
|
+
message: 'Only one of the fields must be defined',
|
|
68
|
+
path: [
|
|
69
|
+
'credentials'
|
|
70
|
+
]
|
|
71
|
+
});
|
|
72
|
+
ctx.addIssue({
|
|
73
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
74
|
+
message: 'Only one of the fields must be defined',
|
|
75
|
+
path: [
|
|
76
|
+
'credentialsFile'
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}).optional(),
|
|
81
|
+
tlsConfig: _zod.z.object({
|
|
82
|
+
ca: _zod.z.string().optional(),
|
|
83
|
+
cert: _zod.z.string().optional(),
|
|
84
|
+
key: _zod.z.string().optional(),
|
|
85
|
+
caFile: _zod.z.string().optional(),
|
|
86
|
+
certFile: _zod.z.string().optional(),
|
|
87
|
+
keyFile: _zod.z.string().optional(),
|
|
88
|
+
serverName: _zod.z.string().optional(),
|
|
89
|
+
insecureSkipVerify: _zod.z.boolean()
|
|
90
|
+
}).superRefine((val, ctx)=>{
|
|
91
|
+
if (val.ca && val.ca.length > 0 && val.caFile && val.caFile.length > 0) {
|
|
92
|
+
ctx.addIssue({
|
|
93
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
94
|
+
message: 'Only one of the fields must be defined',
|
|
95
|
+
path: [
|
|
96
|
+
'ca'
|
|
97
|
+
]
|
|
98
|
+
});
|
|
99
|
+
ctx.addIssue({
|
|
100
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
101
|
+
message: 'Only one of the fields must be defined',
|
|
102
|
+
path: [
|
|
103
|
+
'caFile'
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (val.cert && val.cert.length > 0 && val.certFile && val.certFile.length > 0) {
|
|
108
|
+
ctx.addIssue({
|
|
109
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
110
|
+
message: 'Only one of the fields must be defined',
|
|
111
|
+
path: [
|
|
112
|
+
'cert'
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
ctx.addIssue({
|
|
116
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
117
|
+
message: 'Only one of the fields must be defined',
|
|
118
|
+
path: [
|
|
119
|
+
'certFile'
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (val.key && val.key.length > 0 && val.keyFile && val.keyFile.length > 0) {
|
|
124
|
+
ctx.addIssue({
|
|
125
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
126
|
+
message: 'Only one of the fields must be defined',
|
|
127
|
+
path: [
|
|
128
|
+
'key'
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
ctx.addIssue({
|
|
132
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
133
|
+
message: 'Only one of the fields must be defined',
|
|
134
|
+
path: [
|
|
135
|
+
'keyFile'
|
|
136
|
+
]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}).optional()
|
|
140
|
+
}).superRefine((val, ctx)=>{
|
|
141
|
+
if (val.basicAuth && val.authorization) {
|
|
142
|
+
ctx.addIssue({
|
|
143
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
144
|
+
message: 'Only one of the fields must be defined',
|
|
145
|
+
path: [
|
|
146
|
+
'basicAuth'
|
|
147
|
+
]
|
|
148
|
+
});
|
|
149
|
+
ctx.addIssue({
|
|
150
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
151
|
+
message: 'Only one of the fields must be defined',
|
|
152
|
+
path: [
|
|
153
|
+
'authorization'
|
|
154
|
+
]
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
const secretValidationSchema = _zod.z.object({
|
|
159
|
+
kind: _zod.z.literal('Secret'),
|
|
160
|
+
metadata: _zod.z.object({
|
|
161
|
+
name: _resource.resourceIdValidationSchema,
|
|
162
|
+
project: _resource.resourceIdValidationSchema
|
|
163
|
+
}),
|
|
164
|
+
spec: secretSpecSchema
|
|
165
|
+
});
|
|
166
|
+
const globalSecretValidationSchema = _zod.z.object({
|
|
167
|
+
kind: _zod.z.literal('GlobalSecret'),
|
|
168
|
+
metadata: _zod.z.object({
|
|
169
|
+
name: _resource.resourceIdValidationSchema
|
|
170
|
+
}),
|
|
171
|
+
spec: secretSpecSchema
|
|
172
|
+
});
|
|
173
|
+
const secretsEditorValidationSchema = _zod.z.discriminatedUnion('kind', [
|
|
174
|
+
secretValidationSchema,
|
|
175
|
+
globalSecretValidationSchema
|
|
176
|
+
]);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "variableEditorValidationSchema", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return variableEditorValidationSchema;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _zod = require("zod");
|
|
24
|
+
const variableEditorValidationSchema = _zod.z.object({
|
|
25
|
+
name: _zod.z.string().nonempty('Required').regex(/^\w+$/, 'Must only contains alphanumerical characters and underscores').refine((val)=>!val.startsWith('__'), '__ prefix is reserved to builtin variables'),
|
|
26
|
+
title: _zod.z.string().optional(),
|
|
27
|
+
description: _zod.z.string().optional(),
|
|
28
|
+
kind: _zod.z.enum([
|
|
29
|
+
'TextVariable',
|
|
30
|
+
'ListVariable',
|
|
31
|
+
'BuiltinVariable'
|
|
32
|
+
]),
|
|
33
|
+
textVariableFields: _zod.z.object({
|
|
34
|
+
value: _zod.z.string(),
|
|
35
|
+
constant: _zod.z.boolean()
|
|
36
|
+
}),
|
|
37
|
+
listVariableFields: _zod.z.object({
|
|
38
|
+
allowMultiple: _zod.z.boolean(),
|
|
39
|
+
allowAllValue: _zod.z.boolean(),
|
|
40
|
+
customAllValue: _zod.z.string().optional(),
|
|
41
|
+
capturingRegexp: _zod.z.string().optional(),
|
|
42
|
+
sort: _zod.z.string().optional(),
|
|
43
|
+
plugin: _zod.z.object({
|
|
44
|
+
kind: _zod.z.string(),
|
|
45
|
+
spec: _zod.z.object({})
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';\nimport { CALCULATIONS_CONFIG, CalculationConfig, CalculationType } from '@perses-dev/core';\n\ntype AutocompleteCalculationOption = CalculationConfig & { id: CalculationType };\nconst CALC_OPTIONS: AutocompleteCalculationOption[] = Object.entries(CALCULATIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as CalculationType,\n ...config,\n };\n});\n\nexport interface CalculationSelectorProps {\n value: CalculationType;\n onChange: (unit: CalculationType) => void;\n}\n\nexport function CalculationSelector({ value, onChange }: CalculationSelectorProps) {\n const handleCalculationChange = (_: unknown, newValue: AutocompleteCalculationOption) => {\n onChange(newValue.id);\n };\n\n const calcConfig = CALCULATIONS_CONFIG[value];\n\n return (\n <OptionsEditorControl\n label=\"Calculation\"\n control={\n <SettingsAutocomplete\n value={{\n ...calcConfig,\n id: value,\n }}\n options={CALC_OPTIONS}\n onChange={handleCalculationChange}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","CALCULATIONS_CONFIG","CALC_OPTIONS","Object","entries","map","id","config","CalculationSelector","value","onChange","handleCalculationChange","_","newValue","calcConfig","label","control","options","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC
|
|
1
|
+
{"version":3,"sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';\nimport { CALCULATIONS_CONFIG, CalculationConfig, CalculationType } from '@perses-dev/core';\n\ntype AutocompleteCalculationOption = CalculationConfig & { id: CalculationType };\nconst CALC_OPTIONS: AutocompleteCalculationOption[] = Object.entries(CALCULATIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as CalculationType,\n ...config,\n };\n});\n\nexport interface CalculationSelectorProps {\n value: CalculationType;\n onChange: (unit: CalculationType) => void;\n}\n\nexport function CalculationSelector({ value, onChange }: CalculationSelectorProps) {\n const handleCalculationChange = (_: unknown, newValue: AutocompleteCalculationOption) => {\n onChange(newValue.id);\n };\n\n const calcConfig = CALCULATIONS_CONFIG[value];\n\n return (\n <OptionsEditorControl\n label=\"Calculation\"\n control={\n <SettingsAutocomplete\n value={{\n ...calcConfig,\n id: value,\n }}\n options={CALC_OPTIONS}\n onChange={handleCalculationChange}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","CALCULATIONS_CONFIG","CALC_OPTIONS","Object","entries","map","id","config","CalculationSelector","value","onChange","handleCalculationChange","_","newValue","calcConfig","label","control","options","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,oBAAoB,EAAEC,oBAAoB,QAAQ,yBAAyB;AACpF,SAASC,mBAAmB,QAA4C,mBAAmB;AAG3F,MAAMC,eAAgDC,OAAOC,QAAQH,qBAAqBI,IAAI,CAAC,CAACC,IAAIC,OAAO;IACzG,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF;AAOA,OAAO,SAASC,oBAAoB,EAAEC,MAAK,EAAEC,SAAQ,EAA4B;IAC/E,MAAMC,0BAA0B,CAACC,GAAYC;QAC3CH,SAASG,SAASP;IACpB;IAEA,MAAMQ,aAAab,mBAAmB,CAACQ,MAAM;IAE7C,qBACE,KAACV;QACCgB,OAAM;QACNC,uBACE,KAAChB;YACCS,OAAO;gBACL,GAAGK,UAAU;gBACbR,IAAIG;YACN;YACAQ,SAASf;YACTQ,UAAUC;YACVO,gBAAgB;;;AAK1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/CalculationSelector/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './CalculationSelector';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/CalculationSelector/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './CalculationSelector';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action, DatasourceSpec } from '@perses-dev/core';
|
|
2
|
+
import { DispatchWithoutAction } from 'react';
|
|
3
|
+
interface DatasourceEditorFormProps {
|
|
4
|
+
initialName: string;
|
|
5
|
+
initialSpec: DatasourceSpec;
|
|
6
|
+
initialAction: Action;
|
|
7
|
+
isDraft: boolean;
|
|
8
|
+
isReadonly?: boolean;
|
|
9
|
+
onSave: (name: string, spec: DatasourceSpec) => void;
|
|
10
|
+
onClose: DispatchWithoutAction;
|
|
11
|
+
onDelete?: DispatchWithoutAction;
|
|
12
|
+
}
|
|
13
|
+
export declare function DatasourceEditorForm(props: DatasourceEditorFormProps): JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=DatasourceEditorForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatasourceEditorForm.d.ts","sourceRoot":"","sources":["../../../src/components/DatasourceEditorForm/DatasourceEditorForm.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,qBAAqB,EAAyB,MAAM,OAAO,CAAC;AA2BrE,UAAU,yBAAyB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,cAAc,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IACrD,OAAO,EAAE,qBAAqB,CAAC;IAC/B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,eAwOpE"}
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
// Copyright 2023 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
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { useImmer } from 'use-immer';
|
|
15
|
+
import { Box, Button, Divider, FormControlLabel, Grid, Stack, Switch, TextField, Typography } from '@mui/material';
|
|
16
|
+
import { useCallback, useState } from 'react';
|
|
17
|
+
import { DiscardChangesConfirmationDialog } from '@perses-dev/components';
|
|
18
|
+
import { Controller, FormProvider, useForm } from 'react-hook-form';
|
|
19
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
20
|
+
import { PluginEditor } from '../PluginEditor';
|
|
21
|
+
import { getSubmitText, getTitleAction } from '../../utils';
|
|
22
|
+
import { datasourceEditValidationSchema } from '../../validation';
|
|
23
|
+
/**
|
|
24
|
+
* This preprocessing ensures that we always have a defined object for the `display` property
|
|
25
|
+
* @param datasource
|
|
26
|
+
*/ function getInitialState(name, spec) {
|
|
27
|
+
var _spec_display, _spec_display1;
|
|
28
|
+
var _spec_display_name, _spec_display_description;
|
|
29
|
+
const patchedDisplay = {
|
|
30
|
+
name: (_spec_display_name = (_spec_display = spec.display) === null || _spec_display === void 0 ? void 0 : _spec_display.name) !== null && _spec_display_name !== void 0 ? _spec_display_name : '',
|
|
31
|
+
description: (_spec_display_description = (_spec_display1 = spec.display) === null || _spec_display1 === void 0 ? void 0 : _spec_display1.description) !== null && _spec_display_description !== void 0 ? _spec_display_description : ''
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
name: name,
|
|
35
|
+
spec: {
|
|
36
|
+
...spec,
|
|
37
|
+
display: patchedDisplay
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function DatasourceEditorForm(props) {
|
|
42
|
+
var _state_spec_display, _state_spec_display1;
|
|
43
|
+
const { initialName , initialSpec , initialAction , isDraft , isReadonly , onSave , onClose , onDelete } = props;
|
|
44
|
+
const initialState = getInitialState(initialName, initialSpec);
|
|
45
|
+
const [state, setState] = useImmer(initialState);
|
|
46
|
+
const [isDiscardDialogOpened, setDiscardDialogOpened] = useState(false);
|
|
47
|
+
const [action, setAction] = useState(initialAction);
|
|
48
|
+
const titleAction = getTitleAction(action, isDraft);
|
|
49
|
+
const submitText = getSubmitText(action, isDraft);
|
|
50
|
+
const form = useForm({
|
|
51
|
+
resolver: zodResolver(datasourceEditValidationSchema),
|
|
52
|
+
mode: 'onBlur',
|
|
53
|
+
defaultValues: {
|
|
54
|
+
name: state.name,
|
|
55
|
+
title: (_state_spec_display = state.spec.display) === null || _state_spec_display === void 0 ? void 0 : _state_spec_display.name,
|
|
56
|
+
description: (_state_spec_display1 = state.spec.display) === null || _state_spec_display1 === void 0 ? void 0 : _state_spec_display1.description,
|
|
57
|
+
default: state.spec.default
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const processForm = ()=>{
|
|
61
|
+
var _state_spec_display, _state_spec_display1, _state_spec_display2, _state_spec_display3;
|
|
62
|
+
// reset display attributes to undefined when empty, because we don't want to save empty strings
|
|
63
|
+
onSave(state.name, {
|
|
64
|
+
...state.spec,
|
|
65
|
+
display: {
|
|
66
|
+
name: ((_state_spec_display = state.spec.display) === null || _state_spec_display === void 0 ? void 0 : _state_spec_display.name) === '' ? undefined : (_state_spec_display1 = state.spec.display) === null || _state_spec_display1 === void 0 ? void 0 : _state_spec_display1.name,
|
|
67
|
+
description: ((_state_spec_display2 = state.spec.display) === null || _state_spec_display2 === void 0 ? void 0 : _state_spec_display2.description) === '' ? undefined : (_state_spec_display3 = state.spec.display) === null || _state_spec_display3 === void 0 ? void 0 : _state_spec_display3.description
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
// When user click on cancel, several possibilities:
|
|
72
|
+
// - create action: ask for discard approval
|
|
73
|
+
// - update action: ask for discard approval if changed
|
|
74
|
+
// - read action: don´t ask for discard approval
|
|
75
|
+
const handleCancel = useCallback(()=>{
|
|
76
|
+
if (JSON.stringify(initialState) !== JSON.stringify(state)) {
|
|
77
|
+
setDiscardDialogOpened(true);
|
|
78
|
+
} else {
|
|
79
|
+
onClose();
|
|
80
|
+
}
|
|
81
|
+
}, [
|
|
82
|
+
state,
|
|
83
|
+
initialState,
|
|
84
|
+
setDiscardDialogOpened,
|
|
85
|
+
onClose
|
|
86
|
+
]);
|
|
87
|
+
return /*#__PURE__*/ _jsxs(FormProvider, {
|
|
88
|
+
...form,
|
|
89
|
+
children: [
|
|
90
|
+
/*#__PURE__*/ _jsxs(Box, {
|
|
91
|
+
sx: {
|
|
92
|
+
display: 'flex',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
padding: (theme)=>theme.spacing(1, 2),
|
|
95
|
+
borderBottom: (theme)=>`1px solid ${theme.palette.divider}`
|
|
96
|
+
},
|
|
97
|
+
children: [
|
|
98
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
99
|
+
variant: "h2",
|
|
100
|
+
children: [
|
|
101
|
+
titleAction,
|
|
102
|
+
" Datasource"
|
|
103
|
+
]
|
|
104
|
+
}),
|
|
105
|
+
/*#__PURE__*/ _jsx(Stack, {
|
|
106
|
+
direction: "row",
|
|
107
|
+
spacing: 1,
|
|
108
|
+
sx: {
|
|
109
|
+
marginLeft: 'auto'
|
|
110
|
+
},
|
|
111
|
+
children: action === 'read' ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
112
|
+
children: [
|
|
113
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
114
|
+
disabled: isReadonly,
|
|
115
|
+
variant: "contained",
|
|
116
|
+
onClick: ()=>setAction('update'),
|
|
117
|
+
children: "Edit"
|
|
118
|
+
}),
|
|
119
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
120
|
+
color: "error",
|
|
121
|
+
disabled: isReadonly,
|
|
122
|
+
variant: "outlined",
|
|
123
|
+
onClick: onDelete,
|
|
124
|
+
children: "Delete"
|
|
125
|
+
}),
|
|
126
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
127
|
+
orientation: "vertical",
|
|
128
|
+
flexItem: true,
|
|
129
|
+
sx: (theme)=>({
|
|
130
|
+
borderColor: theme.palette.grey['500'],
|
|
131
|
+
'&.MuiDivider-root': {
|
|
132
|
+
marginLeft: 2,
|
|
133
|
+
marginRight: 1
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
}),
|
|
137
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
138
|
+
color: "secondary",
|
|
139
|
+
variant: "outlined",
|
|
140
|
+
onClick: onClose,
|
|
141
|
+
children: "Close"
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
145
|
+
children: [
|
|
146
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
147
|
+
variant: "contained",
|
|
148
|
+
disabled: !form.formState.isValid,
|
|
149
|
+
onClick: form.handleSubmit(processForm),
|
|
150
|
+
children: submitText
|
|
151
|
+
}),
|
|
152
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
153
|
+
color: "secondary",
|
|
154
|
+
variant: "outlined",
|
|
155
|
+
onClick: handleCancel,
|
|
156
|
+
children: "Cancel"
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
}),
|
|
163
|
+
/*#__PURE__*/ _jsxs(Box, {
|
|
164
|
+
padding: 2,
|
|
165
|
+
sx: {
|
|
166
|
+
overflowY: 'scroll'
|
|
167
|
+
},
|
|
168
|
+
children: [
|
|
169
|
+
/*#__PURE__*/ _jsxs(Grid, {
|
|
170
|
+
container: true,
|
|
171
|
+
spacing: 2,
|
|
172
|
+
mb: 2,
|
|
173
|
+
children: [
|
|
174
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
175
|
+
item: true,
|
|
176
|
+
xs: 4,
|
|
177
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
178
|
+
name: "name",
|
|
179
|
+
render: ({ field , fieldState })=>{
|
|
180
|
+
var _fieldState_error;
|
|
181
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
182
|
+
...field,
|
|
183
|
+
required: true,
|
|
184
|
+
fullWidth: true,
|
|
185
|
+
name: "name",
|
|
186
|
+
label: "Name",
|
|
187
|
+
InputLabelProps: {
|
|
188
|
+
shrink: action === 'read' ? true : undefined
|
|
189
|
+
},
|
|
190
|
+
InputProps: {
|
|
191
|
+
disabled: action === 'update' && !isDraft,
|
|
192
|
+
readOnly: action === 'read'
|
|
193
|
+
},
|
|
194
|
+
error: !!fieldState.error,
|
|
195
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
196
|
+
onChange: (event)=>{
|
|
197
|
+
field.onChange(event);
|
|
198
|
+
setState((draft)=>{
|
|
199
|
+
draft.name = event.target.value;
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
}),
|
|
206
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
207
|
+
item: true,
|
|
208
|
+
xs: 8,
|
|
209
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
210
|
+
name: "title",
|
|
211
|
+
render: ({ field , fieldState })=>{
|
|
212
|
+
var _fieldState_error;
|
|
213
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
214
|
+
...field,
|
|
215
|
+
fullWidth: true,
|
|
216
|
+
name: "title",
|
|
217
|
+
label: "Display Label",
|
|
218
|
+
InputLabelProps: {
|
|
219
|
+
shrink: action === 'read' ? true : undefined
|
|
220
|
+
},
|
|
221
|
+
InputProps: {
|
|
222
|
+
readOnly: action === 'read'
|
|
223
|
+
},
|
|
224
|
+
error: !!fieldState.error,
|
|
225
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
226
|
+
onChange: (event)=>{
|
|
227
|
+
setState((draft)=>{
|
|
228
|
+
field.onChange(event);
|
|
229
|
+
if (draft.spec.display) {
|
|
230
|
+
draft.spec.display.name = event.target.value;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
}),
|
|
238
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
239
|
+
item: true,
|
|
240
|
+
xs: 12,
|
|
241
|
+
children: /*#__PURE__*/ _jsx(Controller, {
|
|
242
|
+
name: "description",
|
|
243
|
+
render: ({ field , fieldState })=>{
|
|
244
|
+
var _fieldState_error;
|
|
245
|
+
/*#__PURE__*/ return _jsx(TextField, {
|
|
246
|
+
...field,
|
|
247
|
+
fullWidth: true,
|
|
248
|
+
name: "description",
|
|
249
|
+
label: "Description",
|
|
250
|
+
InputLabelProps: {
|
|
251
|
+
shrink: action === 'read' ? true : undefined
|
|
252
|
+
},
|
|
253
|
+
InputProps: {
|
|
254
|
+
readOnly: action === 'read'
|
|
255
|
+
},
|
|
256
|
+
error: !!fieldState.error,
|
|
257
|
+
helperText: (_fieldState_error = fieldState.error) === null || _fieldState_error === void 0 ? void 0 : _fieldState_error.message,
|
|
258
|
+
onChange: (event)=>{
|
|
259
|
+
field.onChange(event);
|
|
260
|
+
setState((draft)=>{
|
|
261
|
+
if (draft.spec.display) {
|
|
262
|
+
draft.spec.display.description = event.target.value;
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
})
|
|
269
|
+
}),
|
|
270
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
271
|
+
item: true,
|
|
272
|
+
xs: 6,
|
|
273
|
+
sx: {
|
|
274
|
+
paddingTop: '5px !important'
|
|
275
|
+
},
|
|
276
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
277
|
+
children: [
|
|
278
|
+
/*#__PURE__*/ _jsx(Controller, {
|
|
279
|
+
name: "default",
|
|
280
|
+
render: ({ field })=>/*#__PURE__*/ _jsx(FormControlLabel, {
|
|
281
|
+
...field,
|
|
282
|
+
control: /*#__PURE__*/ _jsx(Switch, {
|
|
283
|
+
checked: state.spec.default,
|
|
284
|
+
readOnly: action === 'read',
|
|
285
|
+
onChange: (event)=>{
|
|
286
|
+
if (action === 'read') return; // ReadOnly prop is not blocking user interaction...
|
|
287
|
+
field.onChange(event);
|
|
288
|
+
setState((draft)=>{
|
|
289
|
+
draft.spec.default = event.target.checked;
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}),
|
|
293
|
+
label: "Set as default"
|
|
294
|
+
})
|
|
295
|
+
}),
|
|
296
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
297
|
+
variant: "caption",
|
|
298
|
+
children: [
|
|
299
|
+
"Whether this datasource should be the default ",
|
|
300
|
+
state.spec.plugin.kind,
|
|
301
|
+
" to be used"
|
|
302
|
+
]
|
|
303
|
+
})
|
|
304
|
+
]
|
|
305
|
+
})
|
|
306
|
+
})
|
|
307
|
+
]
|
|
308
|
+
}),
|
|
309
|
+
/*#__PURE__*/ _jsx(Divider, {}),
|
|
310
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
311
|
+
py: 1,
|
|
312
|
+
variant: "h3",
|
|
313
|
+
children: "Plugin Options"
|
|
314
|
+
}),
|
|
315
|
+
/*#__PURE__*/ _jsx(PluginEditor, {
|
|
316
|
+
width: "100%",
|
|
317
|
+
pluginType: "Datasource",
|
|
318
|
+
pluginKindLabel: "Source",
|
|
319
|
+
value: state.spec.plugin,
|
|
320
|
+
isReadonly: action === 'read',
|
|
321
|
+
onChange: (v)=>{
|
|
322
|
+
setState((draft)=>{
|
|
323
|
+
draft.spec.plugin = v;
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
}),
|
|
329
|
+
/*#__PURE__*/ _jsx(DiscardChangesConfirmationDialog, {
|
|
330
|
+
description: "Are you sure you want to discard your changes? Changes cannot be recovered.",
|
|
331
|
+
isOpen: isDiscardDialogOpened,
|
|
332
|
+
onCancel: ()=>setDiscardDialogOpened(false),
|
|
333
|
+
onDiscardChanges: ()=>{
|
|
334
|
+
setDiscardDialogOpened(false);
|
|
335
|
+
onClose();
|
|
336
|
+
}
|
|
337
|
+
})
|
|
338
|
+
]
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
//# sourceMappingURL=DatasourceEditorForm.js.map
|