@perses-dev/plugin-system 0.52.0-beta.0 → 0.52.0-beta.2
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 → src/components}/LegendOptionsEditor/LegendOptionsEditor.js +48 -21
- package/dist/cjs/{model → src/model}/legend.js +13 -0
- package/dist/cjs/{remote → src/remote}/PluginRuntime.js +3 -2
- package/dist/cjs/src/runtime/RouterProvider.js +113 -0
- package/dist/cjs/{runtime → src/runtime}/index.js +1 -0
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +2 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/model/legend.d.ts +3 -1
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/panels.d.ts +8 -0
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/remote/PluginRuntime.d.ts +2 -2
- package/dist/remote/PluginRuntime.d.ts.map +1 -1
- package/dist/runtime/RouterProvider.d.ts +32 -0
- package/dist/runtime/RouterProvider.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/src/components/CalculationSelector/CalculationSelector.js.map +1 -0
- package/dist/src/components/CalculationSelector/index.js.map +1 -0
- package/dist/src/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -0
- package/dist/src/components/DatasourceEditorForm/index.js.map +1 -0
- package/dist/src/components/DatasourceSelect.js.map +1 -0
- package/dist/src/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -0
- package/dist/{components/OptionsEditorTabPanel → src/components/HTTPSettingsEditor}/index.js.map +1 -1
- package/dist/{components → src/components}/LegendOptionsEditor/LegendOptionsEditor.js +49 -22
- package/dist/src/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -0
- package/dist/src/components/LegendOptionsEditor/index.js.map +1 -0
- package/dist/src/components/MetricLabelInput/MetricLabelInput.js.map +1 -0
- package/dist/{components/CalculationSelector → src/components/MetricLabelInput}/index.js.map +1 -1
- package/dist/src/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -0
- package/dist/src/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -0
- package/dist/{components/DatasourceEditorForm → src/components/MultiQueryEditor}/index.js.map +1 -1
- package/dist/src/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -0
- package/dist/src/components/OptionsEditorRadios/index.js.map +1 -0
- package/dist/src/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -0
- package/dist/src/components/OptionsEditorTabPanel/index.js.map +1 -0
- package/dist/src/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -0
- package/dist/src/components/OptionsEditorTabs/index.js.map +1 -0
- package/dist/src/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -0
- package/dist/{components/OptionsEditorRadios → src/components/PanelSpecEditor}/index.js.map +1 -1
- package/dist/src/components/PluginEditor/PluginEditor.js.map +1 -0
- package/dist/src/components/PluginEditor/index.js.map +1 -0
- package/dist/src/components/PluginEditor/plugin-editor-api.js.map +1 -0
- package/dist/src/components/PluginKindSelect/PluginKindSelect.js.map +1 -0
- package/dist/src/components/PluginKindSelect/index.js.map +1 -0
- package/dist/src/components/PluginRegistry/PluginRegistry.js.map +1 -0
- package/dist/{components/MultiQueryEditor → src/components/PluginRegistry}/index.js.map +1 -1
- package/dist/src/components/PluginRegistry/plugin-indexes.js.map +1 -0
- package/dist/src/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -0
- package/dist/src/components/PluginSpecEditor/index.js.map +1 -0
- package/dist/src/components/ProjectSelect.js.map +1 -0
- package/dist/src/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
- package/dist/src/components/TimeRangeControls/index.js.map +1 -0
- package/dist/src/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -0
- package/dist/src/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -0
- package/dist/src/components/Variables/VariableEditorForm/index.js.map +1 -0
- package/dist/src/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -0
- package/dist/{components/PluginEditor → src/components/Variables}/index.js.map +1 -1
- package/dist/src/components/Variables/variable-model.js.map +1 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/constants/index.js.map +1 -0
- package/dist/src/constants/user-interface-text.js.map +1 -0
- package/dist/src/context/ProjectStoreProvider.js.map +1 -0
- package/dist/src/context/ValidationProvider.js.map +1 -0
- package/dist/{test-utils → src/context}/index.js.map +1 -1
- package/dist/src/context/query-params.js.map +1 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/model/datasource.js.map +1 -0
- package/dist/src/model/explore.js.map +1 -0
- package/dist/src/model/index.js.map +1 -0
- package/dist/{model → src/model}/legend.js +10 -0
- package/dist/src/model/legend.js.map +1 -0
- package/dist/src/model/panels.js.map +1 -0
- package/dist/src/model/plugin-base.js.map +1 -0
- package/dist/src/model/plugin-loading.js.map +1 -0
- package/dist/src/model/plugins.js.map +1 -0
- package/dist/src/model/profile-queries.js.map +1 -0
- package/dist/src/model/time-series-queries.js.map +1 -0
- package/dist/src/model/trace-queries.js.map +1 -0
- package/dist/src/model/variables.js.map +1 -0
- package/dist/src/remote/PersesPlugin.types.js.map +1 -0
- package/dist/src/remote/PluginLoaderComponent.js.map +1 -0
- package/dist/{remote → src/remote}/PluginRuntime.js +4 -3
- package/dist/src/remote/PluginRuntime.js.map +1 -0
- package/dist/{constants → src/remote}/index.js.map +1 -1
- package/dist/src/remote/remotePluginLoader.js.map +1 -0
- package/dist/src/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -0
- package/dist/{components/LegendOptionsEditor → src/runtime/DataQueriesProvider}/index.js.map +1 -1
- package/dist/src/runtime/DataQueriesProvider/model.js.map +1 -0
- package/dist/src/runtime/QueryCountProvider.js.map +1 -0
- package/dist/src/runtime/RouterProvider.js +58 -0
- package/dist/src/runtime/RouterProvider.js.map +1 -0
- package/dist/src/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -0
- package/dist/src/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -0
- package/dist/src/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -0
- package/dist/{components/OptionsEditorTabs → src/runtime/TimeRangeProvider}/index.js.map +1 -1
- package/dist/src/runtime/TimeRangeProvider/query-params.js.map +1 -0
- package/dist/src/runtime/TimeRangeProvider/refresh-interval.js.map +1 -0
- package/dist/src/runtime/UsageMetricsProvider.js.map +1 -0
- package/dist/src/runtime/builtin-variables.js.map +1 -0
- package/dist/src/runtime/datasources.js.map +1 -0
- package/dist/{runtime → src/runtime}/index.js +1 -0
- package/dist/src/runtime/index.js.map +1 -0
- package/dist/src/runtime/plugin-registry.js.map +1 -0
- package/dist/src/runtime/profile-queries.js.map +1 -0
- package/dist/src/runtime/time-series-queries.js.map +1 -0
- package/dist/src/runtime/trace-queries.js.map +1 -0
- package/dist/src/runtime/utils.js.map +1 -0
- package/dist/src/runtime/variables.js.map +1 -0
- package/dist/{context → src/test}/index.js.map +1 -1
- package/dist/src/test/mock-data.js.map +1 -0
- package/dist/src/test/render-hook.js.map +1 -0
- package/dist/src/test/render.js.map +1 -0
- package/dist/src/test/setup-tests.js.map +1 -0
- package/dist/src/test/test-plugins/bert/index.js.map +1 -0
- package/dist/src/test/test-plugins/ernie/index.js.map +1 -0
- package/dist/src/test/test-plugins/index.js.map +1 -0
- package/dist/src/test/utils.js.map +1 -0
- package/dist/src/test-utils/index.js.map +1 -0
- package/dist/src/test-utils/mock-plugin-registry.js.map +1 -0
- package/dist/src/utils/action.js.map +1 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/variables.js.map +1 -0
- package/package.json +4 -4
- package/dist/components/CalculationSelector/CalculationSelector.js.map +0 -1
- package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +0 -1
- package/dist/components/DatasourceSelect.js.map +0 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +0 -1
- package/dist/components/HTTPSettingsEditor/index.js.map +0 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +0 -1
- package/dist/components/MetricLabelInput/MetricLabelInput.js.map +0 -1
- package/dist/components/MetricLabelInput/index.js.map +0 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +0 -1
- package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +0 -1
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +0 -1
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +0 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +0 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +0 -1
- package/dist/components/PanelSpecEditor/index.js.map +0 -1
- package/dist/components/PluginEditor/PluginEditor.js.map +0 -1
- package/dist/components/PluginEditor/plugin-editor-api.js.map +0 -1
- package/dist/components/PluginKindSelect/PluginKindSelect.js.map +0 -1
- package/dist/components/PluginKindSelect/index.js.map +0 -1
- package/dist/components/PluginRegistry/PluginRegistry.js.map +0 -1
- package/dist/components/PluginRegistry/index.js.map +0 -1
- package/dist/components/PluginRegistry/plugin-indexes.js.map +0 -1
- package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +0 -1
- package/dist/components/PluginSpecEditor/index.js.map +0 -1
- package/dist/components/ProjectSelect.js.map +0 -1
- package/dist/components/TimeRangeControls/TimeRangeControls.js.map +0 -1
- package/dist/components/TimeRangeControls/index.js.map +0 -1
- package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +0 -1
- package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +0 -1
- package/dist/components/Variables/VariableEditorForm/index.js.map +0 -1
- package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +0 -1
- package/dist/components/Variables/index.js.map +0 -1
- package/dist/components/Variables/variable-model.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/constants/user-interface-text.js.map +0 -1
- package/dist/context/ProjectStoreProvider.js.map +0 -1
- package/dist/context/ValidationProvider.js.map +0 -1
- package/dist/context/query-params.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/model/datasource.js.map +0 -1
- package/dist/model/explore.js.map +0 -1
- package/dist/model/index.js.map +0 -1
- package/dist/model/legend.js.map +0 -1
- package/dist/model/panels.js.map +0 -1
- package/dist/model/plugin-base.js.map +0 -1
- package/dist/model/plugin-loading.js.map +0 -1
- package/dist/model/plugins.js.map +0 -1
- package/dist/model/profile-queries.js.map +0 -1
- package/dist/model/time-series-queries.js.map +0 -1
- package/dist/model/trace-queries.js.map +0 -1
- package/dist/model/variables.js.map +0 -1
- package/dist/remote/PersesPlugin.types.js.map +0 -1
- package/dist/remote/PluginLoaderComponent.js.map +0 -1
- package/dist/remote/PluginRuntime.js.map +0 -1
- package/dist/remote/index.js.map +0 -1
- package/dist/remote/remotePluginLoader.js.map +0 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +0 -1
- package/dist/runtime/DataQueriesProvider/index.js.map +0 -1
- package/dist/runtime/DataQueriesProvider/model.js.map +0 -1
- package/dist/runtime/QueryCountProvider.js.map +0 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +0 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +0 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +0 -1
- package/dist/runtime/TimeRangeProvider/index.js.map +0 -1
- package/dist/runtime/TimeRangeProvider/query-params.js.map +0 -1
- package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +0 -1
- package/dist/runtime/UsageMetricsProvider.js.map +0 -1
- package/dist/runtime/builtin-variables.js.map +0 -1
- package/dist/runtime/datasources.js.map +0 -1
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/plugin-registry.js.map +0 -1
- package/dist/runtime/profile-queries.js.map +0 -1
- package/dist/runtime/time-series-queries.js.map +0 -1
- package/dist/runtime/trace-queries.js.map +0 -1
- package/dist/runtime/utils.js.map +0 -1
- package/dist/runtime/variables.js.map +0 -1
- package/dist/test/index.js.map +0 -1
- package/dist/test/mock-data.js.map +0 -1
- package/dist/test/render-hook.js.map +0 -1
- package/dist/test/render.js.map +0 -1
- package/dist/test/setup-tests.js.map +0 -1
- package/dist/test/test-plugins/bert/index.js.map +0 -1
- package/dist/test/test-plugins/ernie/index.js.map +0 -1
- package/dist/test/test-plugins/index.js.map +0 -1
- package/dist/test/utils.js.map +0 -1
- package/dist/test-utils/mock-plugin-registry.js.map +0 -1
- package/dist/utils/action.js.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/variables.js.map +0 -1
- /package/dist/cjs/{components → src/components}/CalculationSelector/CalculationSelector.js +0 -0
- /package/dist/cjs/{components → src/components}/CalculationSelector/index.js +0 -0
- /package/dist/cjs/{components → src/components}/DatasourceEditorForm/DatasourceEditorForm.js +0 -0
- /package/dist/cjs/{components → src/components}/DatasourceEditorForm/index.js +0 -0
- /package/dist/cjs/{components → src/components}/DatasourceSelect.js +0 -0
- /package/dist/cjs/{components → src/components}/HTTPSettingsEditor/HTTPSettingsEditor.js +0 -0
- /package/dist/cjs/{components → src/components}/HTTPSettingsEditor/index.js +0 -0
- /package/dist/cjs/{components → src/components}/LegendOptionsEditor/index.js +0 -0
- /package/dist/cjs/{components → src/components}/MetricLabelInput/MetricLabelInput.js +0 -0
- /package/dist/cjs/{components → src/components}/MetricLabelInput/index.js +0 -0
- /package/dist/cjs/{components → src/components}/MultiQueryEditor/MultiQueryEditor.js +0 -0
- /package/dist/cjs/{components → src/components}/MultiQueryEditor/QueryEditorContainer.js +0 -0
- /package/dist/cjs/{components → src/components}/MultiQueryEditor/index.js +0 -0
- /package/dist/cjs/{components → src/components}/OptionsEditorRadios/OptionsEditorRadios.js +0 -0
- /package/dist/cjs/{components → src/components}/OptionsEditorRadios/index.js +0 -0
- /package/dist/cjs/{components → src/components}/OptionsEditorTabPanel/OptionsEditorTabPanel.js +0 -0
- /package/dist/cjs/{components → src/components}/OptionsEditorTabPanel/index.js +0 -0
- /package/dist/cjs/{components → src/components}/OptionsEditorTabs/OptionsEditorTabs.js +0 -0
- /package/dist/cjs/{components → src/components}/OptionsEditorTabs/index.js +0 -0
- /package/dist/cjs/{components → src/components}/PanelSpecEditor/PanelSpecEditor.js +0 -0
- /package/dist/cjs/{components → src/components}/PanelSpecEditor/index.js +0 -0
- /package/dist/cjs/{components → src/components}/PluginEditor/PluginEditor.js +0 -0
- /package/dist/cjs/{components → src/components}/PluginEditor/index.js +0 -0
- /package/dist/cjs/{components → src/components}/PluginEditor/plugin-editor-api.js +0 -0
- /package/dist/cjs/{components → src/components}/PluginKindSelect/PluginKindSelect.js +0 -0
- /package/dist/cjs/{components → src/components}/PluginKindSelect/index.js +0 -0
- /package/dist/cjs/{components → src/components}/PluginRegistry/PluginRegistry.js +0 -0
- /package/dist/cjs/{components → src/components}/PluginRegistry/index.js +0 -0
- /package/dist/cjs/{components → src/components}/PluginRegistry/plugin-indexes.js +0 -0
- /package/dist/cjs/{components → src/components}/PluginSpecEditor/PluginSpecEditor.js +0 -0
- /package/dist/cjs/{components → src/components}/PluginSpecEditor/index.js +0 -0
- /package/dist/cjs/{components → src/components}/ProjectSelect.js +0 -0
- /package/dist/cjs/{components → src/components}/TimeRangeControls/TimeRangeControls.js +0 -0
- /package/dist/cjs/{components → src/components}/TimeRangeControls/index.js +0 -0
- /package/dist/cjs/{components → src/components}/Variables/VariableEditorForm/VariableEditorForm.js +0 -0
- /package/dist/cjs/{components → src/components}/Variables/VariableEditorForm/VariablePreview.js +0 -0
- /package/dist/cjs/{components → src/components}/Variables/VariableEditorForm/index.js +0 -0
- /package/dist/cjs/{components → src/components}/Variables/VariableEditorForm/variable-editor-form-model.js +0 -0
- /package/dist/cjs/{components → src/components}/Variables/index.js +0 -0
- /package/dist/cjs/{components → src/components}/Variables/variable-model.js +0 -0
- /package/dist/cjs/{components → src/components}/index.js +0 -0
- /package/dist/cjs/{constants → src/constants}/index.js +0 -0
- /package/dist/cjs/{constants → src/constants}/user-interface-text.js +0 -0
- /package/dist/cjs/{context → src/context}/ProjectStoreProvider.js +0 -0
- /package/dist/cjs/{context → src/context}/ValidationProvider.js +0 -0
- /package/dist/cjs/{context → src/context}/index.js +0 -0
- /package/dist/cjs/{context → src/context}/query-params.js +0 -0
- /package/dist/cjs/{index.js → src/index.js} +0 -0
- /package/dist/cjs/{model → src/model}/datasource.js +0 -0
- /package/dist/cjs/{model → src/model}/explore.js +0 -0
- /package/dist/cjs/{model → src/model}/index.js +0 -0
- /package/dist/cjs/{model → src/model}/panels.js +0 -0
- /package/dist/cjs/{model → src/model}/plugin-base.js +0 -0
- /package/dist/cjs/{model → src/model}/plugin-loading.js +0 -0
- /package/dist/cjs/{model → src/model}/plugins.js +0 -0
- /package/dist/cjs/{model → src/model}/profile-queries.js +0 -0
- /package/dist/cjs/{model → src/model}/time-series-queries.js +0 -0
- /package/dist/cjs/{model → src/model}/trace-queries.js +0 -0
- /package/dist/cjs/{model → src/model}/variables.js +0 -0
- /package/dist/cjs/{remote → src/remote}/PersesPlugin.types.js +0 -0
- /package/dist/cjs/{remote → src/remote}/PluginLoaderComponent.js +0 -0
- /package/dist/cjs/{remote → src/remote}/index.js +0 -0
- /package/dist/cjs/{remote → src/remote}/remotePluginLoader.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/DataQueriesProvider/DataQueriesProvider.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/DataQueriesProvider/index.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/DataQueriesProvider/model.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/QueryCountProvider.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/TimeRangeProvider/TimeRangeProvider.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/TimeRangeProvider/TimeRangeSettingsProvider.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/TimeRangeProvider/index.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/TimeRangeProvider/query-params.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/TimeRangeProvider/refresh-interval.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/UsageMetricsProvider.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/builtin-variables.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/datasources.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/plugin-registry.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/profile-queries.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/time-series-queries.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/trace-queries.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/utils.js +0 -0
- /package/dist/cjs/{runtime → src/runtime}/variables.js +0 -0
- /package/dist/cjs/{test → src/test}/index.js +0 -0
- /package/dist/cjs/{test → src/test}/mock-data.js +0 -0
- /package/dist/cjs/{test → src/test}/render-hook.js +0 -0
- /package/dist/cjs/{test → src/test}/render.js +0 -0
- /package/dist/cjs/{test → src/test}/setup-tests.js +0 -0
- /package/dist/cjs/{test → src/test}/test-plugins/bert/index.js +0 -0
- /package/dist/cjs/{test → src/test}/test-plugins/ernie/index.js +0 -0
- /package/dist/cjs/{test → src/test}/test-plugins/index.js +0 -0
- /package/dist/cjs/{test → src/test}/utils.js +0 -0
- /package/dist/cjs/{test-utils → src/test-utils}/index.js +0 -0
- /package/dist/cjs/{test-utils → src/test-utils}/mock-plugin-registry.js +0 -0
- /package/dist/cjs/{utils → src/utils}/action.js +0 -0
- /package/dist/cjs/{utils → src/utils}/index.js +0 -0
- /package/dist/cjs/{utils → src/utils}/variables.js +0 -0
- /package/dist/{components → src/components}/CalculationSelector/CalculationSelector.js +0 -0
- /package/dist/{components → src/components}/CalculationSelector/index.js +0 -0
- /package/dist/{components → src/components}/DatasourceEditorForm/DatasourceEditorForm.js +0 -0
- /package/dist/{components → src/components}/DatasourceEditorForm/index.js +0 -0
- /package/dist/{components → src/components}/DatasourceSelect.js +0 -0
- /package/dist/{components → src/components}/HTTPSettingsEditor/HTTPSettingsEditor.js +0 -0
- /package/dist/{components → src/components}/HTTPSettingsEditor/index.js +0 -0
- /package/dist/{components → src/components}/LegendOptionsEditor/index.js +0 -0
- /package/dist/{components → src/components}/MetricLabelInput/MetricLabelInput.js +0 -0
- /package/dist/{components → src/components}/MetricLabelInput/index.js +0 -0
- /package/dist/{components → src/components}/MultiQueryEditor/MultiQueryEditor.js +0 -0
- /package/dist/{components → src/components}/MultiQueryEditor/QueryEditorContainer.js +0 -0
- /package/dist/{components → src/components}/MultiQueryEditor/index.js +0 -0
- /package/dist/{components → src/components}/OptionsEditorRadios/OptionsEditorRadios.js +0 -0
- /package/dist/{components → src/components}/OptionsEditorRadios/index.js +0 -0
- /package/dist/{components → src/components}/OptionsEditorTabPanel/OptionsEditorTabPanel.js +0 -0
- /package/dist/{components → src/components}/OptionsEditorTabPanel/index.js +0 -0
- /package/dist/{components → src/components}/OptionsEditorTabs/OptionsEditorTabs.js +0 -0
- /package/dist/{components → src/components}/OptionsEditorTabs/index.js +0 -0
- /package/dist/{components → src/components}/PanelSpecEditor/PanelSpecEditor.js +0 -0
- /package/dist/{components → src/components}/PanelSpecEditor/index.js +0 -0
- /package/dist/{components → src/components}/PluginEditor/PluginEditor.js +0 -0
- /package/dist/{components → src/components}/PluginEditor/index.js +0 -0
- /package/dist/{components → src/components}/PluginEditor/plugin-editor-api.js +0 -0
- /package/dist/{components → src/components}/PluginKindSelect/PluginKindSelect.js +0 -0
- /package/dist/{components → src/components}/PluginKindSelect/index.js +0 -0
- /package/dist/{components → src/components}/PluginRegistry/PluginRegistry.js +0 -0
- /package/dist/{components → src/components}/PluginRegistry/index.js +0 -0
- /package/dist/{components → src/components}/PluginRegistry/plugin-indexes.js +0 -0
- /package/dist/{components → src/components}/PluginSpecEditor/PluginSpecEditor.js +0 -0
- /package/dist/{components → src/components}/PluginSpecEditor/index.js +0 -0
- /package/dist/{components → src/components}/ProjectSelect.js +0 -0
- /package/dist/{components → src/components}/TimeRangeControls/TimeRangeControls.js +0 -0
- /package/dist/{components → src/components}/TimeRangeControls/index.js +0 -0
- /package/dist/{components → src/components}/Variables/VariableEditorForm/VariableEditorForm.js +0 -0
- /package/dist/{components → src/components}/Variables/VariableEditorForm/VariablePreview.js +0 -0
- /package/dist/{components → src/components}/Variables/VariableEditorForm/index.js +0 -0
- /package/dist/{components → src/components}/Variables/VariableEditorForm/variable-editor-form-model.js +0 -0
- /package/dist/{components → src/components}/Variables/index.js +0 -0
- /package/dist/{components → src/components}/Variables/variable-model.js +0 -0
- /package/dist/{components → src/components}/index.js +0 -0
- /package/dist/{constants → src/constants}/index.js +0 -0
- /package/dist/{constants → src/constants}/user-interface-text.js +0 -0
- /package/dist/{context → src/context}/ProjectStoreProvider.js +0 -0
- /package/dist/{context → src/context}/ValidationProvider.js +0 -0
- /package/dist/{context → src/context}/index.js +0 -0
- /package/dist/{context → src/context}/query-params.js +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{model → src/model}/datasource.js +0 -0
- /package/dist/{model → src/model}/explore.js +0 -0
- /package/dist/{model → src/model}/index.js +0 -0
- /package/dist/{model → src/model}/panels.js +0 -0
- /package/dist/{model → src/model}/plugin-base.js +0 -0
- /package/dist/{model → src/model}/plugin-loading.js +0 -0
- /package/dist/{model → src/model}/plugins.js +0 -0
- /package/dist/{model → src/model}/profile-queries.js +0 -0
- /package/dist/{model → src/model}/time-series-queries.js +0 -0
- /package/dist/{model → src/model}/trace-queries.js +0 -0
- /package/dist/{model → src/model}/variables.js +0 -0
- /package/dist/{remote → src/remote}/PersesPlugin.types.js +0 -0
- /package/dist/{remote → src/remote}/PluginLoaderComponent.js +0 -0
- /package/dist/{remote → src/remote}/index.js +0 -0
- /package/dist/{remote → src/remote}/remotePluginLoader.js +0 -0
- /package/dist/{runtime → src/runtime}/DataQueriesProvider/DataQueriesProvider.js +0 -0
- /package/dist/{runtime → src/runtime}/DataQueriesProvider/index.js +0 -0
- /package/dist/{runtime → src/runtime}/DataQueriesProvider/model.js +0 -0
- /package/dist/{runtime → src/runtime}/QueryCountProvider.js +0 -0
- /package/dist/{runtime → src/runtime}/TimeRangeProvider/TimeRangeProvider.js +0 -0
- /package/dist/{runtime → src/runtime}/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +0 -0
- /package/dist/{runtime → src/runtime}/TimeRangeProvider/TimeRangeSettingsProvider.js +0 -0
- /package/dist/{runtime → src/runtime}/TimeRangeProvider/index.js +0 -0
- /package/dist/{runtime → src/runtime}/TimeRangeProvider/query-params.js +0 -0
- /package/dist/{runtime → src/runtime}/TimeRangeProvider/refresh-interval.js +0 -0
- /package/dist/{runtime → src/runtime}/UsageMetricsProvider.js +0 -0
- /package/dist/{runtime → src/runtime}/builtin-variables.js +0 -0
- /package/dist/{runtime → src/runtime}/datasources.js +0 -0
- /package/dist/{runtime → src/runtime}/plugin-registry.js +0 -0
- /package/dist/{runtime → src/runtime}/profile-queries.js +0 -0
- /package/dist/{runtime → src/runtime}/time-series-queries.js +0 -0
- /package/dist/{runtime → src/runtime}/trace-queries.js +0 -0
- /package/dist/{runtime → src/runtime}/utils.js +0 -0
- /package/dist/{runtime → src/runtime}/variables.js +0 -0
- /package/dist/{test → src/test}/index.js +0 -0
- /package/dist/{test → src/test}/mock-data.js +0 -0
- /package/dist/{test → src/test}/render-hook.js +0 -0
- /package/dist/{test → src/test}/render.js +0 -0
- /package/dist/{test → src/test}/setup-tests.js +0 -0
- /package/dist/{test → src/test}/test-plugins/bert/index.js +0 -0
- /package/dist/{test → src/test}/test-plugins/ernie/index.js +0 -0
- /package/dist/{test → src/test}/test-plugins/index.js +0 -0
- /package/dist/{test → src/test}/utils.js +0 -0
- /package/dist/{test-utils → src/test-utils}/index.js +0 -0
- /package/dist/{test-utils → src/test-utils}/mock-plugin-registry.js +0 -0
- /package/dist/{utils → src/utils}/action.js +0 -0
- /package/dist/{utils → src/utils}/index.js +0 -0
- /package/dist/{utils → src/utils}/variables.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Variables/VariableEditorForm/VariableEditorForm.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { DispatchWithoutAction, ReactElement, useState } from 'react';\nimport {\n Box,\n Typography,\n Switch,\n TextField,\n Grid,\n FormControlLabel,\n MenuItem,\n Stack,\n ClickAwayListener,\n Divider,\n} from '@mui/material';\nimport { VariableDefinition, ListVariableDefinition, Action } from '@perses-dev/core';\nimport { DiscardChangesConfirmationDialog, ErrorAlert, ErrorBoundary, FormActions } from '@perses-dev/components';\nimport { Control, Controller, FormProvider, SubmitHandler, useForm, useFormContext, useWatch } from 'react-hook-form';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { getSubmitText, getTitleAction } from '../../../utils';\nimport { VARIABLE_TYPES } from '../variable-model';\nimport { PluginEditor } from '../../PluginEditor';\nimport { useValidationSchemas } from '../../../context';\nimport { VariableListPreview, VariablePreview } from './VariablePreview';\n\nfunction FallbackPreview(): ReactElement {\n return <div>Error previewing values</div>;\n}\n\ninterface KindVariableEditorFormProps {\n action: Action;\n control: Control<VariableDefinition>;\n}\n\nfunction TextVariableEditorForm({ action, control }: KindVariableEditorFormProps): ReactElement {\n return (\n <>\n <Typography py={1} variant=\"subtitle1\">\n Text Options\n </Typography>\n <Stack spacing={2}>\n <Controller\n control={control}\n name=\"spec.value\"\n render={({ field, fieldState }) => (\n <>\n <Box>\n <VariablePreview values={[field.value]} />\n </Box>\n <TextField\n {...field}\n label=\"Value\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n </>\n )}\n />\n <Controller\n control={control}\n name=\"spec.constant\"\n render={({ field }) => (\n <FormControlLabel\n label=\"Constant\"\n control={\n <Switch\n {...field}\n checked={!!field.value}\n readOnly={action === 'read'}\n value={field.value ?? false}\n onChange={(event) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n field.onChange(event);\n }}\n />\n }\n />\n )}\n />\n </Stack>\n </>\n );\n}\n\nfunction ListVariableEditorForm({ action, control }: KindVariableEditorFormProps): ReactElement {\n const form = useFormContext<VariableDefinition>();\n /** We use `previewSpec` to know when to explicitly update the\n * spec that will be used for preview. The reason why we do this is to avoid\n * having to re-fetch the values when the user is still editing the spec.\n */\n const [previewSpec, setPreviewSpec] = useState<ListVariableDefinition>(form.getValues() as ListVariableDefinition);\n const refreshPreview = (): void => {\n setPreviewSpec(form.getValues() as ListVariableDefinition);\n };\n\n const plugin = useWatch<VariableDefinition, 'spec.plugin'>({ control, name: 'spec.plugin' });\n const kind = plugin?.kind;\n const pluginSpec = plugin?.spec;\n\n const _allowAllValue = useWatch<VariableDefinition, 'spec.allowAllValue'>({\n control: control,\n name: 'spec.allowAllValue',\n });\n\n // When variable kind is selected we need to provide default values\n // TODO: check if react-hook-form has a better way to do this\n const values = form.getValues() as ListVariableDefinition;\n if (values.spec.allowAllValue === undefined) {\n form.setValue('spec.allowAllValue', false);\n }\n\n if (values.spec.allowMultiple === undefined) {\n form.setValue('spec.allowMultiple', false);\n }\n\n return (\n <>\n <Typography py={1} variant=\"subtitle1\">\n List Options\n </Typography>\n <Stack spacing={2} mb={2}>\n {kind ? (\n <Box>\n <ErrorBoundary FallbackComponent={FallbackPreview} resetKeys={[previewSpec]}>\n <VariableListPreview definition={previewSpec} onRefresh={refreshPreview} />\n </ErrorBoundary>\n </Box>\n ) : (\n <VariablePreview isLoading={true} />\n )}\n\n <Stack>\n {/** Hack?: Cool technique to refresh the preview to simulate onBlur event */}\n <ClickAwayListener onClickAway={() => refreshPreview()}>\n <Box />\n </ClickAwayListener>\n {/** **/}\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <Controller\n control={control}\n name=\"spec.plugin\"\n render={({ field }) => {\n return (\n <PluginEditor\n width=\"100%\"\n pluginTypes={['Variable']}\n pluginKindLabel=\"Source\"\n value={{\n selection: {\n type: 'Variable',\n kind: kind ?? 'StaticListVariable',\n },\n spec: pluginSpec ?? { values: [] },\n }}\n isReadonly={action === 'read'}\n onChange={(v) => {\n field.onChange({ kind: v.selection.kind, spec: v.spec });\n }}\n />\n );\n }}\n />\n </ErrorBoundary>\n </Stack>\n\n <Stack>\n <Controller\n control={control}\n name=\"spec.capturingRegexp\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n label=\"Capturing Regexp Filter\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n value={field.value ?? ''}\n onChange={(event) => {\n if (event.target.value === '') {\n field.onChange(undefined);\n } else {\n field.onChange(event);\n }\n }}\n helperText={\n fieldState.error?.message\n ? fieldState.error.message\n : 'Optional, if you want to filter on captured result.'\n }\n />\n )}\n />\n </Stack>\n\n <Stack>\n <Controller\n control={control}\n name=\"spec.sort\"\n render={({ field, fieldState }) => (\n <TextField\n select\n {...field}\n fullWidth\n label=\"Sort\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? 'none'}\n onChange={(event) => {\n field.onChange(event);\n }}\n >\n <MenuItem value=\"none\">None</MenuItem>\n <MenuItem value=\"alphabetical-asc\">Alphabetical, asc</MenuItem>\n <MenuItem value=\"alphabetical-desc\">Alphabetical, desc</MenuItem>\n <MenuItem value=\"numerical-asc\">Numerical, asc</MenuItem>\n <MenuItem value=\"numerical-desc\">Numerical, desc</MenuItem>\n <MenuItem value=\"alphabetical-ci-asc\">Alphabetical, case-insensitive, asc</MenuItem>\n <MenuItem value=\"alphabetical-ci-desc\">Alphabetical, case-insensitive, desc</MenuItem>\n </TextField>\n )}\n />\n </Stack>\n </Stack>\n\n <Divider />\n\n <Typography py={1} variant=\"subtitle1\">\n Dropdown Options\n </Typography>\n <Stack spacing=\"2\">\n <Stack>\n <Controller\n control={control}\n name=\"spec.allowMultiple\"\n render={({ field }) => (\n <FormControlLabel\n label=\"Allow Multiple Values\"\n control={\n <Switch\n {...field}\n checked={!!field.value}\n readOnly={action === 'read'}\n value={field.value ?? false}\n onChange={(event) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n field.onChange(event);\n }}\n />\n }\n />\n )}\n />\n <Typography variant=\"caption\">Enables multiple values to be selected at the same time</Typography>\n </Stack>\n <Stack>\n <Controller\n control={control}\n name=\"spec.allowAllValue\"\n render={({ field }) => (\n <FormControlLabel\n label=\"Allow All option\"\n control={\n <Switch\n {...field}\n checked={!!field.value}\n readOnly={action === 'read'}\n value={field.value ?? false}\n onChange={(event) => {\n if (action === 'read') return; // ReadOnly prop is not blocking user interaction...\n field.onChange(event);\n }}\n />\n }\n />\n )}\n />\n <Typography mb={1} variant=\"caption\">\n Enables an option to include all variable values\n </Typography>\n {_allowAllValue && (\n <Controller\n control={control}\n name=\"spec.customAllValue\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Custom All Value\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={\n fieldState.error?.message\n ? fieldState.error.message\n : 'When All is selected, this value will be used'\n }\n value={field.value ?? ''}\n onChange={(event) => {\n if (event.target.value === '') {\n field.onChange(undefined);\n } else {\n field.onChange(event);\n }\n }}\n />\n )}\n />\n )}\n </Stack>\n </Stack>\n </>\n );\n}\n\ninterface VariableEditorFormProps {\n initialVariableDefinition: VariableDefinition;\n action: Action;\n isDraft: boolean;\n isReadonly?: boolean;\n onActionChange?: (action: Action) => void;\n onSave: (def: VariableDefinition) => void;\n onClose: () => void;\n onDelete?: DispatchWithoutAction;\n}\n\nexport function VariableEditorForm({\n initialVariableDefinition,\n action,\n isDraft,\n isReadonly,\n onActionChange,\n onSave,\n onClose,\n onDelete,\n}: VariableEditorFormProps): ReactElement {\n const [isDiscardDialogOpened, setDiscardDialogOpened] = useState<boolean>(false);\n const titleAction = getTitleAction(action, isDraft);\n const submitText = getSubmitText(action, isDraft);\n\n const { variableEditorSchema } = useValidationSchemas();\n const form = useForm<VariableDefinition>({\n resolver: zodResolver(variableEditorSchema),\n mode: 'onBlur',\n defaultValues: initialVariableDefinition,\n });\n\n const kind = useWatch({ control: form.control, name: 'kind' });\n\n function clearFormData(data: VariableDefinition): VariableDefinition {\n const result = { ...data };\n if (\n result.spec.display?.name === undefined &&\n result.spec.display?.description === undefined &&\n result.spec.display?.hidden === undefined\n ) {\n delete result.spec.display;\n }\n return result;\n }\n\n const processForm: SubmitHandler<VariableDefinition> = (data: VariableDefinition) => {\n // reset display attributes to undefined when empty, because we don't want to save empty strings\n onSave(clearFormData(data));\n };\n\n // When user click on cancel, several possibilities:\n // - create action: ask for discard approval\n // - update action: ask for discard approval if changed\n // - read action: don´t ask for discard approval\n function handleCancel(): void {\n if (JSON.stringify(initialVariableDefinition) !== JSON.stringify(clearFormData(form.getValues()))) {\n setDiscardDialogOpened(true);\n } else {\n onClose();\n }\n }\n\n return (\n <FormProvider {...form}>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n padding: (theme) => theme.spacing(1, 2),\n borderBottom: (theme) => `1px solid ${theme.palette.divider}`,\n }}\n >\n <Typography variant=\"h2\">{titleAction} Variable</Typography>\n <FormActions\n action={action}\n submitText={submitText}\n isReadonly={isReadonly}\n isValid={form.formState.isValid}\n onActionChange={onActionChange}\n onSubmit={form.handleSubmit(processForm)}\n onDelete={onDelete}\n onCancel={handleCancel}\n />\n </Box>\n <Box padding={2} sx={{ overflowY: 'scroll' }}>\n <Grid container spacing={2} mb={2}>\n <Grid item xs={8}>\n <Controller\n control={form.control}\n name=\"spec.name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n required\n fullWidth\n label=\"Name\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n disabled: action === 'update' && !isDraft,\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={4}>\n <Controller\n control={form.control}\n name=\"spec.display.name\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Display Label\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={8}>\n <Controller\n control={form.control}\n name=\"spec.display.description\"\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Description\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? ''}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={4}>\n <Controller\n control={form.control}\n name=\"kind\"\n render={({ field, fieldState }) => (\n <TextField\n select\n {...field}\n fullWidth\n label=\"Type\"\n InputLabelProps={{ shrink: action === 'read' ? true : undefined }}\n InputProps={{\n readOnly: action === 'read',\n }}\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n value={field.value ?? 'TextVariable'}\n onChange={(event) => {\n field.onChange(event);\n }}\n >\n {VARIABLE_TYPES.map((v) => (\n <MenuItem key={v.kind} value={v.kind}>\n {v.label}\n </MenuItem>\n ))}\n </TextField>\n )}\n />\n </Grid>\n </Grid>\n\n <Divider />\n\n {kind === 'TextVariable' && (\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <TextVariableEditorForm action={action} control={form.control} />\n </ErrorBoundary>\n )}\n {kind === 'ListVariable' && (\n <ErrorBoundary FallbackComponent={ErrorAlert}>\n <ListVariableEditorForm action={action} control={form.control} />\n </ErrorBoundary>\n )}\n </Box>\n <DiscardChangesConfirmationDialog\n description=\"Are you sure you want to discard these changes? Changes cannot be recovered.\"\n isOpen={isDiscardDialogOpened}\n onCancel={() => {\n setDiscardDialogOpened(false);\n }}\n onDiscardChanges={() => {\n setDiscardDialogOpened(false);\n onClose();\n }}\n />\n </FormProvider>\n );\n}\n"],"names":["React","useState","Box","Typography","Switch","TextField","Grid","FormControlLabel","MenuItem","Stack","ClickAwayListener","Divider","DiscardChangesConfirmationDialog","ErrorAlert","ErrorBoundary","FormActions","Controller","FormProvider","useForm","useFormContext","useWatch","zodResolver","getSubmitText","getTitleAction","VARIABLE_TYPES","PluginEditor","useValidationSchemas","VariableListPreview","VariablePreview","FallbackPreview","div","TextVariableEditorForm","action","control","py","variant","spacing","name","render","field","fieldState","values","value","label","InputLabelProps","shrink","undefined","InputProps","readOnly","error","helperText","message","onChange","event","checked","ListVariableEditorForm","form","previewSpec","setPreviewSpec","getValues","refreshPreview","plugin","kind","pluginSpec","spec","_allowAllValue","allowAllValue","setValue","allowMultiple","mb","FallbackComponent","resetKeys","definition","onRefresh","isLoading","onClickAway","width","pluginTypes","pluginKindLabel","selection","type","isReadonly","v","target","select","fullWidth","VariableEditorForm","initialVariableDefinition","isDraft","onActionChange","onSave","onClose","onDelete","isDiscardDialogOpened","setDiscardDialogOpened","titleAction","submitText","variableEditorSchema","resolver","mode","defaultValues","clearFormData","data","result","display","description","hidden","processForm","handleCancel","JSON","stringify","sx","alignItems","padding","theme","borderBottom","palette","divider","isValid","formState","onSubmit","handleSubmit","onCancel","overflowY","container","item","xs","required","disabled","map","isOpen","onDiscardChanges"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAA8CC,QAAQ,QAAQ,QAAQ;AAC7E,SACEC,GAAG,EACHC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,gBAAgB,EAChBC,QAAQ,EACRC,KAAK,EACLC,iBAAiB,EACjBC,OAAO,QACF,gBAAgB;AAEvB,SAASC,gCAAgC,EAAEC,UAAU,EAAEC,aAAa,EAAEC,WAAW,QAAQ,yBAAyB;AAClH,SAAkBC,UAAU,EAAEC,YAAY,EAAiBC,OAAO,EAAEC,cAAc,EAAEC,QAAQ,QAAQ,kBAAkB;AACtH,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,aAAa,EAAEC,cAAc,QAAQ,iBAAiB;AAC/D,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,oBAAoB,QAAQ,mBAAmB;AACxD,SAASC,mBAAmB,EAAEC,eAAe,QAAQ,oBAAoB;AAEzE,SAASC;IACP,qBAAO,KAACC;kBAAI;;AACd;AAOA,SAASC,uBAAuB,EAAEC,MAAM,EAAEC,OAAO,EAA+B;IAC9E,qBACE;;0BACE,KAAC9B;gBAAW+B,IAAI;gBAAGC,SAAQ;0BAAY;;0BAGvC,MAAC1B;gBAAM2B,SAAS;;kCACd,KAACpB;wBACCiB,SAASA;wBACTI,MAAK;wBACLC,QAAQ,CAAC,EAAEC,KAAK,EAAEC,UAAU,EAAE,iBAC5B;;kDACE,KAACtC;kDACC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S,OAAOc;4CAAU;4CAChEC,YAAY;gDACVC,UAAUhB,WAAW;4CACvB;4CACAiB,OAAO,CAAC,CAACT,WAAWS,KAAK;4CACzBC,YAAYV,WAAWS,KAAK,EAAEE;4CAC9BT,OAAOH,MAAMG,KAAK,IAAI;4CACtBU,UAAU,CAACC;gDACTd,MAAMa,QAAQ,CAACC;4CACjB;sDAEC7B,eAAeyG,GAAG,CAAC,CAAC/C,kBACnB,KAAC1E;oDAAsBkC,OAAOwC,EAAEpB,IAAI;8DACjCoB,EAAEvC,KAAK;mDADKuC,EAAEpB,IAAI;;;;;;kCAUjC,KAACnD;oBAEAmD,SAAS,gCACR,KAAChD;wBAAcwD,mBAAmBzD;kCAChC,cAAA,KAACkB;4BAAuBC,QAAQA;4BAAQC,SAASuB,KAAKvB,OAAO;;;oBAGhE6B,SAAS,gCACR,KAAChD;wBAAcwD,mBAAmBzD;kCAChC,cAAA,KAAC0C;4BAAuBvB,QAAQA;4BAAQC,SAASuB,KAAKvB,OAAO;;;;;0BAInE,KAACrB;gBACC6F,aAAY;gBACZyB,QAAQrC;gBACR6B,UAAU;oBACR5B,uBAAuB;gBACzB;gBACAqC,kBAAkB;oBAChBrC,uBAAuB;oBACvBH;gBACF;;;;AAIR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Variables/VariableEditorForm/VariablePreview.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { ReactElement, useState } from 'react';\nimport { Alert, Box, Card, Chip, CircularProgress, IconButton, Stack, Typography } from '@mui/material';\nimport { InfoTooltip, useSnackbar } from '@perses-dev/components';\nimport Refresh from 'mdi-material-ui/Refresh';\nimport Clipboard from 'mdi-material-ui/ClipboardOutline';\nimport { ListVariableDefinition } from '@perses-dev/core';\nimport { TOOLTIP_TEXT } from '../../../constants';\nimport { useListVariablePluginValues } from '../variable-model';\n\nconst DEFAULT_MAX_PREVIEW_VALUES = 50;\n\ninterface VariablePreviewProps {\n values?: string[];\n onRefresh?: () => void;\n isLoading?: boolean;\n error?: string;\n}\n\nexport function VariablePreview(props: VariablePreviewProps): ReactElement {\n const { values, onRefresh, isLoading, error } = props;\n const [maxValues, setMaxValues] = useState<number | undefined>(DEFAULT_MAX_PREVIEW_VALUES);\n const { infoSnackbar } = useSnackbar();\n const showAll = (): void => {\n setMaxValues(undefined);\n };\n let notShown = 0;\n\n if (values && values?.length > 0 && maxValues) {\n notShown = values.length - maxValues;\n }\n\n return (\n <Box>\n <Stack direction=\"row\" spacing={1} alignItems=\"center\" mb={1}>\n <Typography variant=\"h4\">Preview Values</Typography>\n {onRefresh && (\n <InfoTooltip description={TOOLTIP_TEXT.refreshVariableValues}>\n <IconButton onClick={onRefresh} size=\"small\">\n <Refresh />\n </IconButton>\n </InfoTooltip>\n )}\n <InfoTooltip description={TOOLTIP_TEXT.copyVariableValues}>\n <IconButton\n onClick={async () => {\n if (values?.length) {\n await navigator.clipboard.writeText(values.map((value) => value).join(', '));\n infoSnackbar('Preview values copied to clipboard!');\n }\n }}\n size=\"small\"\n >\n <Clipboard />\n </IconButton>\n </InfoTooltip>\n </Stack>\n <Card variant=\"outlined\">\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1, m: 2 }}>\n {error && <Alert severity=\"error\">{error}</Alert>}\n {values?.length === 0 && <Alert severity=\"info\">No results</Alert>}\n {isLoading && (\n <Stack width=\"100%\" sx={{ alignItems: 'center', justifyContent: 'center' }}>\n <CircularProgress />\n </Stack>\n )}\n {values?.slice(0, maxValues).map((val, index) => <Chip size=\"small\" key={index} label={val} />)}\n {notShown > 0 && <Chip onClick={showAll} variant=\"outlined\" size=\"small\" label={`+${notShown} more`} />}\n </Box>\n </Card>\n </Box>\n );\n}\n\ninterface VariableListPreviewProps {\n definition: ListVariableDefinition;\n onRefresh: () => void;\n}\n\nexport function VariableListPreview(props: VariableListPreviewProps): ReactElement {\n const { definition, onRefresh } = props;\n const { data, isFetching, error } = useListVariablePluginValues(definition);\n const errorMessage = (error as Error)?.message;\n\n return (\n <VariablePreview\n values={data?.map((val) => val.value) || []}\n onRefresh={onRefresh}\n isLoading={isFetching}\n error={errorMessage}\n />\n );\n}\n"],"names":["React","useState","Alert","Box","Card","Chip","CircularProgress","IconButton","Stack","Typography","InfoTooltip","useSnackbar","Refresh","Clipboard","TOOLTIP_TEXT","useListVariablePluginValues","DEFAULT_MAX_PREVIEW_VALUES","VariablePreview","props","values","onRefresh","isLoading","error","maxValues","setMaxValues","infoSnackbar","showAll","undefined","notShown","length","direction","spacing","alignItems","mb","variant","description","refreshVariableValues","onClick","size","copyVariableValues","navigator","clipboard","writeText","map","value","join","sx","display","flexWrap","gap","m","severity","width","justifyContent","slice","val","index","label","VariableListPreview","definition","data","isFetching","errorMessage","message"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAAuBC,QAAQ,QAAQ,QAAQ;AACtD,SAASC,KAAK,EAAEC,GAAG,EAAEC,IAAI,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,UAAU,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AACxG,SAASC,WAAW,EAAEC,WAAW,QAAQ,yBAAyB;AAClE,OAAOC,aAAa,0BAA0B;AAC9C,OAAOC,eAAe,mCAAmC;AAEzD,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAAS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gCAAEd,YAAY;gCAAUqB,gBAAgB;4BAAS;sCACvE,cAAA,KAAC/C;;wBAGJa,QAAQmC,MAAM,GAAG/B,WAAWoB,IAAI,CAACY,KAAKC,sBAAU,KAACnD;gCAAKiC,MAAK;gCAAoBmB,OAAOF;+BAAdC;wBACxE5B,WAAW,mBAAK,KAACvB;4BAAKgC,SAASX;4BAASQ,SAAQ;4BAAWI,MAAK;4BAAQmB,OAAO,CAAC,CAAC,EAAE7B,SAAS,KAAK,CAAC;;;;;;;AAK7G;AAOA,OAAO,SAAS8B,oBAAoBxC,KAA+B;IACjE,MAAM,EAAEyC,UAAU,EAAEvC,SAAS,EAAE,GAAGF;IAClC,MAAM,EAAE0C,IAAI,EAAEC,UAAU,EAAEvC,KAAK,EAAE,GAAGP,4BAA4B4C;IAChE,MAAMG,eAAgBxC,OAAiByC;IAEvC,qBACE,KAAC9C;QACCE,QAAQyC,MAAMjB,IAAI,CAACY,MAAQA,IAAIX,KAAK,KAAK,EAAE;QAC3CxB,WAAWA;QACXC,WAAWwC;QACXvC,OAAOwC;;AAGb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Variables/VariableEditorForm/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './VariableEditorForm';\nexport * from './VariablePreview';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,uBAAuB;AACrC,cAAc,oBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Variables/VariableEditorForm/variable-editor-form-model.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ListVariableSpec, TextVariableDefinition, TextVariableSpec, VariableDefinition } from '@perses-dev/core';\n\nexport type VariableEditorState = {\n name: string;\n title?: string;\n kind: 'TextVariable' | 'ListVariable' | 'BuiltinVariable';\n description?: string;\n listVariableFields: Omit<ListVariableSpec, 'name' | 'display'>;\n textVariableFields: Omit<TextVariableSpec, 'name' | 'display'>;\n};\n\nexport function getInitialState(initialVariableDefinition: VariableDefinition): VariableEditorState {\n const textVariableFields: Omit<TextVariableSpec, 'name' | 'display'> = {\n value: (initialVariableDefinition as TextVariableDefinition).spec.value ?? '',\n constant: (initialVariableDefinition as TextVariableDefinition).spec.constant ?? false,\n };\n\n const listVariableFields: Omit<ListVariableSpec, 'name' | 'display'> = {\n allowMultiple: false,\n allowAllValue: false,\n customAllValue: undefined,\n capturingRegexp: undefined,\n sort: undefined,\n plugin: {\n kind: '',\n spec: {},\n },\n };\n if (initialVariableDefinition.kind === 'ListVariable') {\n listVariableFields.allowMultiple = initialVariableDefinition.spec.allowMultiple ?? false;\n listVariableFields.allowAllValue = initialVariableDefinition.spec.allowAllValue ?? false;\n listVariableFields.customAllValue = initialVariableDefinition.spec.customAllValue;\n listVariableFields.capturingRegexp = initialVariableDefinition.spec.capturingRegexp;\n listVariableFields.sort = initialVariableDefinition.spec.sort;\n listVariableFields.plugin = initialVariableDefinition.spec.plugin;\n }\n\n return {\n name: initialVariableDefinition.spec.name,\n title: initialVariableDefinition.spec.display?.name ?? '',\n kind: initialVariableDefinition.kind,\n description: initialVariableDefinition.spec.display?.description ?? '',\n listVariableFields,\n textVariableFields,\n };\n}\n\nexport function getVariableDefinitionFromState(state: VariableEditorState): VariableDefinition {\n const { name, title, kind, description } = state;\n\n const display = { name: title, description: description };\n\n if (kind === 'TextVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n ...state.textVariableFields,\n },\n };\n }\n\n if (kind === 'ListVariable') {\n return {\n kind,\n spec: {\n name,\n display,\n allowMultiple: state.listVariableFields.allowMultiple,\n allowAllValue: state.listVariableFields.allowAllValue,\n customAllValue: state.listVariableFields.customAllValue,\n capturingRegexp: state.listVariableFields.capturingRegexp,\n sort: state.listVariableFields.sort,\n plugin: state.listVariableFields.plugin,\n },\n };\n }\n throw new Error(`Unknown variable kind: ${kind}`);\n}\n"],"names":["getInitialState","initialVariableDefinition","textVariableFields","value","spec","constant","listVariableFields","allowMultiple","allowAllValue","customAllValue","undefined","capturingRegexp","sort","plugin","kind","name","title","display","description","getVariableDefinitionFromState","state","Error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAajC,OAAO,SAASA,gBAAgBC,yBAA6C;IAC3E,MAAMC,qBAAiE;QACrEC,OAAO,AAACF,0BAAqDG,IAAI,CAACD,KAAK,IAAI;QAC3EE,UAAU,AAACJ,0BAAqDG,IAAI,CAACC,QAAQ,IAAI;IACnF;IAEA,MAAMC,qBAAiE;QACrEC,eAAe;QACfC,eAAe;QACfC,gBAAgBC;QAChBC,iBAAiBD;QACjBE,MAAMF;QACNG,QAAQ;YACNC,MAAM;YACNV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M,IAAI;gBACnCC,QAAQO,MAAMd,kBAAkB,CAACO,MAAM;YACzC;QACF;IACF;IACA,MAAM,IAAIQ,MAAM,CAAC,uBAAuB,EAAEP,MAAM;AAClD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Variables/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './variable-model';\nexport * from './VariableEditorForm';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB;AACjC,cAAc,uBAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Variables/variable-model.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ListVariableDefinition } from '@perses-dev/core';\nimport { useQuery, UseQueryResult } from '@tanstack/react-query';\nimport { VariableOption } from '../../model';\nimport { useDatasourceStore, usePlugin, useTimeRange, useAllVariableValues, VariableStateMap } from '../../runtime';\n\nexport function filterVariableList(data: VariableOption[], capturedRegexp: RegExp): VariableOption[] {\n const result: VariableOption[] = [];\n const filteredSet = new Set<string>();\n for (const variableValue of data) {\n const matches = variableValue.value.matchAll(capturedRegexp);\n let concat = '';\n for (const match of matches) {\n for (let i = 1; i < match.length; i++) {\n const m = match[i];\n if (m !== undefined) {\n concat = `${concat}${m}`;\n }\n }\n }\n if (concat !== '' && !filteredSet.has(concat)) {\n // like that we are avoiding to have duplicating variable value\n filteredSet.add(concat);\n result.push({ label: variableValue.label, value: concat });\n }\n }\n return result;\n}\n\nexport function useListVariablePluginValues(definition: ListVariableDefinition): UseQueryResult<VariableOption[]> {\n const { data: variablePlugin } = usePlugin('Variable', definition.spec.plugin.kind);\n const datasourceStore = useDatasourceStore();\n const allVariables = useAllVariableValues();\n const { absoluteTimeRange: timeRange, refreshKey } = useTimeRange();\n\n const variablePluginCtx = { timeRange, datasourceStore, variables: allVariables };\n\n const spec = definition.spec.plugin.spec;\n const capturingRegexp =\n definition.spec.capturingRegexp !== undefined ? new RegExp(definition.spec.capturingRegexp, 'g') : undefined;\n\n let dependsOnVariables: string[] = Object.keys(allVariables); // Default to all variables\n if (variablePlugin?.dependsOn) {\n const dependencies = variablePlugin.dependsOn(spec, variablePluginCtx);\n dependsOnVariables = dependencies.variables ? dependencies.variables : dependsOnVariables;\n }\n // Exclude self variable to avoid circular dependency\n dependsOnVariables = dependsOnVariables.filter((v) => v !== definition.spec.name);\n\n const variables = useAllVariableValues(dependsOnVariables);\n\n let waitToLoad = false;\n if (dependsOnVariables) {\n waitToLoad = dependsOnVariables.some((v) => variables[v]?.loading);\n }\n\n const variablesValueKey = getVariableValuesKey(variables);\n\n return useQuery({\n queryKey: [definition, variablesValueKey, timeRange, refreshKey],\n queryFn: async () => {\n const resp = await variablePlugin?.getVariableOptions(spec, { datasourceStore, variables, timeRange });\n if (resp === undefined) {\n return [];\n }\n if (!capturingRegexp) {\n return resp.data;\n }\n return filterVariableList(resp.data, capturingRegexp);\n },\n enabled: !!variablePlugin || waitToLoad,\n });\n}\n\n/**\n * Returns a serialized string of the current state of variable values.\n */\nexport function getVariableValuesKey(v: VariableStateMap): string {\n return Object.values(v)\n .map((v) => JSON.stringify(v.value))\n .join(',');\n}\n\nexport const VARIABLE_TYPES = [\n { label: 'List', kind: 'ListVariable' },\n { label: 'Text', kind: 'TextVariable' },\n] as const;\n"],"names":["useQuery","useDatasourceStore","usePlugin","useTimeRange","useAllVariableValues","filterVariableList","data","capturedRegexp","result","filteredSet","Set","variableValue","matches","value","matchAll","concat","match","i","length","m","undefined","has","add","push","label","useListVariablePluginValues","definition","variablePlugin","spec","plugin","kind","datasourceStore","allVariables","absoluteTimeRange","timeRange","refreshKey","variablePluginCtx","variables","capturingRegexp","RegExp","dependsOnVariables","Object","keys","dependsOn","dependencies","filter","v","name","waitToLoad","some","loading","variablesValueKey","getVariableValuesKey","queryKey","queryFn","resp","getVariableOptions","enabled","values","map","JSON","stringify","join","VARIABLE_TYPES"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,QAAQ,QAAwB,wBAAwB;AAEjE,SAASC,kBAAkB,EAAEC,SAAS,EAAEC,YAAY,EAAEC,oBAAoB,QAA0B,gBAAgB;AAEpH,OAAO,SAASC,mBAAmBC,IAAsB,EAAEC,cAAsB;IAC/E,MAAMC,SAA2B,EAAE;IACnC,MAAMC,cAAc,IAAIC;IACxB,KAAK,MAAMC,iBAAiBL,KAAM;QAChC,MAAMM,UAAUD,cAAcE,KAAK,CAACC,QAAQ,CAACP;QAC7C,IAAIQ,SAAS;QACb,KAAK,MAAMC,SAASJ,QAAS;YAC3B,IAAK,IAAIK,IAAI,GAA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,mBAAmBS,IAAI,CAAC,CAACH,IAAMT,SAAS,CAACS,EAAE,EAAEI;IAC5D;IAEA,MAAMC,oBAAoBC,qBAAqBf;IAE/C,OAAOrC,SAAS;QACdqD,UAAU;YAAC3B;YAAYyB;YAAmBjB;YAAWC;SAAW;QAChEmB,SAAS;YACP,MAAMC,OAAO,MAAM5B,gBAAgB6B,mBAAmB5B,MAAM;gBAAEG;gBAAiBM;gBAAWH;YAAU;YACpG,IAAIqB,SAASnC,WAAW;gBACtB,OAAO,EAAE;YACX;YACA,IAAI,CAACkB,iBAAiB;gBACpB,OAAOiB,KAAKjD,IAAI;YAClB;YACA,OAAOD,mBAAmBkD,KAAKjD,IAAI,EAAEgC;QACvC;QACAmB,SAAS,CAAC,CAAC9B,kBAAkBqB;IAC/B;AACF;AAEA;;CAEC,GACD,OAAO,SAASI,qBAAqBN,CAAmB;IACtD,OAAOL,OAAOiB,MAAM,CAACZ,GAClBa,GAAG,CAAC,CAACb,IAAMc,KAAKC,SAAS,CAACf,EAAEjC,KAAK,GACjCiD,IAAI,CAAC;AACV;AAEA,OAAO,MAAMC,iBAAiB;IAC5B;QAAEvC,OAAO;QAAQM,MAAM;IAAe;IACtC;QAAEN,OAAO;QAAQM,MAAM;IAAe;CACvC,CAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './CalculationSelector';\nexport * from './DatasourceEditorForm';\nexport * from './DatasourceSelect';\nexport * from './HTTPSettingsEditor';\nexport * from './LegendOptionsEditor';\nexport * from './MultiQueryEditor';\nexport * from './OptionsEditorRadios';\nexport * from './OptionsEditorTabs';\nexport * from './PanelSpecEditor';\nexport * from './PluginEditor';\nexport * from './PluginKindSelect';\nexport * from './PluginRegistry';\nexport * from './PluginSpecEditor';\nexport * from './TimeRangeControls';\nexport * from './Variables';\nexport * from './ProjectSelect';\nexport * from './MetricLabelInput';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB;AACtC,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,wBAAwB;AACtC,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC,cAAc,iBAAiB;AAC/B,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,cAAc;AAC5B,cAAc,kBAAkB;AAChC,cAAc,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/constants/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './user-interface-text';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/constants/user-interface-text.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport const TOOLTIP_TEXT = {\n // Variable editor buttons\n refreshVariableValues: 'Refresh values',\n copyVariableValues: 'Copy values to clipboard',\n // Time range controls buttons\n refresh: 'Refresh',\n refreshInterval: 'Auto refresh interval',\n zoomIn: 'Zoom in',\n zoomOut: 'Zoom out',\n};\n"],"names":["TOOLTIP_TEXT","refreshVariableValues","copyVariableValues","refresh","refreshInterval","zoomIn","zoomOut"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,MAAMA,eAAe;IAC1B,0BAA0B;IAC1BC,uBAAuB;IACvBC,oBAAoB;IACpB,8BAA8B;IAC9BC,SAAS;IACTC,iBAAiB;IACjBC,QAAQ;IACRC,SAAS;AACX,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/context/ProjectStoreProvider.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useQuery, UseQueryResult } from '@tanstack/react-query';\nimport { ReactNode, createContext, useContext, useMemo, ReactElement } from 'react';\nimport { fetchJson, ProjectResource, StatusError } from '@perses-dev/core';\nimport { useSetProjectParams } from './query-params';\n\nexport interface ProjectStore {\n setProject: (project: ProjectResource) => void;\n project: ProjectResource;\n}\n\nexport interface ProjectStoreProviderProps {\n children?: ReactNode;\n enabledURLParams?: boolean;\n}\n\nexport const ProjectStoreContext = createContext<ProjectStore | undefined>(undefined);\n\nexport function useProjectList(): UseQueryResult<ProjectResource[], StatusError> {\n return useQuery<ProjectResource[], StatusError>({\n queryKey: ['projects'],\n queryFn: () => {\n return fetchJson<ProjectResource[]>('/api/v1/projects');\n },\n });\n}\n\nexport function useProjectStore(): ProjectStore {\n const ctx = useContext(ProjectStoreContext);\n if (ctx === undefined) {\n throw new Error('No ProjectStoreContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function ProjectStoreProvider(props: ProjectStoreProviderProps): ReactElement {\n const { children, enabledURLParams } = props;\n const { project, setProject } = useSetProjectParams(enabledURLParams);\n\n const contextValue = useMemo(\n () => ({\n project: {\n kind: 'Project',\n metadata: {\n name: project,\n },\n } as ProjectResource,\n setProject: (project: ProjectResource): void => {\n setProject(project.metadata.name);\n },\n }),\n [project, setProject]\n );\n\n return <ProjectStoreContext.Provider value={contextValue}>{children}</ProjectStoreContext.Provider>;\n}\n"],"names":["useQuery","createContext","useContext","useMemo","fetchJson","useSetProjectParams","ProjectStoreContext","undefined","useProjectList","queryKey","queryFn","useProjectStore","ctx","Error","ProjectStoreProvider","props","children","enabledURLParams","project","setProject","contextValue","kind","metadata","name","Provider","value"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,QAAQ,QAAwB,wBAAwB;AACjE,SAAoBC,aAAa,EAAEC,UAAU,EAAEC,OAAO,QAAsB,QAAQ;AACpF,SAASC,SAAS,QAAsC,mBAAmB;AAC3E,SAASC,mBAAmB,QAAQ,iBAAiB;AAYrD,OAAO,MAAMC,oCAAsBL,cAAwCM,WAAW;AAEtF,OAAO,SAASC;IACd,OAAOR,SAAyC;QAC9CS,UAAU;YAAC;SAAW;QACtBC,SAAS;YACP,OAAON,UAA6B;QACtC;IACF;AACF;AAEA,OAAO,SAASO;IACd,MAAMC,MAAMV,WAAWI;IACvB,IAAIM,QAAQL,WAAW;QACrB,MAAM,IAAIM,MAAM;IAClB;IACA,OAAOD;AACT;AAEA,OAAO,SAASE,qBAAqBC,KAAgC;IACnE,MAAM,EAAEC,QAAQ,EAAEC,gBAAgB,EAAE,GAAGF;IACvC,MAAM,EAAEG,OAAO,EAAEC,UAAU,EAAE,GAAGd,oBAAoBY;IAEpD,MAAMG,eAAejB,QACnB,IAAO,CAAA;YACLe,SAAS;gBACPG,MAAM;gBACNC,UAAU;oBACRC,MAAML;gBACR;YACF;YACAC,YAAY,CAACD;gBACXC,WAAWD,QAAQI,QAAQ,CAACC,IAAI;YAClC;QACF,CAAA,GACA;QAACL;QAASC;KAAW;IAGvB,qBAAO,KAACb,oBAAoBkB,QAAQ;QAACC,OAAOL;kBAAeJ;;AAC7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/context/ValidationProvider.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createContext, ReactElement, ReactNode, useContext, useState } from 'react';\nimport {\n DatasourceDefinition,\n PanelEditorValues,\n VariableDefinition,\n PluginSchema,\n datasourceDefinitionSchema,\n panelEditorSchema as defaultPanelEditorSchema,\n variableDefinitionSchema,\n buildDatasourceDefinitionSchema,\n buildPanelEditorSchema,\n buildVariableDefinitionSchema,\n} from '@perses-dev/core';\nimport { z } from 'zod';\n\nexport interface ValidationSchemas {\n datasourceEditorSchema: z.Schema<DatasourceDefinition>;\n panelEditorSchema: z.Schema<PanelEditorValues>;\n variableEditorSchema: z.Schema<VariableDefinition>;\n setDatasourceEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setPanelEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n setVariableEditorSchemaPlugin: (pluginSchema: PluginSchema) => void;\n}\n\nexport const ValidationSchemasContext = createContext<ValidationSchemas | undefined>(undefined);\n\nexport function useValidationSchemas(): ValidationSchemas {\n const ctx = useContext(ValidationSchemasContext);\n if (ctx === undefined) {\n throw new Error('No ValidationSchemasContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\ninterface ValidationProviderProps {\n children: ReactNode;\n}\n\n/*\n * Provide validation schemas for forms handling plugins (datasources, variables, panels).\n */\nexport function ValidationProvider({ children }: ValidationProviderProps): ReactElement {\n const [datasourceEditorSchema, setDatasourceEditorSchema] =\n useState<z.Schema<DatasourceDefinition>>(datasourceDefinitionSchema);\n const [panelEditorSchema, setPanelEditorSchema] = useState<z.Schema<PanelEditorValues>>(defaultPanelEditorSchema);\n const [variableEditorSchema, setVariableEditorSchema] =\n useState<z.Schema<VariableDefinition>>(variableDefinitionSchema);\n\n function setDatasourceEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setDatasourceEditorSchema(buildDatasourceDefinitionSchema(pluginSchema));\n }\n\n function setPanelEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setPanelEditorSchema(buildPanelEditorSchema(pluginSchema));\n }\n\n function setVariableEditorSchemaPlugin(pluginSchema: PluginSchema): void {\n setVariableEditorSchema(buildVariableDefinitionSchema(pluginSchema));\n }\n\n return (\n <ValidationSchemasContext.Provider\n value={{\n datasourceEditorSchema,\n panelEditorSchema,\n variableEditorSchema,\n setDatasourceEditorSchemaPlugin,\n setPanelEditorSchemaPlugin,\n setVariableEditorSchemaPlugin,\n }}\n >\n {children}\n </ValidationSchemasContext.Provider>\n );\n}\n"],"names":["createContext","useContext","useState","datasourceDefinitionSchema","panelEditorSchema","defaultPanelEditorSchema","variableDefinitionSchema","buildDatasourceDefinitionSchema","buildPanelEditorSchema","buildVariableDefinitionSchema","ValidationSchemasContext","undefined","useValidationSchemas","ctx","Error","ValidationProvider","children","datasourceEditorSchema","setDatasourceEditorSchema","setPanelEditorSchema","variableEditorSchema","setVariableEditorSchema","setDatasourceEditorSchemaPlugin","pluginSchema","setPanelEditorSchemaPlugin","setVariableEditorSchemaPlugin","Provider","value"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,aAAa,EAA2BC,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AACrF,SAKEC,0BAA0B,EAC1BC,qBAAqBC,wBAAwB,EAC7CC,wBAAwB,EACxBC,+BAA+B,EAC/BC,sBAAsB,EACtBC,6BAA6B,QACxB,mBAAmB;AAY1B,OAAO,MAAMC,yCAA2BV,cAA6CW,WAAW;AAEhG,OAAO,SAASC;IACd,MAAMC,MAAMZ,WAAWS;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAMA;;CAEC,GACD,OAAO,SAASE,mBAAmB,EAAEC,QAAQ,EAA2B;IACtE,MAAM,CAACC,wBAAwBC,0BAA0B,GACvDhB,SAAyCC;IAC3C,MAAM,CAACC,mBAAmBe,qBAAqB,GAAGjB,SAAsCG;IACxF,MAAM,CAACe,sBAAsBC,wBAAwB,GACnDnB,SAAuCI;IAEzC,SAASgB,gCAAgCC,YAA0B;QACjEL,0BAA0BX,gCAAgCgB;IAC5D;IAEA,SAASC,2BAA2BD,YAA0B;QAC5DJ,qBAAqBX,uBAAuBe;IAC9C;IAEA,SAASE,8BAA8BF,YAA0B;QAC/DF,wBAAwBZ,8BAA8Bc;IACxD;IAEA,qBACE,KAACb,yBAAyBgB,QAAQ;QAChCC,OAAO;YACLV;YACAb;YACAgB;YACAE;YACAE;YACAC;QACF;kBAECT;;AAGP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/context/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './ProjectStoreProvider';\nexport * from './ValidationProvider';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,yBAAyB;AACvC,cAAc,uBAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/context/query-params.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useCallback, useState } from 'react';\nimport { useQueryParams } from 'use-query-params';\n\nexport function useSetProjectParams(enabledURLParams = true): {\n project: string;\n setProject: (project: string) => void;\n} {\n const [query, setQuery] = useQueryParams({ project: '' }, { updateType: 'replaceIn' });\n\n const [projectState, setProjectState] = useState<string>('none');\n\n const setProject = useCallback(\n (project: string) => {\n return setQuery({ project });\n },\n [setQuery]\n );\n\n if (enabledURLParams) {\n return {\n project: query.project || 'none',\n setProject,\n };\n }\n\n return {\n project: projectState,\n setProject: setProjectState,\n };\n}\n"],"names":["useCallback","useState","useQueryParams","useSetProjectParams","enabledURLParams","query","setQuery","project","updateType","projectState","setProjectState","setProject"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAC9C,SAASC,cAAc,QAAQ,mBAAmB;AAElD,OAAO,SAASC,oBAAoBC,mBAAmB,IAAI;IAIzD,MAAM,CAACC,OAAOC,SAAS,GAAGJ,eAAe;QAAEK,SAAS;IAAG,GAAG;QAAEC,YAAY;IAAY;IAEpF,MAAM,CAACC,cAAcC,gBAAgB,GAAGT,SAAiB;IAEzD,MAAMU,aAAaX,YACjB,CAACO;QACC,OAAOD,SAAS;YAAEC;QAAQ;IAC5B,GACA;QAACD;KAAS;IAGZ,IAAIF,kBAAkB;QACpB,OAAO;YACLG,SAASF,MAAME,OAAO,IAAI;YAC1BI;QACF;IACF;IAEA,OAAO;QACLJ,SAASE;QACTE,YAAYD;IACd;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './components';\nexport * from './constants';\nexport * from './model';\nexport * from './runtime';\nexport * from './test-utils';\nexport * from './utils';\nexport * from './context';\nexport * from './remote';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe;AAC7B,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,YAAY;AAC1B,cAAc,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/datasource.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { BuiltinVariableDefinition, UnknownSpec } from '@perses-dev/core';\nimport { Plugin } from './plugin-base';\n\n/**\n * Plugin that defines options for an external system that Perses talks to for data.\n */\nexport interface DatasourcePlugin<Spec = UnknownSpec, Client = unknown> extends Plugin<Spec> {\n createClient: (spec: Spec, options: DatasourceClientOptions) => Client;\n // Provide builtin variable definitions available on the datasource. Optional\n getBuiltinVariableDefinitions?: () => BuiltinVariableDefinition[];\n}\n\nexport interface DatasourceClientOptions {\n proxyUrl?: string;\n}\n\n/**\n * Common properties for all clients\n */\nexport interface DatasourceClient {\n // TODO: set kind and define healthCheck function\n kind?: string;\n healthCheck?: () => Promise<boolean>;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAkBjC;;CAEC,GACD,WAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/explore.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/core';\nimport { Plugin } from './plugin-base';\n\nexport interface ExploreComponentProps<Spec> {\n spec: Spec;\n}\n\n/**\n * Plugin that defines options for an external system that Perses talks to for data.\n */\nexport interface ExplorePlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n ExploreComponent: React.ComponentType<ExploreComponentProps<Spec>>;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AASjC;;CAEC,GACD,WAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './datasource';\nexport * from './legend';\nexport * from './panels';\nexport * from './plugins';\nexport * from './plugin-base';\nexport * from './plugin-loading';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './profile-queries';\nexport * from './variables';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,eAAe;AAC7B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,cAAc"}
|
|
@@ -28,6 +28,16 @@ export const legendValues = [
|
|
|
28
28
|
'max',
|
|
29
29
|
'sum'
|
|
30
30
|
];
|
|
31
|
+
export const comparisonLegends = {
|
|
32
|
+
abs: {
|
|
33
|
+
label: 'Absolute',
|
|
34
|
+
description: 'Absolute value'
|
|
35
|
+
},
|
|
36
|
+
relative: {
|
|
37
|
+
label: 'Relative',
|
|
38
|
+
description: 'Relative value'
|
|
39
|
+
}
|
|
40
|
+
};
|
|
31
41
|
export const LEGEND_POSITIONS_CONFIG = {
|
|
32
42
|
bottom: {
|
|
33
43
|
label: 'Bottom'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/legend.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n CALCULATIONS_CONFIG,\n CalculationType,\n LegendMode,\n LegendOptionsBase,\n LegendPositions,\n isValidLegendMode,\n isValidLegendPosition,\n LegendSize,\n isValidLegendSize,\n} from '@perses-dev/core';\n\n// This file contains legend-related model code specific to panel plugin specs.\n// See the `core` package for common/shared legend model code and the\n// `components` package for legend model code specific to the Legend component.\n\n// Explicity listing the calculations we intend to use for legend values because\n// we want them ordered in a specific way, and it may be possible in the future\n// that we only use a subset of calculations for the legend because the calculations\n// are also used by other features.\nexport const legendValues: CalculationType[] = [\n 'mean',\n 'first',\n 'first-number',\n 'last',\n 'last-number',\n 'min',\n 'max',\n 'sum',\n];\nexport type LegendValue = (typeof legendValues)[number];\n\nexport type ComparisonValues = 'abs' | 'relative';\n\nexport const comparisonLegends: Record<ComparisonValues, LegendSingleSelectConfig> = {\n abs: { label: 'Absolute', description: 'Absolute value' },\n relative: { label: 'Relative', description: 'Relative value' },\n};\n\n// Note: explicitly defining different options for the legend spec and\n// legend component that extend from some common options, so we can allow the\n// component and the spec to diverge in some upcoming work.\nexport interface LegendSpecOptions extends LegendOptionsBase {\n values?: Array<LegendValue | ComparisonValues>;\n}\n\nexport type LegendSingleSelectConfig = {\n label: string;\n description?: string;\n};\n\nexport const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendSingleSelectConfig>> = {\n bottom: { label: 'Bottom' },\n right: { label: 'Right' },\n};\n\nexport const LEGEND_MODE_CONFIG: Readonly<Record<LegendMode, LegendSingleSelectConfig>> = {\n list: { label: 'List' },\n table: { label: 'Table' },\n};\n\nexport const LEGEND_SIZE_CONFIG: Readonly<Record<LegendSize, LegendSingleSelectConfig>> = {\n small: { label: 'Small' },\n medium: { label: 'Medium' },\n};\n\nexport const LEGEND_VALUE_CONFIG = legendValues.reduce(\n (config, value) => {\n config[value] = CALCULATIONS_CONFIG[value];\n\n return config;\n },\n {} as Partial<Record<LegendValue, LegendSingleSelectConfig>>\n);\n\nexport function validateLegendSpec(legend?: LegendOptionsBase): boolean {\n if (legend === undefined) {\n // undefined is valid since this is how legend is hidden by default\n return true;\n }\n if (!isValidLegendPosition(legend.position)) {\n return false;\n }\n if (legend.mode && !isValidLegendMode(legend.mode)) {\n return false;\n }\n if (legend.size && !isValidLegendSize(legend.size)) {\n return false;\n }\n\n return true;\n}\n"],"names":["CALCULATIONS_CONFIG","isValidLegendMode","isValidLegendPosition","isValidLegendSize","legendValues","comparisonLegends","abs","label","description","relative","LEGEND_POSITIONS_CONFIG","bottom","right","LEGEND_MODE_CONFIG","list","table","LEGEND_SIZE_CONFIG","small","medium","LEGEND_VALUE_CONFIG","reduce","config","value","validateLegendSpec","legend","undefined","position","mode","size"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,i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ACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/panels.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport { UnknownSpec, PanelDefinition, QueryPluginType, QueryDataType, QueryDefinition } from '@perses-dev/core';\nimport { OptionsEditorTab } from '../components';\nimport { QueryOptions } from '../runtime';\nimport { OptionsEditorProps, Plugin } from './plugin-base';\n\nexport type PanelOptionsEditorComponent<T> = Pick<OptionsEditorTab, 'label'> & {\n content: React.ComponentType<OptionsEditorProps<T>>;\n};\n\nexport type PanelAction<TPanelProps> = {\n component: React.ComponentType<TPanelProps>;\n location?: string; // 'header' or other available locations\n};\n\n/**\n * Plugin the provides custom visualizations inside a Panel.\n */\nexport interface PanelPlugin<Spec = UnknownSpec, TPanelProps = PanelProps<Spec>> extends Plugin<Spec> {\n PanelComponent: React.ComponentType<TPanelProps>;\n /**\n * React components for custom tabs\n */\n panelOptionsEditorComponents?: Array<PanelOptionsEditorComponent<Spec>>;\n /**\n * Show a custom React component when the query is loading.\n * Default: <LoadingOverlay />\n */\n LoadingComponent?: React.ComponentType<TPanelProps>;\n /**\n * List of query types supported by this panel.\n * @default [] (no query types supported) only relevant if hideQueryEditor is true\n */\n supportedQueryTypes?: QueryPluginType[];\n /**\n * Static options for the queries that will be executed.\n * Each {@link QueryPluginType} implementation can have its own options.\n * For example see {@link UseTimeSeriesQueryOptions} for time series queries.\n */\n queryOptions?: QueryOptions | ((spec: Spec) => QueryOptions);\n /**\n * If true, query editor will be hidden for panel plugin\n * @default false\n */\n hideQueryEditor?: boolean;\n /**\n * List of panel actions that will be rendered in the panel header\n */\n actions?: Array<PanelAction<TPanelProps>>;\n}\n\n/**\n * The props provided by Perses to a panel plugin's PanelComponent.\n */\nexport interface PanelProps<Spec, SupportedQueryTypes = QueryDataType> {\n spec: Spec;\n contentDimensions?: {\n width: number;\n height: number;\n };\n definition?: PanelDefinition;\n queryResults: Array<PanelData<SupportedQueryTypes>>;\n}\n\nexport interface PanelData<SupportedQueryTypes = QueryDataType> {\n definition: QueryDefinition;\n data: SupportedQueryTypes;\n}\n"],"names":["React"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAOA,WAAW,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/plugin-base.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { QueryDefinition } from '@perses-dev/core';\nimport React from 'react';\n\n/**\n * Base type of all plugin implementations.\n */\nexport interface Plugin<Spec> {\n /**\n * React component for editing the plugin's options in the UI.\n */\n OptionsEditorComponent?: React.ComponentType<OptionsEditorProps<Spec>>;\n\n /**\n * Callback for creating the initial options for the plugin.\n */\n createInitialOptions: () => Spec;\n}\n\n/**\n * Common props passed to options editor components.\n */\nexport interface OptionsEditorProps<Spec> {\n // TODO: These are temporary and may not actually make sense, so replace\n // with whatever makes sense as visual editing evolves\n value: Spec;\n onChange: (next: Spec) => void;\n isReadonly?: boolean;\n}\n\n/**\n * Common props passed to query editor component\n */\nexport interface QueryEditorProps<Spec> extends OptionsEditorProps<Spec> {\n queries: QueryDefinition[];\n}\n"],"names":["React"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,OAAOA,WAAW,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/plugin-loading.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PluginModuleResource } from './plugins';\n\n/**\n * A component capable of loading the resource/metadata for all available plugins, then loading individual plugins for\n * those resources on-demand.\n */\nexport interface PluginLoader {\n getInstalledPlugins: () => Promise<PluginModuleResource[]>;\n importPluginModule: (resource: PluginModuleResource) => Promise<unknown>;\n}\n\n/**\n * The dynamic import for a single plugin resource.\n */\nexport interface DynamicImportPlugin {\n resource: PluginModuleResource;\n importPlugin(): Promise<unknown>;\n}\n\n/**\n * A PluginLoader for the common pattern in Perses where we eagerly import a plugin's resource file, and then lazy load\n * the plugin itself via a dynamic `import()` statement.\n */\nexport function dynamicImportPluginLoader(plugins: DynamicImportPlugin[]): PluginLoader {\n const importMap: Map<PluginModuleResource, DynamicImportPlugin['importPlugin']> = new Map(\n plugins.map((plugin) => [plugin.resource, plugin.importPlugin])\n );\n\n return {\n async getInstalledPlugins(): Promise<PluginModuleResource[]> {\n return Promise.resolve(Array.from(importMap.keys()));\n },\n importPluginModule(resource): Promise<unknown> {\n const importFn = importMap.get(resource);\n if (importFn === undefined) {\n throw new Error('Plugin not found');\n }\n return importFn();\n },\n };\n}\n"],"names":["dynamicImportPluginLoader","plugins","importMap","Map","map","plugin","resource","importPlugin","getInstalledPlugins","Promise","resolve","Array","from","keys","importPluginModule","importFn","get","undefined","Error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAqBjC;;;CAGC,GACD,OAAO,SAASA,0BAA0BC,OAA8B;IACtE,MAAMC,YAA4E,IAAIC,IACpFF,QAAQG,GAAG,CAAC,CAACC,SAAW;YAACA,OAAOC,QAAQ;YAAED,OAAOE,YAAY;SAAC;IAGhE,OAAO;QACL,MAAMC;YACJ,OAAOC,QAAQC,OAAO,CAACC,MAAMC,IAAI,CAACV,UAAUW,IAAI;QAClD;QACAC,oBAAmBR,QAAQ;YACzB,MAAMS,WAAWb,UAAUc,GAAG,CAACV;YAC/B,IAAIS,aAAaE,WAAW;gBAC1B,MAAM,IAAIC,MAAM;YAClB;YACA,OAAOH;QACT;IACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/plugins.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec } from '@perses-dev/core';\nimport { DatasourcePlugin } from './datasource';\nimport { PanelPlugin } from './panels';\nimport { Plugin } from './plugin-base';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { TraceQueryPlugin } from './trace-queries';\nimport { ProfileQueryPlugin } from './profile-queries';\nimport { VariablePlugin } from './variables';\nimport { ExplorePlugin } from './explore';\n\nexport interface PluginModuleSpec {\n plugins: PluginMetadata[];\n}\n\nexport interface PluginMetadataWithModule extends PluginMetadata {\n module: PluginModuleMetadata;\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n kind: PluginType;\n spec: {\n name: string;\n display: {\n name: string;\n description?: string;\n };\n };\n}\n\n/**\n * Metadata about a module/package that contains plugins.\n */\nexport interface PluginModuleMetadata {\n name: string;\n version: string;\n}\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: PluginModuleMetadata;\n spec: PluginModuleSpec;\n}\n\n/**\n * All supported plugin types. A plugin's implementation must extend from `Plugin<UnknownSpec>` to be considered a valid\n * `PluginType`.\n */\nexport type PluginType = {\n // Filter out implementations on SupportedPlugins that don't extend `Plugin<UnknownSpec>`\n [K in keyof SupportedPlugins]: SupportedPlugins[K] extends Plugin<UnknownSpec> ? K : never;\n}[keyof SupportedPlugins];\n\n/**\n * Map of plugin type key/string -> implementation type. Use Typescript module augmentation to extend the plugin system\n * with new plugin types.\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n TraceQuery: TraceQueryPlugin;\n ProfileQuery: ProfileQueryPlugin;\n Datasource: DatasourcePlugin;\n Explore: ExplorePlugin;\n}\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n\n/**\n * Default plugin kinds by plugin type.\n */\ntype PluginKinds = Partial<Record<PluginType, string>>;\nexport type DefaultPluginKinds = Required<Pick<PluginKinds, 'TimeSeriesQuery'>> & Omit<PluginKinds, 'TimeSeriesQuery'>;\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAmFjC,WAAuH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/profile-queries.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Query, QueryKey } from '@tanstack/react-query';\nimport { UnknownSpec, ProfileData, AbsoluteTimeRange } from '@perses-dev/core';\nimport { DatasourceStore } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * A plugin for running profile queries.\n */\nexport interface ProfileQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getProfileData: (spec: Spec, ctx: ProfileQueryContext) => Promise<ProfileData>;\n}\n\n/**\n * Context available to ProfileQuery plugins at runtime.\n */\nexport interface ProfileQueryContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange?: AbsoluteTimeRange;\n}\n\nexport type ProfileDataQuery = Query<ProfileData, unknown, ProfileData, QueryKey>;\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAsBjC,WAAkF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/time-series-queries.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Query, QueryKey } from '@tanstack/react-query';\nimport { AbsoluteTimeRange, UnknownSpec, TimeSeriesData } from '@perses-dev/core';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a TimeSeriesQuery.\n */\ntype TimeSeriesQueryPluginDependencies = {\n /**\n * Returns a list of variables name this time series query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running time series queries.\n */\nexport interface TimeSeriesQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext) => Promise<TimeSeriesData>;\n\n dependsOn?: (spec: Spec, ctx: TimeSeriesQueryContext) => TimeSeriesQueryPluginDependencies;\n}\n\nexport type TimeSeriesQueryMode = 'instant' | 'range';\n\n/**\n * Context available to TimeSeriesQuery plugins at runtime.\n */\nexport interface TimeSeriesQueryContext {\n suggestedStepMs?: number;\n mode?: TimeSeriesQueryMode;\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n refreshKey: string;\n}\n\nexport type TimeSeriesDataQuery = Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>;\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAwCjC,WAA2F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/trace-queries.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Query, QueryKey } from '@tanstack/react-query';\nimport { UnknownSpec, TraceData, AbsoluteTimeRange } from '@perses-dev/core';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\nimport { Plugin } from './plugin-base';\n\n/**\n * An object containing all the dependencies of a TraceQuery.\n */\ntype TraceQueryQueryPluginDependencies = {\n /**\n * Returns a list of variables name this trace query depends on.\n */\n variables?: string[];\n};\n\n/**\n * A plugin for running trace queries.\n */\nexport interface TraceQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getTraceData: (spec: Spec, ctx: TraceQueryContext) => Promise<TraceData>;\n dependsOn?: (spec: Spec, ctx: TraceQueryContext) => TraceQueryQueryPluginDependencies;\n}\n\n/**\n * Context available to TraceQuery plugins at runtime.\n */\nexport interface TraceQueryContext {\n datasourceStore: DatasourceStore;\n absoluteTimeRange?: AbsoluteTimeRange;\n variableState: VariableStateMap;\n}\n\nexport type TraceDataQuery = Query<TraceData, unknown, TraceData, QueryKey>;\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAkCjC,WAA4E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/variables.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { UnknownSpec, AbsoluteTimeRange } from '@perses-dev/core';\nimport { VariableStateMap, DatasourceStore } from '../runtime';\nimport { Plugin } from './plugin-base';\n\nexport type VariableOption = { label: string; value: string };\n\nexport interface GetVariableOptionsContext {\n variables: VariableStateMap;\n datasourceStore: DatasourceStore;\n timeRange: AbsoluteTimeRange;\n}\n\n/**\n * An object containing all the dependencies of a VariablePlugin.\n */\ntype VariablePluginDependencies = {\n /**\n * Returns a list of variables name this time series query depends on.\n */\n variables?: string[];\n};\n\n/**\n * Plugin for handling custom VariableDefinitions.\n */\nexport interface VariablePlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getVariableOptions: (definition: Spec, ctx: GetVariableOptionsContext) => Promise<{ data: VariableOption[] }>;\n\n /**\n * Returns a list of variables name this variable depends on. Used to optimize fetching\n */\n dependsOn?: (definition: Spec, ctx: GetVariableOptionsContext) => VariablePluginDependencies;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAwBjC;;CAEC,GACD,WAOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/remote/PersesPlugin.types.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport interface PersesPlugin {\n name: string;\n moduleName: string;\n baseURL?: string;\n}\n\nexport type RemotePluginModule = Record<string, unknown>;\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAQjC,WAAyD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/remote/PluginLoaderComponent.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\n// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useEffect, useRef, useState } from 'react';\nimport { PersesPlugin, RemotePluginModule } from './PersesPlugin.types';\nimport { usePluginRuntime } from './PluginRuntime';\n\ninterface PluginLoaderProps<P> {\n plugin: PersesPlugin;\n props?: P;\n field?: string;\n}\n\nfunction PluginContainer<P>({\n pluginFn,\n props,\n}: {\n pluginFn: (props: P | undefined) => JSX.Element;\n props: P | undefined;\n}): JSX.Element {\n return pluginFn(props);\n}\n\nexport function PluginLoaderComponent<P>({ plugin, props, field }: PluginLoaderProps<P>): JSX.Element | null {\n const { loadPlugin } = usePluginRuntime({ plugin });\n const [pluginModule, setPluginModule] = useState<RemotePluginModule | null>(null);\n const [error, setError] = useState<Error | null>(null);\n\n const name = `${plugin.moduleName}-${plugin.name}`;\n const previousPluginName = useRef<string>(name);\n\n useEffect(() => {\n previousPluginName.current = name;\n setError(null);\n\n loadPlugin()\n .then((module) => {\n setPluginModule(module);\n })\n .catch((error) => {\n setPluginModule(null);\n console.error(\n `PluginLoaderComponent: Error loading plugin ${plugin.name} from module ${plugin.moduleName}:`,\n error\n );\n setError(\n new Error(`PluginLoaderComponent: Error loading plugin ${plugin.name} from module ${plugin.moduleName}`)\n );\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [name]);\n\n if (error) {\n throw error;\n }\n\n if (!pluginModule) {\n return null;\n }\n\n let pluginFunction = pluginModule[plugin.name];\n\n if (field && pluginFunction && typeof pluginFunction === 'object' && field in pluginFunction) {\n pluginFunction = (pluginFunction as Record<string, unknown>)[field];\n }\n\n if (!pluginFunction) {\n throw new Error(`PluginLoaderComponent: Plugin module ${plugin.moduleName} does not have a ${plugin.name} export`);\n }\n\n if (typeof pluginFunction !== 'function') {\n throw new Error(`PluginLoaderComponent: Plugin ${plugin.name} export is not a function`);\n }\n\n // make sure to re mount the plugin when changes, to avoid mismatch in hooks ordering when re rendering\n if (previousPluginName.current !== name) {\n return null;\n }\n\n return (\n <PluginContainer key={name} pluginFn={pluginFunction as (props: P | undefined) => JSX.Element} props={props} />\n );\n}\n"],"names":["useEffect","useRef","useState","usePluginRuntime","PluginContainer","pluginFn","props","PluginLoaderComponent","plugin","field","loadPlugin","pluginModule","setPluginModule","error","setError","name","moduleName","previousPluginName","current","then","module","catch","console","Error","pluginFunction"],"mappings":"AAAA,oDAAoD,GACpD,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1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AgB;QAC5FA,iBAAiB,AAACA,cAA0C,CAACf,MAAM;IACrE;IAEA,IAAI,CAACe,gBAAgB;QACnB,MAAM,IAAID,MAAM,CAAC,qCAAqC,EAAEf,OAAOQ,UAAU,CAAC,iBAAiB,EAAER,OAAOO,IAAI,CAAC,OAAO,CAAC;IACnH;IAEA,IAAI,OAAOS,mBAAmB,YAAY;QACxC,MAAM,IAAID,MAAM,CAAC,8BAA8B,EAAEf,OAAOO,IAAI,CAAC,yBAAyB,CAAC;IACzF;IAEA,uGAAuG;IACvG,IAAIE,mBAAmBC,OAAO,KAAKH,MAAM;QACvC,OAAO;IACT;IAEA,qBACE,KAACX;QAA2BC,UAAUmB;QAAyDlB,OAAOA;OAAhFS;AAE1B"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import {
|
|
13
|
+
import { createInstance } from '@module-federation/enhanced/runtime';
|
|
14
14
|
import * as ReactQuery from '@tanstack/react-query';
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import ReactDOM from 'react-dom';
|
|
@@ -19,7 +19,7 @@ import * as ReactRouterDOM from 'react-router-dom';
|
|
|
19
19
|
let instance = null;
|
|
20
20
|
const getPluginRuntime = ()=>{
|
|
21
21
|
if (instance === null) {
|
|
22
|
-
const pluginRuntime =
|
|
22
|
+
const pluginRuntime = createInstance({
|
|
23
23
|
name: '@perses/perses-ui-host',
|
|
24
24
|
remotes: [],
|
|
25
25
|
shared: {
|
|
@@ -207,7 +207,8 @@ const registerRemote = (name, baseURL)=>{
|
|
|
207
207
|
};
|
|
208
208
|
export const loadPlugin = async (moduleName, pluginName, baseURL)=>{
|
|
209
209
|
registerRemote(moduleName, baseURL);
|
|
210
|
-
|
|
210
|
+
const pluginRuntime = getPluginRuntime();
|
|
211
|
+
return pluginRuntime.loadRemote(`${moduleName}/${pluginName}`);
|
|
211
212
|
};
|
|
212
213
|
export function usePluginRuntime({ plugin }) {
|
|
213
214
|
return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/remote/PluginRuntime.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-require-imports */\n// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createInstance, ModuleFederation } from '@module-federation/enhanced/runtime';\n\nimport * as ReactQuery from '@tanstack/react-query';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport * as ReactHookForm from 'react-hook-form';\nimport * as ReactRouterDOM from 'react-router-dom';\nimport { PersesPlugin, RemotePluginModule } from './PersesPlugin.types';\n\nlet instance: ModuleFederation | null = null;\n\nconst getPluginRuntime = (): ModuleFederation => {\n if (instance === null) {\n const pluginRuntime = createInstance({\n name: '@perses/perses-ui-host',\n remotes: [], // all remotes are loaded dynamically\n shared: {\n react: {\n version: React.version,\n lib: () => React,\n shareConfig: {\n singleton: true,\n requiredVersion: `^${React.version}`,\n },\n },\n 'react-dom': {\n version: '18.3.1',\n lib: () => ReactDOM,\n shareConfig: {\n singleton: true,\n requiredVersion: `^18.3.1`,\n },\n },\n 'react-router-dom': {\n version: '6.26.0',\n lib: () => ReactRouterDOM,\n shareConfig: {\n singleton: true,\n requiredVersion: '^6.26.0',\n },\n },\n '@tanstack/react-query': {\n version: '4.39.1',\n lib: () => ReactQuery,\n shareConfig: {\n singleton: true,\n requiredVersion: '^4.39.1',\n },\n },\n 'react-hook-form': {\n version: '7.52.2',\n lib: () => ReactHookForm,\n shareConfig: {\n singleton: true,\n requiredVersion: '^7.52.2',\n },\n },\n echarts: {\n version: '5.5.0',\n lib: () => require('echarts'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^5.5.0',\n },\n },\n '@perses-dev/core': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/core'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n '@perses-dev/components': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/components'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n '@perses-dev/plugin-system': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/plugin-system'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n '@perses-dev/explore': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/explore'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n '@perses-dev/dashboards': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/dashboards'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n // Below are the shared modules that are used by the plugins, this can be part of the SDK\n 'date-fns': {\n version: '4.1.0',\n lib: () => require('date-fns'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^4.1.0',\n },\n },\n 'date-fns-tz': {\n version: '3.2.0',\n lib: () => require('date-fns-tz'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^3.2.0',\n },\n },\n lodash: {\n version: '4.17.21',\n lib: () => require('lodash'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^4.17.21',\n },\n },\n '@emotion/react': {\n version: '11.11.3',\n lib: () => require('@emotion/react'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^11.11.3',\n },\n },\n '@emotion/styled': {\n version: '11.11.0',\n lib: () => require('@emotion/styled'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^11.11.0',\n },\n },\n '@hookform/resolvers/zod': {\n version: '3.3.4',\n lib: () => require('@hookform/resolvers/zod'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^3.3.4',\n },\n },\n 'use-resize-observer': {\n version: '9.1.0',\n lib: () => require('use-resize-observer'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^9.1.0',\n },\n },\n 'mdi-material-ui': {\n version: '7.4.0',\n lib: () => require('mdi-material-ui'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^7.4.0',\n },\n },\n immer: {\n version: '10.1.1',\n lib: () => require('immer'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^10.1.1',\n },\n },\n },\n });\n\n instance = pluginRuntime;\n\n return instance;\n }\n return instance;\n};\n\nconst registerRemote = (name: string, baseURL?: string): void => {\n const pluginRuntime = getPluginRuntime();\n const existingRemote = pluginRuntime.options.remotes.find((remote) => remote.name === name);\n if (!existingRemote) {\n const remoteEntryURL = baseURL ? `${baseURL}/${name}/mf-manifest.json` : `/plugins/${name}/mf-manifest.json`;\n pluginRuntime.registerRemotes([\n {\n name,\n entry: remoteEntryURL,\n alias: name,\n },\n ]);\n }\n};\n\nexport const loadPlugin = async (\n moduleName: string,\n pluginName: string,\n baseURL?: string\n): Promise<RemotePluginModule | null> => {\n registerRemote(moduleName, baseURL);\n\n const pluginRuntime = getPluginRuntime();\n\n return pluginRuntime.loadRemote<RemotePluginModule>(`${moduleName}/${pluginName}`);\n};\n\nexport function usePluginRuntime({ plugin }: { plugin: PersesPlugin }): {\n pluginRuntime: ModuleFederation;\n loadPlugin: () => Promise<RemotePluginModule | null>;\n} {\n return {\n pluginRuntime: getPluginRuntime(),\n loadPlugin: () => loadPlugin(plugin.moduleName, plugin.name, plugin.baseURL),\n };\n}\n"],"names":["createInstance","ReactQuery","React","ReactDOM","ReactHookForm","ReactRouterDOM","instance","getPluginRuntime","pluginRuntime","name","remotes","shared","react","version","lib","shareConfig","singleton","requiredVersion","echarts","require","lodash","immer","registerRemote","baseURL","existingRemote","options","find","remote","remoteEntryURL","registerRemotes","entry","alias","loadPlugin","moduleName","pluginName","loadRemote","usePluginRuntime","plugin"],"mappings":"AAAA,wDAAwD,GACxD,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,cAAc,QAA0B,sCAAsC;AAEvF,YAAYC,gBAAgB,wBAAwB;AACpD,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,cAAc,YAAY;AACjC,YAAYC,mBAAmB,kBAAkB;AACjD,YAAYC,oBAAoB,mBAAmB;AAGnD,IAAIC,WAAoC;AAExC,MAAMC,mBAAmB;IACvB,IAAID,aAAa,MAAM;QACrB,MAAME,gBAAgBR,eAAe;YACnCS,MAAM;YACNC,SAAS,EAAE;YACXC,QAAQ;gBACNC,OAAO;oBACLC,SAASX,MAAMW,OAAO;oBACtBC,KAAK,IAAMZ;oBACXa,aAAa;wBACXC,WAAW;wBACXC,iBAAiB,CAAC,CAAC,EAAEf,MAAMW,OAAO,EAAE;oBACtC;gBACF;gBACA,aAAa;oBACXA,SAAS;oBACTC,KAAK,IAAMX;oBACXY,aAAa;wBACXC,WAAW;wBACXC,iBAAiB,CAAC,OAAO,CAAC;oBAC5B;gBACF;gBACA,oBAAoB;oBAClBJ,SAAS;oBACTC,KAAK,IAAMT;oBACXU,aAAa;wBACXC,WAAW;wBACXC,iBAAiB;oBACnB;gBACF;gBACA,yBAAyB;oBACvBJ,SAAS;oBACTC,KAAK,IAAMb;oBACXc,aAAa;wBACXC,WAAW;wBACXC,iBAAiB;oBACnB;gBACF;gBACA,mBAAmB;oBACjBJ,SAAS;oBACTC,KAAK,IAAMV;oBACXW,aAAa;wBACXC,WAAW;wBACXC,iBAAiB;oBACnB;gBACF;gBACAC,SAAS;oBACPL,SAAS;oBACTC,KAAK,IAAMK,QAAQ;oBACnBJ,aAAa;wBACXC,WAA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|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/remote/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './PluginLoaderComponent';\nexport * from './remotePluginLoader';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,0BAA0B;AACxC,cAAc,uBAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/remote/remotePluginLoader.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PluginLoader, PluginMetadata, PluginModuleResource } from '@perses-dev/plugin-system';\nimport { RemotePluginModule } from './PersesPlugin.types';\nimport { loadPlugin } from './PluginRuntime';\n\nconst isPluginMetadata = (plugin: unknown): plugin is PluginMetadata => {\n return (\n typeof plugin === 'object' &&\n plugin !== null &&\n 'kind' in plugin &&\n 'spec' in plugin &&\n typeof plugin.spec === 'object' &&\n plugin.spec !== null &&\n 'name' in plugin.spec\n );\n};\n\nconst isPluginModuleResource = (pluginModule: unknown): pluginModule is PluginModuleResource => {\n return (\n typeof pluginModule === 'object' &&\n pluginModule !== null &&\n 'metadata' in pluginModule &&\n 'spec' in pluginModule &&\n typeof pluginModule.spec === 'object' &&\n pluginModule.spec !== null &&\n 'plugins' in pluginModule.spec &&\n Array.isArray(pluginModule.spec.plugins) &&\n pluginModule.spec.plugins.every(isPluginMetadata)\n );\n};\n\nexport const remotePluginLoader = (baseURL?: string): PluginLoader => {\n return {\n getInstalledPlugins: async (): Promise<PluginModuleResource[]> => {\n const pluginsResponse = await fetch(`${baseURL ? baseURL : ''}/api/v1/plugins`);\n\n const plugins = await pluginsResponse.json();\n\n let pluginModules: PluginModuleResource[] = [];\n\n if (Array.isArray(plugins)) {\n pluginModules = plugins.filter(isPluginModuleResource);\n } else {\n console.error('RemotePluginLoader: Error loading plugins, response is not an array');\n }\n\n if (!pluginModules.length) {\n console.error('RemotePluginLoader: No valid plugins found');\n }\n\n return pluginModules;\n },\n importPluginModule: async (resource): Promise<RemotePluginModule> => {\n const pluginModuleName = resource.metadata.name;\n\n const pluginModule: RemotePluginModule = {};\n\n for (const plugin of resource.spec.plugins) {\n const remotePluginModule = await loadPlugin(pluginModuleName, plugin.spec.name);\n\n const remotePlugin = remotePluginModule?.[plugin.spec.name];\n if (remotePlugin) {\n pluginModule[plugin.spec.name] = remotePlugin;\n } else {\n console.error(`RemotePluginLoader: Error loading plugin ${plugin.spec.name}`);\n }\n }\n\n return pluginModule;\n },\n };\n};\n"],"names":["loadPlugin","isPluginMetadata","plugin","spec","isPluginModuleResource","pluginModule","Array","isArray","plugins","every","remotePluginLoader","baseURL","getInstalledPlugins","pluginsResponse","fetch","json","pluginModules","filter","console","error","length","importPluginModule","resource","pluginModuleName","metadata","name","remotePluginModule","remotePlugin"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0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,MAAM1B,WAAWuB,kBAAkBrB,OAAOC,IAAI,CAACsB,IAAI;gBAE9E,MAAME,eAAeD,oBAAoB,CAACxB,OAAOC,IAAI,CAACsB,IAAI,CAAC;gBAC3D,IAAIE,cAAc;oBAChBtB,YAAY,CAACH,OAAOC,IAAI,CAACsB,IAAI,CAAC,GAAGE;gBACnC,OAAO;oBACLT,QAAQC,KAAK,CAAC,CAAC,yCAAyC,EAAEjB,OAAOC,IAAI,CAACsB,IAAI,EAAE;gBAC9E;YACF;YAEA,OAAOpB;QACT;IACF;AACF,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtime/DataQueriesProvider/DataQueriesProvider.tsx"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createContext, ReactElement, useCallback, useContext, useMemo } from 'react';\nimport { QueryType, TimeSeriesQueryDefinition } from '@perses-dev/core';\nimport { useTimeSeriesQueries } from '../time-series-queries';\nimport { useTraceQueries, TraceQueryDefinition } from '../trace-queries';\nimport { useProfileQueries, ProfileQueryDefinition } from '../profile-queries';\n\nimport { useUsageMetrics } from '../UsageMetricsProvider';\nimport {\n DataQueriesProviderProps,\n UseDataQueryResults,\n transformQueryResults,\n DataQueriesContextType,\n QueryData,\n useQueryType,\n} from './model';\n\nexport const DataQueriesContext = createContext<DataQueriesContextType | undefined>(undefined);\n\nexport function useDataQueriesContext(): DataQueriesContextType {\n const ctx = useContext(DataQueriesContext);\n if (ctx === undefined) {\n throw new Error('No DataQueriesContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useDataQueries<T extends keyof QueryType>(queryType: T): UseDataQueryResults<QueryType[T]> {\n const ctx = useDataQueriesContext();\n\n // Filter the query results based on the specified query type\n const filteredQueryResults = ctx.queryResults.filter(\n (queryResult) => queryResult?.definition?.kind === queryType\n ) as Array<QueryData<QueryType[T]>>;\n\n // Filter the errors based on the specified query type\n const filteredErrors = ctx.errors.filter((errors, index) => ctx.queryResults[index]?.definition?.kind === queryType);\n\n // Create a new context object with the filtered results and errors\n const filteredCtx = {\n queryResults: filteredQueryResults,\n isFetching: filteredQueryResults.some((result) => result.isFetching),\n isLoading: filteredQueryResults.some((result) => result.isLoading),\n refetchAll: ctx.refetchAll,\n errors: filteredErrors,\n };\n\n return filteredCtx;\n}\n\nexport function DataQueriesProvider(props: DataQueriesProviderProps): ReactElement {\n const { definitions, options, children, queryOptions } = props;\n\n // Returns a query kind, for example \"TimeSeriesQuery\" = getQueryType(\"PrometheusTimeSeriesQuery\")\n const getQueryType = useQueryType();\n\n const queryDefinitions = definitions.map((definition) => {\n const type = getQueryType(definition.kind);\n return {\n kind: type,\n spec: {\n plugin: definition,\n },\n };\n });\n\n const usageMetrics = useUsageMetrics();\n\n // Filter definitions for time series query and other future query plugins\n const timeSeriesQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'TimeSeriesQuery'\n ) as TimeSeriesQueryDefinition[];\n const timeSeriesResults = useTimeSeriesQueries(timeSeriesQueries, options, queryOptions);\n const traceQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'TraceQuery'\n ) as TraceQueryDefinition[];\n const traceResults = useTraceQueries(traceQueries);\n const profileQueries = queryDefinitions.filter(\n (definition) => definition.kind === 'ProfileQuery'\n ) as ProfileQueryDefinition[];\n const profileResults = useProfileQueries(profileQueries);\n\n const refetchAll = useCallback(() => {\n timeSeriesResults.forEach((result) => result.refetch());\n traceResults.forEach((result) => result.refetch());\n profileResults.forEach((result) => result.refetch());\n }, [timeSeriesResults, traceResults, profileResults]);\n\n const ctx = useMemo(() => {\n const mergedQueryResults = [\n ...transformQueryResults(timeSeriesResults, timeSeriesQueries),\n ...transformQueryResults(traceResults, traceQueries),\n ...transformQueryResults(profileResults, profileQueries),\n ];\n\n if (queryOptions?.enabled) {\n for (const result of mergedQueryResults) {\n if (!result.isLoading && !result.isFetching && !result.error) {\n usageMetrics.markQuery(result.definition, 'success');\n } else if (result.error) {\n usageMetrics.markQuery(result.definition, 'error');\n } else {\n usageMetrics.markQuery(result.definition, 'pending');\n }\n }\n }\n\n return {\n queryResults: mergedQueryResults,\n isFetching: mergedQueryResults.some((result) => result.isFetching),\n isLoading: mergedQueryResults.some((result) => result.isLoading),\n refetchAll,\n errors: mergedQueryResults.map((result) => result.error),\n };\n }, [\n timeSeriesQueries,\n timeSeriesResults,\n traceQueries,\n traceResults,\n profileQueries,\n profileResults,\n refetchAll,\n queryOptions?.enabled,\n usageMetrics,\n ]);\n\n return <DataQueriesContext.Provider value={ctx}>{children}</DataQueriesContext.Provider>;\n}\n"],"names":["createContext","useCallback","useContext","useMemo","useTimeSeriesQueries","useTraceQueries","useProfileQueries","useUsageMetrics","transformQueryResults","useQueryType","DataQueriesContext","undefined","useDataQueriesContext","ctx","Error","useDataQueries","queryType","filteredQueryResults","queryResults","filter","queryResult","definition","kind","filteredErrors","errors","index","filteredCtx","isFetching","some","result","isLoading","refetchAll","DataQueriesProvider","props","definitions","options","children","queryOptions","getQueryType","queryDefinitions","map","type","spec","plugin","usageMetrics","timeSeriesQueries","timeSeriesResults","traceQueries","traceResults","profileQueries","profileResults","forEach","refetch","mergedQueryResults","enabled","error","markQuery","Provider","value"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,aAAa,EAAgBC,WAAW,EAAEC,UAAU,EAAEC,OAAO,QAAQ,QAAQ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,UAAU;YACjEG,WAAWuB,mBAAmBzB,IAAI,CAAC,CAACC,SAAWA,OAAOC,SAAS;YAC/DC;YACAP,QAAQ6B,mBAAmBb,GAAG,CAAC,CAACX,SAAWA,OAAO0B,KAAK;QACzD;IACF,GAAG;QACDV;QACAC;QACAC;QACAC;QACAC;QACAC;QACAnB;QACAM,cAAciB;QACdV;KACD;IAED,qBAAO,KAAClC,mBAAmB+C,QAAQ;QAACC,OAAO7C;kBAAMuB;;AACnD"}
|
package/dist/{components/LegendOptionsEditor → src/runtime/DataQueriesProvider}/index.js.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtime/DataQueriesProvider/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DataQueriesProvider';\nexport * from './model';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,wBAAwB;AACtC,cAAc,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtime/DataQueriesProvider/model.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Definition, QueryDefinition, UnknownSpec, QueryDataType } from '@perses-dev/core';\nimport { QueryObserverOptions, UseQueryResult } from '@tanstack/react-query';\nimport { ReactNode, useCallback, useMemo } from 'react';\nimport { useListPluginMetadata } from '../plugin-registry';\n\nexport type QueryOptions = Record<string, unknown>;\nexport interface DataQueriesProviderProps<QueryPluginSpec = UnknownSpec> {\n definitions: Array<Definition<QueryPluginSpec>>;\n children?: ReactNode;\n options?: QueryOptions;\n queryOptions?: Omit<QueryObserverOptions, 'queryKey'>;\n}\n\nexport interface DataQueriesContextType {\n queryResults: QueryData[];\n refetchAll: () => void;\n isFetching: boolean;\n isLoading: boolean;\n errors: unknown[];\n}\n\nexport interface UseDataQueryResults<T> extends Omit<DataQueriesContextType, 'queryResults'> {\n queryResults: Array<QueryData<T>>;\n}\n\nexport type QueryData<T = QueryDataType> = {\n data?: T;\n definition: QueryDefinition;\n error: unknown;\n isFetching: boolean;\n isLoading: boolean;\n refetch?: () => void;\n};\n\nexport function transformQueryResults(results: UseQueryResult[], definitions: QueryDefinition[]): QueryData[] {\n return results.map(({ data, isFetching, isLoading, refetch, error }, i) => {\n return {\n definition: definitions[i],\n data,\n isFetching,\n isLoading,\n refetch,\n error,\n } as QueryData;\n });\n}\n\nexport function useQueryType(): (pluginKind: string) => string | undefined {\n const { data: timeSeriesQueryPlugins, isLoading: isTimeSeriesQueryLoading } = useListPluginMetadata([\n 'TimeSeriesQuery',\n ]);\n const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = useListPluginMetadata(['TraceQuery']);\n const { data: profileQueryPlugins, isLoading: isProfileQueryPluginLoading } = useListPluginMetadata(['ProfileQuery']);\n\n // For example, `map: {\"TimeSeriesQuery\":[\"PrometheusTimeSeriesQuery\"],\"TraceQuery\":[\"TempoTraceQuery\"]}`\n const queryTypeMap = useMemo(() => {\n const map: Record<string, string[]> = {\n TimeSeriesQuery: [],\n TraceQuery: [],\n ProfileQuery: [],\n };\n\n if (timeSeriesQueryPlugins) {\n timeSeriesQueryPlugins.forEach((plugin) => {\n map[plugin.kind]?.push(plugin.spec.name);\n });\n }\n\n if (traceQueryPlugins) {\n traceQueryPlugins.forEach((plugin) => {\n map[plugin.kind]?.push(plugin.spec.name);\n });\n }\n\n if (profileQueryPlugins) {\n profileQueryPlugins.forEach((plugin) => {\n map[plugin.kind]?.push(plugin.spec.name);\n });\n }\n return map;\n }, [timeSeriesQueryPlugins, traceQueryPlugins, profileQueryPlugins]);\n\n const getQueryType = useCallback(\n (pluginKind: string) => {\n const isLoading = (pluginKind: string): boolean => {\n switch (pluginKind) {\n case 'PrometheusTimeSeriesQuery':\n return isTimeSeriesQueryLoading;\n case 'TempoTraceQuery':\n return isTraceQueryPluginLoading;\n case 'PyroscopeProfileQuery':\n return isProfileQueryPluginLoading;\n }\n\n return isTraceQueryPluginLoading || isTimeSeriesQueryLoading || isProfileQueryPluginLoading;\n };\n\n if (isLoading(pluginKind)) {\n return undefined;\n }\n\n for (const queryType in queryTypeMap) {\n if (queryTypeMap[queryType]?.includes(pluginKind)) {\n return queryType;\n }\n }\n\n throw new Error(`Unable to determine the query type: ${pluginKind}`);\n },\n [queryTypeMap, isTimeSeriesQueryLoading, isTraceQueryPluginLoading, isProfileQueryPluginLoading]\n );\n\n return getQueryType;\n}\n"],"names":["useCallback","useMemo","useListPluginMetadata","transformQueryResults","results","definitions","map","data","isFetching","isLoading","refetch","error","i","definition","useQueryType","timeSeriesQueryPlugins","isTimeSeriesQueryLoading","traceQueryPlugins","isTraceQueryPluginLoading","profileQueryPlugins","isProfileQueryPluginLoading","queryTypeMap","TimeSeriesQuery","TraceQuery","ProfileQuery","forEach","plugin","kind","push","spec","name","getQueryType","pluginKind","undefined","queryType","includes","Error"],"mappings":"AAAA,oCAAoC;A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,IAAIX,qBAAqB;YACvBA,oBAAoBM,OAAO,CAAC,CAACC;gBAC3BpB,GAAG,CAACoB,OAAOC,IAAI,CAAC,EAAEC,KAAKF,OAAOG,IAAI,CAACC,IAAI;YACzC;QACF;QACA,OAAOxB;IACT,GAAG;QAACS;QAAwBE;QAAmBE;KAAoB;IAEnE,MAAMY,eAAe/B,YACnB,CAACgC;QACC,MAAMvB,YAAY,CAACuB;YACjB,OAAQA;gBACN,KAAK;oBACH,OAAOhB;gBACT,KAAK;oBACH,OAAOE;gBACT,KAAK;oBACH,OAAOE;YACX;YAEA,OAAOF,6BAA6BF,4BAA4BI;QAClE;QAEA,IAAIX,UAAUuB,aAAa;YACzB,OAAOC;QACT;QAEA,IAAK,MAAMC,aAAab,aAAc;YACpC,IAAIA,YAAY,CAACa,UAAU,EAAEC,SAASH,aAAa;gBACjD,OAAOE;YACT;QACF;QAEA,MAAM,IAAIE,MAAM,CAAC,oCAAoC,EAAEJ,YAAY;IACrE,GACA;QAACX;QAAcL;QAA0BE;QAA2BE;KAA4B;IAGlG,OAAOW;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/runtime/QueryCountProvider.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React, { createContext, useContext, ReactNode } from 'react';\n\ninterface QueryCountProviderProps {\n queryCount: number;\n children: ReactNode;\n}\n\nconst QueryCountContext = createContext<number>(0);\n\nexport const QueryCountProvider: React.FC<QueryCountProviderProps> = ({ queryCount, children }) => {\n return <QueryCountContext.Provider value={queryCount}>{children}</QueryCountContext.Provider>;\n};\n\nexport const useQueryCountContext = (): number => {\n return useContext(QueryCountContext);\n};\n"],"names":["React","createContext","useContext","QueryCountContext","QueryCountProvider","queryCount","children","Provider","value","useQueryCountContext"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,SAASC,aAAa,EAAEC,UAAU,QAAmB,QAAQ;AAOpE,MAAMC,kCAAoBF,cAAsB;AAEhD,OAAO,MAAMG,qBAAwD,CAAC,EAAEC,UAAU,EAAEC,QAAQ,EAAE;IAC5F,qBAAO,KAACH,kBAAkBI,QAAQ;QAACC,OAAOH;kBAAaC;;AACzD,EAAE;AAEF,OAAO,MAAMG,uBAAuB;IAClC,OAAOP,WAAWC;AACpB,EAAE"}
|