@perses-dev/plugin-system 0.0.0-snapshot-scatter-chart-embed-8efdfab → 0.0.0-snapshot-explorer-plugin-c4a7621
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/CalculationSelector/CalculationSelector.js +1 -1
- package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +83 -163
- package/dist/cjs/components/DatasourceSelect.js +12 -15
- package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +528 -0
- package/dist/cjs/components/{TimeSeriesQueryEditor → HTTPSettingsEditor}/index.js +2 -2
- package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +8 -7
- package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +41 -0
- package/dist/cjs/{validation/resource.js → components/MetricLabelInput/index.js} +15 -9
- package/dist/cjs/components/{TraceQueryEditor/TraceQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +39 -40
- package/dist/cjs/components/{TimeSeriesQueryEditor/TimeSeriesQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +23 -11
- package/dist/cjs/components/MultiQueryEditor/index.js +30 -0
- package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +3 -3
- package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +3 -3
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +54 -62
- package/dist/cjs/components/PluginEditor/PluginEditor.js +16 -13
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +44 -33
- package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +55 -7
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +9 -10
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +20 -17
- package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +3 -3
- package/dist/cjs/components/ProjectSelect.js +7 -7
- package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +131 -0
- package/dist/cjs/components/{TraceQueryEditor → TimeRangeControls}/index.js +1 -1
- package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +394 -439
- package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +17 -15
- package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +7 -12
- package/dist/cjs/components/Variables/variable-model.js +35 -37
- package/dist/cjs/components/index.js +4 -1
- package/dist/cjs/constants/user-interface-text.js +4 -1
- package/dist/cjs/context/ProjectStoreProvider.js +12 -9
- package/dist/cjs/context/ValidationProvider.js +69 -0
- package/dist/cjs/context/index.js +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/{components/TimeSeriesQueryEditor/index.js → cjs/model/explore.js} +4 -3
- package/dist/cjs/model/legend.js +5 -5
- package/dist/cjs/remote/PersesPlugin.types.js +16 -0
- package/dist/cjs/remote/PluginLoaderComponent.js +75 -0
- package/dist/cjs/remote/PluginRuntime.js +267 -0
- package/dist/cjs/{validation → remote}/index.js +2 -4
- package/dist/cjs/remote/remotePluginLoader.js +61 -0
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +23 -14
- package/dist/cjs/runtime/DataQueriesProvider/model.js +10 -9
- package/dist/cjs/runtime/QueryCountProvider.js +83 -0
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +37 -13
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +3 -3
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +100 -0
- package/dist/cjs/runtime/TimeRangeProvider/index.js +2 -1
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +20 -23
- package/dist/cjs/runtime/UsageMetricsProvider.js +99 -0
- package/dist/cjs/runtime/builtin-variables.js +7 -7
- package/dist/cjs/runtime/datasources.js +30 -21
- package/dist/cjs/runtime/index.js +4 -2
- package/dist/cjs/runtime/plugin-registry.js +48 -36
- package/dist/cjs/runtime/time-series-queries.js +35 -40
- package/dist/cjs/runtime/trace-queries.js +9 -6
- package/dist/cjs/runtime/{template-variables.js → variables.js} +38 -48
- package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +1 -1
- package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +1 -65
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +1 -1
- package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +5 -5
- package/dist/cjs/stories/shared-utils/decorators/{WithPluginSystemTemplateVariables.js → WithPluginSystemVariables.js} +9 -9
- package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +1 -1
- package/dist/cjs/stories/shared-utils/decorators/index.js +2 -2
- package/dist/cjs/test/mock-data.js +25 -4
- package/dist/cjs/test/render.js +2 -11
- package/dist/cjs/test/test-plugins/bert/index.js +21 -20
- package/dist/cjs/test/test-plugins/ernie/index.js +2 -2
- package/dist/cjs/test/test-plugins/index.js +3 -1
- package/dist/cjs/test-utils/mock-plugin-registry.js +13 -13
- package/dist/cjs/utils/action.js +3 -3
- package/dist/cjs/utils/variables.js +24 -24
- package/dist/components/CalculationSelector/CalculationSelector.d.ts +2 -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/DatasourceEditorForm/DatasourceEditorForm.d.ts +7 -7
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +86 -166
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
- package/dist/components/DatasourceSelect.d.ts +4 -4
- package/dist/components/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect.js +9 -12
- package/dist/components/DatasourceSelect.js.map +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +11 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +474 -0
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -0
- package/dist/components/HTTPSettingsEditor/index.d.ts +2 -0
- package/dist/components/HTTPSettingsEditor/index.d.ts.map +1 -0
- package/dist/components/HTTPSettingsEditor/index.js +15 -0
- package/dist/components/HTTPSettingsEditor/index.js.map +1 -0
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +3 -2
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +10 -9
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.d.ts +7 -0
- package/dist/components/MetricLabelInput/MetricLabelInput.d.ts.map +1 -0
- package/dist/components/MetricLabelInput/MetricLabelInput.js +33 -0
- package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -0
- package/dist/components/MetricLabelInput/index.d.ts +2 -0
- package/dist/components/MetricLabelInput/index.d.ts.map +1 -0
- package/dist/components/MetricLabelInput/index.js +15 -0
- package/dist/components/MetricLabelInput/index.js.map +1 -0
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +17 -0
- package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -0
- package/dist/components/{TimeSeriesQueryEditor/TimeSeriesQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +42 -39
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -0
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +29 -0
- package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -0
- package/dist/components/{TimeSeriesQueryEditor/TimeSeriesQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +33 -10
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -0
- package/dist/components/MultiQueryEditor/index.d.ts +2 -0
- package/dist/components/MultiQueryEditor/index.d.ts.map +1 -0
- package/dist/components/MultiQueryEditor/index.js +15 -0
- package/dist/components/{TraceQueryEditor → MultiQueryEditor}/index.js.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +4 -4
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +3 -3
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +2 -2
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +5 -5
- 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/PanelSpecEditor/PanelSpecEditor.d.ts +5 -3
- package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +56 -64
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.d.ts +2 -2
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +16 -13
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +16 -10
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +44 -33
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +11 -5
- package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js +61 -10
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.d.ts +4 -4
- package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +9 -10
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.d.ts +4 -4
- package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js +17 -14
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +5 -5
- 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/ProjectSelect.d.ts +3 -3
- package/dist/components/ProjectSelect.d.ts.map +1 -1
- package/dist/components/ProjectSelect.js +7 -7
- package/dist/components/ProjectSelect.js.map +1 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +14 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -0
- package/dist/components/TimeRangeControls/TimeRangeControls.js +110 -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/{TraceQueryEditor → TimeRangeControls}/index.js +1 -1
- package/dist/components/TimeRangeControls/index.js.map +1 -0
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +4 -3
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +395 -442
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +3 -3
- package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js +11 -11
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +3 -3
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +7 -12
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
- package/dist/components/Variables/variable-model.d.ts +2 -1
- package/dist/components/Variables/variable-model.d.ts.map +1 -1
- package/dist/components/Variables/variable-model.js +29 -31
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/components/index.d.ts +4 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -1
- package/dist/components/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 +4 -4
- package/dist/context/ProjectStoreProvider.d.ts.map +1 -1
- package/dist/context/ProjectStoreProvider.js +9 -6
- package/dist/context/ProjectStoreProvider.js.map +1 -1
- package/dist/context/ValidationProvider.d.ts +19 -0
- package/dist/context/ValidationProvider.d.ts.map +1 -0
- package/dist/context/ValidationProvider.js +52 -0
- package/dist/context/ValidationProvider.js.map +1 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -0
- package/dist/context/index.js.map +1 -1
- package/dist/context/query-params.d.ts.map +1 -1
- package/dist/context/query-params.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/datasource.js +3 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/explore.d.ts +13 -0
- package/dist/model/explore.d.ts.map +1 -0
- package/dist/{validation/resource.js → model/explore.js} +4 -3
- package/dist/model/explore.js.map +1 -0
- package/dist/model/legend.d.ts +2 -2
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js.map +1 -1
- package/dist/model/panels.d.ts +17 -5
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugin-base.d.ts +0 -1
- 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 +35 -21
- 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 +4 -3
- 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 +1 -1
- package/dist/model/trace-queries.d.ts.map +1 -1
- package/dist/model/trace-queries.js.map +1 -1
- 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/remote/PersesPlugin.types.d.ts +7 -0
- package/dist/remote/PersesPlugin.types.d.ts.map +1 -0
- package/dist/remote/PersesPlugin.types.js +15 -0
- package/dist/remote/PersesPlugin.types.js.map +1 -0
- package/dist/remote/PluginLoaderComponent.d.ts +10 -0
- package/dist/remote/PluginLoaderComponent.d.ts.map +1 -0
- package/dist/remote/PluginLoaderComponent.js +67 -0
- package/dist/remote/PluginLoaderComponent.js.map +1 -0
- package/dist/remote/PluginRuntime.d.ts +11 -0
- package/dist/remote/PluginRuntime.d.ts.map +1 -0
- package/dist/remote/PluginRuntime.js +202 -0
- package/dist/remote/PluginRuntime.js.map +1 -0
- package/dist/remote/index.d.ts +3 -0
- package/dist/remote/index.d.ts.map +1 -0
- package/dist/{validation → remote}/index.js +2 -4
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/remotePluginLoader.d.ts +3 -0
- package/dist/remote/remotePluginLoader.d.ts.map +1 -0
- package/dist/remote/remotePluginLoader.js +53 -0
- package/dist/remote/remotePluginLoader.js.map +1 -0
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +2 -2
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +19 -10
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +6 -7
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +10 -9
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/QueryCountProvider.d.ts +9 -0
- package/dist/runtime/QueryCountProvider.d.ts.map +1 -0
- package/dist/{validation/datasource.js → runtime/QueryCountProvider.js} +14 -10
- package/dist/runtime/QueryCountProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +6 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +30 -9
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +2 -2
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +3 -3
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +32 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +82 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts +1 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/index.js +2 -1
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +8 -11
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
- package/dist/runtime/UsageMetricsProvider.d.ts +25 -0
- package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -0
- package/dist/runtime/UsageMetricsProvider.js +77 -0
- package/dist/runtime/UsageMetricsProvider.js.map +1 -0
- package/dist/runtime/builtin-variables.d.ts +2 -2
- package/dist/runtime/builtin-variables.d.ts.map +1 -1
- package/dist/runtime/builtin-variables.js +4 -4
- package/dist/runtime/builtin-variables.js.map +1 -1
- package/dist/runtime/datasources.d.ts +5 -4
- package/dist/runtime/datasources.d.ts.map +1 -1
- package/dist/runtime/datasources.js +24 -15
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +4 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/plugin-registry.d.ts +11 -11
- package/dist/runtime/plugin-registry.d.ts.map +1 -1
- package/dist/runtime/plugin-registry.js +40 -28
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts +5 -4
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +28 -33
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/runtime/trace-queries.d.ts +5 -4
- package/dist/runtime/trace-queries.d.ts.map +1 -1
- package/dist/runtime/trace-queries.js +10 -7
- package/dist/runtime/trace-queries.js.map +1 -1
- package/dist/runtime/{template-variables.d.ts → variables.d.ts} +7 -7
- package/dist/runtime/variables.d.ts.map +1 -0
- package/dist/runtime/{template-variables.js → variables.js} +35 -44
- package/dist/runtime/variables.js.map +1 -0
- package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts +3 -3
- package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.js +1 -1
- package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +2 -2
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +2 -22
- package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +3 -3
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts +3 -3
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +5 -5
- package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts +13 -0
- package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts.map +1 -0
- package/dist/stories/shared-utils/decorators/{WithPluginSystemTemplateVariables.js → WithPluginSystemVariables.js} +10 -10
- package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.js.map +1 -0
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +3 -3
- package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.js +1 -1
- package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
- package/dist/stories/shared-utils/decorators/index.d.ts +1 -1
- package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
- package/dist/stories/shared-utils/decorators/index.js +2 -2
- package/dist/stories/shared-utils/decorators/index.js.map +1 -1
- package/dist/test/mock-data.d.ts.map +1 -1
- package/dist/test/mock-data.js +25 -4
- package/dist/test/mock-data.js.map +1 -1
- package/dist/test/render.d.ts +4 -4
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +2 -11
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
- package/dist/test/test-plugins/bert/index.js +21 -20
- 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-utils/mock-plugin-registry.d.ts +6 -4
- package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +10 -10
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/dist/utils/variables.d.ts +4 -4
- package/dist/utils/variables.d.ts.map +1 -1
- package/dist/utils/variables.js +19 -19
- package/dist/utils/variables.js.map +1 -1
- package/package.json +7 -6
- package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +0 -146
- package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +0 -96
- package/dist/cjs/validation/datasource.js +0 -30
- package/dist/cjs/validation/role.js +0 -85
- package/dist/cjs/validation/rolebinding.js +0 -55
- package/dist/cjs/validation/secret.js +0 -176
- package/dist/cjs/validation/variable.js +0 -48
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +0 -8
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +0 -13
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/index.d.ts +0 -2
- package/dist/components/TimeSeriesQueryEditor/index.d.ts.map +0 -1
- package/dist/components/TimeSeriesQueryEditor/index.js.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts +0 -9
- package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryEditor.js +0 -130
- package/dist/components/TraceQueryEditor/TraceQueryEditor.js.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts +0 -13
- package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +0 -1
- package/dist/components/TraceQueryEditor/TraceQueryInput.js +0 -83
- package/dist/components/TraceQueryEditor/TraceQueryInput.js.map +0 -1
- package/dist/components/TraceQueryEditor/index.d.ts +0 -2
- package/dist/components/TraceQueryEditor/index.d.ts.map +0 -1
- package/dist/runtime/template-variables.d.ts.map +0 -1
- package/dist/runtime/template-variables.js.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts +0 -13
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +0 -1
- package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +0 -1
- package/dist/validation/datasource.d.ts +0 -19
- package/dist/validation/datasource.d.ts.map +0 -1
- package/dist/validation/datasource.js.map +0 -1
- package/dist/validation/index.d.ts +0 -5
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/resource.d.ts +0 -3
- package/dist/validation/resource.d.ts.map +0 -1
- package/dist/validation/resource.js.map +0 -1
- package/dist/validation/role.d.ts +0 -228
- package/dist/validation/role.d.ts.map +0 -1
- package/dist/validation/role.js +0 -66
- package/dist/validation/role.js.map +0 -1
- package/dist/validation/rolebinding.d.ts +0 -137
- package/dist/validation/rolebinding.d.ts.map +0 -1
- package/dist/validation/rolebinding.js +0 -47
- package/dist/validation/rolebinding.js.map +0 -1
- package/dist/validation/secret.d.ts +0 -964
- package/dist/validation/secret.d.ts.map +0 -1
- package/dist/validation/secret.js +0 -157
- package/dist/validation/secret.js.map +0 -1
- package/dist/validation/variable.d.ts +0 -96
- package/dist/validation/variable.d.ts.map +0 -1
- package/dist/validation/variable.js +0 -40
- package/dist/validation/variable.js.map +0 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
TimeRangeSettingsContext: function() {
|
|
25
|
+
return TimeRangeSettingsContext;
|
|
26
|
+
},
|
|
27
|
+
TimeRangeSettingsProvider: function() {
|
|
28
|
+
return TimeRangeSettingsProvider;
|
|
29
|
+
},
|
|
30
|
+
useShowCustomTimeRangeSetting: function() {
|
|
31
|
+
return useShowCustomTimeRangeSetting;
|
|
32
|
+
},
|
|
33
|
+
useTimeRangeOptionsSetting: function() {
|
|
34
|
+
return useTimeRangeOptionsSetting;
|
|
35
|
+
},
|
|
36
|
+
useTimeRangeSettings: function() {
|
|
37
|
+
return useTimeRangeSettings;
|
|
38
|
+
},
|
|
39
|
+
useTimeRangeSettingsContext: function() {
|
|
40
|
+
return useTimeRangeSettingsContext;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
44
|
+
const _react = require("react");
|
|
45
|
+
const _components = require("@perses-dev/components");
|
|
46
|
+
const DEFAULT_OPTIONS = [
|
|
47
|
+
'5m',
|
|
48
|
+
'15m',
|
|
49
|
+
'30m',
|
|
50
|
+
'1h',
|
|
51
|
+
'6h',
|
|
52
|
+
'12h',
|
|
53
|
+
'24h',
|
|
54
|
+
'7d',
|
|
55
|
+
'14d'
|
|
56
|
+
];
|
|
57
|
+
const defaultTimeRangeSettings = {
|
|
58
|
+
showCustom: true,
|
|
59
|
+
options: DEFAULT_OPTIONS.map((duration)=>(0, _components.buildRelativeTimeOption)(duration))
|
|
60
|
+
};
|
|
61
|
+
const TimeRangeSettingsContext = /*#__PURE__*/ (0, _react.createContext)(defaultTimeRangeSettings);
|
|
62
|
+
function useTimeRangeSettingsContext() {
|
|
63
|
+
const ctx = (0, _react.useContext)(TimeRangeSettingsContext);
|
|
64
|
+
if (ctx === undefined) {
|
|
65
|
+
throw new Error('No TimeRangeContext found. Did you forget a Provider?');
|
|
66
|
+
}
|
|
67
|
+
return ctx;
|
|
68
|
+
}
|
|
69
|
+
function useTimeRangeSettings() {
|
|
70
|
+
return useTimeRangeSettingsContext();
|
|
71
|
+
}
|
|
72
|
+
function useShowCustomTimeRangeSetting(override) {
|
|
73
|
+
const showCustomTimeRange = useTimeRangeSettings().showCustom;
|
|
74
|
+
if (override !== undefined) {
|
|
75
|
+
return override;
|
|
76
|
+
}
|
|
77
|
+
return showCustomTimeRange;
|
|
78
|
+
}
|
|
79
|
+
function useTimeRangeOptionsSetting(override) {
|
|
80
|
+
const showCustomTimeRange = useTimeRangeSettings().options;
|
|
81
|
+
if (override !== undefined) {
|
|
82
|
+
return override;
|
|
83
|
+
}
|
|
84
|
+
return showCustomTimeRange;
|
|
85
|
+
}
|
|
86
|
+
function TimeRangeSettingsProvider(props) {
|
|
87
|
+
const ctx = (0, _react.useMemo)(()=>{
|
|
88
|
+
return {
|
|
89
|
+
showCustom: props.showCustom === undefined ? defaultTimeRangeSettings.showCustom : props.showCustom,
|
|
90
|
+
options: props.options === undefined ? defaultTimeRangeSettings.options : props.options
|
|
91
|
+
};
|
|
92
|
+
}, [
|
|
93
|
+
props.showCustom,
|
|
94
|
+
props.options
|
|
95
|
+
]);
|
|
96
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(TimeRangeSettingsContext.Provider, {
|
|
97
|
+
value: ctx,
|
|
98
|
+
children: props.children
|
|
99
|
+
});
|
|
100
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
16
16
|
});
|
|
17
17
|
_export_star(require("./TimeRangeProvider"), exports);
|
|
18
18
|
_export_star(require("./TimeRangeProviderWithQueryParams"), exports);
|
|
19
|
+
_export_star(require("./TimeRangeSettingsProvider"), exports);
|
|
19
20
|
_export_star(require("./query-params"), exports);
|
|
20
21
|
function _export_star(from, to) {
|
|
21
22
|
Object.keys(from).forEach(function(k) {
|
|
@@ -21,32 +21,32 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
TimeRangeParam: function() {
|
|
25
|
+
return TimeRangeParam;
|
|
26
26
|
},
|
|
27
27
|
decodeTimeRangeValue: function() {
|
|
28
28
|
return decodeTimeRangeValue;
|
|
29
29
|
},
|
|
30
|
-
|
|
31
|
-
return
|
|
32
|
-
},
|
|
33
|
-
timeRangeQueryConfig: function() {
|
|
34
|
-
return timeRangeQueryConfig;
|
|
30
|
+
encodeTimeRangeValue: function() {
|
|
31
|
+
return encodeTimeRangeValue;
|
|
35
32
|
},
|
|
36
33
|
refreshIntervalQueryConfig: function() {
|
|
37
34
|
return refreshIntervalQueryConfig;
|
|
38
35
|
},
|
|
39
|
-
|
|
40
|
-
return
|
|
41
|
-
},
|
|
42
|
-
useTimeRangeParams: function() {
|
|
43
|
-
return useTimeRangeParams;
|
|
36
|
+
timeRangeQueryConfig: function() {
|
|
37
|
+
return timeRangeQueryConfig;
|
|
44
38
|
},
|
|
45
39
|
useInitialRefreshInterval: function() {
|
|
46
40
|
return useInitialRefreshInterval;
|
|
47
41
|
},
|
|
42
|
+
useInitialTimeRange: function() {
|
|
43
|
+
return useInitialTimeRange;
|
|
44
|
+
},
|
|
48
45
|
useSetRefreshIntervalParams: function() {
|
|
49
46
|
return useSetRefreshIntervalParams;
|
|
47
|
+
},
|
|
48
|
+
useTimeRangeParams: function() {
|
|
49
|
+
return useTimeRangeParams;
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
const _react = require("react");
|
|
@@ -54,15 +54,12 @@ const _usequeryparams = require("use-query-params");
|
|
|
54
54
|
const _datefns = require("date-fns");
|
|
55
55
|
const _core = require("@perses-dev/core");
|
|
56
56
|
/* Interprets an encoded string and returns either the string or null/undefined if not available */ function getEncodedValue(input, allowEmptyString) {
|
|
57
|
-
if (input == null) {
|
|
58
|
-
return input;
|
|
59
|
-
}
|
|
60
57
|
// '' or []
|
|
61
|
-
if (input.length === 0 && (!allowEmptyString || allowEmptyString && input !== '')) {
|
|
58
|
+
if (!input || input.length === 0 && (!allowEmptyString || allowEmptyString && input !== '')) {
|
|
62
59
|
return null;
|
|
63
60
|
}
|
|
64
61
|
const str = input instanceof Array ? input[0] : input;
|
|
65
|
-
if (str
|
|
62
|
+
if (str === null || str === undefined) {
|
|
66
63
|
return str;
|
|
67
64
|
}
|
|
68
65
|
if (!allowEmptyString && str === '') {
|
|
@@ -83,7 +80,7 @@ function encodeTimeRangeValue(timeOptionValue) {
|
|
|
83
80
|
}
|
|
84
81
|
function decodeTimeRangeValue(input) {
|
|
85
82
|
const paramString = getEncodedValue(input);
|
|
86
|
-
if (paramString
|
|
83
|
+
if (!paramString) return null;
|
|
87
84
|
return (0, _core.isDurationString)(paramString) ? paramString : new Date(Number(paramString));
|
|
88
85
|
}
|
|
89
86
|
const TimeRangeParam = {
|
|
@@ -91,7 +88,7 @@ const TimeRangeParam = {
|
|
|
91
88
|
decode: decodeTimeRangeValue,
|
|
92
89
|
equals: (valueA, valueB)=>{
|
|
93
90
|
if (valueA === valueB) return true;
|
|
94
|
-
if (valueA
|
|
91
|
+
if (!valueA || !valueB) return valueA === valueB;
|
|
95
92
|
return valueA.valueOf() === valueB.valueOf();
|
|
96
93
|
}
|
|
97
94
|
};
|
|
@@ -106,7 +103,7 @@ function useInitialTimeRange(dashboardDuration) {
|
|
|
106
103
|
const [query] = (0, _usequeryparams.useQueryParams)(timeRangeQueryConfig, {
|
|
107
104
|
updateType: 'replaceIn'
|
|
108
105
|
});
|
|
109
|
-
const { start
|
|
106
|
+
const { start, end } = query;
|
|
110
107
|
return (0, _react.useMemo)(()=>{
|
|
111
108
|
let initialTimeRange = {
|
|
112
109
|
pastDuration: dashboardDuration
|
|
@@ -138,7 +135,7 @@ function useTimeRangeParams(initialTimeRange) {
|
|
|
138
135
|
});
|
|
139
136
|
// determine whether initial param had previously been populated to fix back btn
|
|
140
137
|
const [paramsLoaded, setParamsLoaded] = (0, _react.useState)(false);
|
|
141
|
-
const { start
|
|
138
|
+
const { start } = query;
|
|
142
139
|
(0, _react.useEffect)(()=>{
|
|
143
140
|
// when dashboard loaded with no params, default to dashboard duration
|
|
144
141
|
if (!paramsLoaded && !start) {
|
|
@@ -177,7 +174,7 @@ function useInitialRefreshInterval(dashboardDuration) {
|
|
|
177
174
|
const [query] = (0, _usequeryparams.useQueryParams)(refreshIntervalQueryConfig, {
|
|
178
175
|
updateType: 'replaceIn'
|
|
179
176
|
});
|
|
180
|
-
const { refresh
|
|
177
|
+
const { refresh } = query;
|
|
181
178
|
return (0, _react.useMemo)(()=>{
|
|
182
179
|
let initialTimeRange = dashboardDuration;
|
|
183
180
|
if (!refresh) {
|
|
@@ -199,7 +196,7 @@ function useSetRefreshIntervalParams(initialRefreshInterval) {
|
|
|
199
196
|
});
|
|
200
197
|
// determine whether initial param had previously been populated to fix back btn
|
|
201
198
|
const [paramsLoaded, setParamsLoaded] = (0, _react.useState)(false);
|
|
202
|
-
const { refresh
|
|
199
|
+
const { refresh } = query;
|
|
203
200
|
(0, _react.useEffect)(()=>{
|
|
204
201
|
// when dashboard loaded with no params, default to dashboard refresh interval
|
|
205
202
|
if (!paramsLoaded && !refresh) {
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
UsageMetricsContext: function() {
|
|
25
|
+
return UsageMetricsContext;
|
|
26
|
+
},
|
|
27
|
+
UsageMetricsProvider: function() {
|
|
28
|
+
return UsageMetricsProvider;
|
|
29
|
+
},
|
|
30
|
+
useUsageMetrics: function() {
|
|
31
|
+
return useUsageMetrics;
|
|
32
|
+
},
|
|
33
|
+
useUsageMetricsContext: function() {
|
|
34
|
+
return useUsageMetricsContext;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
38
|
+
const _core = require("@perses-dev/core");
|
|
39
|
+
const _react = require("react");
|
|
40
|
+
const UsageMetricsContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
41
|
+
const useUsageMetricsContext = ()=>{
|
|
42
|
+
return (0, _react.useContext)(UsageMetricsContext);
|
|
43
|
+
};
|
|
44
|
+
const useUsageMetrics = ()=>{
|
|
45
|
+
const ctx = useUsageMetricsContext();
|
|
46
|
+
return {
|
|
47
|
+
markQuery: (definition, newState)=>{
|
|
48
|
+
if (ctx === undefined) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const definitionKey = JSON.stringify(definition);
|
|
52
|
+
if (ctx.pendingQueries.has(definitionKey) && newState === 'pending') {
|
|
53
|
+
// Never allow transitions back to pending, to avoid re-sending stats on a re-render.
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (ctx.pendingQueries.get(definitionKey) !== newState) {
|
|
57
|
+
ctx.pendingQueries.set(definitionKey, newState);
|
|
58
|
+
if (newState === 'error') {
|
|
59
|
+
ctx.renderErrorCount += 1;
|
|
60
|
+
}
|
|
61
|
+
const allDone = [
|
|
62
|
+
...ctx.pendingQueries.values()
|
|
63
|
+
].every((p)=>p !== 'pending');
|
|
64
|
+
if (ctx.renderDurationMs === 0 && allDone) {
|
|
65
|
+
ctx.renderDurationMs = Date.now() - ctx.startRenderTime;
|
|
66
|
+
submitMetrics(ctx);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
const submitMetrics = async (stats)=>{
|
|
73
|
+
await (0, _core.fetch)('/api/v1/view', {
|
|
74
|
+
method: 'POST',
|
|
75
|
+
headers: {
|
|
76
|
+
'Content-Type': 'application/json'
|
|
77
|
+
},
|
|
78
|
+
body: JSON.stringify({
|
|
79
|
+
project: stats.project,
|
|
80
|
+
dashboard: stats.dashboard,
|
|
81
|
+
render_time: stats.renderDurationMs / 1000,
|
|
82
|
+
render_errors: stats.renderErrorCount
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const UsageMetricsProvider = ({ project, dashboard, children })=>{
|
|
87
|
+
const ctx = {
|
|
88
|
+
project: project,
|
|
89
|
+
dashboard: dashboard,
|
|
90
|
+
renderErrorCount: 0,
|
|
91
|
+
startRenderTime: Date.now(),
|
|
92
|
+
renderDurationMs: 0,
|
|
93
|
+
pendingQueries: new Map()
|
|
94
|
+
};
|
|
95
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(UsageMetricsContext.Provider, {
|
|
96
|
+
value: ctx,
|
|
97
|
+
children: children
|
|
98
|
+
});
|
|
99
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -27,11 +27,11 @@ _export(exports, {
|
|
|
27
27
|
useBuiltinVariableContext: function() {
|
|
28
28
|
return useBuiltinVariableContext;
|
|
29
29
|
},
|
|
30
|
-
useBuiltinVariableValues: function() {
|
|
31
|
-
return useBuiltinVariableValues;
|
|
32
|
-
},
|
|
33
30
|
useBuiltinVariableDefinitions: function() {
|
|
34
31
|
return useBuiltinVariableDefinitions;
|
|
32
|
+
},
|
|
33
|
+
useBuiltinVariableValues: function() {
|
|
34
|
+
return useBuiltinVariableValues;
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
const _react = require("react");
|
|
@@ -44,7 +44,7 @@ function useBuiltinVariableContext() {
|
|
|
44
44
|
return ctx;
|
|
45
45
|
}
|
|
46
46
|
function useBuiltinVariableValues(names) {
|
|
47
|
-
const { variables
|
|
47
|
+
const { variables } = useBuiltinVariableContext();
|
|
48
48
|
const states = (0, _react.useMemo)(()=>{
|
|
49
49
|
const values = {};
|
|
50
50
|
for (const variable of variables){
|
|
@@ -59,7 +59,7 @@ function useBuiltinVariableValues(names) {
|
|
|
59
59
|
]);
|
|
60
60
|
const values = (0, _react.useMemo)(()=>{
|
|
61
61
|
const values = {};
|
|
62
|
-
names
|
|
62
|
+
names?.forEach((name)=>{
|
|
63
63
|
const s = states[name];
|
|
64
64
|
if (s) {
|
|
65
65
|
values[name] = s;
|
|
@@ -76,6 +76,6 @@ function useBuiltinVariableValues(names) {
|
|
|
76
76
|
return values;
|
|
77
77
|
}
|
|
78
78
|
function useBuiltinVariableDefinitions() {
|
|
79
|
-
const { variables
|
|
79
|
+
const { variables } = useBuiltinVariableContext();
|
|
80
80
|
return variables;
|
|
81
81
|
}
|
|
@@ -24,17 +24,17 @@ _export(exports, {
|
|
|
24
24
|
DatasourceStoreContext: function() {
|
|
25
25
|
return DatasourceStoreContext;
|
|
26
26
|
},
|
|
27
|
+
useDatasource: function() {
|
|
28
|
+
return useDatasource;
|
|
29
|
+
},
|
|
30
|
+
useDatasourceClient: function() {
|
|
31
|
+
return useDatasourceClient;
|
|
32
|
+
},
|
|
27
33
|
useDatasourceStore: function() {
|
|
28
34
|
return useDatasourceStore;
|
|
29
35
|
},
|
|
30
36
|
useListDatasourceSelectItems: function() {
|
|
31
37
|
return useListDatasourceSelectItems;
|
|
32
|
-
},
|
|
33
|
-
useDatasourceClient: function() {
|
|
34
|
-
return useDatasourceClient;
|
|
35
|
-
},
|
|
36
|
-
useDatasource: function() {
|
|
37
|
-
return useDatasource;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
const _reactquery = require("@tanstack/react-query");
|
|
@@ -47,25 +47,34 @@ function useDatasourceStore() {
|
|
|
47
47
|
}
|
|
48
48
|
return ctx;
|
|
49
49
|
}
|
|
50
|
-
function useListDatasourceSelectItems(
|
|
51
|
-
const { listDatasourceSelectItems
|
|
52
|
-
return (0, _reactquery.useQuery)(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
function useListDatasourceSelectItems(datasourcePluginName, project) {
|
|
51
|
+
const { listDatasourceSelectItems } = useDatasourceStore();
|
|
52
|
+
return (0, _reactquery.useQuery)({
|
|
53
|
+
queryKey: [
|
|
54
|
+
'listDatasourceSelectItems',
|
|
55
|
+
datasourcePluginName,
|
|
56
|
+
project
|
|
57
|
+
],
|
|
58
|
+
queryFn: ()=>listDatasourceSelectItems(datasourcePluginName)
|
|
59
|
+
});
|
|
57
60
|
}
|
|
58
61
|
function useDatasourceClient(selector) {
|
|
59
62
|
const store = useDatasourceStore();
|
|
60
|
-
return (0, _reactquery.useQuery)(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
return (0, _reactquery.useQuery)({
|
|
64
|
+
queryKey: [
|
|
65
|
+
'getDatasourceClient',
|
|
66
|
+
selector
|
|
67
|
+
],
|
|
68
|
+
queryFn: ()=>store.getDatasourceClient(selector)
|
|
69
|
+
});
|
|
64
70
|
}
|
|
65
71
|
function useDatasource(selector) {
|
|
66
72
|
const store = useDatasourceStore();
|
|
67
|
-
return (0, _reactquery.useQuery)(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
return (0, _reactquery.useQuery)({
|
|
74
|
+
queryKey: [
|
|
75
|
+
'getDatasource',
|
|
76
|
+
selector
|
|
77
|
+
],
|
|
78
|
+
queryFn: ()=>store.getDatasource(selector)
|
|
79
|
+
});
|
|
71
80
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -17,11 +17,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
17
|
_export_star(require("./builtin-variables"), exports);
|
|
18
18
|
_export_star(require("./datasources"), exports);
|
|
19
19
|
_export_star(require("./plugin-registry"), exports);
|
|
20
|
-
_export_star(require("./
|
|
20
|
+
_export_star(require("./variables"), exports);
|
|
21
21
|
_export_star(require("./TimeRangeProvider"), exports);
|
|
22
22
|
_export_star(require("./time-series-queries"), exports);
|
|
23
23
|
_export_star(require("./trace-queries"), exports);
|
|
24
24
|
_export_star(require("./DataQueriesProvider"), exports);
|
|
25
|
+
_export_star(require("./QueryCountProvider"), exports);
|
|
26
|
+
_export_star(require("./UsageMetricsProvider"), exports);
|
|
25
27
|
function _export_star(from, to) {
|
|
26
28
|
Object.keys(from).forEach(function(k) {
|
|
27
29
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -24,24 +24,24 @@ _export(exports, {
|
|
|
24
24
|
PluginRegistryContext: function() {
|
|
25
25
|
return PluginRegistryContext;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
useListPluginMetadata: function() {
|
|
28
|
+
return useListPluginMetadata;
|
|
29
29
|
},
|
|
30
30
|
usePlugin: function() {
|
|
31
31
|
return usePlugin;
|
|
32
32
|
},
|
|
33
|
-
usePlugins: function() {
|
|
34
|
-
return usePlugins;
|
|
35
|
-
},
|
|
36
|
-
useListPluginMetadata: function() {
|
|
37
|
-
return useListPluginMetadata;
|
|
38
|
-
},
|
|
39
33
|
usePluginBuiltinVariableDefinitions: function() {
|
|
40
34
|
return usePluginBuiltinVariableDefinitions;
|
|
35
|
+
},
|
|
36
|
+
usePluginRegistry: function() {
|
|
37
|
+
return usePluginRegistry;
|
|
38
|
+
},
|
|
39
|
+
usePlugins: function() {
|
|
40
|
+
return usePlugins;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
const _react = require("react");
|
|
44
43
|
const _reactquery = require("@tanstack/react-query");
|
|
44
|
+
const _react = require("react");
|
|
45
45
|
const PluginRegistryContext = (0, _react.createContext)(undefined);
|
|
46
46
|
function usePluginRegistry() {
|
|
47
47
|
const ctx = (0, _react.useContext)(PluginRegistryContext);
|
|
@@ -51,21 +51,24 @@ function usePluginRegistry() {
|
|
|
51
51
|
return ctx;
|
|
52
52
|
}
|
|
53
53
|
function usePlugin(pluginType, kind, options) {
|
|
54
|
-
var _options_enabled;
|
|
55
54
|
// We never want to ask for a plugin when the kind isn't set yet, so disable those queries automatically
|
|
56
55
|
options = {
|
|
57
56
|
...options,
|
|
58
|
-
enabled: (
|
|
57
|
+
enabled: (options?.enabled ?? true) && pluginType !== undefined && kind !== ''
|
|
59
58
|
};
|
|
60
|
-
const { getPlugin
|
|
61
|
-
return (0, _reactquery.useQuery)(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
const { getPlugin } = usePluginRegistry();
|
|
60
|
+
return (0, _reactquery.useQuery)({
|
|
61
|
+
queryKey: [
|
|
62
|
+
'getPlugin',
|
|
63
|
+
pluginType,
|
|
64
|
+
kind
|
|
65
|
+
],
|
|
66
|
+
queryFn: ()=>getPlugin(pluginType, kind),
|
|
67
|
+
...options
|
|
68
|
+
});
|
|
66
69
|
}
|
|
67
70
|
function usePlugins(pluginType, plugins) {
|
|
68
|
-
const { getPlugin
|
|
71
|
+
const { getPlugin } = usePluginRegistry();
|
|
69
72
|
return (0, _reactquery.useQueries)({
|
|
70
73
|
queries: plugins.map((p)=>{
|
|
71
74
|
return {
|
|
@@ -79,27 +82,36 @@ function usePlugins(pluginType, plugins) {
|
|
|
79
82
|
})
|
|
80
83
|
});
|
|
81
84
|
}
|
|
82
|
-
function useListPluginMetadata(
|
|
83
|
-
const { listPluginMetadata
|
|
84
|
-
return (0, _reactquery.useQuery)(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
function useListPluginMetadata(pluginTypes, options) {
|
|
86
|
+
const { listPluginMetadata } = usePluginRegistry();
|
|
87
|
+
return (0, _reactquery.useQuery)({
|
|
88
|
+
queryKey: [
|
|
89
|
+
'listPluginMetadata',
|
|
90
|
+
pluginTypes
|
|
91
|
+
],
|
|
92
|
+
queryFn: ()=>listPluginMetadata(pluginTypes),
|
|
93
|
+
...options
|
|
94
|
+
});
|
|
88
95
|
}
|
|
89
96
|
function usePluginBuiltinVariableDefinitions() {
|
|
90
|
-
const { getPlugin
|
|
91
|
-
return (0, _reactquery.useQuery)(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const { getPlugin, listPluginMetadata } = usePluginRegistry();
|
|
98
|
+
return (0, _reactquery.useQuery)({
|
|
99
|
+
queryKey: [
|
|
100
|
+
'usePluginBuiltinVariableDefinitions'
|
|
101
|
+
],
|
|
102
|
+
queryFn: async ()=>{
|
|
103
|
+
const datasources = await listPluginMetadata([
|
|
104
|
+
'Datasource'
|
|
105
|
+
]);
|
|
106
|
+
const datasourceNames = new Set(datasources.map((datasource)=>datasource.spec.name));
|
|
107
|
+
const result = [];
|
|
108
|
+
for (const name of datasourceNames){
|
|
109
|
+
const plugin = await getPlugin('Datasource', name);
|
|
110
|
+
if (plugin.getBuiltinVariableDefinitions) {
|
|
111
|
+
plugin.getBuiltinVariableDefinitions().forEach((definition)=>result.push(definition));
|
|
112
|
+
}
|
|
101
113
|
}
|
|
114
|
+
return result;
|
|
102
115
|
}
|
|
103
|
-
return result;
|
|
104
116
|
});
|
|
105
117
|
}
|