@perses-dev/plugin-system 0.0.0-snapshot-panel-extra-content-3-17f9c42 → 0.0.0-snapshot-scatterplot-fix-imports-95e1b59
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 +7 -5
- 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 +137 -25
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +19 -17
- package/dist/cjs/components/LegendOptionsEditor/index.js +10 -8
- package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +25 -30
- package/dist/cjs/components/OptionsEditorRadios/index.js +10 -8
- package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +7 -5
- package/dist/cjs/components/OptionsEditorTabPanel/index.js +10 -8
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +13 -11
- package/dist/cjs/components/OptionsEditorTabs/index.js +10 -8
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +60 -19
- package/dist/cjs/components/PanelSpecEditor/index.js +10 -8
- package/dist/cjs/components/PluginEditor/PluginEditor.js +25 -32
- package/dist/cjs/components/PluginEditor/index.js +11 -9
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +8 -6
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +25 -14
- 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 +7 -3
- package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +9 -7
- package/dist/cjs/components/PluginSpecEditor/index.js +10 -8
- package/dist/cjs/components/ProjectSelect.js +96 -0
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +192 -0
- package/dist/cjs/components/TimeRangeControls/index.js +30 -0
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +45 -49
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +23 -21
- 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 +445 -230
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +38 -32
- package/dist/cjs/components/Variables/VariableEditorForm/index.js +11 -9
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +36 -37
- package/dist/cjs/components/Variables/index.js +11 -9
- package/dist/cjs/components/Variables/variable-model.js +24 -17
- package/dist/cjs/components/index.js +24 -19
- package/dist/cjs/constants/index.js +10 -8
- package/dist/cjs/constants/user-interface-text.js +7 -2
- 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 +55 -27
- 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 +45 -59
- 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 +44 -14
- package/dist/cjs/runtime/template-variables.js +51 -13
- package/dist/cjs/runtime/time-series-queries.js +43 -31
- 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 +21 -16
- 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 +16 -12
- package/dist/cjs/test/test-plugins/ernie/index.js +15 -11
- package/dist/cjs/test/test-plugins/index.js +14 -10
- package/dist/cjs/test-utils/index.js +10 -8
- package/dist/cjs/test-utils/mock-plugin-registry.js +9 -5
- 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/duration.js +25 -0
- package/dist/cjs/validation/index.js +34 -0
- package/dist/cjs/validation/resource.js +24 -0
- package/dist/cjs/validation/role.js +86 -0
- package/dist/cjs/validation/rolebinding.js +55 -0
- package/dist/cjs/validation/secret.js +176 -0
- package/dist/cjs/validation/user.js +46 -0
- package/dist/cjs/validation/variable.js +48 -0
- package/dist/components/CalculationSelector/CalculationSelector.d.ts +1 -2
- package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
- 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 +14 -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 +8 -3
- package/dist/components/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect.js +120 -23
- package/dist/components/DatasourceSelect.js.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +1 -2
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +3 -3
- 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 +5 -5
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +18 -25
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
- package/dist/components/OptionsEditorRadios/index.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.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.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +3 -3
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +3 -3
- 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 +2 -3
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +50 -11
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PanelSpecEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts +1 -2
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +17 -26
- 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 +3 -3
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +5 -5
- 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 +23 -14
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginKindSelect/index.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.d.ts +4 -4
- package/dist/components/PluginRegistry/PluginRegistry.d.ts.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 +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +2 -2
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js +3 -3
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
- package/dist/components/PluginSpecEditor/index.js.map +1 -1
- package/dist/components/ProjectSelect.d.ts +14 -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/TimeRangeControls/TimeRangeControls.d.ts +13 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.js +168 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
- package/dist/components/TimeRangeControls/index.d.ts +2 -0
- package/dist/components/TimeRangeControls/index.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/index.js +15 -0
- package/dist/components/TimeRangeControls/index.js.map +1 -0
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +1 -2
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +38 -44
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +1 -2
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +1 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js +3 -3
- 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 +8 -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 +12 -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 +395 -184
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -3
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +4 -4
- 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 +30 -35
- 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.d.ts.map +1 -1
- package/dist/components/Variables/variable-model.js +9 -10
- 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.d.ts +2 -0
- package/dist/constants/user-interface-text.d.ts.map +1 -1
- package/dist/constants/user-interface-text.js +4 -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 +3 -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 +3 -3
- 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 +3 -2
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js.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 +6 -4
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/model/time-series-queries.d.ts +2 -2
- package/dist/model/time-series-queries.d.ts.map +1 -1
- package/dist/model/time-series-queries.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/model/variables.d.ts +2 -2
- package/dist/model/variables.d.ts.map +1 -1
- package/dist/model/variables.js +3 -1
- package/dist/model/variables.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +6 -6
- 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 +18 -13
- 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 +9 -4
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +37 -20
- 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 +5 -5
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +13 -45
- 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 +5 -3
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +22 -5
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/template-variables.d.ts +6 -5
- package/dist/runtime/template-variables.d.ts.map +1 -1
- package/dist/runtime/template-variables.js +36 -9
- 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 +21 -19
- 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.d.ts +2 -3
- package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +1 -2
- 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 +12 -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 +2 -3
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +24 -8
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts +2 -3
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +4 -5
- 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.d.ts +1 -1
- package/dist/test/render.d.ts.map +1 -1
- 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 +2 -2
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test/test-plugins/ernie/index.js +2 -2
- 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.d.ts +1 -1
- package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +3 -3
- 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/duration.d.ts +3 -0
- package/dist/validation/duration.d.ts.map +1 -0
- package/dist/validation/duration.js +17 -0
- package/dist/validation/duration.js.map +1 -0
- package/dist/validation/index.d.ts +6 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +19 -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 +67 -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/user.d.ts +93 -0
- package/dist/validation/user.d.ts.map +1 -0
- package/dist/validation/user.js +38 -0
- package/dist/validation/user.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
|
@@ -16,7 +16,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "usePluginEditor", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return usePluginEditor;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
23
|
const _core = require("@perses-dev/core");
|
|
22
24
|
const _react = require("react");
|
|
@@ -24,7 +26,7 @@ const _immer = require("immer");
|
|
|
24
26
|
const _runtime = require("../../runtime");
|
|
25
27
|
function usePluginEditor(props) {
|
|
26
28
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
27
|
-
const { pluginType
|
|
29
|
+
const { pluginType, value, onHideQueryEditorChange = ()=>{} } = props; // setting onHideQueryEditorChange to empty function here because useEvent requires a function
|
|
28
30
|
// Keep a stable reference so we don't run the effect below when we don't need to
|
|
29
31
|
const onChange = (0, _core.useEvent)(props.onChange);
|
|
30
32
|
const onHideQuery = (0, _core.useEvent)(onHideQueryEditorChange);
|
|
@@ -46,13 +48,13 @@ function usePluginEditor(props) {
|
|
|
46
48
|
const hideQueryState = (0, _react.useRef)({
|
|
47
49
|
[value.kind]: false
|
|
48
50
|
});
|
|
49
|
-
const { defaultPluginKinds
|
|
51
|
+
const { defaultPluginKinds } = (0, _runtime.usePluginRegistry)();
|
|
50
52
|
const defaultPluginKind = defaultPluginKinds === null || defaultPluginKinds === void 0 ? void 0 : defaultPluginKinds[pluginType];
|
|
51
53
|
const initPendingKind = !value.kind && defaultPluginKind ? defaultPluginKind : '';
|
|
52
54
|
// When kind changes and we haven't loaded that plugin before, we will need to enter a "pending" state so that we
|
|
53
55
|
// can generate proper initial spec values that match the new plugin kind
|
|
54
56
|
const [pendingKind, setPendingKind] = (0, _react.useState)(initPendingKind);
|
|
55
|
-
const { data: plugin
|
|
57
|
+
const { data: plugin, isFetching, error } = (0, _runtime.usePlugin)(pluginType, pendingKind);
|
|
56
58
|
(0, _react.useEffect)(()=>{
|
|
57
59
|
// Nothing to do if no new plugin kind is pending
|
|
58
60
|
if (pendingKind === '') return;
|
|
@@ -86,10 +88,10 @@ function usePluginEditor(props) {
|
|
|
86
88
|
* When the user tries to change the plugin kind, make sure we have the correct spec for that plugin kind before we
|
|
87
89
|
* make the switch.
|
|
88
90
|
*/ const onKindChange = (e)=>{
|
|
89
|
-
var
|
|
91
|
+
var _prevSpecState_current_pluginType;
|
|
90
92
|
const nextKind = e.target.value;
|
|
91
93
|
// If we already have state for this plugin type/kind from a previous selection, just use it
|
|
92
|
-
const previousState = (
|
|
94
|
+
const previousState = (_prevSpecState_current_pluginType = prevSpecState.current[pluginType]) === null || _prevSpecState_current_pluginType === void 0 ? void 0 : _prevSpecState_current_pluginType[nextKind];
|
|
93
95
|
if (previousState !== undefined) {
|
|
94
96
|
rememberCurrentSpecState();
|
|
95
97
|
onChange({
|
|
@@ -16,26 +16,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "PluginKindSelect", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return PluginKindSelect;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _material = require("@mui/material");
|
|
25
|
+
const _react = require("react");
|
|
23
26
|
const _runtime = require("../../runtime");
|
|
24
|
-
|
|
25
|
-
const { pluginType
|
|
26
|
-
const { data
|
|
27
|
+
const PluginKindSelect = /*#__PURE__*/ (0, _react.forwardRef)((props, ref)=>{
|
|
28
|
+
const { pluginType, value: propValue, ...others } = props;
|
|
29
|
+
const { data, isLoading } = (0, _runtime.useListPluginMetadata)(pluginType);
|
|
27
30
|
// Pass an empty value while options are still loading so MUI doesn't complain about us using an "out of range" value
|
|
28
31
|
const value = propValue !== '' && isLoading ? '' : propValue;
|
|
29
32
|
// TODO: Does this need a loading indicator of some kind?
|
|
30
|
-
return /*#__PURE__*/ (0,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
33
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TextField, {
|
|
34
|
+
select: true,
|
|
35
|
+
inputRef: ref,
|
|
34
36
|
...others,
|
|
35
37
|
value: value,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
"data-testid": "plugin-kind-select",
|
|
39
|
+
children: [
|
|
40
|
+
isLoading && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
41
|
+
value: "",
|
|
42
|
+
children: "Loading..."
|
|
43
|
+
}),
|
|
44
|
+
data === null || data === void 0 ? void 0 : data.map((metadata)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
45
|
+
"data-testid": "option",
|
|
46
|
+
value: metadata.kind,
|
|
47
|
+
children: metadata.display.name
|
|
48
|
+
}, metadata.kind))
|
|
49
|
+
]
|
|
40
50
|
});
|
|
41
|
-
}
|
|
51
|
+
});
|
|
52
|
+
PluginKindSelect.displayName = 'PluginKindSelect';
|
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
function
|
|
17
|
+
_export_star(require("./PluginKindSelect"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
return from;
|
|
28
30
|
}
|
|
@@ -16,16 +16,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "PluginRegistry", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return PluginRegistry;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _core = require("@perses-dev/core");
|
|
23
25
|
const _react = require("react");
|
|
24
26
|
const _runtime = require("../../runtime");
|
|
25
|
-
const
|
|
27
|
+
const _pluginindexes = require("./plugin-indexes");
|
|
26
28
|
function PluginRegistry(props) {
|
|
27
|
-
const { pluginLoader: { getInstalledPlugins
|
|
28
|
-
const getPluginIndexes = (0,
|
|
29
|
+
const { pluginLoader: { getInstalledPlugins, importPluginModule }, children, defaultPluginKinds } = props;
|
|
30
|
+
const getPluginIndexes = (0, _pluginindexes.usePluginIndexes)(getInstalledPlugins);
|
|
29
31
|
// De-dupe calls to import plugin modules
|
|
30
32
|
const importCache = (0, _react.useRef)(new Map());
|
|
31
33
|
// Do useEvent here since this accesses the importPluginModule prop and we want a stable reference to it for the
|
|
@@ -44,7 +46,7 @@ function PluginRegistry(props) {
|
|
|
44
46
|
// Get the indexes of the installed plugins
|
|
45
47
|
const pluginIndexes = await getPluginIndexes();
|
|
46
48
|
// Figure out what module the plugin is in by looking in the index
|
|
47
|
-
const typeAndKindKey = (0,
|
|
49
|
+
const typeAndKindKey = (0, _pluginindexes.getTypeAndKindKey)(pluginType, kind);
|
|
48
50
|
const resource = pluginIndexes.pluginResourcesByTypeAndKind.get(typeAndKindKey);
|
|
49
51
|
if (resource === undefined) {
|
|
50
52
|
throw new Error(`A ${pluginType} plugin for kind '${kind}' is not installed`);
|
|
@@ -63,8 +65,8 @@ function PluginRegistry(props) {
|
|
|
63
65
|
]);
|
|
64
66
|
const listPluginMetadata = (0, _react.useCallback)(async (pluginType)=>{
|
|
65
67
|
const pluginIndexes = await getPluginIndexes();
|
|
66
|
-
var
|
|
67
|
-
return (
|
|
68
|
+
var _pluginIndexes_pluginMetadataByType_get;
|
|
69
|
+
return (_pluginIndexes_pluginMetadataByType_get = pluginIndexes.pluginMetadataByType.get(pluginType)) !== null && _pluginIndexes_pluginMetadataByType_get !== void 0 ? _pluginIndexes_pluginMetadataByType_get : [];
|
|
68
70
|
}, [
|
|
69
71
|
getPluginIndexes
|
|
70
72
|
]);
|
|
@@ -78,7 +80,7 @@ function PluginRegistry(props) {
|
|
|
78
80
|
listPluginMetadata,
|
|
79
81
|
defaultPluginKinds
|
|
80
82
|
]);
|
|
81
|
-
return /*#__PURE__*/ (0,
|
|
83
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_runtime.PluginRegistryContext.Provider, {
|
|
82
84
|
value: context,
|
|
83
85
|
children: children
|
|
84
86
|
});
|
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
function
|
|
17
|
+
_export_star(require("./PluginRegistry"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
return from;
|
|
28
30
|
}
|
|
@@ -21,8 +21,12 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
getTypeAndKindKey: function() {
|
|
25
|
+
return getTypeAndKindKey;
|
|
26
|
+
},
|
|
27
|
+
usePluginIndexes: function() {
|
|
28
|
+
return usePluginIndexes;
|
|
29
|
+
}
|
|
26
30
|
});
|
|
27
31
|
const _core = require("@perses-dev/core");
|
|
28
32
|
const _react = require("react");
|
|
@@ -36,7 +40,7 @@ function usePluginIndexes(getInstalledPlugins) {
|
|
|
36
40
|
const pluginMetadataByType = new Map();
|
|
37
41
|
for (const resource of installedPlugins){
|
|
38
42
|
for (const pluginMetadata of resource.spec.plugins){
|
|
39
|
-
const { pluginType
|
|
43
|
+
const { pluginType, kind } = pluginMetadata;
|
|
40
44
|
// Index the plugin by type and kind to point at the module that contains it
|
|
41
45
|
const key = getTypeAndKindKey(pluginType, kind);
|
|
42
46
|
if (pluginResourcesByTypeAndKind.has(key)) {
|
|
@@ -16,16 +16,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "PluginSpecEditor", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()
|
|
19
|
+
get: function() {
|
|
20
|
+
return PluginSpecEditor;
|
|
21
|
+
}
|
|
20
22
|
});
|
|
21
|
-
const
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
22
24
|
const _components = require("@perses-dev/components");
|
|
23
25
|
const _runtime = require("../../runtime");
|
|
24
26
|
function PluginSpecEditor(props) {
|
|
25
|
-
const { pluginType
|
|
26
|
-
const { data: plugin
|
|
27
|
+
const { pluginType, pluginKind, ...others } = props;
|
|
28
|
+
const { data: plugin, isLoading, error } = (0, _runtime.usePlugin)(pluginType, pluginKind);
|
|
27
29
|
if (error) {
|
|
28
|
-
return /*#__PURE__*/ (0,
|
|
30
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ErrorAlert, {
|
|
29
31
|
error: error
|
|
30
32
|
});
|
|
31
33
|
}
|
|
@@ -39,9 +41,9 @@ function PluginSpecEditor(props) {
|
|
|
39
41
|
if (pluginType === 'Panel') {
|
|
40
42
|
throw new Error('This editor should not be used for panel type. Please use Panel Spec Editor instead.');
|
|
41
43
|
}
|
|
42
|
-
const { OptionsEditorComponent
|
|
44
|
+
const { OptionsEditorComponent } = plugin;
|
|
43
45
|
if (OptionsEditorComponent !== undefined) {
|
|
44
|
-
return /*#__PURE__*/ (0,
|
|
46
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(OptionsEditorComponent, {
|
|
45
47
|
...others
|
|
46
48
|
});
|
|
47
49
|
}
|
|
@@ -14,15 +14,17 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
function
|
|
17
|
+
_export_star(require("./PluginSpecEditor"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
19
|
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
26
28
|
});
|
|
27
29
|
return from;
|
|
28
30
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
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, "ProjectSelect", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return ProjectSelect;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _context = require("../context");
|
|
26
|
+
function ProjectSelect(props) {
|
|
27
|
+
const { onChange, value, ...others } = props;
|
|
28
|
+
const { data, isLoading } = (0, _context.useProjectList)();
|
|
29
|
+
// While loading available values, just use an empty string so MUI select doesn't warn about values out of range
|
|
30
|
+
const optionValue = isLoading ? '' : projectToOptionValue(value);
|
|
31
|
+
// When the user makes a selection, convert the string option value back to a DatasourceSelector
|
|
32
|
+
const handleChange = (e)=>{
|
|
33
|
+
const next = optionValueToSelector(e.target.value);
|
|
34
|
+
onChange(next);
|
|
35
|
+
};
|
|
36
|
+
// TODO:
|
|
37
|
+
// - Does this need a loading indicator of some kind?
|
|
38
|
+
// - The group's edit link is not clickable once selected.
|
|
39
|
+
// - The group's edit link is disabled if datasource is overridden.
|
|
40
|
+
// Ref: https://github.com/mui/material-ui/issues/36572
|
|
41
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Select, {
|
|
42
|
+
...others,
|
|
43
|
+
value: optionValue,
|
|
44
|
+
onChange: handleChange,
|
|
45
|
+
children: [
|
|
46
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
47
|
+
value: 'none',
|
|
48
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
49
|
+
direction: "row",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
justifyContent: "space-between",
|
|
52
|
+
width: "100%",
|
|
53
|
+
height: 32,
|
|
54
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ListItemText, {
|
|
55
|
+
children: "None"
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
}),
|
|
59
|
+
data === null || data === void 0 ? void 0 : data.map((project)=>[
|
|
60
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
61
|
+
value: project.metadata.name,
|
|
62
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
63
|
+
direction: "row",
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
justifyContent: "space-between",
|
|
66
|
+
width: "100%",
|
|
67
|
+
height: 32,
|
|
68
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ListItemText, {
|
|
69
|
+
children: project.metadata.name
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
}, project.metadata.name)
|
|
73
|
+
])
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Given a ProjectSelectItemSelector,
|
|
79
|
+
* returns a string value that can be used as a Select input value.
|
|
80
|
+
* @param selector
|
|
81
|
+
*/ function projectToOptionValue(project) {
|
|
82
|
+
var _project_metadata_name;
|
|
83
|
+
return (_project_metadata_name = project.metadata.name) !== null && _project_metadata_name !== void 0 ? _project_metadata_name : 'none';
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Given an option value name,
|
|
87
|
+
* returns a ProjectResource to be used by the query data model.
|
|
88
|
+
* @param optionValue
|
|
89
|
+
*/ function optionValueToSelector(optionValue) {
|
|
90
|
+
return {
|
|
91
|
+
kind: 'Project',
|
|
92
|
+
metadata: {
|
|
93
|
+
name: optionValue
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
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
|
+
DEFAULT_REFRESH_INTERVAL_OPTIONS: function() {
|
|
25
|
+
return DEFAULT_REFRESH_INTERVAL_OPTIONS;
|
|
26
|
+
},
|
|
27
|
+
DEFAULT_TIME_RANGE_OPTIONS: function() {
|
|
28
|
+
return DEFAULT_TIME_RANGE_OPTIONS;
|
|
29
|
+
},
|
|
30
|
+
TimeRangeControls: function() {
|
|
31
|
+
return TimeRangeControls;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
35
|
+
const _Refresh = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Refresh"));
|
|
36
|
+
const _material = require("@mui/material");
|
|
37
|
+
const _components = require("@perses-dev/components");
|
|
38
|
+
const _react = require("react");
|
|
39
|
+
const _constants = require("../../constants");
|
|
40
|
+
const _runtime = require("../../runtime");
|
|
41
|
+
function _interop_require_default(obj) {
|
|
42
|
+
return obj && obj.__esModule ? obj : {
|
|
43
|
+
default: obj
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const DEFAULT_TIME_RANGE_OPTIONS = [
|
|
47
|
+
{
|
|
48
|
+
value: {
|
|
49
|
+
pastDuration: '5m'
|
|
50
|
+
},
|
|
51
|
+
display: 'Last 5 minutes'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
value: {
|
|
55
|
+
pastDuration: '15m'
|
|
56
|
+
},
|
|
57
|
+
display: 'Last 15 minutes'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
value: {
|
|
61
|
+
pastDuration: '30m'
|
|
62
|
+
},
|
|
63
|
+
display: 'Last 30 minutes'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
value: {
|
|
67
|
+
pastDuration: '1h'
|
|
68
|
+
},
|
|
69
|
+
display: 'Last 1 hour'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
value: {
|
|
73
|
+
pastDuration: '6h'
|
|
74
|
+
},
|
|
75
|
+
display: 'Last 6 hours'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
value: {
|
|
79
|
+
pastDuration: '12h'
|
|
80
|
+
},
|
|
81
|
+
display: 'Last 12 hours'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
value: {
|
|
85
|
+
pastDuration: '24h'
|
|
86
|
+
},
|
|
87
|
+
display: 'Last 1 day'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
value: {
|
|
91
|
+
pastDuration: '7d'
|
|
92
|
+
},
|
|
93
|
+
display: 'Last 7 days'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
value: {
|
|
97
|
+
pastDuration: '14d'
|
|
98
|
+
},
|
|
99
|
+
display: 'Last 14 days'
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
const DEFAULT_REFRESH_INTERVAL_OPTIONS = [
|
|
103
|
+
{
|
|
104
|
+
value: {
|
|
105
|
+
pastDuration: '0s'
|
|
106
|
+
},
|
|
107
|
+
display: 'Off'
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
value: {
|
|
111
|
+
pastDuration: '5s'
|
|
112
|
+
},
|
|
113
|
+
display: '5s'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
value: {
|
|
117
|
+
pastDuration: '10s'
|
|
118
|
+
},
|
|
119
|
+
display: '10s'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
value: {
|
|
123
|
+
pastDuration: '15s'
|
|
124
|
+
},
|
|
125
|
+
display: '15s'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
value: {
|
|
129
|
+
pastDuration: '30s'
|
|
130
|
+
},
|
|
131
|
+
display: '30s'
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
value: {
|
|
135
|
+
pastDuration: '60s'
|
|
136
|
+
},
|
|
137
|
+
display: '1m'
|
|
138
|
+
}
|
|
139
|
+
];
|
|
140
|
+
const DEFAULT_HEIGHT = '34px';
|
|
141
|
+
function TimeRangeControls({ heightPx, showTimeRangeSelector = true, showRefreshButton = true, showRefreshInterval = true, timePresets = DEFAULT_TIME_RANGE_OPTIONS }) {
|
|
142
|
+
const { timeRange, setTimeRange, refresh, refreshInterval, setRefreshInterval } = (0, _runtime.useTimeRange)();
|
|
143
|
+
// Convert height to a string, then use the string for styling
|
|
144
|
+
const height = heightPx === undefined ? DEFAULT_HEIGHT : `${heightPx}px`;
|
|
145
|
+
// add time preset if one does not match duration given in time range
|
|
146
|
+
if ('pastDuration' in timeRange && !timePresets.some((option)=>option.value.pastDuration === timeRange['pastDuration'])) {
|
|
147
|
+
timePresets.push({
|
|
148
|
+
value: {
|
|
149
|
+
pastDuration: timeRange['pastDuration']
|
|
150
|
+
},
|
|
151
|
+
display: `Last ${timeRange['pastDuration']}`
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
// set the new refresh interval both in the dashboard context & as query param
|
|
155
|
+
const handleRefreshIntervalChange = (0, _react.useCallback)((duration)=>{
|
|
156
|
+
setRefreshInterval(duration);
|
|
157
|
+
}, [
|
|
158
|
+
setRefreshInterval
|
|
159
|
+
]);
|
|
160
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
161
|
+
direction: "row",
|
|
162
|
+
spacing: 1,
|
|
163
|
+
children: [
|
|
164
|
+
showTimeRangeSelector && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.DateTimeRangePicker, {
|
|
165
|
+
timeOptions: timePresets,
|
|
166
|
+
value: timeRange,
|
|
167
|
+
onChange: setTimeRange,
|
|
168
|
+
height: height
|
|
169
|
+
}),
|
|
170
|
+
showRefreshButton && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
171
|
+
description: _constants.TOOLTIP_TEXT.refresh,
|
|
172
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ToolbarIconButton, {
|
|
173
|
+
"aria-label": _constants.TOOLTIP_TEXT.refresh,
|
|
174
|
+
onClick: refresh,
|
|
175
|
+
sx: {
|
|
176
|
+
height
|
|
177
|
+
},
|
|
178
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Refresh.default, {})
|
|
179
|
+
})
|
|
180
|
+
}),
|
|
181
|
+
showRefreshInterval && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
|
|
182
|
+
description: _constants.TOOLTIP_TEXT.refreshInterval,
|
|
183
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.RefreshIntervalPicker, {
|
|
184
|
+
timeOptions: DEFAULT_REFRESH_INTERVAL_OPTIONS,
|
|
185
|
+
value: refreshInterval,
|
|
186
|
+
onChange: handleRefreshIntervalChange,
|
|
187
|
+
height: height
|
|
188
|
+
})
|
|
189
|
+
})
|
|
190
|
+
]
|
|
191
|
+
});
|
|
192
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
_export_star(require("./TimeRangeControls"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return from;
|
|
30
|
+
}
|