@perses-dev/prometheus-plugin 0.50.2 → 0.51.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/LICENSE +183 -183
- package/README.md +41 -0
- package/__mf/css/async/2341.dacad691.css +1 -0
- package/__mf/css/async/5263.dacad691.css +1 -0
- package/__mf/css/async/6759.dacad691.css +1 -0
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/622.f7592106.js +5 -0
- package/__mf/js/Prometheus.328aad7c.js +5 -0
- package/__mf/js/async/1465.3b5e12d5.js +1 -0
- package/__mf/js/async/1495.6c8b8071.js +1 -0
- package/__mf/js/async/1620.6376bd14.js +2 -0
- package/__mf/js/async/1620.6376bd14.js.LICENSE.txt +9 -0
- package/__mf/js/async/1864.df7c4beb.js +1 -0
- package/__mf/js/async/1950.704c331e.js +1 -0
- package/__mf/js/async/1964.95da06f6.js +2 -0
- package/__mf/js/async/1964.95da06f6.js.LICENSE.txt +9 -0
- package/__mf/js/async/1996.01084c88.js +2 -0
- package/__mf/js/async/1996.01084c88.js.LICENSE.txt +24 -0
- package/__mf/js/async/212.bd5d617a.js +1 -0
- package/__mf/js/async/2316.fec4907a.js +1 -0
- package/__mf/js/async/232.f3523a60.js +1 -0
- package/__mf/js/async/2569.daf868a6.js +10 -0
- package/__mf/js/async/2569.daf868a6.js.LICENSE.txt +27 -0
- package/__mf/js/async/2675.c3b73822.js +1 -0
- package/__mf/js/async/3224.23f0dccf.js +1 -0
- package/__mf/js/async/3355.a4dbcdb0.js +1 -0
- package/__mf/js/async/3436.97c926a4.js +1 -0
- package/__mf/js/async/3818.dde21d04.js +1 -0
- package/__mf/js/async/3871.6915e369.js +1 -0
- package/__mf/js/async/3960.129d5ef5.js +2 -0
- package/__mf/js/async/3960.129d5ef5.js.LICENSE.txt +8 -0
- package/__mf/js/async/4075.b77ca1c7.js +1 -0
- package/__mf/js/async/4238.8e4d29d5.js +1 -0
- package/__mf/js/async/4323.4266fd6a.js +1 -0
- package/__mf/js/async/4421.1bcc1637.js +1 -0
- package/__mf/js/async/4489.3361e7bc.js +29 -0
- package/__mf/js/async/4489.3361e7bc.js.LICENSE.txt +59 -0
- package/__mf/js/async/5214.027c4332.js +1 -0
- package/__mf/js/async/5345.8c2e4b4a.js +1 -0
- package/__mf/js/async/537.6911ea2e.js +1 -0
- package/__mf/js/async/5387.fd6e16d6.js +1 -0
- package/__mf/js/async/5654.ecb41aea.js +38 -0
- package/__mf/js/async/5724.6ee6ec51.js +1 -0
- package/__mf/js/async/5774.9b0b6be1.js +1 -0
- package/__mf/js/async/5790.2273e061.js +1 -0
- package/__mf/js/async/5913.9d30fd07.js +73 -0
- package/__mf/js/async/5913.9d30fd07.js.LICENSE.txt +19 -0
- package/__mf/js/async/5914.bd342d22.js +74 -0
- package/__mf/js/async/5981.40bed0d0.js +2 -0
- package/__mf/js/async/5981.40bed0d0.js.LICENSE.txt +8 -0
- package/__mf/js/async/6292.7b8efa78.js +1 -0
- package/__mf/js/async/6333.865a46e0.js +2 -0
- package/__mf/js/async/6333.865a46e0.js.LICENSE.txt +9 -0
- package/__mf/js/async/6377.ca974d89.js +2 -0
- package/__mf/js/async/6377.ca974d89.js.LICENSE.txt +32 -0
- package/__mf/js/async/6770.adb1c939.js +1 -0
- package/__mf/js/async/684.ca510333.js +1 -0
- package/__mf/js/async/694.f861d67c.js +1 -0
- package/__mf/js/async/7272.a763aa92.js +1 -0
- package/__mf/js/async/738.aca54e25.js +1 -0
- package/__mf/js/async/7740.0c5363fd.js +1 -0
- package/__mf/js/async/8265.b9e2c31e.js +1 -0
- package/__mf/js/async/8488.5237550f.js +1 -0
- package/__mf/js/async/8587.4891ea90.js +1 -0
- package/__mf/js/async/8610.8300df79.js +1 -0
- package/__mf/js/async/87.fdc843ac.js +1 -0
- package/__mf/js/async/8930.9fbbc975.js +1 -0
- package/__mf/js/async/8997.18901f45.js +28 -0
- package/__mf/js/async/9173.e8fbead5.js +2 -0
- package/__mf/js/async/9173.e8fbead5.js.LICENSE.txt +19 -0
- package/__mf/js/async/__federation_expose_PrometheusDatasource.f6f57299.js +1 -0
- package/__mf/js/async/__federation_expose_PrometheusExplorer.5fcf955a.js +1 -0
- package/__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.86d0ad5a.js +1 -0
- package/__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.b2893484.js +1 -0
- package/__mf/js/async/__federation_expose_PrometheusPromQLVariable.cd16f6e8.js +1 -0
- package/__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.eb9eefa6.js +1 -0
- package/__mf/js/main.154a5b65.js +1 -0
- package/lib/bootstrap.d.ts +2 -0
- package/lib/bootstrap.d.ts.map +1 -0
- package/lib/bootstrap.js +19 -0
- package/lib/bootstrap.js.map +1 -0
- package/lib/cjs/bootstrap.js +26 -0
- package/{dist → lib}/cjs/components/PromQLEditor.js +9 -7
- package/lib/cjs/components/TreeNode.js +492 -0
- package/{dist → lib}/cjs/components/promql/ast.js +21 -21
- package/lib/cjs/components/promql/functionSignatures.js +651 -0
- package/lib/cjs/components/promql/serialize.js +88 -0
- package/{dist → lib}/cjs/components/promql/utils.js +12 -1
- package/{dist/cjs/components/parse.js → lib/cjs/components/query.js} +37 -4
- package/lib/cjs/env.d.js +14 -0
- package/lib/cjs/explore/PrometheusExplorer.js +203 -0
- package/lib/cjs/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js +268 -0
- package/lib/cjs/explore/PrometheusMetricsFinder/display/MetricChip.js +61 -0
- package/lib/cjs/explore/PrometheusMetricsFinder/display/list/MetricList.js +179 -0
- package/lib/cjs/explore/PrometheusMetricsFinder/filter/FilterInputs.js +231 -0
- package/lib/cjs/explore/PrometheusMetricsFinder/filter/FinderFilters.js +97 -0
- package/{dist/cjs/plugins/prometheus-time-series-query → lib/cjs/explore/PrometheusMetricsFinder}/index.js +1 -1
- package/lib/cjs/explore/PrometheusMetricsFinder/overview/MetricOverview.js +235 -0
- package/lib/cjs/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js +144 -0
- package/lib/cjs/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js +423 -0
- package/lib/cjs/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js +53 -0
- package/lib/cjs/explore/PrometheusMetricsFinder/types.js +25 -0
- package/lib/cjs/explore/PrometheusMetricsFinder/utils.js +203 -0
- package/lib/cjs/explore/index.js +19 -0
- package/lib/cjs/getPluginModule.js +27 -0
- package/lib/cjs/index-federation.js +55 -0
- package/lib/cjs/index.js +28 -0
- package/{dist → lib}/cjs/model/api-types.js +1 -1
- package/{dist → lib}/cjs/model/prometheus-client.js +1 -1
- package/lib/cjs/plugins/PrometheusDatasourceEditor.js +109 -0
- package/lib/cjs/plugins/PrometheusLabelNamesVariable.js +34 -0
- package/lib/cjs/plugins/PrometheusLabelValuesVariable.js +38 -0
- package/lib/cjs/plugins/PrometheusPromQLVariable.js +42 -0
- package/lib/cjs/plugins/index.js +26 -0
- package/{dist → lib}/cjs/plugins/prometheus-datasource.js +9 -9
- package/{dist → lib}/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +11 -9
- package/{dist → lib}/cjs/plugins/prometheus-time-series-query/get-time-series-data.js +51 -29
- package/lib/cjs/plugins/prometheus-time-series-query/index.js +35 -0
- package/{dist → lib}/cjs/plugins/prometheus-variables.js +25 -101
- package/{dist → lib}/cjs/plugins/variable.js +1 -2
- package/lib/cjs/setup-tests.js +19 -0
- package/{dist → lib}/cjs/utils/utils.js +1 -2
- package/lib/components/PromQLEditor.d.ts.map +1 -0
- package/{dist → lib}/components/PromQLEditor.js +9 -7
- package/lib/components/PromQLEditor.js.map +1 -0
- package/lib/components/TreeNode.d.ts +15 -0
- package/lib/components/TreeNode.d.ts.map +1 -0
- package/lib/components/TreeNode.js +479 -0
- package/lib/components/TreeNode.js.map +1 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js.map +1 -0
- package/lib/components/promql/ast.d.ts.map +1 -0
- package/{dist → lib}/components/promql/ast.js +21 -21
- package/lib/components/promql/ast.js.map +1 -0
- package/{dist → lib}/components/promql/format.d.ts +1 -1
- package/lib/components/promql/format.d.ts.map +1 -0
- package/lib/components/promql/format.js.map +1 -0
- package/lib/components/promql/functionSignatures.d.ts +3 -0
- package/lib/components/promql/functionSignatures.d.ts.map +1 -0
- package/lib/components/promql/functionSignatures.js +643 -0
- package/lib/components/promql/functionSignatures.js.map +1 -0
- package/lib/components/promql/serialize.d.ts +4 -0
- package/lib/components/promql/serialize.d.ts.map +1 -0
- package/lib/components/promql/serialize.js +80 -0
- package/lib/components/promql/serialize.js.map +1 -0
- package/{dist → lib}/components/promql/utils.d.ts +1 -0
- package/lib/components/promql/utils.d.ts.map +1 -0
- package/{dist → lib}/components/promql/utils.js +9 -1
- package/lib/components/promql/utils.js.map +1 -0
- package/lib/components/query.d.ts +6 -0
- package/lib/components/query.d.ts.map +1 -0
- package/{dist/components/parse.js → lib/components/query.js} +27 -2
- package/lib/components/query.js.map +1 -0
- package/lib/env.d.js +15 -0
- package/lib/env.d.js.map +1 -0
- package/lib/explore/PrometheusExplorer.d.ts +3 -0
- package/lib/explore/PrometheusExplorer.d.ts.map +1 -0
- package/lib/explore/PrometheusExplorer.js +190 -0
- package/lib/explore/PrometheusExplorer.js.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.d.ts +31 -0
- package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.d.ts.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js +244 -0
- package/lib/explore/PrometheusMetricsFinder/PrometheusMetricsFinder.js.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/display/MetricChip.d.ts +4 -0
- package/lib/explore/PrometheusMetricsFinder/display/MetricChip.d.ts.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/display/MetricChip.js +53 -0
- package/lib/explore/PrometheusMetricsFinder/display/MetricChip.js.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.d.ts +27 -0
- package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.d.ts.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.js +158 -0
- package/lib/explore/PrometheusMetricsFinder/display/list/MetricList.js.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.d.ts +23 -0
- package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.d.ts.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.js +209 -0
- package/lib/explore/PrometheusMetricsFinder/filter/FilterInputs.js.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.d.ts +13 -0
- package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.d.ts.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.js +84 -0
- package/lib/explore/PrometheusMetricsFinder/filter/FinderFilters.js.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/index.d.ts +2 -0
- package/lib/explore/PrometheusMetricsFinder/index.d.ts.map +1 -0
- package/{dist/model/api-types.js → lib/explore/PrometheusMetricsFinder/index.js} +2 -2
- package/lib/explore/PrometheusMetricsFinder/index.js.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.d.ts +23 -0
- package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.d.ts.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.js +214 -0
- package/lib/explore/PrometheusMetricsFinder/overview/MetricOverview.js.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.d.ts +28 -0
- package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.d.ts.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js +125 -0
- package/lib/explore/PrometheusMetricsFinder/overview/tabs/JobTab.js.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.d.ts +25 -0
- package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.d.ts.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js +399 -0
- package/lib/explore/PrometheusMetricsFinder/overview/tabs/OverviewTab.js.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.d.ts +12 -0
- package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.d.ts.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js +45 -0
- package/lib/explore/PrometheusMetricsFinder/overview/tabs/SimilarTab.js.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/types.d.ts +22 -0
- package/lib/explore/PrometheusMetricsFinder/types.d.ts.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/types.js +17 -0
- package/lib/explore/PrometheusMetricsFinder/types.js.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/utils.d.ts +22 -0
- package/lib/explore/PrometheusMetricsFinder/utils.d.ts.map +1 -0
- package/lib/explore/PrometheusMetricsFinder/utils.js +185 -0
- package/lib/explore/PrometheusMetricsFinder/utils.js.map +1 -0
- package/lib/explore/index.d.ts +3 -0
- package/lib/explore/index.d.ts.map +1 -0
- package/lib/explore/index.js +4 -0
- package/lib/explore/index.js.map +1 -0
- package/lib/getPluginModule.d.ts +6 -0
- package/lib/getPluginModule.d.ts.map +1 -0
- package/lib/getPluginModule.js +16 -0
- package/lib/getPluginModule.js.map +1 -0
- package/lib/index-federation.d.ts +1 -0
- package/lib/index-federation.d.ts.map +1 -0
- package/lib/index-federation.js +15 -0
- package/{dist/components/index.js.map → lib/index-federation.js.map} +1 -1
- package/lib/index.d.ts +6 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -0
- package/{dist → lib}/model/api-types.d.ts +18 -1
- package/lib/model/api-types.d.ts.map +1 -0
- package/{dist/plugins/prometheus-time-series-query/index.js → lib/model/api-types.js} +3 -3
- package/lib/model/api-types.js.map +1 -0
- package/lib/model/index.d.ts.map +1 -0
- package/lib/model/index.js.map +1 -0
- package/lib/model/parse-sample-values.d.ts.map +1 -0
- package/lib/model/parse-sample-values.js.map +1 -0
- package/lib/model/prometheus-client.d.ts.map +1 -0
- package/{dist → lib}/model/prometheus-client.js +1 -1
- package/lib/model/prometheus-client.js.map +1 -0
- package/lib/model/prometheus-selectors.d.ts.map +1 -0
- package/lib/model/prometheus-selectors.js.map +1 -0
- package/lib/model/time.d.ts.map +1 -0
- package/lib/model/time.js.map +1 -0
- package/lib/plugins/MatcherEditor.d.ts.map +1 -0
- package/lib/plugins/MatcherEditor.js.map +1 -0
- package/lib/plugins/PrometheusDatasourceEditor.d.ts.map +1 -0
- package/lib/plugins/PrometheusDatasourceEditor.js +96 -0
- package/lib/plugins/PrometheusDatasourceEditor.js.map +1 -0
- package/lib/plugins/PrometheusLabelNamesVariable.d.ts +4 -0
- package/lib/plugins/PrometheusLabelNamesVariable.d.ts.map +1 -0
- package/lib/plugins/PrometheusLabelNamesVariable.js +26 -0
- package/lib/plugins/PrometheusLabelNamesVariable.js.map +1 -0
- package/lib/plugins/PrometheusLabelValuesVariable.d.ts +4 -0
- package/lib/plugins/PrometheusLabelValuesVariable.d.ts.map +1 -0
- package/lib/plugins/PrometheusLabelValuesVariable.js +30 -0
- package/lib/plugins/PrometheusLabelValuesVariable.js.map +1 -0
- package/lib/plugins/PrometheusPromQLVariable.d.ts +4 -0
- package/lib/plugins/PrometheusPromQLVariable.d.ts.map +1 -0
- package/lib/plugins/PrometheusPromQLVariable.js +34 -0
- package/lib/plugins/PrometheusPromQLVariable.js.map +1 -0
- package/lib/plugins/index.d.ts +10 -0
- package/lib/plugins/index.d.ts.map +1 -0
- package/lib/plugins/index.js +11 -0
- package/lib/plugins/index.js.map +1 -0
- package/lib/plugins/prometheus-datasource.d.ts.map +1 -0
- package/{dist → lib}/plugins/prometheus-datasource.js +9 -9
- package/lib/plugins/prometheus-datasource.js.map +1 -0
- package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.d.ts.map +1 -0
- package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js.map +1 -0
- package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -0
- package/{dist → lib}/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +9 -7
- package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -0
- package/lib/plugins/prometheus-time-series-query/get-time-series-data.d.ts.map +1 -0
- package/{dist → lib}/plugins/prometheus-time-series-query/get-time-series-data.js +51 -29
- package/lib/plugins/prometheus-time-series-query/get-time-series-data.js.map +1 -0
- package/lib/plugins/prometheus-time-series-query/index.d.ts +7 -0
- package/lib/plugins/prometheus-time-series-query/index.d.ts.map +1 -0
- package/lib/plugins/prometheus-time-series-query/index.js +20 -0
- package/lib/plugins/prometheus-time-series-query/index.js.map +1 -0
- package/lib/plugins/prometheus-time-series-query/query-editor-model.d.ts.map +1 -0
- package/lib/plugins/prometheus-time-series-query/query-editor-model.js.map +1 -0
- package/lib/plugins/prometheus-time-series-query/replace-prom-builtin-variables.d.ts.map +1 -0
- package/lib/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js.map +1 -0
- package/lib/plugins/prometheus-time-series-query/time-series-query-model.d.ts.map +1 -0
- package/lib/plugins/prometheus-time-series-query/time-series-query-model.js.map +1 -0
- package/lib/plugins/prometheus-variables.d.ts +14 -0
- package/lib/plugins/prometheus-variables.d.ts.map +1 -0
- package/{dist → lib}/plugins/prometheus-variables.js +15 -98
- package/lib/plugins/prometheus-variables.js.map +1 -0
- package/lib/plugins/types.d.ts.map +1 -0
- package/lib/plugins/types.js.map +1 -0
- package/lib/plugins/variable.d.ts.map +1 -0
- package/{dist → lib}/plugins/variable.js +1 -2
- package/lib/plugins/variable.js.map +1 -0
- package/lib/setup-tests.d.ts +2 -0
- package/lib/setup-tests.d.ts.map +1 -0
- package/lib/setup-tests.js +17 -0
- package/{dist/utils/index.js.map → lib/setup-tests.js.map} +1 -1
- package/lib/test/setup-tests.d.ts.map +1 -0
- package/lib/test/setup-tests.js.map +1 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/utils.d.ts.map +1 -0
- package/{dist → lib}/utils/utils.js +1 -2
- package/lib/utils/utils.js.map +1 -0
- package/mf-manifest.json +898 -0
- package/mf-stats.json +1004 -0
- package/package.json +99 -38
- package/dist/cjs/components/TreeNode.js +0 -147
- package/dist/cjs/index.js +0 -61
- package/dist/cjs/plugins/PrometheusDatasourceEditor.js +0 -626
- package/dist/components/PromQLEditor.d.ts.map +0 -1
- package/dist/components/PromQLEditor.js.map +0 -1
- package/dist/components/TreeNode.d.ts +0 -10
- package/dist/components/TreeNode.d.ts.map +0 -1
- package/dist/components/TreeNode.js +0 -139
- package/dist/components/TreeNode.js.map +0 -1
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/parse.d.ts +0 -5
- package/dist/components/parse.d.ts.map +0 -1
- package/dist/components/parse.js.map +0 -1
- package/dist/components/promql/ast.d.ts.map +0 -1
- package/dist/components/promql/ast.js.map +0 -1
- package/dist/components/promql/format.d.ts.map +0 -1
- package/dist/components/promql/format.js.map +0 -1
- package/dist/components/promql/utils.d.ts.map +0 -1
- package/dist/components/promql/utils.js.map +0 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -24
- package/dist/index.js.map +0 -1
- package/dist/model/api-types.d.ts.map +0 -1
- package/dist/model/api-types.js.map +0 -1
- package/dist/model/index.d.ts.map +0 -1
- package/dist/model/index.js.map +0 -1
- package/dist/model/parse-sample-values.d.ts.map +0 -1
- package/dist/model/parse-sample-values.js.map +0 -1
- package/dist/model/prometheus-client.d.ts.map +0 -1
- package/dist/model/prometheus-client.js.map +0 -1
- package/dist/model/prometheus-selectors.d.ts.map +0 -1
- package/dist/model/prometheus-selectors.js.map +0 -1
- package/dist/model/time.d.ts.map +0 -1
- package/dist/model/time.js.map +0 -1
- package/dist/plugins/MatcherEditor.d.ts.map +0 -1
- package/dist/plugins/MatcherEditor.js.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor.js +0 -572
- package/dist/plugins/PrometheusDatasourceEditor.js.map +0 -1
- package/dist/plugins/prometheus-datasource.d.ts.map +0 -1
- package/dist/plugins/prometheus-datasource.js.map +0 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.d.ts.map +0 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js.map +0 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +0 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +0 -1
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.d.ts.map +0 -1
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.js.map +0 -1
- package/dist/plugins/prometheus-time-series-query/index.d.ts +0 -2
- package/dist/plugins/prometheus-time-series-query/index.d.ts.map +0 -1
- package/dist/plugins/prometheus-time-series-query/index.js.map +0 -1
- package/dist/plugins/prometheus-time-series-query/query-editor-model.d.ts.map +0 -1
- package/dist/plugins/prometheus-time-series-query/query-editor-model.js.map +0 -1
- package/dist/plugins/prometheus-time-series-query/replace-prom-builtin-variables.d.ts.map +0 -1
- package/dist/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js.map +0 -1
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.d.ts.map +0 -1
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.js.map +0 -1
- package/dist/plugins/prometheus-variables.d.ts +0 -6
- package/dist/plugins/prometheus-variables.d.ts.map +0 -1
- package/dist/plugins/prometheus-variables.js.map +0 -1
- package/dist/plugins/types.d.ts.map +0 -1
- package/dist/plugins/types.js.map +0 -1
- package/dist/plugins/variable.d.ts.map +0 -1
- package/dist/plugins/variable.js.map +0 -1
- package/dist/test/setup-tests.d.ts.map +0 -1
- package/dist/test/setup-tests.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/utils.d.ts.map +0 -1
- package/dist/utils/utils.js.map +0 -1
- package/plugin.json +0 -58
- /package/{dist → lib}/cjs/components/index.js +0 -0
- /package/{dist → lib}/cjs/components/promql/format.js +0 -0
- /package/{dist → lib}/cjs/model/index.js +0 -0
- /package/{dist → lib}/cjs/model/parse-sample-values.js +0 -0
- /package/{dist → lib}/cjs/model/prometheus-selectors.js +0 -0
- /package/{dist → lib}/cjs/model/time.js +0 -0
- /package/{dist → lib}/cjs/plugins/MatcherEditor.js +0 -0
- /package/{dist → lib}/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +0 -0
- /package/{dist → lib}/cjs/plugins/prometheus-time-series-query/query-editor-model.js +0 -0
- /package/{dist → lib}/cjs/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js +0 -0
- /package/{dist → lib}/cjs/plugins/prometheus-time-series-query/time-series-query-model.js +0 -0
- /package/{dist → lib}/cjs/plugins/types.js +0 -0
- /package/{dist → lib}/cjs/test/setup-tests.js +0 -0
- /package/{dist → lib}/cjs/utils/index.js +0 -0
- /package/{dist → lib}/components/PromQLEditor.d.ts +0 -0
- /package/{dist → lib}/components/index.d.ts +0 -0
- /package/{dist → lib}/components/index.js +0 -0
- /package/{dist → lib}/components/promql/ast.d.ts +0 -0
- /package/{dist → lib}/components/promql/format.js +0 -0
- /package/{dist → lib}/model/index.d.ts +0 -0
- /package/{dist → lib}/model/index.js +0 -0
- /package/{dist → lib}/model/parse-sample-values.d.ts +0 -0
- /package/{dist → lib}/model/parse-sample-values.js +0 -0
- /package/{dist → lib}/model/prometheus-client.d.ts +0 -0
- /package/{dist → lib}/model/prometheus-selectors.d.ts +0 -0
- /package/{dist → lib}/model/prometheus-selectors.js +0 -0
- /package/{dist → lib}/model/time.d.ts +0 -0
- /package/{dist → lib}/model/time.js +0 -0
- /package/{dist → lib}/plugins/MatcherEditor.d.ts +0 -0
- /package/{dist → lib}/plugins/MatcherEditor.js +0 -0
- /package/{dist → lib}/plugins/PrometheusDatasourceEditor.d.ts +0 -0
- /package/{dist → lib}/plugins/prometheus-datasource.d.ts +0 -0
- /package/{dist → lib}/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.d.ts +0 -0
- /package/{dist → lib}/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +0 -0
- /package/{dist → lib}/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts +0 -0
- /package/{dist → lib}/plugins/prometheus-time-series-query/get-time-series-data.d.ts +0 -0
- /package/{dist → lib}/plugins/prometheus-time-series-query/query-editor-model.d.ts +0 -0
- /package/{dist → lib}/plugins/prometheus-time-series-query/query-editor-model.js +0 -0
- /package/{dist → lib}/plugins/prometheus-time-series-query/replace-prom-builtin-variables.d.ts +0 -0
- /package/{dist → lib}/plugins/prometheus-time-series-query/replace-prom-builtin-variables.js +0 -0
- /package/{dist → lib}/plugins/prometheus-time-series-query/time-series-query-model.d.ts +0 -0
- /package/{dist → lib}/plugins/prometheus-time-series-query/time-series-query-model.js +0 -0
- /package/{dist → lib}/plugins/types.d.ts +0 -0
- /package/{dist → lib}/plugins/types.js +0 -0
- /package/{dist → lib}/plugins/variable.d.ts +0 -0
- /package/{dist → lib}/test/setup-tests.d.ts +0 -0
- /package/{dist → lib}/test/setup-tests.js +0 -0
- /package/{dist → lib}/utils/index.d.ts +0 -0
- /package/{dist → lib}/utils/index.js +0 -0
- /package/{dist → lib}/utils/utils.d.ts +0 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { cloneElement, forwardRef, useMemo, useRef, useState } from 'react';
|
|
15
|
+
import { Autocomplete, CircularProgress, IconButton, InputAdornment, TextField } from '@mui/material';
|
|
16
|
+
import CheckIcon from 'mdi-material-ui/Check';
|
|
17
|
+
import DeleteIcon from 'mdi-material-ui/Delete';
|
|
18
|
+
import { Virtuoso } from 'react-virtuoso';
|
|
19
|
+
import { useLabels, useLabelValues } from '../utils';
|
|
20
|
+
// TODO: fix when a filter is deleted => refresh data
|
|
21
|
+
export function LabelFilterInput({ datasource, value, filters, onChange, onDelete }) {
|
|
22
|
+
const filtersWithoutCurrent = useMemo(()=>filters.filter((filter)=>filter.label !== value.label), [
|
|
23
|
+
filters,
|
|
24
|
+
value.label
|
|
25
|
+
]);
|
|
26
|
+
const { data: labelOptions, isLoading: isLabelOptionsLoading } = useLabels(filtersWithoutCurrent, datasource);
|
|
27
|
+
const { data: labelValuesOptions, isLoading: isLabelValuesOptionsLoading } = useLabelValues(value.label, filtersWithoutCurrent, datasource);
|
|
28
|
+
return /*#__PURE__*/ _jsx(RawFilterInput, {
|
|
29
|
+
value: value,
|
|
30
|
+
labelOptions: labelOptions?.data ?? [],
|
|
31
|
+
labelValuesOptions: labelValuesOptions?.data ?? [],
|
|
32
|
+
isLabelOptionsLoading: isLabelOptionsLoading,
|
|
33
|
+
isLabelValuesOptionsLoading: isLabelValuesOptionsLoading,
|
|
34
|
+
onChange: onChange,
|
|
35
|
+
onDelete: onDelete
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// https://stackoverflow.com/questions/69060738/material-ui-autocomplete-virtualization-w-react-virtuoso
|
|
39
|
+
export const ListboxComponent = /*#__PURE__*/ forwardRef(({ children, ...rest }, ref)=>{
|
|
40
|
+
const data = children;
|
|
41
|
+
const localRef = useRef('500px');
|
|
42
|
+
const [height, setHeight] = useState(0);
|
|
43
|
+
return /*#__PURE__*/ _jsx("ul", {
|
|
44
|
+
style: {
|
|
45
|
+
overflow: 'hidden',
|
|
46
|
+
padding: '0',
|
|
47
|
+
height: height ? `min(40vh, ${height}px)` : '40vh'
|
|
48
|
+
},
|
|
49
|
+
ref: (reference)=>{
|
|
50
|
+
const maxHeight = reference ? getComputedStyle(reference).maxHeight : null;
|
|
51
|
+
if (maxHeight && maxHeight !== localRef.current) {
|
|
52
|
+
localRef.current = maxHeight;
|
|
53
|
+
}
|
|
54
|
+
if (typeof ref === 'function') {
|
|
55
|
+
ref(reference);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
...rest,
|
|
59
|
+
children: /*#__PURE__*/ _jsx(Virtuoso, {
|
|
60
|
+
style: {
|
|
61
|
+
height: localRef.current,
|
|
62
|
+
padding: '10px 0'
|
|
63
|
+
},
|
|
64
|
+
data: data,
|
|
65
|
+
totalListHeightChanged: setHeight,
|
|
66
|
+
itemContent: (index, child)=>{
|
|
67
|
+
return /*#__PURE__*/ cloneElement(child, {
|
|
68
|
+
index,
|
|
69
|
+
title: child.props.children
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
ListboxComponent.displayName = 'ListboxComponent';
|
|
76
|
+
export function RawFilterInput({ value, labelOptions, labelValuesOptions, isLabelOptionsLoading, isLabelValuesOptionsLoading, onChange, onDelete }) {
|
|
77
|
+
const [isEditingLabelName, setIsEditingLabelName] = useState(value.labelValues.length === 0);
|
|
78
|
+
const [labelName, setLabelName] = useState(value.label);
|
|
79
|
+
function handleLabelConfirmation() {
|
|
80
|
+
setIsEditingLabelName(false);
|
|
81
|
+
onChange({
|
|
82
|
+
label: labelName,
|
|
83
|
+
labelValues: value.labelValues,
|
|
84
|
+
operator: value.operator
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function handleKeyPress(event) {
|
|
88
|
+
if (isEditingLabelName && event.key === 'Enter') {
|
|
89
|
+
handleLabelConfirmation();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
93
|
+
children: [
|
|
94
|
+
/*#__PURE__*/ _jsx(Autocomplete, {
|
|
95
|
+
freeSolo: true,
|
|
96
|
+
disableClearable: true,
|
|
97
|
+
options: labelOptions ?? [],
|
|
98
|
+
value: value.label,
|
|
99
|
+
sx: {
|
|
100
|
+
minWidth: 250,
|
|
101
|
+
display: isEditingLabelName ? 'block' : 'none'
|
|
102
|
+
},
|
|
103
|
+
ListboxComponent: ListboxComponent,
|
|
104
|
+
loading: isLabelOptionsLoading,
|
|
105
|
+
renderInput: (params)=>{
|
|
106
|
+
return /*#__PURE__*/ _jsx(TextField, {
|
|
107
|
+
...params,
|
|
108
|
+
label: "Label Name",
|
|
109
|
+
variant: "outlined",
|
|
110
|
+
fullWidth: true,
|
|
111
|
+
size: "medium",
|
|
112
|
+
InputProps: {
|
|
113
|
+
...params.InputProps,
|
|
114
|
+
endAdornment: /*#__PURE__*/ _jsxs(InputAdornment, {
|
|
115
|
+
position: "end",
|
|
116
|
+
children: [
|
|
117
|
+
isLabelOptionsLoading ? /*#__PURE__*/ _jsx(CircularProgress, {
|
|
118
|
+
color: "inherit",
|
|
119
|
+
size: 20
|
|
120
|
+
}) : null,
|
|
121
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
122
|
+
"aria-label": "validate label name",
|
|
123
|
+
onClick: ()=>handleLabelConfirmation(),
|
|
124
|
+
edge: "end",
|
|
125
|
+
children: /*#__PURE__*/ _jsx(CheckIcon, {})
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
onKeyDown: handleKeyPress,
|
|
133
|
+
onInputChange: (_, newValue)=>{
|
|
134
|
+
setLabelName(newValue ?? '');
|
|
135
|
+
}
|
|
136
|
+
}),
|
|
137
|
+
/*#__PURE__*/ _jsx(Autocomplete, {
|
|
138
|
+
freeSolo: true,
|
|
139
|
+
multiple: value.operator === '=~' || value.operator === '!~',
|
|
140
|
+
limitTags: 1,
|
|
141
|
+
disableClearable: true,
|
|
142
|
+
options: labelValuesOptions ?? [],
|
|
143
|
+
value: value.labelValues,
|
|
144
|
+
ListboxComponent: ListboxComponent,
|
|
145
|
+
sx: {
|
|
146
|
+
minWidth: 250,
|
|
147
|
+
display: isEditingLabelName ? 'none' : 'block'
|
|
148
|
+
},
|
|
149
|
+
loading: isLabelValuesOptionsLoading,
|
|
150
|
+
renderInput: (params)=>{
|
|
151
|
+
return /*#__PURE__*/ _jsx(TextField, {
|
|
152
|
+
...params,
|
|
153
|
+
label: value.label,
|
|
154
|
+
variant: "outlined",
|
|
155
|
+
fullWidth: true,
|
|
156
|
+
size: "medium",
|
|
157
|
+
InputProps: {
|
|
158
|
+
...params.InputProps,
|
|
159
|
+
startAdornment: /*#__PURE__*/ _jsxs(_Fragment, {
|
|
160
|
+
children: [
|
|
161
|
+
/*#__PURE__*/ _jsx(InputAdornment, {
|
|
162
|
+
position: "start",
|
|
163
|
+
children: value.operator
|
|
164
|
+
}),
|
|
165
|
+
params.InputProps.startAdornment
|
|
166
|
+
]
|
|
167
|
+
}),
|
|
168
|
+
endAdornment: /*#__PURE__*/ _jsxs(InputAdornment, {
|
|
169
|
+
position: "end",
|
|
170
|
+
children: [
|
|
171
|
+
isLabelValuesOptionsLoading ? /*#__PURE__*/ _jsx(CircularProgress, {
|
|
172
|
+
color: "inherit",
|
|
173
|
+
size: 20
|
|
174
|
+
}) : null,
|
|
175
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
176
|
+
"aria-label": "delete label filter",
|
|
177
|
+
onClick: ()=>onDelete(),
|
|
178
|
+
edge: "end",
|
|
179
|
+
children: /*#__PURE__*/ _jsx(DeleteIcon, {})
|
|
180
|
+
})
|
|
181
|
+
]
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
onChange: (_, newValue)=>{
|
|
187
|
+
if (typeof newValue === 'string') {
|
|
188
|
+
onChange({
|
|
189
|
+
label: value.label,
|
|
190
|
+
labelValues: [
|
|
191
|
+
newValue
|
|
192
|
+
],
|
|
193
|
+
operator: value.operator
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
if (Array.isArray(newValue)) {
|
|
197
|
+
onChange({
|
|
198
|
+
label: value.label,
|
|
199
|
+
labelValues: newValue,
|
|
200
|
+
operator: value.operator
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
//# sourceMappingURL=FilterInputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/explore/PrometheusMetricsFinder/filter/FilterInputs.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 {\n cloneElement,\n forwardRef,\n HTMLAttributes,\n ReactElement,\n SyntheticEvent,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Autocomplete, CircularProgress, IconButton, InputAdornment, TextField } from '@mui/material';\nimport CheckIcon from 'mdi-material-ui/Check';\nimport DeleteIcon from 'mdi-material-ui/Delete';\nimport { DatasourceSelector } from '@perses-dev/core';\nimport { Virtuoso } from 'react-virtuoso';\nimport { LabelFilter } from '../types';\nimport { useLabels, useLabelValues } from '../utils';\n\nexport interface LabelFilterInputProps {\n datasource: DatasourceSelector;\n value: LabelFilter;\n filters: LabelFilter[];\n onChange: (next: LabelFilter) => void;\n onDelete: () => void;\n}\n\n// TODO: fix when a filter is deleted => refresh data\nexport function LabelFilterInput({\n datasource,\n value,\n filters,\n onChange,\n onDelete,\n}: LabelFilterInputProps): ReactElement {\n const filtersWithoutCurrent = useMemo(\n () => filters.filter((filter) => filter.label !== value.label),\n [filters, value.label]\n );\n\n const { data: labelOptions, isLoading: isLabelOptionsLoading } = useLabels(filtersWithoutCurrent, datasource);\n const { data: labelValuesOptions, isLoading: isLabelValuesOptionsLoading } = useLabelValues(\n value.label,\n filtersWithoutCurrent,\n datasource\n );\n\n return (\n <RawFilterInput\n value={value}\n labelOptions={labelOptions?.data ?? []}\n labelValuesOptions={labelValuesOptions?.data ?? []}\n isLabelOptionsLoading={isLabelOptionsLoading}\n isLabelValuesOptionsLoading={isLabelValuesOptionsLoading}\n onChange={onChange}\n onDelete={onDelete}\n />\n );\n}\n\n// https://stackoverflow.com/questions/69060738/material-ui-autocomplete-virtualization-w-react-virtuoso\nexport const ListboxComponent = forwardRef<HTMLUListElement, HTMLAttributes<HTMLUListElement>>(\n ({ children, ...rest }, ref) => {\n const data = children as ReactElement[];\n const localRef = useRef<string>('500px');\n\n const [height, setHeight] = useState(0);\n\n return (\n <ul\n style={{ overflow: 'hidden', padding: '0', height: height ? `min(40vh, ${height}px)` : '40vh' }}\n ref={(reference) => {\n const maxHeight = reference ? getComputedStyle(reference).maxHeight : null;\n if (maxHeight && maxHeight !== localRef.current) {\n localRef.current = maxHeight;\n }\n\n if (typeof ref === 'function') {\n ref(reference);\n }\n }}\n {...rest}\n >\n <Virtuoso\n style={{ height: localRef.current, padding: '10px 0' }}\n data={data}\n totalListHeightChanged={setHeight}\n itemContent={(index, child) => {\n return cloneElement(child, { index, title: child.props.children });\n }}\n />\n </ul>\n );\n }\n);\nListboxComponent.displayName = 'ListboxComponent';\n\nexport interface RawFilterInputProps {\n value: LabelFilter;\n labelOptions?: string[];\n labelValuesOptions?: string[];\n isLabelOptionsLoading?: boolean;\n isLabelValuesOptionsLoading?: boolean;\n onChange: (next: LabelFilter) => void;\n onDelete: () => void;\n}\n\nexport function RawFilterInput({\n value,\n labelOptions,\n labelValuesOptions,\n isLabelOptionsLoading,\n isLabelValuesOptionsLoading,\n onChange,\n onDelete,\n}: RawFilterInputProps): ReactElement {\n const [isEditingLabelName, setIsEditingLabelName] = useState(value.labelValues.length === 0);\n const [labelName, setLabelName] = useState(value.label);\n\n function handleLabelConfirmation(): void {\n setIsEditingLabelName(false);\n onChange({ label: labelName, labelValues: value.labelValues, operator: value.operator });\n }\n\n function handleKeyPress(event: { key: string }): void {\n if (isEditingLabelName && event.key === 'Enter') {\n handleLabelConfirmation();\n }\n }\n\n return (\n <>\n <Autocomplete\n freeSolo\n disableClearable\n options={labelOptions ?? []}\n value={value.label}\n sx={{ minWidth: 250, display: isEditingLabelName ? 'block' : 'none' }}\n ListboxComponent={ListboxComponent}\n loading={isLabelOptionsLoading}\n renderInput={(params) => {\n return (\n <TextField\n {...params}\n label=\"Label Name\"\n variant=\"outlined\"\n fullWidth\n size=\"medium\"\n InputProps={{\n ...params.InputProps,\n endAdornment: (\n <InputAdornment position=\"end\">\n {isLabelOptionsLoading ? <CircularProgress color=\"inherit\" size={20} /> : null}\n <IconButton aria-label=\"validate label name\" onClick={() => handleLabelConfirmation()} edge=\"end\">\n <CheckIcon />\n </IconButton>\n </InputAdornment>\n ),\n }}\n />\n );\n }}\n onKeyDown={handleKeyPress}\n onInputChange={(_: SyntheticEvent, newValue: string | null) => {\n setLabelName(newValue ?? '');\n }}\n />\n <Autocomplete\n freeSolo\n multiple={value.operator === '=~' || value.operator === '!~'}\n limitTags={1}\n disableClearable\n options={labelValuesOptions ?? []}\n value={value.labelValues}\n ListboxComponent={ListboxComponent}\n sx={{ minWidth: 250, display: isEditingLabelName ? 'none' : 'block' }}\n loading={isLabelValuesOptionsLoading}\n renderInput={(params) => {\n return (\n <TextField\n {...params}\n label={value.label}\n variant=\"outlined\"\n fullWidth\n size=\"medium\"\n InputProps={{\n ...params.InputProps,\n startAdornment: (\n <>\n <InputAdornment position=\"start\">{value.operator}</InputAdornment>\n {params.InputProps.startAdornment}\n </>\n ),\n endAdornment: (\n <InputAdornment position=\"end\">\n {isLabelValuesOptionsLoading ? <CircularProgress color=\"inherit\" size={20} /> : null}\n <IconButton aria-label=\"delete label filter\" onClick={() => onDelete()} edge=\"end\">\n <DeleteIcon />\n </IconButton>\n </InputAdornment>\n ),\n }}\n />\n );\n }}\n onChange={(_, newValue) => {\n if (typeof newValue === 'string') {\n onChange({ label: value.label, labelValues: [newValue], operator: value.operator });\n }\n if (Array.isArray(newValue)) {\n onChange({ label: value.label, labelValues: newValue, operator: value.operator });\n }\n }}\n />\n </>\n );\n}\n"],"names":["cloneElement","forwardRef","useMemo","useRef","useState","Autocomplete","CircularProgress","IconButton","InputAdornment","TextField","CheckIcon","DeleteIcon","Virtuoso","useLabels","useLabelValues","LabelFilterInput","datasource","value","filters","onChange","onDelete","filtersWithoutCurrent","filter","label","data","labelOptions","isLoading","isLabelOptionsLoading","labelValuesOptions","isLabelValuesOptionsLoading","RawFilterInput","ListboxComponent","children","rest","ref","localRef","height","setHeight","ul","style","overflow","padding","reference","maxHeight","getComputedStyle","current","totalListHeightChanged","itemContent","index","child","title","props","displayName","isEditingLabelName","setIsEditingLabelName","labelValues","length","labelName","setLabelName","handleLabelConfirmation","operator","handleKeyPress","event","key","freeSolo","disableClearable","options","sx","minWidth","display","loading","renderInput","params","variant","fullWidth","size","InputProps","endAdornment","position","color","aria-label","onClick","edge","onKeyDown","onInputChange","_","newValue","multiple","limitTags","startAdornment","Array","isArray"],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StackProps } from '@mui/material';
|
|
2
|
+
import { DatasourceSelector } from '@perses-dev/core';
|
|
3
|
+
import { ReactElement } from 'react';
|
|
4
|
+
import { LabelFilter } from '../types';
|
|
5
|
+
export interface ExplorerFiltersProps extends StackProps {
|
|
6
|
+
datasource: DatasourceSelector;
|
|
7
|
+
filters: LabelFilter[];
|
|
8
|
+
filteredFilters: LabelFilter[];
|
|
9
|
+
onDatasourceChange: (next: DatasourceSelector) => void;
|
|
10
|
+
onFiltersChange: (next: LabelFilter[]) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function FinderFilters({ datasource, filters, filteredFilters, onDatasourceChange, onFiltersChange, ...props }: ExplorerFiltersProps): ReactElement;
|
|
13
|
+
//# sourceMappingURL=FinderFilters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FinderFilters.d.ts","sourceRoot":"","sources":["../../../../../src/explore/PrometheusMetricsFinder/filter/FinderFilters.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA0C,UAAU,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IACtD,UAAU,EAAE,kBAAkB,CAAC;IAC/B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,eAAe,EAAE,WAAW,EAAE,CAAC;IAC/B,kBAAkB,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACvD,eAAe,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;CAChD;AAED,wBAAgB,aAAa,CAAC,EAC5B,UAAU,EACV,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,GAAG,KAAK,EACT,EAAE,oBAAoB,GAAG,YAAY,CA6CrC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Button, FormControl, InputLabel, Stack } from '@mui/material';
|
|
15
|
+
import { DatasourceSelect } from '@perses-dev/plugin-system';
|
|
16
|
+
import PlusIcon from 'mdi-material-ui/Plus';
|
|
17
|
+
import { PROM_DATASOURCE_KIND } from '../../../model/prometheus-selectors';
|
|
18
|
+
import { LabelFilterInput } from './FilterInputs';
|
|
19
|
+
export function FinderFilters({ datasource, filters, filteredFilters, onDatasourceChange, onFiltersChange, ...props }) {
|
|
20
|
+
function handleDatasourceChange(next) {
|
|
21
|
+
onDatasourceChange(next);
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
24
|
+
...props,
|
|
25
|
+
direction: "row",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
flexWrap: "wrap",
|
|
28
|
+
gap: 1,
|
|
29
|
+
sx: {
|
|
30
|
+
width: '100%'
|
|
31
|
+
},
|
|
32
|
+
children: [
|
|
33
|
+
/*#__PURE__*/ _jsxs(FormControl, {
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ _jsx(InputLabel, {
|
|
36
|
+
children: "Prometheus Datasource"
|
|
37
|
+
}),
|
|
38
|
+
/*#__PURE__*/ _jsx(DatasourceSelect, {
|
|
39
|
+
datasourcePluginKind: PROM_DATASOURCE_KIND,
|
|
40
|
+
value: datasource,
|
|
41
|
+
onChange: handleDatasourceChange,
|
|
42
|
+
label: "Prometheus Datasource"
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
}),
|
|
46
|
+
filters.map((filter, index)=>/*#__PURE__*/ _jsx(LabelFilterInput, {
|
|
47
|
+
datasource: datasource,
|
|
48
|
+
filters: filteredFilters,
|
|
49
|
+
value: filter,
|
|
50
|
+
onChange: (next)=>{
|
|
51
|
+
const nextFilters = [
|
|
52
|
+
...filters
|
|
53
|
+
];
|
|
54
|
+
nextFilters[index] = next;
|
|
55
|
+
onFiltersChange(nextFilters);
|
|
56
|
+
},
|
|
57
|
+
onDelete: ()=>{
|
|
58
|
+
const nextFilters = [
|
|
59
|
+
...filters
|
|
60
|
+
];
|
|
61
|
+
nextFilters.splice(index, 1);
|
|
62
|
+
onFiltersChange(nextFilters);
|
|
63
|
+
}
|
|
64
|
+
}, index)),
|
|
65
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
66
|
+
startIcon: /*#__PURE__*/ _jsx(PlusIcon, {}),
|
|
67
|
+
"aria-label": "add filter",
|
|
68
|
+
onClick: ()=>{
|
|
69
|
+
onFiltersChange([
|
|
70
|
+
...filters,
|
|
71
|
+
{
|
|
72
|
+
label: '',
|
|
73
|
+
labelValues: [],
|
|
74
|
+
operator: '=~'
|
|
75
|
+
}
|
|
76
|
+
]);
|
|
77
|
+
},
|
|
78
|
+
children: "Add filter"
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=FinderFilters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/explore/PrometheusMetricsFinder/filter/FinderFilters.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 { Button, FormControl, InputLabel, Stack, StackProps } from '@mui/material';\nimport { DatasourceSelector } from '@perses-dev/core';\nimport { DatasourceSelect } from '@perses-dev/plugin-system';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport { ReactElement } from 'react';\nimport { PROM_DATASOURCE_KIND } from '../../../model/prometheus-selectors';\nimport { LabelFilter } from '../types';\nimport { LabelFilterInput } from './FilterInputs';\n\nexport interface ExplorerFiltersProps extends StackProps {\n datasource: DatasourceSelector;\n filters: LabelFilter[];\n filteredFilters: LabelFilter[];\n onDatasourceChange: (next: DatasourceSelector) => void;\n onFiltersChange: (next: LabelFilter[]) => void;\n}\n\nexport function FinderFilters({\n datasource,\n filters,\n filteredFilters,\n onDatasourceChange,\n onFiltersChange,\n ...props\n}: ExplorerFiltersProps): ReactElement {\n function handleDatasourceChange(next: DatasourceSelector): void {\n onDatasourceChange(next);\n }\n\n return (\n <Stack {...props} direction=\"row\" alignItems=\"center\" flexWrap=\"wrap\" gap={1} sx={{ width: '100%' }}>\n <FormControl>\n <InputLabel>Prometheus Datasource</InputLabel>\n <DatasourceSelect\n datasourcePluginKind={PROM_DATASOURCE_KIND}\n value={datasource}\n onChange={handleDatasourceChange}\n label=\"Prometheus Datasource\"\n />\n </FormControl>\n {filters.map((filter, index) => (\n <LabelFilterInput\n key={index}\n datasource={datasource}\n filters={filteredFilters}\n value={filter}\n onChange={(next) => {\n const nextFilters = [...filters];\n nextFilters[index] = next;\n onFiltersChange(nextFilters);\n }}\n onDelete={() => {\n const nextFilters = [...filters];\n nextFilters.splice(index, 1);\n onFiltersChange(nextFilters);\n }}\n />\n ))}\n <Button\n startIcon={<PlusIcon />}\n aria-label=\"add filter\"\n onClick={() => {\n onFiltersChange([...filters, { label: '', labelValues: [], operator: '=~' }]);\n }}\n >\n Add filter\n </Button>\n </Stack>\n );\n}\n"],"names":["Button","FormControl","InputLabel","Stack","DatasourceSelect","PlusIcon","PROM_DATASOURCE_KIND","LabelFilterInput","FinderFilters","datasource","filters","filteredFilters","onDatasourceChange","onFiltersChange","props","handleDatasourceChange","next","direction","alignItems","flexWrap","gap","sx","width","datasourcePluginKind","value","onChange","label","map","filter","index","nextFilters","onDelete","splice","startIcon","aria-label","onClick","labelValues","operator"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,EAAEC,WAAW,EAAEC,UAAU,EAAEC,KAAK,QAAoB,gBAAgB;AAEnF,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,OAAOC,cAAc,uBAAuB;AAE5C,SAASC,oBAAoB,QAAQ,sCAAsC;AAE3E,SAASC,gBAAgB,QAAQ,iBAAiB;AAUlD,OAAO,SAASC,cAAc,EAC5BC,UAAU,EACVC,OAAO,EACPC,eAAe,EACfC,kBAAkB,EAClBC,eAAe,EACf,GAAGC,OACkB;IACrB,SAASC,uBAAuBC,IAAwB;QACtDJ,mBAAmBI;IACrB;IAEA,qBACE,MAACb;QAAO,GAAGW,KAAK;QAAEG,WAAU;QAAMC,YAAW;QAASC,UAAS;QAAOC,KAAK;QAAGC,IAAI;YAAEC,OAAO;QAAO;;0BAChG,MAACrB;;kCACC,KAACC;kCAAW;;kCACZ,KAACE;wBACCmB,sBAAsBjB;wBACtBkB,OAAOf;wBACPgB,UAAUV;wBACVW,OAAM;;;;YAGThB,QAAQiB,GAAG,CAAC,CAACC,QAAQC,sBACpB,KAACtB;oBAECE,YAAYA;oBACZC,SAASC;oBACTa,OAAOI;oBACPH,UAAU,CAACT;wBACT,MAAMc,cAAc;+BAAIpB;yBAAQ;wBAChCoB,WAAW,CAACD,MAAM,GAAGb;wBACrBH,gBAAgBiB;oBAClB;oBACAC,UAAU;wBACR,MAAMD,cAAc;+BAAIpB;yBAAQ;wBAChCoB,YAAYE,MAAM,CAACH,OAAO;wBAC1BhB,gBAAgBiB;oBAClB;mBAbKD;0BAgBT,KAAC7B;gBACCiC,yBAAW,KAAC5B;gBACZ6B,cAAW;gBACXC,SAAS;oBACPtB,gBAAgB;2BAAIH;wBAAS;4BAAEgB,OAAO;4BAAIU,aAAa,EAAE;4BAAEC,UAAU;wBAAK;qBAAE;gBAC9E;0BACD;;;;AAKP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/explore/PrometheusMetricsFinder/index.ts"],"names":[],"mappings":"AAaA,cAAc,2BAA2B,CAAC"}
|
|
@@ -10,6 +10,6 @@
|
|
|
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
|
-
export
|
|
13
|
+
export * from './PrometheusMetricsFinder';
|
|
14
14
|
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/explore/PrometheusMetricsFinder/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 './PrometheusMetricsFinder';\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,4BAA4B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StackProps } from '@mui/material';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { DatasourceSelector } from '@perses-dev/core';
|
|
4
|
+
import { LabelFilter } from '../types';
|
|
5
|
+
export interface OverviewPanelProps extends StackProps {
|
|
6
|
+
metricName: string;
|
|
7
|
+
datasource: DatasourceSelector;
|
|
8
|
+
filters: LabelFilter[];
|
|
9
|
+
type?: string;
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function OverviewPanel({ metricName, datasource, filters, type, isLoading, ...props }: OverviewPanelProps): ReactElement;
|
|
13
|
+
export interface MetricOverviewProps extends StackProps {
|
|
14
|
+
metricName: string;
|
|
15
|
+
datasource: DatasourceSelector;
|
|
16
|
+
filters: LabelFilter[];
|
|
17
|
+
isMetadataEnabled?: boolean;
|
|
18
|
+
isPanelEnabled?: boolean;
|
|
19
|
+
onExplore?: (metricName: string) => void;
|
|
20
|
+
onFiltersChange: (filters: LabelFilter[]) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function MetricOverview({ metricName, datasource, filters, isMetadataEnabled, isPanelEnabled, onExplore, onFiltersChange, ...props }: MetricOverviewProps): ReactElement;
|
|
23
|
+
//# sourceMappingURL=MetricOverview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetricOverview.d.ts","sourceRoot":"","sources":["../../../../../src/explore/PrometheusMetricsFinder/overview/MetricOverview.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA+C,UAAU,EAAsB,MAAM,eAAe,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAqB,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAA4C,MAAM,kBAAkB,CAAC;AAKhG,OAAO,EAAqB,WAAW,EAAE,MAAM,UAAU,CAAC;AAM1D,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAC5B,UAAU,EACV,UAAU,EACV,OAAO,EACP,IAAI,EACJ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,kBAAkB,GAAG,YAAY,CAyEnC;AAED,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;CACnD;AAED,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,eAAe,EACf,GAAG,KAAK,EACT,EAAE,mBAAmB,GAAG,YAAY,CAyFpC"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Checkbox, FormControlLabel, Skeleton, Stack, Tab, Tabs, Tooltip } from '@mui/material';
|
|
15
|
+
import { useMemo, useState } from 'react';
|
|
16
|
+
import { Panel } from '@perses-dev/dashboards';
|
|
17
|
+
import useResizeObserver from 'use-resize-observer';
|
|
18
|
+
import { DataQueriesProvider, useSuggestedStepMs } from '@perses-dev/plugin-system';
|
|
19
|
+
import HelpCircleOutlineIcon from 'mdi-material-ui/HelpCircleOutline';
|
|
20
|
+
import { computeFilterExpr } from '../types';
|
|
21
|
+
import { useMetricMetadata } from '../utils';
|
|
22
|
+
import { OverviewTab } from './tabs/OverviewTab';
|
|
23
|
+
import { JobTab } from './tabs/JobTab';
|
|
24
|
+
import { SimilarTab } from './tabs/SimilarTab';
|
|
25
|
+
export function OverviewPanel({ metricName, datasource, filters, type, isLoading, ...props }) {
|
|
26
|
+
const { width, ref: panelRef } = useResizeObserver();
|
|
27
|
+
const suggestedStepMs = useSuggestedStepMs(width);
|
|
28
|
+
const [rateEnabled, setRateEnabled] = useState(true);
|
|
29
|
+
const { queries, definitions } = useMemo(()=>{
|
|
30
|
+
const expr = type === 'counter' || rateEnabled && (type === undefined || type === 'summary' || type === 'histogram') ? `rate({__name__="${metricName}", ${computeFilterExpr(filters)}}[5m])` : `{__name__="${metricName}", ${computeFilterExpr(filters)}}`;
|
|
31
|
+
const queries = [
|
|
32
|
+
{
|
|
33
|
+
kind: 'TimeSeriesQuery',
|
|
34
|
+
spec: {
|
|
35
|
+
plugin: {
|
|
36
|
+
kind: 'PrometheusTimeSeriesQuery',
|
|
37
|
+
spec: {
|
|
38
|
+
datasource: datasource,
|
|
39
|
+
query: expr
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
const definitions = queries.map((query)=>{
|
|
46
|
+
return {
|
|
47
|
+
kind: query.spec.plugin.kind,
|
|
48
|
+
spec: query.spec.plugin.spec
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
queries,
|
|
53
|
+
definitions
|
|
54
|
+
};
|
|
55
|
+
}, [
|
|
56
|
+
datasource,
|
|
57
|
+
filters,
|
|
58
|
+
metricName,
|
|
59
|
+
rateEnabled,
|
|
60
|
+
type
|
|
61
|
+
]);
|
|
62
|
+
if (isLoading) {
|
|
63
|
+
return /*#__PURE__*/ _jsx(Stack, {
|
|
64
|
+
...props,
|
|
65
|
+
children: /*#__PURE__*/ _jsx(Skeleton, {
|
|
66
|
+
variant: "rectangular",
|
|
67
|
+
height: "100%"
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
72
|
+
ref: panelRef,
|
|
73
|
+
alignItems: "end",
|
|
74
|
+
...props,
|
|
75
|
+
children: [
|
|
76
|
+
(type === undefined || type === 'summary' || type === 'histogram') && /*#__PURE__*/ _jsx(FormControlLabel, {
|
|
77
|
+
control: /*#__PURE__*/ _jsx(Checkbox, {
|
|
78
|
+
size: "small"
|
|
79
|
+
}),
|
|
80
|
+
label: "Enable rate",
|
|
81
|
+
checked: rateEnabled,
|
|
82
|
+
onChange: (_, checked)=>setRateEnabled(checked)
|
|
83
|
+
}),
|
|
84
|
+
/*#__PURE__*/ _jsx(DataQueriesProvider, {
|
|
85
|
+
definitions: definitions,
|
|
86
|
+
options: {
|
|
87
|
+
suggestedStepMs,
|
|
88
|
+
mode: 'range'
|
|
89
|
+
},
|
|
90
|
+
children: /*#__PURE__*/ _jsx(Panel, {
|
|
91
|
+
panelOptions: {
|
|
92
|
+
hideHeader: true
|
|
93
|
+
},
|
|
94
|
+
definition: {
|
|
95
|
+
kind: 'Panel',
|
|
96
|
+
spec: {
|
|
97
|
+
queries: queries,
|
|
98
|
+
display: {
|
|
99
|
+
name: ''
|
|
100
|
+
},
|
|
101
|
+
plugin: {
|
|
102
|
+
kind: 'TimeSeriesChart',
|
|
103
|
+
spec: {}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
export function MetricOverview({ metricName, datasource, filters, isMetadataEnabled, isPanelEnabled, onExplore, onFiltersChange, ...props }) {
|
|
113
|
+
const [tab, setTab] = useState(0);
|
|
114
|
+
const { metadata, isLoading: isMetadataLoading } = useMetricMetadata(metricName, datasource);
|
|
115
|
+
const filtersWithMetricName = useMemo(()=>{
|
|
116
|
+
const result = filters.filter((filter)=>filter.label !== '__name__');
|
|
117
|
+
result.push({
|
|
118
|
+
label: '__name__',
|
|
119
|
+
labelValues: [
|
|
120
|
+
metricName
|
|
121
|
+
],
|
|
122
|
+
operator: '='
|
|
123
|
+
});
|
|
124
|
+
return result;
|
|
125
|
+
}, [
|
|
126
|
+
filters,
|
|
127
|
+
metricName
|
|
128
|
+
]);
|
|
129
|
+
function handleFilterAdd(filter) {
|
|
130
|
+
onFiltersChange([
|
|
131
|
+
...filters,
|
|
132
|
+
filter
|
|
133
|
+
]);
|
|
134
|
+
}
|
|
135
|
+
function handleExplore(metricName, tab) {
|
|
136
|
+
onExplore?.(metricName);
|
|
137
|
+
if (tab !== undefined) {
|
|
138
|
+
setTab(tab);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
142
|
+
sx: {
|
|
143
|
+
width: '100%'
|
|
144
|
+
},
|
|
145
|
+
...props,
|
|
146
|
+
children: [
|
|
147
|
+
isPanelEnabled && /*#__PURE__*/ _jsx(OverviewPanel, {
|
|
148
|
+
metricName: metricName,
|
|
149
|
+
filters: filters,
|
|
150
|
+
datasource: datasource,
|
|
151
|
+
type: metadata?.type,
|
|
152
|
+
height: "250px",
|
|
153
|
+
isLoading: isMetadataEnabled && isMetadataLoading
|
|
154
|
+
}),
|
|
155
|
+
/*#__PURE__*/ _jsxs(Tabs, {
|
|
156
|
+
value: tab,
|
|
157
|
+
onChange: (_, state)=>setTab(state),
|
|
158
|
+
variant: "scrollable",
|
|
159
|
+
sx: {
|
|
160
|
+
borderBottom: 1,
|
|
161
|
+
borderColor: 'divider'
|
|
162
|
+
},
|
|
163
|
+
children: [
|
|
164
|
+
/*#__PURE__*/ _jsx(Tab, {
|
|
165
|
+
label: "Overview"
|
|
166
|
+
}),
|
|
167
|
+
/*#__PURE__*/ _jsx(Tab, {
|
|
168
|
+
label: "Job related metrics",
|
|
169
|
+
icon: /*#__PURE__*/ _jsx(Tooltip, {
|
|
170
|
+
title: "All metrics scraped from the same job",
|
|
171
|
+
placement: "top",
|
|
172
|
+
children: /*#__PURE__*/ _jsx(HelpCircleOutlineIcon, {})
|
|
173
|
+
}),
|
|
174
|
+
iconPosition: "end"
|
|
175
|
+
}),
|
|
176
|
+
filters.length > 0 && /*#__PURE__*/ _jsx(Tab, {
|
|
177
|
+
label: "Similar metrics",
|
|
178
|
+
icon: /*#__PURE__*/ _jsx(Tooltip, {
|
|
179
|
+
title: "All metrics matching current filters",
|
|
180
|
+
placement: "top",
|
|
181
|
+
children: /*#__PURE__*/ _jsx(HelpCircleOutlineIcon, {})
|
|
182
|
+
}),
|
|
183
|
+
iconPosition: "end"
|
|
184
|
+
})
|
|
185
|
+
]
|
|
186
|
+
}),
|
|
187
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
188
|
+
gap: 1,
|
|
189
|
+
children: [
|
|
190
|
+
tab === 0 && /*#__PURE__*/ _jsx(OverviewTab, {
|
|
191
|
+
metricName: metricName,
|
|
192
|
+
datasource: datasource,
|
|
193
|
+
filters: filtersWithMetricName,
|
|
194
|
+
onFilterAdd: handleFilterAdd
|
|
195
|
+
}),
|
|
196
|
+
tab === 1 && /*#__PURE__*/ _jsx(JobTab, {
|
|
197
|
+
filters: filtersWithMetricName,
|
|
198
|
+
datasource: datasource,
|
|
199
|
+
isMetadataEnabled: isMetadataEnabled,
|
|
200
|
+
onExplore: (metricName)=>handleExplore(metricName, 0)
|
|
201
|
+
}),
|
|
202
|
+
tab === 2 && /*#__PURE__*/ _jsx(SimilarTab, {
|
|
203
|
+
filters: filtersWithMetricName,
|
|
204
|
+
datasource: datasource,
|
|
205
|
+
isMetadataEnabled: isMetadataEnabled,
|
|
206
|
+
onExplore: (metricName)=>handleExplore(metricName, 0)
|
|
207
|
+
})
|
|
208
|
+
]
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
//# sourceMappingURL=MetricOverview.js.map
|