@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
package/{dist → lib}/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js
RENAMED
|
@@ -23,24 +23,24 @@ Object.defineProperty(exports, "PrometheusTimeSeriesQueryEditor", {
|
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
24
|
const _immer = require("immer");
|
|
25
25
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
26
|
+
const _components = require("@perses-dev/components");
|
|
26
27
|
const _material = require("@mui/material");
|
|
27
28
|
const _model = require("../../model");
|
|
28
29
|
const _types = require("../types");
|
|
29
|
-
const
|
|
30
|
+
const _components1 = require("../../components");
|
|
30
31
|
const _queryeditormodel = require("./query-editor-model");
|
|
31
32
|
function PrometheusTimeSeriesQueryEditor(props) {
|
|
32
33
|
const { onChange, value } = props;
|
|
33
34
|
const { datasource } = value;
|
|
34
|
-
const selectedDatasource = datasource
|
|
35
|
-
const datasourceSelectLabelID =
|
|
35
|
+
const selectedDatasource = datasource ?? _model.DEFAULT_PROM;
|
|
36
|
+
const datasourceSelectLabelID = (0, _components.useId)('prom-datasource-label'); // for panels with multiple queries, this component is rendered multiple times on the same page
|
|
36
37
|
const { data: client } = (0, _pluginsystem.useDatasourceClient)(selectedDatasource);
|
|
37
|
-
const promURL = client
|
|
38
|
+
const promURL = client?.options.datasourceUrl;
|
|
38
39
|
const { data: datasourceResource } = (0, _pluginsystem.useDatasource)(selectedDatasource);
|
|
39
40
|
const { handleQueryChange, handleQueryBlur } = (0, _queryeditormodel.useQueryState)(props);
|
|
40
41
|
const { format, handleFormatChange, handleFormatBlur } = (0, _queryeditormodel.useFormatState)(props);
|
|
41
42
|
const { minStep, handleMinStepChange, handleMinStepBlur } = (0, _queryeditormodel.useMinStepState)(props);
|
|
42
|
-
|
|
43
|
-
const minStepPlaceholder = (_ref = minStep !== null && minStep !== void 0 ? minStep : datasourceResource && (datasourceResource === null || datasourceResource === void 0 ? void 0 : datasourceResource.plugin.spec).scrapeInterval) !== null && _ref !== void 0 ? _ref : _types.DEFAULT_SCRAPE_INTERVAL;
|
|
43
|
+
const minStepPlaceholder = minStep ?? (datasourceResource && (datasourceResource?.plugin.spec).scrapeInterval) ?? _types.DEFAULT_SCRAPE_INTERVAL;
|
|
44
44
|
const handleDatasourceChange = (next)=>{
|
|
45
45
|
if ((0, _model.isPrometheusDatasourceSelector)(next)) {
|
|
46
46
|
onChange((0, _immer.produce)(value, (draft)=>{
|
|
@@ -61,6 +61,7 @@ function PrometheusTimeSeriesQueryEditor(props) {
|
|
|
61
61
|
children: [
|
|
62
62
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputLabel, {
|
|
63
63
|
id: datasourceSelectLabelID,
|
|
64
|
+
shrink: true,
|
|
64
65
|
children: "Prometheus Datasource"
|
|
65
66
|
}),
|
|
66
67
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
|
|
@@ -68,11 +69,12 @@ function PrometheusTimeSeriesQueryEditor(props) {
|
|
|
68
69
|
value: selectedDatasource,
|
|
69
70
|
onChange: handleDatasourceChange,
|
|
70
71
|
labelId: datasourceSelectLabelID,
|
|
71
|
-
label: "Prometheus Datasource"
|
|
72
|
+
label: "Prometheus Datasource",
|
|
73
|
+
notched: true
|
|
72
74
|
})
|
|
73
75
|
]
|
|
74
76
|
}),
|
|
75
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
77
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.PromQLEditor, {
|
|
76
78
|
completeConfig: {
|
|
77
79
|
remote: {
|
|
78
80
|
url: promURL
|
|
@@ -92,7 +94,7 @@ function PrometheusTimeSeriesQueryEditor(props) {
|
|
|
92
94
|
label: "Legend",
|
|
93
95
|
placeholder: "Example: '{{instance}}' will generate series names like 'webserver-123', 'webserver-456'...",
|
|
94
96
|
helperText: "Text to be displayed in the legend and the tooltip. Use {{label_name}} to interpolate label values.",
|
|
95
|
-
value: format
|
|
97
|
+
value: format ?? '',
|
|
96
98
|
onChange: (e)=>handleFormatChange(e.target.value),
|
|
97
99
|
onBlur: handleFormatBlur
|
|
98
100
|
}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -34,16 +34,13 @@ const getTimeSeriesData = async (spec, context)=>{
|
|
|
34
34
|
series: []
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
var _datasource_plugin_spec_scrapeInterval;
|
|
40
|
-
const datasourceScrapeInterval = Math.trunc((0, _datefns.milliseconds)((0, _core.parseDurationString)((_datasource_plugin_spec_scrapeInterval = datasource.plugin.spec.scrapeInterval) !== null && _datasource_plugin_spec_scrapeInterval !== void 0 ? _datasource_plugin_spec_scrapeInterval : _types.DEFAULT_SCRAPE_INTERVAL)) / 1000);
|
|
41
|
-
var _getDurationStringSeconds;
|
|
37
|
+
const datasource = await context.datasourceStore.getDatasource(spec.datasource ?? _model.DEFAULT_PROM);
|
|
38
|
+
const datasourceScrapeInterval = Math.trunc((0, _datefns.milliseconds)((0, _core.parseDurationString)(datasource.plugin.spec.scrapeInterval ?? _types.DEFAULT_SCRAPE_INTERVAL)) / 1000);
|
|
42
39
|
// Min step is the lower bound of the interval between data points
|
|
43
40
|
// If no value is provided for it, it should default to the scrape interval of the datasource
|
|
44
|
-
const minStep = (
|
|
41
|
+
const minStep = (0, _model.getDurationStringSeconds)(// resolve any variable that may have been provided
|
|
45
42
|
// TODO add a validation check to make sure the variable is a DurationString, to avoid the back & forth cast here
|
|
46
|
-
(0, _pluginsystem.replaceVariables)(spec.minStep, context.variableState))
|
|
43
|
+
(0, _pluginsystem.replaceVariables)(spec.minStep, context.variableState)) ?? datasourceScrapeInterval;
|
|
47
44
|
const timeRange = (0, _model.getPrometheusTimeRange)(context.timeRange);
|
|
48
45
|
const step = (0, _model.getRangeStep)(timeRange, minStep, undefined, context.suggestedStepMs); // TODO: resolution
|
|
49
46
|
// Align the time range so that it's a multiple of the step
|
|
@@ -63,9 +60,8 @@ const getTimeSeriesData = async (spec, context)=>{
|
|
|
63
60
|
if (seriesNameFormat) {
|
|
64
61
|
seriesNameFormat = (0, _pluginsystem.replaceVariables)(seriesNameFormat, context.variableState);
|
|
65
62
|
}
|
|
66
|
-
var _spec_datasource1;
|
|
67
63
|
// Get the datasource, using the default Prom Datasource if one isn't specified in the query
|
|
68
|
-
const client = await context.datasourceStore.getDatasourceClient(
|
|
64
|
+
const client = await context.datasourceStore.getDatasourceClient(spec.datasource ?? _model.DEFAULT_PROM);
|
|
69
65
|
// Make the request to Prom
|
|
70
66
|
let response;
|
|
71
67
|
switch(context.mode){
|
|
@@ -90,10 +86,8 @@ const getTimeSeriesData = async (spec, context)=>{
|
|
|
90
86
|
// Custom display for response header warnings, configurable error responses display coming next
|
|
91
87
|
const notices = [];
|
|
92
88
|
if (response.status === 'success') {
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
var _warnings_;
|
|
96
|
-
const warningMessage = (_warnings_ = warnings[0]) !== null && _warnings_ !== void 0 ? _warnings_ : '';
|
|
89
|
+
const warnings = response.warnings ?? [];
|
|
90
|
+
const warningMessage = warnings[0] ?? '';
|
|
97
91
|
if (warningMessage !== '') {
|
|
98
92
|
notices.push({
|
|
99
93
|
type: 'warning',
|
|
@@ -109,7 +103,7 @@ const getTimeSeriesData = async (spec, context)=>{
|
|
|
109
103
|
end: (0, _datefns.fromUnixTime)(end)
|
|
110
104
|
},
|
|
111
105
|
stepMs: step * 1000,
|
|
112
|
-
series: buildTimeSeries(
|
|
106
|
+
series: buildTimeSeries(query, result, seriesNameFormat),
|
|
113
107
|
metadata: {
|
|
114
108
|
notices,
|
|
115
109
|
executedQueryString: query
|
|
@@ -117,35 +111,63 @@ const getTimeSeriesData = async (spec, context)=>{
|
|
|
117
111
|
};
|
|
118
112
|
return chartData;
|
|
119
113
|
};
|
|
120
|
-
function buildVectorData(
|
|
114
|
+
function buildVectorData(query, data, seriesNameFormat) {
|
|
121
115
|
return data.result.map((res)=>{
|
|
122
|
-
const { metric, value } = res;
|
|
116
|
+
const { metric, value, histogram } = res;
|
|
123
117
|
// Account for seriesNameFormat from query editor when determining name to show in legend, tooltip, etc.
|
|
124
118
|
const { name, formattedName } = (0, _utils.getFormattedPrometheusSeriesName)(query, metric, seriesNameFormat);
|
|
119
|
+
if (histogram) {
|
|
120
|
+
return {
|
|
121
|
+
name,
|
|
122
|
+
formattedName,
|
|
123
|
+
labels: metric,
|
|
124
|
+
values: [
|
|
125
|
+
(0, _model.parseValueTuple)([
|
|
126
|
+
histogram[0],
|
|
127
|
+
histogram[1].sum
|
|
128
|
+
])
|
|
129
|
+
],
|
|
130
|
+
histograms: [
|
|
131
|
+
histogram
|
|
132
|
+
]
|
|
133
|
+
};
|
|
134
|
+
}
|
|
125
135
|
return {
|
|
126
136
|
name,
|
|
137
|
+
formattedName,
|
|
138
|
+
labels: metric,
|
|
127
139
|
values: [
|
|
128
140
|
(0, _model.parseValueTuple)(value)
|
|
129
|
-
]
|
|
130
|
-
formattedName,
|
|
131
|
-
labels: metric
|
|
141
|
+
]
|
|
132
142
|
};
|
|
133
143
|
});
|
|
134
144
|
}
|
|
135
|
-
function buildMatrixData(
|
|
145
|
+
function buildMatrixData(query, data, seriesNameFormat) {
|
|
136
146
|
return data.result.map((res)=>{
|
|
137
|
-
const { metric, values } = res;
|
|
147
|
+
const { metric, values, histograms } = res;
|
|
138
148
|
// Account for seriesNameFormat from query editor when determining name to show in legend, tooltip, etc.
|
|
139
149
|
const { name, formattedName } = (0, _utils.getFormattedPrometheusSeriesName)(query, metric, seriesNameFormat);
|
|
150
|
+
if (histograms) {
|
|
151
|
+
return {
|
|
152
|
+
name,
|
|
153
|
+
formattedName,
|
|
154
|
+
labels: metric,
|
|
155
|
+
values: histograms.map((histogram)=>(0, _model.parseValueTuple)([
|
|
156
|
+
histogram[0],
|
|
157
|
+
histogram[1].sum
|
|
158
|
+
])),
|
|
159
|
+
histograms: histograms.map((histogram)=>histogram)
|
|
160
|
+
};
|
|
161
|
+
}
|
|
140
162
|
return {
|
|
141
163
|
name,
|
|
142
|
-
values: values.map(_model.parseValueTuple),
|
|
143
164
|
formattedName,
|
|
144
|
-
labels: metric
|
|
165
|
+
labels: metric,
|
|
166
|
+
values: values.map(_model.parseValueTuple)
|
|
145
167
|
};
|
|
146
168
|
});
|
|
147
169
|
}
|
|
148
|
-
function buildScalarData(
|
|
170
|
+
function buildScalarData(query, data, seriesNameFormat) {
|
|
149
171
|
const { name, formattedName } = (0, _utils.getFormattedPrometheusSeriesName)(query, {}, seriesNameFormat);
|
|
150
172
|
return [
|
|
151
173
|
{
|
|
@@ -157,18 +179,18 @@ function buildScalarData(data, query, seriesNameFormat) {
|
|
|
157
179
|
}
|
|
158
180
|
];
|
|
159
181
|
}
|
|
160
|
-
function buildTimeSeries(
|
|
182
|
+
function buildTimeSeries(query, data, seriesNameFormat) {
|
|
161
183
|
if (!data) {
|
|
162
184
|
return [];
|
|
163
185
|
}
|
|
164
186
|
const resultType = data.resultType;
|
|
165
187
|
switch(resultType){
|
|
166
188
|
case 'vector':
|
|
167
|
-
return buildVectorData(
|
|
189
|
+
return buildVectorData(query, data, seriesNameFormat);
|
|
168
190
|
case 'matrix':
|
|
169
|
-
return buildMatrixData(
|
|
191
|
+
return buildMatrixData(query, data, seriesNameFormat);
|
|
170
192
|
case 'scalar':
|
|
171
|
-
return buildScalarData(
|
|
193
|
+
return buildScalarData(query, data, seriesNameFormat);
|
|
172
194
|
default:
|
|
173
195
|
console.warn('Unknown result type', resultType, data);
|
|
174
196
|
return [];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
_export_star(require("./PrometheusTimeSeriesQuery"), exports);
|
|
18
|
+
_export_star(require("./PrometheusTimeSeriesQueryEditor"), exports);
|
|
19
|
+
_export_star(require("./get-time-series-data"), exports);
|
|
20
|
+
_export_star(require("./replace-prom-builtin-variables"), exports);
|
|
21
|
+
_export_star(require("./query-editor-model"), exports);
|
|
22
|
+
_export_star(require("./time-series-query-model"), exports);
|
|
23
|
+
function _export_star(from, to) {
|
|
24
|
+
Object.keys(from).forEach(function(k) {
|
|
25
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
26
|
+
Object.defineProperty(to, k, {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function() {
|
|
29
|
+
return from[k];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return from;
|
|
35
|
+
}
|
|
@@ -21,27 +21,36 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
|
|
25
|
-
return
|
|
24
|
+
PrometheusLabelNamesVariableEditor: function() {
|
|
25
|
+
return PrometheusLabelNamesVariableEditor;
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
PrometheusLabelValuesVariableEditor: function() {
|
|
28
|
+
return PrometheusLabelValuesVariableEditor;
|
|
29
29
|
},
|
|
30
|
-
|
|
31
|
-
return
|
|
30
|
+
PrometheusPromQLVariableEditor: function() {
|
|
31
|
+
return PrometheusPromQLVariableEditor;
|
|
32
|
+
},
|
|
33
|
+
capturingMatrix: function() {
|
|
34
|
+
return capturingMatrix;
|
|
35
|
+
},
|
|
36
|
+
capturingVector: function() {
|
|
37
|
+
return capturingVector;
|
|
38
|
+
},
|
|
39
|
+
stringArrayToVariableOptions: function() {
|
|
40
|
+
return stringArrayToVariableOptions;
|
|
32
41
|
}
|
|
33
42
|
});
|
|
34
43
|
const _jsxruntime = require("react/jsx-runtime");
|
|
35
|
-
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
36
44
|
const _material = require("@mui/material");
|
|
45
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
37
46
|
const _immer = require("immer");
|
|
38
|
-
const _model = require("../model");
|
|
39
47
|
const _components = require("../components");
|
|
48
|
+
const _model = require("../model");
|
|
40
49
|
const _MatcherEditor = require("./MatcherEditor");
|
|
41
50
|
function PrometheusLabelValuesVariableEditor(props) {
|
|
42
51
|
const { onChange, value } = props;
|
|
43
52
|
const { datasource } = value;
|
|
44
|
-
const selectedDatasource = datasource
|
|
53
|
+
const selectedDatasource = datasource ?? _model.DEFAULT_PROM;
|
|
45
54
|
const handleDatasourceChange = (next)=>{
|
|
46
55
|
if ((0, _model.isPrometheusDatasourceSelector)(next)) {
|
|
47
56
|
onChange((0, _immer.produce)(value, (draft)=>{
|
|
@@ -52,7 +61,6 @@ function PrometheusLabelValuesVariableEditor(props) {
|
|
|
52
61
|
}
|
|
53
62
|
throw new Error('Got unexpected non-Prometheus datasource selector');
|
|
54
63
|
};
|
|
55
|
-
var _props_value_matchers;
|
|
56
64
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
57
65
|
spacing: 2,
|
|
58
66
|
children: [
|
|
@@ -88,7 +96,7 @@ function PrometheusLabelValuesVariableEditor(props) {
|
|
|
88
96
|
}
|
|
89
97
|
}),
|
|
90
98
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_MatcherEditor.MatcherEditor, {
|
|
91
|
-
matchers:
|
|
99
|
+
matchers: props.value.matchers ?? [],
|
|
92
100
|
onChange: (e)=>{
|
|
93
101
|
props.onChange({
|
|
94
102
|
...props.value,
|
|
@@ -103,7 +111,7 @@ function PrometheusLabelValuesVariableEditor(props) {
|
|
|
103
111
|
function PrometheusLabelNamesVariableEditor(props) {
|
|
104
112
|
const { onChange, value } = props;
|
|
105
113
|
const { datasource } = value;
|
|
106
|
-
const selectedDatasource = datasource
|
|
114
|
+
const selectedDatasource = datasource ?? _model.DEFAULT_PROM;
|
|
107
115
|
const handleDatasourceChange = (next)=>{
|
|
108
116
|
if ((0, _model.isPrometheusDatasourceSelector)(next)) {
|
|
109
117
|
onChange((0, _immer.produce)(value, (draft)=>{
|
|
@@ -114,7 +122,6 @@ function PrometheusLabelNamesVariableEditor(props) {
|
|
|
114
122
|
}
|
|
115
123
|
throw new Error('Got unexpected non-Prometheus datasource selector');
|
|
116
124
|
};
|
|
117
|
-
var _props_value_matchers;
|
|
118
125
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
119
126
|
spacing: 2,
|
|
120
127
|
children: [
|
|
@@ -136,7 +143,7 @@ function PrometheusLabelNamesVariableEditor(props) {
|
|
|
136
143
|
]
|
|
137
144
|
}),
|
|
138
145
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_MatcherEditor.MatcherEditor, {
|
|
139
|
-
matchers:
|
|
146
|
+
matchers: props.value.matchers ?? [],
|
|
140
147
|
isReadonly: props.isReadonly,
|
|
141
148
|
onChange: (e)=>{
|
|
142
149
|
props.onChange({
|
|
@@ -151,9 +158,9 @@ function PrometheusLabelNamesVariableEditor(props) {
|
|
|
151
158
|
function PrometheusPromQLVariableEditor(props) {
|
|
152
159
|
const { onChange, value } = props;
|
|
153
160
|
const { datasource } = value;
|
|
154
|
-
const selectedDatasource = datasource
|
|
161
|
+
const selectedDatasource = datasource ?? _model.DEFAULT_PROM;
|
|
155
162
|
const { data: client } = (0, _pluginsystem.useDatasourceClient)(selectedDatasource);
|
|
156
|
-
const promURL = client
|
|
163
|
+
const promURL = client?.options.datasourceUrl;
|
|
157
164
|
const handleDatasourceChange = (next)=>{
|
|
158
165
|
if ((0, _model.isPrometheusDatasourceSelector)(next)) {
|
|
159
166
|
onChange((0, _immer.produce)(value, (draft)=>{
|
|
@@ -193,10 +200,9 @@ function PrometheusPromQLVariableEditor(props) {
|
|
|
193
200
|
value: value.expr,
|
|
194
201
|
datasource: selectedDatasource,
|
|
195
202
|
onBlur: (event)=>{
|
|
196
|
-
var _event_target_textContent;
|
|
197
203
|
props.onChange({
|
|
198
204
|
...props.value,
|
|
199
|
-
expr:
|
|
205
|
+
expr: event.target.textContent ?? ''
|
|
200
206
|
});
|
|
201
207
|
},
|
|
202
208
|
readOnly: props.isReadonly,
|
|
@@ -238,92 +244,10 @@ function capturingVector(vector, labelName) {
|
|
|
238
244
|
}
|
|
239
245
|
return Array.from(captured.values());
|
|
240
246
|
}
|
|
241
|
-
|
|
242
|
-
* Takes a list of strings and returns a list of VariableOptions
|
|
243
|
-
*/ const stringArrayToVariableOptions = (values)=>{
|
|
247
|
+
const stringArrayToVariableOptions = (values)=>{
|
|
244
248
|
if (!values) return [];
|
|
245
249
|
return values.map((value)=>({
|
|
246
250
|
value,
|
|
247
251
|
label: value
|
|
248
252
|
}));
|
|
249
253
|
};
|
|
250
|
-
const PrometheusLabelNamesVariable = {
|
|
251
|
-
getVariableOptions: async (spec, ctx)=>{
|
|
252
|
-
var _spec_datasource;
|
|
253
|
-
const client = await ctx.datasourceStore.getDatasourceClient((_spec_datasource = spec.datasource) !== null && _spec_datasource !== void 0 ? _spec_datasource : _model.DEFAULT_PROM);
|
|
254
|
-
const match = spec.matchers ? spec.matchers.map((m)=>(0, _pluginsystem.replaceVariables)(m, ctx.variables)) : undefined;
|
|
255
|
-
const timeRange = (0, _model.getPrometheusTimeRange)(ctx.timeRange);
|
|
256
|
-
const { data: options } = await client.labelNames({
|
|
257
|
-
'match[]': match,
|
|
258
|
-
...timeRange
|
|
259
|
-
});
|
|
260
|
-
return {
|
|
261
|
-
data: stringArrayToVariableOptions(options)
|
|
262
|
-
};
|
|
263
|
-
},
|
|
264
|
-
dependsOn: (spec)=>{
|
|
265
|
-
var _spec_matchers;
|
|
266
|
-
return {
|
|
267
|
-
variables: ((_spec_matchers = spec.matchers) === null || _spec_matchers === void 0 ? void 0 : _spec_matchers.map((m)=>(0, _pluginsystem.parseVariables)(m)).flat()) || []
|
|
268
|
-
};
|
|
269
|
-
},
|
|
270
|
-
OptionsEditorComponent: PrometheusLabelNamesVariableEditor,
|
|
271
|
-
createInitialOptions: ()=>({})
|
|
272
|
-
};
|
|
273
|
-
const PrometheusLabelValuesVariable = {
|
|
274
|
-
getVariableOptions: async (spec, ctx)=>{
|
|
275
|
-
const pluginDef = spec;
|
|
276
|
-
var _spec_datasource;
|
|
277
|
-
const client = await ctx.datasourceStore.getDatasourceClient((_spec_datasource = spec.datasource) !== null && _spec_datasource !== void 0 ? _spec_datasource : _model.DEFAULT_PROM);
|
|
278
|
-
const match = pluginDef.matchers ? pluginDef.matchers.map((m)=>(0, _pluginsystem.replaceVariables)(m, ctx.variables)) : undefined;
|
|
279
|
-
const timeRange = (0, _model.getPrometheusTimeRange)(ctx.timeRange);
|
|
280
|
-
const { data: options } = await client.labelValues({
|
|
281
|
-
labelName: (0, _pluginsystem.replaceVariables)(pluginDef.labelName, ctx.variables),
|
|
282
|
-
'match[]': match,
|
|
283
|
-
...timeRange
|
|
284
|
-
});
|
|
285
|
-
return {
|
|
286
|
-
data: stringArrayToVariableOptions(options)
|
|
287
|
-
};
|
|
288
|
-
},
|
|
289
|
-
dependsOn: (spec)=>{
|
|
290
|
-
var _spec_matchers;
|
|
291
|
-
return {
|
|
292
|
-
variables: ((_spec_matchers = spec.matchers) === null || _spec_matchers === void 0 ? void 0 : _spec_matchers.map((m)=>(0, _pluginsystem.parseVariables)(m)).flat().concat((0, _pluginsystem.parseVariables)(spec.labelName))) || []
|
|
293
|
-
};
|
|
294
|
-
},
|
|
295
|
-
OptionsEditorComponent: PrometheusLabelValuesVariableEditor,
|
|
296
|
-
createInitialOptions: ()=>({
|
|
297
|
-
labelName: ''
|
|
298
|
-
})
|
|
299
|
-
};
|
|
300
|
-
const PrometheusPromQLVariable = {
|
|
301
|
-
getVariableOptions: async (spec, ctx)=>{
|
|
302
|
-
var _spec_datasource;
|
|
303
|
-
const client = await ctx.datasourceStore.getDatasourceClient((_spec_datasource = spec.datasource) !== null && _spec_datasource !== void 0 ? _spec_datasource : _model.DEFAULT_PROM);
|
|
304
|
-
// TODO we may want to manage a range query as well.
|
|
305
|
-
const { data: options } = await client.instantQuery({
|
|
306
|
-
query: (0, _pluginsystem.replaceVariables)(spec.expr, ctx.variables)
|
|
307
|
-
});
|
|
308
|
-
const labelName = (0, _pluginsystem.replaceVariables)(spec.labelName, ctx.variables);
|
|
309
|
-
let values = [];
|
|
310
|
-
if ((options === null || options === void 0 ? void 0 : options.resultType) === 'matrix') {
|
|
311
|
-
values = capturingMatrix(options, labelName);
|
|
312
|
-
} else if ((options === null || options === void 0 ? void 0 : options.resultType) === 'vector') {
|
|
313
|
-
values = capturingVector(options, labelName);
|
|
314
|
-
}
|
|
315
|
-
return {
|
|
316
|
-
data: stringArrayToVariableOptions(values)
|
|
317
|
-
};
|
|
318
|
-
},
|
|
319
|
-
dependsOn: (spec)=>{
|
|
320
|
-
return {
|
|
321
|
-
variables: (0, _pluginsystem.parseVariables)(spec.expr).concat((0, _pluginsystem.parseVariables)(spec.labelName))
|
|
322
|
-
};
|
|
323
|
-
},
|
|
324
|
-
OptionsEditorComponent: PrometheusPromQLVariableEditor,
|
|
325
|
-
createInitialOptions: ()=>({
|
|
326
|
-
expr: '',
|
|
327
|
-
labelName: ''
|
|
328
|
-
})
|
|
329
|
-
};
|
|
@@ -69,8 +69,7 @@ function StaticListVariableOptionEditor(props) {
|
|
|
69
69
|
}
|
|
70
70
|
const StaticListVariable = {
|
|
71
71
|
getVariableOptions: async (spec)=>{
|
|
72
|
-
|
|
73
|
-
const values = (_spec_values = spec.values) === null || _spec_values === void 0 ? void 0 : _spec_values.map((v)=>{
|
|
72
|
+
const values = spec.values?.map((v)=>{
|
|
74
73
|
if (typeof v === 'string') {
|
|
75
74
|
return {
|
|
76
75
|
label: v,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
require("@testing-library/jest-dom");
|
|
18
|
+
// Always mock e-charts during tests since we don't have a proper canvas in jsdom
|
|
19
|
+
jest.mock('echarts/core');
|
|
@@ -34,8 +34,7 @@ _export(exports, {
|
|
|
34
34
|
function formatSeriesName(inputFormat, seriesLabels) {
|
|
35
35
|
const resolveLabelsRegex = /\{\{\s*(.+?)\s*\}\}/g;
|
|
36
36
|
return inputFormat.replace(resolveLabelsRegex, (_match, token)=>{
|
|
37
|
-
|
|
38
|
-
const resolvedValue = (_seriesLabels_token = seriesLabels[token]) !== null && _seriesLabels_token !== void 0 ? _seriesLabels_token : '';
|
|
37
|
+
const resolvedValue = seriesLabels[token] ?? '';
|
|
39
38
|
return resolvedValue;
|
|
40
39
|
});
|
|
41
40
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PromQLEditor.d.ts","sourceRoot":"","sources":["../../../src/components/PromQLEditor.tsx"],"names":[],"mappings":"AAaA,OAAmB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAmB,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAI1F,OAAO,EAAE,YAAY,EAAqB,MAAM,OAAO,CAAC;AAIxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AASxD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,cAAc,EAAE,qBAAqB,CAAC;IACtC,UAAU,EAAE,4BAA4B,CAAC;CAC1C,GAAG,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,YAAY,CAAC,CAAC;AAEvD,wBAAgB,YAAY,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB,GAAG,YAAY,CAoHrG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
2
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
// you may not use this file except in compliance with the License.
|
|
4
4
|
// You may obtain a copy of the License at
|
|
@@ -21,7 +21,7 @@ import { ErrorAlert } from '@perses-dev/components';
|
|
|
21
21
|
import CloseIcon from 'mdi-material-ui/Close';
|
|
22
22
|
import { useReplaceVariablesInString } from '@perses-dev/plugin-system';
|
|
23
23
|
import { replacePromBuiltinVariables } from '../plugins/prometheus-time-series-query/replace-prom-builtin-variables';
|
|
24
|
-
import { useParseQuery } from './
|
|
24
|
+
import { useParseQuery } from './query';
|
|
25
25
|
import TreeNode from './TreeNode';
|
|
26
26
|
const treeViewStr = 'Tree View';
|
|
27
27
|
const treeViewOpenStr = 'Open ' + treeViewStr;
|
|
@@ -43,7 +43,7 @@ export function PromQLEditor({ completeConfig, datasource, ...rest }) {
|
|
|
43
43
|
// queries here, so maybe we should extract this part to independant hook(s), to be reused here?
|
|
44
44
|
queryExpr = replacePromBuiltinVariables(queryExpr, 12345, 12345);
|
|
45
45
|
}
|
|
46
|
-
const { data: parseQueryResponse, isLoading, error } = useParseQuery(queryExpr
|
|
46
|
+
const { data: parseQueryResponse, isLoading, error } = useParseQuery(queryExpr ?? '', datasource, isTreeViewVisible);
|
|
47
47
|
const handleShowTreeView = ()=>{
|
|
48
48
|
setTreeViewVisible(!isTreeViewVisible);
|
|
49
49
|
};
|
|
@@ -105,7 +105,7 @@ export function PromQLEditor({ completeConfig, datasource, ...rest }) {
|
|
|
105
105
|
fontSize: '18px'
|
|
106
106
|
}
|
|
107
107
|
})
|
|
108
|
-
})
|
|
108
|
+
}, "tree-view-button")
|
|
109
109
|
}),
|
|
110
110
|
isTreeViewVisible && /*#__PURE__*/ _jsxs("div", {
|
|
111
111
|
style: {
|
|
@@ -129,7 +129,7 @@ export function PromQLEditor({ completeConfig, datasource, ...rest }) {
|
|
|
129
129
|
fontSize: '18px'
|
|
130
130
|
}
|
|
131
131
|
})
|
|
132
|
-
})
|
|
132
|
+
}, "tree-view-close-button")
|
|
133
133
|
}),
|
|
134
134
|
error ? // Here the user is able to hide the error alert
|
|
135
135
|
/*#__PURE__*/ _jsx(ErrorAlert, {
|
|
@@ -143,9 +143,11 @@ export function PromQLEditor({ completeConfig, datasource, ...rest }) {
|
|
|
143
143
|
overflowX: 'auto',
|
|
144
144
|
backgroundColor: theme.palette.background.default
|
|
145
145
|
},
|
|
146
|
-
children: isLoading ? /*#__PURE__*/ _jsx(CircularProgress, {}) :
|
|
146
|
+
children: isLoading ? /*#__PURE__*/ _jsx(CircularProgress, {}) : parseQueryResponse?.data ? /*#__PURE__*/ _jsx(TreeNode, {
|
|
147
147
|
node: parseQueryResponse.data,
|
|
148
|
-
reverse: false
|
|
148
|
+
reverse: false,
|
|
149
|
+
childIdx: 0,
|
|
150
|
+
datasource: datasource
|
|
149
151
|
}) : null
|
|
150
152
|
})
|
|
151
153
|
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PromQLEditor.tsx"],"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 CodeMirror, { ReactCodeMirrorProps } from '@uiw/react-codemirror';\nimport { PromQLExtension, CompleteConfiguration } from '@prometheus-io/codemirror-promql';\nimport { EditorView } from '@codemirror/view';\nimport { useTheme, CircularProgress, InputLabel, Stack, IconButton, Tooltip } from '@mui/material';\nimport FileTreeIcon from 'mdi-material-ui/FileTree';\nimport { ReactElement, useMemo, useState } from 'react';\nimport { ErrorAlert } from '@perses-dev/components';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { useReplaceVariablesInString } from '@perses-dev/plugin-system';\nimport { PrometheusDatasourceSelector } from '../model';\nimport { replacePromBuiltinVariables } from '../plugins/prometheus-time-series-query/replace-prom-builtin-variables';\nimport { useParseQuery } from './query';\nimport TreeNode from './TreeNode';\n\nconst treeViewStr = 'Tree View';\nconst treeViewOpenStr = 'Open ' + treeViewStr;\nconst treeViewCloseStr = 'Close ' + treeViewStr;\n\nexport type PromQLEditorProps = {\n completeConfig: CompleteConfiguration;\n datasource: PrometheusDatasourceSelector;\n} & Omit<ReactCodeMirrorProps, 'theme' | 'extensions'>;\n\nexport function PromQLEditor({ completeConfig, datasource, ...rest }: PromQLEditorProps): ReactElement {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n const [isTreeViewVisible, setTreeViewVisible] = useState(false);\n\n const promQLExtension = useMemo(() => {\n return new PromQLExtension().activateLinter(false).setComplete(completeConfig).asExtension();\n }, [completeConfig]);\n\n let queryExpr = useReplaceVariablesInString(rest.value);\n if (queryExpr) {\n // TODO placeholder values for steps to be replaced with actual values\n // Looks like providing proper values involves some refactoring: currently we'd need to rely on the timeseries query context,\n // but these step values are actually computed independently / before the queries are getting fired, so it's useless to fire\n // queries here, so maybe we should extract this part to independant hook(s), to be reused here?\n queryExpr = replacePromBuiltinVariables(queryExpr, 12345, 12345);\n }\n\n const { data: parseQueryResponse, isLoading, error } = useParseQuery(queryExpr ?? '', datasource, isTreeViewVisible);\n\n const handleShowTreeView = (): void => {\n setTreeViewVisible(!isTreeViewVisible);\n };\n\n return (\n <Stack position=\"relative\">\n <InputLabel // reproduce the same kind of input label that regular MUI TextFields have\n shrink\n sx={{\n position: 'absolute',\n top: '-8px',\n left: '10px',\n padding: '0 4px',\n color: theme.palette.text.primary,\n zIndex: 1,\n }}\n >\n PromQL Expression\n </InputLabel>\n <CodeMirror\n {...rest}\n style={{ border: `1px solid ${theme.palette.divider}` }}\n theme={isDarkMode ? 'dark' : 'light'}\n basicSetup={{\n highlightActiveLine: false,\n highlightActiveLineGutter: false,\n foldGutter: false,\n }}\n extensions={[\n EditorView.lineWrapping,\n promQLExtension,\n EditorView.theme({\n '.cm-content': {\n paddingTop: '8px',\n paddingBottom: '8px',\n paddingRight: '40px', // offset for the tree view button\n },\n }),\n ]}\n placeholder=\"Example: sum(rate(http_requests_total[5m]))\"\n />\n {queryExpr && (\n <>\n <Tooltip title={isTreeViewVisible ? treeViewCloseStr : treeViewOpenStr}>\n <IconButton\n aria-label={isTreeViewVisible ? treeViewCloseStr : treeViewOpenStr}\n onClick={handleShowTreeView}\n sx={{ position: 'absolute', right: '5px', top: '5px' }}\n size=\"small\"\n key=\"tree-view-button\"\n >\n <FileTreeIcon sx={{ fontSize: '18px' }} />\n </IconButton>\n </Tooltip>\n {isTreeViewVisible && (\n <div style={{ border: `1px solid ${theme.palette.divider}`, position: 'relative' }}>\n <Tooltip title={treeViewCloseStr}>\n <IconButton\n aria-label={treeViewCloseStr}\n onClick={() => setTreeViewVisible(false)}\n sx={{ position: 'absolute', top: '5px', right: '5px' }}\n size=\"small\"\n key=\"tree-view-close-button\"\n >\n <CloseIcon sx={{ fontSize: '18px' }} />\n </IconButton>\n </Tooltip>\n {error ? (\n // Here the user is able to hide the error alert\n <ErrorAlert\n error={{\n name: `${treeViewStr} not available`,\n message: error.message,\n }}\n />\n ) : (\n <div\n style={{\n padding: `${theme.spacing(1.5)} ${theme.spacing(1.5)} 0 ${theme.spacing(1.5)}`, // let paddingBottom at 0 because nodes have margin-bottom\n overflowX: 'auto',\n backgroundColor: theme.palette.background.default,\n }}\n >\n {isLoading ? (\n <CircularProgress />\n ) : parseQueryResponse?.data ? (\n <TreeNode node={parseQueryResponse.data} reverse={false} childIdx={0} datasource={datasource} />\n ) : null}\n </div>\n )}\n </div>\n )}\n </>\n )}\n </Stack>\n );\n}\n"],"names":["CodeMirror","PromQLExtension","EditorView","useTheme","CircularProgress","InputLabel","Stack","IconButton","Tooltip","FileTreeIcon","useMemo","useState","ErrorAlert","CloseIcon","useReplaceVariablesInString","replacePromBuiltinVariables","useParseQuery","TreeNode","treeViewStr","treeViewOpenStr","treeViewCloseStr","PromQLEditor","completeConfig","datasource","rest","theme","isDarkMode","palette","mode","isTreeViewVisible","setTreeViewVisible","promQLExtension","activateLinter","setComplete","asExtension","queryExpr","value","data","parseQueryResponse","isLoading","error","handleShowTreeView","position","shrink","sx","top","left","padding","color","text","primary","zIndex","style","border","divider","basicSetup","highlightActiveLine","highlightActiveLineGutter","foldGutter","extensions","lineWrapping","paddingTop","paddingBottom","paddingRight","placeholder","title","aria-label","onClick","right","size","fontSize","div","name","message","spacing","overflowX","backgroundColor","background","default","node","reverse","childIdx"],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { PrometheusDatasourceSelector } from '../model';
|
|
3
|
+
import ASTNode from './promql/ast';
|
|
4
|
+
type NodeState = 'waiting' | 'running' | 'error' | 'success';
|
|
5
|
+
interface TreeNodeProps {
|
|
6
|
+
node: ASTNode;
|
|
7
|
+
parentEl?: HTMLDivElement | null;
|
|
8
|
+
reverse: boolean;
|
|
9
|
+
datasource: PrometheusDatasourceSelector;
|
|
10
|
+
childIdx: number;
|
|
11
|
+
reportNodeState?: (childIdx: number, state: NodeState) => void;
|
|
12
|
+
}
|
|
13
|
+
export default function TreeNode({ node, parentEl, reverse, datasource, childIdx, reportNodeState, }: TreeNodeProps): ReactElement;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=TreeNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeNode.d.ts","sourceRoot":"","sources":["../../../src/components/TreeNode.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAA8D,MAAM,OAAO,CAAC;AAGjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,OAAqB,MAAM,cAAc,CAAC;AAejD,KAAK,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAiB7D,UAAU,aAAa;IAErB,IAAI,EAAE,OAAO,CAAC;IAEd,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAEjC,OAAO,EAAE,OAAO,CAAC;IAEjB,UAAU,EAAE,4BAA4B,CAAC;IAGzC,QAAQ,EAAE,MAAM,CAAC;IAGjB,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CAChE;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,UAAU,EACV,QAAQ,EACR,eAAe,GAChB,EAAE,aAAa,GAAG,YAAY,CAoP9B"}
|