@perses-dev/prometheus-plugin 0.53.0 → 0.53.1

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.
Files changed (27) hide show
  1. package/__mf/js/{Prometheus.712b445d.js → Prometheus.c0c6219f.js} +3 -3
  2. package/__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.86bf76a6.js +1 -0
  3. package/__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.e5e35f24.js +1 -0
  4. package/__mf/js/async/__federation_expose_PrometheusPromQLVariable.b2270799.js +1 -0
  5. package/__mf/js/async/{__federation_expose_PrometheusTimeSeriesQuery.90b49f7e.js → __federation_expose_PrometheusTimeSeriesQuery.c29461ad.js} +1 -1
  6. package/__mf/js/{main.61a2057a.js → main.afd47409.js} +2 -2
  7. package/lib/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +8 -1
  8. package/lib/cjs/plugins/prometheus-variables.js +108 -46
  9. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -1
  10. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +8 -1
  11. package/lib/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -1
  12. package/lib/plugins/prometheus-variables.d.ts.map +1 -1
  13. package/lib/plugins/prometheus-variables.js +115 -47
  14. package/lib/plugins/prometheus-variables.js.map +1 -1
  15. package/lib/plugins/test/setup-tests.d.ts.map +1 -0
  16. package/lib/plugins/test/setup-tests.js.map +1 -0
  17. package/mf-manifest.json +17 -17
  18. package/mf-stats.json +19 -19
  19. package/package.json +3 -3
  20. package/__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.e7eaadbd.js +0 -1
  21. package/__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.24d74e40.js +0 -1
  22. package/__mf/js/async/__federation_expose_PrometheusPromQLVariable.ea97322b.js +0 -1
  23. package/lib/test/setup-tests.d.ts.map +0 -1
  24. package/lib/test/setup-tests.js.map +0 -1
  25. /package/lib/cjs/{test → plugins/test}/setup-tests.js +0 -0
  26. /package/lib/{test → plugins/test}/setup-tests.d.ts +0 -0
  27. /package/lib/{test → plugins/test}/setup-tests.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/plugins/test/setup-tests.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport '@testing-library/jest-dom/extend-expect';\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,OAAO,0CAA0C"}
package/mf-manifest.json CHANGED
@@ -5,11 +5,11 @@
5
5
  "name": "Prometheus",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "0.53.0",
8
+ "buildVersion": "0.53.1",
9
9
  "buildName": "@perses-dev/prometheus-plugin"
10
10
  },
11
11
  "remoteEntry": {
12
- "name": "__mf/js/Prometheus.712b445d.js",
12
+ "name": "__mf/js/Prometheus.c0c6219f.js",
13
13
  "path": "",
14
14
  "type": "global"
15
15
  },
@@ -357,11 +357,11 @@
357
357
  "__mf/js/async/5724.794828e3.js",
358
358
  "__mf/js/async/537.82230699.js",
359
359
  "__mf/js/async/8706.9a6f6579.js",
360
- "__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.90b49f7e.js",
360
+ "__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.c29461ad.js",
361
361
  "__mf/js/async/7272.6fa2f127.js",
362
- "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.24d74e40.js",
363
- "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.e7eaadbd.js",
364
- "__mf/js/async/__federation_expose_PrometheusPromQLVariable.ea97322b.js",
362
+ "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.e5e35f24.js",
363
+ "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.86bf76a6.js",
364
+ "__mf/js/async/__federation_expose_PrometheusPromQLVariable.b2270799.js",
365
365
  "__mf/js/async/5257.ce463cb7.js",
366
366
  "__mf/js/async/7376.2e948f2b.js",
367
367
  "__mf/js/async/9550.642ce5ad.js",
@@ -401,7 +401,7 @@
401
401
  "__mf/js/async/5724.794828e3.js",
402
402
  "__mf/js/async/537.82230699.js",
403
403
  "__mf/js/async/8706.9a6f6579.js",
404
- "__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.90b49f7e.js"
404
+ "__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.c29461ad.js"
405
405
  ],
406
406
  "async": [
407
407
  "__mf/js/async/4238.422a1b1c.js",
@@ -416,9 +416,9 @@
416
416
  "__mf/js/async/5724.794828e3.js",
417
417
  "__mf/js/async/537.82230699.js",
418
418
  "__mf/js/async/8706.9a6f6579.js",
419
- "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.24d74e40.js",
420
- "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.e7eaadbd.js",
421
- "__mf/js/async/__federation_expose_PrometheusPromQLVariable.ea97322b.js",
419
+ "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.e5e35f24.js",
420
+ "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.86bf76a6.js",
421
+ "__mf/js/async/__federation_expose_PrometheusPromQLVariable.b2270799.js",
422
422
  "__mf/js/async/5257.ce463cb7.js",
423
423
  "__mf/js/async/7376.2e948f2b.js",
424
424
  "__mf/js/async/9550.642ce5ad.js",
@@ -461,7 +461,7 @@
461
461
  "__mf/js/async/5724.794828e3.js",
462
462
  "__mf/js/async/537.82230699.js",
463
463
  "__mf/js/async/8706.9a6f6579.js",
464
- "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.24d74e40.js"
464
+ "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.e5e35f24.js"
465
465
  ],
466
466
  "async": [
467
467
  "__mf/js/async/4238.422a1b1c.js",
@@ -514,7 +514,7 @@
514
514
  "__mf/js/async/5724.794828e3.js",
515
515
  "__mf/js/async/537.82230699.js",
516
516
  "__mf/js/async/8706.9a6f6579.js",
517
- "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.e7eaadbd.js"
517
+ "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.86bf76a6.js"
518
518
  ],
519
519
  "async": [
520
520
  "__mf/js/async/4238.422a1b1c.js",
@@ -567,7 +567,7 @@
567
567
  "__mf/js/async/5724.794828e3.js",
568
568
  "__mf/js/async/537.82230699.js",
569
569
  "__mf/js/async/8706.9a6f6579.js",
570
- "__mf/js/async/__federation_expose_PrometheusPromQLVariable.ea97322b.js"
570
+ "__mf/js/async/__federation_expose_PrometheusPromQLVariable.b2270799.js"
571
571
  ],
572
572
  "async": [
573
573
  "__mf/js/async/4238.422a1b1c.js",
@@ -636,11 +636,11 @@
636
636
  "__mf/js/async/5724.794828e3.js",
637
637
  "__mf/js/async/537.82230699.js",
638
638
  "__mf/js/async/8706.9a6f6579.js",
639
- "__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.90b49f7e.js",
639
+ "__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.c29461ad.js",
640
640
  "__mf/js/async/7272.6fa2f127.js",
641
- "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.24d74e40.js",
642
- "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.e7eaadbd.js",
643
- "__mf/js/async/__federation_expose_PrometheusPromQLVariable.ea97322b.js",
641
+ "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.e5e35f24.js",
642
+ "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.86bf76a6.js",
643
+ "__mf/js/async/__federation_expose_PrometheusPromQLVariable.b2270799.js",
644
644
  "__mf/js/async/9817.70eae424.js",
645
645
  "__mf/js/async/5876.1976752d.js",
646
646
  "__mf/js/async/212.69f85c2b.js",
package/mf-stats.json CHANGED
@@ -5,11 +5,11 @@
5
5
  "name": "Prometheus",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "0.53.0",
8
+ "buildVersion": "0.53.1",
9
9
  "buildName": "@perses-dev/prometheus-plugin"
10
10
  },
11
11
  "remoteEntry": {
12
- "name": "__mf/js/Prometheus.712b445d.js",
12
+ "name": "__mf/js/Prometheus.c0c6219f.js",
13
13
  "path": "",
14
14
  "type": "global"
15
15
  },
@@ -115,8 +115,8 @@
115
115
  }
116
116
  },
117
117
  "usedIn": [
118
- "./PrometheusTimeSeriesQuery",
119
- "./PrometheusExplorer"
118
+ "./PrometheusExplorer",
119
+ "./PrometheusTimeSeriesQuery"
120
120
  ]
121
121
  },
122
122
  {
@@ -435,11 +435,11 @@
435
435
  "__mf/js/async/5724.794828e3.js",
436
436
  "__mf/js/async/537.82230699.js",
437
437
  "__mf/js/async/8706.9a6f6579.js",
438
- "__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.90b49f7e.js",
438
+ "__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.c29461ad.js",
439
439
  "__mf/js/async/7272.6fa2f127.js",
440
- "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.24d74e40.js",
441
- "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.e7eaadbd.js",
442
- "__mf/js/async/__federation_expose_PrometheusPromQLVariable.ea97322b.js",
440
+ "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.e5e35f24.js",
441
+ "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.86bf76a6.js",
442
+ "__mf/js/async/__federation_expose_PrometheusPromQLVariable.b2270799.js",
443
443
  "__mf/js/async/5257.ce463cb7.js",
444
444
  "__mf/js/async/7376.2e948f2b.js",
445
445
  "__mf/js/async/9550.642ce5ad.js",
@@ -486,7 +486,7 @@
486
486
  "__mf/js/async/5724.794828e3.js",
487
487
  "__mf/js/async/537.82230699.js",
488
488
  "__mf/js/async/8706.9a6f6579.js",
489
- "__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.90b49f7e.js"
489
+ "__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.c29461ad.js"
490
490
  ],
491
491
  "async": [
492
492
  "__mf/js/async/4238.422a1b1c.js",
@@ -501,9 +501,9 @@
501
501
  "__mf/js/async/5724.794828e3.js",
502
502
  "__mf/js/async/537.82230699.js",
503
503
  "__mf/js/async/8706.9a6f6579.js",
504
- "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.24d74e40.js",
505
- "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.e7eaadbd.js",
506
- "__mf/js/async/__federation_expose_PrometheusPromQLVariable.ea97322b.js",
504
+ "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.e5e35f24.js",
505
+ "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.86bf76a6.js",
506
+ "__mf/js/async/__federation_expose_PrometheusPromQLVariable.b2270799.js",
507
507
  "__mf/js/async/5257.ce463cb7.js",
508
508
  "__mf/js/async/7376.2e948f2b.js",
509
509
  "__mf/js/async/9550.642ce5ad.js",
@@ -550,7 +550,7 @@
550
550
  "__mf/js/async/5724.794828e3.js",
551
551
  "__mf/js/async/537.82230699.js",
552
552
  "__mf/js/async/8706.9a6f6579.js",
553
- "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.24d74e40.js"
553
+ "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.e5e35f24.js"
554
554
  ],
555
555
  "async": [
556
556
  "__mf/js/async/4238.422a1b1c.js",
@@ -607,7 +607,7 @@
607
607
  "__mf/js/async/5724.794828e3.js",
608
608
  "__mf/js/async/537.82230699.js",
609
609
  "__mf/js/async/8706.9a6f6579.js",
610
- "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.e7eaadbd.js"
610
+ "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.86bf76a6.js"
611
611
  ],
612
612
  "async": [
613
613
  "__mf/js/async/4238.422a1b1c.js",
@@ -664,7 +664,7 @@
664
664
  "__mf/js/async/5724.794828e3.js",
665
665
  "__mf/js/async/537.82230699.js",
666
666
  "__mf/js/async/8706.9a6f6579.js",
667
- "__mf/js/async/__federation_expose_PrometheusPromQLVariable.ea97322b.js"
667
+ "__mf/js/async/__federation_expose_PrometheusPromQLVariable.b2270799.js"
668
668
  ],
669
669
  "async": [
670
670
  "__mf/js/async/4238.422a1b1c.js",
@@ -743,11 +743,11 @@
743
743
  "__mf/js/async/5724.794828e3.js",
744
744
  "__mf/js/async/537.82230699.js",
745
745
  "__mf/js/async/8706.9a6f6579.js",
746
- "__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.90b49f7e.js",
746
+ "__mf/js/async/__federation_expose_PrometheusTimeSeriesQuery.c29461ad.js",
747
747
  "__mf/js/async/7272.6fa2f127.js",
748
- "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.24d74e40.js",
749
- "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.e7eaadbd.js",
750
- "__mf/js/async/__federation_expose_PrometheusPromQLVariable.ea97322b.js",
748
+ "__mf/js/async/__federation_expose_PrometheusLabelValuesVariable.e5e35f24.js",
749
+ "__mf/js/async/__federation_expose_PrometheusLabelNamesVariable.86bf76a6.js",
750
+ "__mf/js/async/__federation_expose_PrometheusPromQLVariable.b2270799.js",
751
751
  "__mf/js/async/9817.70eae424.js",
752
752
  "__mf/js/async/5876.1976752d.js",
753
753
  "__mf/js/async/212.69f85c2b.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/prometheus-plugin",
3
- "version": "0.53.0",
3
+ "version": "0.53.1",
4
4
  "homepage": "https://github.com/perses/plugins/blob/main/README.md",
5
5
  "repository": {
6
6
  "type": "git",
@@ -85,7 +85,7 @@
85
85
  "kind": "Variable",
86
86
  "spec": {
87
87
  "display": {
88
- "name": "Prometheus Label Variable"
88
+ "name": "Prometheus Label Values Variable"
89
89
  },
90
90
  "name": "PrometheusLabelValuesVariable"
91
91
  }
@@ -94,7 +94,7 @@
94
94
  "kind": "Variable",
95
95
  "spec": {
96
96
  "display": {
97
- "name": "Prometheus Names Variable"
97
+ "name": "Prometheus Label Names Variable"
98
98
  },
99
99
  "name": "PrometheusLabelNamesVariable"
100
100
  }
@@ -1 +0,0 @@
1
- "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["8035"],{74081:function(e,a,r){var l;a.default=void 0,a.default=(0,((l=r(30265))&&l.__esModule?l:{default:l}).default)("M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M9,8H11V17H9V8M13,8H15V17H13V8Z","TrashCan")},24867:function(e,a,r){r.r(a),r.d(a,{PrometheusLabelNamesVariable:()=>s});var l=r(8887),t=r(99176),n=r(62284);let s={getVariableOptions:async(e,a)=>{let r=await a.datasourceStore.getDatasourceClient(e.datasource??t.Mm),s=e.matchers?e.matchers.map(e=>(0,l.replaceVariables)(e,a.variables)):void 0,o=(0,t.Bf)(a.timeRange),{data:u}=await r.labelNames({"match[]":s,...o});return{data:(0,n.LY)(u)}},dependsOn:e=>{var a;return{variables:(null==(a=e.matchers)?void 0:a.map(e=>(0,l.parseVariables)(e)).flat())||[]}},OptionsEditorComponent:n.g3,createInitialOptions:()=>({})}},62284:function(e,a,r){r.d(a,{gB:()=>x,g3:()=>b,xA:()=>g,qT:()=>f,ik:()=>y,LY:()=>j});var l=r(24246),t=r(25283),n=r(90192),s=r(8695),o=r(8887),u=r(75586),d=r(64001),i=r(99176),c=r(36372),h=r(75094),m=r(48565),v=r(74081);function p(e){let{matchers:a,onChange:r,isReadonly:n}=e;return(0,l.jsxs)(t.Z,{spacing:1,mb:2,children:[a.map((e,t)=>(0,l.jsxs)(c.Z,{display:"flex",children:[(0,l.jsx)(s.Z,{fullWidth:!0,label:"Series Selector",value:e,InputProps:{readOnly:n},onChange:e=>{r((0,u.Uy)(a,a=>{a[t]=e.target.value}))}}),(0,l.jsx)(h.Z,{onClick:()=>{r((0,u.Uy)(a,e=>{e.splice(t,1)}))},disabled:n,children:(0,l.jsx)(v.default,{})})]},t)),(0,l.jsx)(c.Z,{children:(0,l.jsx)(m.Z,{fullWidth:!1,color:"secondary",variant:"outlined",onClick:()=>{r((0,u.Uy)(a,e=>{e.push("")}))},disabled:n,children:"Add Series Selector"})})]})}function g(e){let{onChange:a,value:r}=e,{datasource:d}=r,c=d??i.Mm;return(0,l.jsxs)(t.Z,{spacing:2,children:[(0,l.jsx)(n.Z,{margin:"dense",children:(0,l.jsx)(o.DatasourceSelect,{datasourcePluginKind:"PrometheusDatasource",value:c,onChange:e=>{if((0,i.sv)(e))return void a((0,u.Uy)(r,a=>{a.datasource=(0,i.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},readOnly:e.isReadonly,labelId:"prom-datasource-label",label:"Prometheus Datasource"})}),(0,l.jsx)(s.Z,{label:"Label Name",required:!0,value:e.value.labelName,onChange:a=>{e.onChange({...e.value,labelName:a.target.value})},InputProps:{readOnly:e.isReadonly}}),(0,l.jsx)(p,{matchers:e.value.matchers??[],onChange:a=>{e.onChange({...e.value,matchers:a})},isReadonly:e.isReadonly})]})}function b(e){let{onChange:a,value:r}=e,{datasource:s}=r,d=s??i.Mm;return(0,l.jsxs)(t.Z,{spacing:2,children:[(0,l.jsx)(n.Z,{margin:"dense",children:(0,l.jsx)(o.DatasourceSelect,{datasourcePluginKind:"PrometheusDatasource",value:d,onChange:e=>{if((0,i.sv)(e))return void a((0,u.Uy)(r,a=>{a.datasource=(0,i.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},disabled:e.isReadonly,labelId:"prom-datasource-label",label:"Prometheus Datasource"})}),(0,l.jsx)(p,{matchers:e.value.matchers??[],isReadonly:e.isReadonly,onChange:a=>{e.onChange({...e.value,matchers:a})}})]})}function f(e){let{onChange:a,value:r}=e,{datasource:c}=r,h=c??i.Mm,{data:m}=(0,o.useDatasourceClient)(h),v=null==m?void 0:m.options.datasourceUrl;return(0,l.jsxs)(t.Z,{spacing:2,children:[(0,l.jsx)(n.Z,{margin:"dense",children:(0,l.jsx)(o.DatasourceSelect,{datasourcePluginKind:i.nY,value:h,onChange:e=>{if((0,i.sv)(e))return void a((0,u.Uy)(r,a=>{a.datasource=(0,i.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},labelId:"prom-datasource-label",label:"Prometheus Datasource",disabled:e.isReadonly})}),(0,l.jsx)(d.P,{completeConfig:{remote:{url:v}},value:r.expr,datasource:h,onBlur:a=>{e.onChange({...e.value,expr:a.target.textContent??""})},readOnly:e.isReadonly,width:"100%"}),(0,l.jsx)(s.Z,{label:"Label Name",value:e.value.labelName,InputProps:{readOnly:e.isReadonly},onChange:a=>{e.onChange({...e.value,labelName:a.target.value})}})]})}function x(e,a){let r=new Set;for(let l of e.result){let e=l.metric[a];void 0!==e&&r.add(e)}return Array.from(r.values())}function y(e,a){let r=new Set;for(let l of e.result){let e=l.metric[a];void 0!==e&&r.add(e)}return Array.from(r.values())}let j=e=>e?e.map(e=>({value:e,label:e})):[]}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["6925"],{74081:function(e,a,l){var r;a.default=void 0,a.default=(0,((r=l(30265))&&r.__esModule?r:{default:r}).default)("M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M9,8H11V17H9V8M13,8H15V17H13V8Z","TrashCan")},41233:function(e,a,l){l.r(a),l.d(a,{PrometheusLabelValuesVariable:()=>s});var r=l(8887),t=l(99176),n=l(62284);let s={getVariableOptions:async(e,a)=>{let l=await a.datasourceStore.getDatasourceClient(e.datasource??t.Mm),s=e.matchers?e.matchers.map(e=>(0,r.replaceVariables)(e,a.variables)):void 0,o=(0,t.Bf)(a.timeRange),{data:u}=await l.labelValues({labelName:(0,r.replaceVariables)(e.labelName,a.variables),"match[]":s,...o});return{data:(0,n.LY)(u)}},dependsOn:e=>{var a;return{variables:(null==(a=e.matchers)?void 0:a.map(e=>(0,r.parseVariables)(e)).flat().concat((0,r.parseVariables)(e.labelName)))||[]}},OptionsEditorComponent:n.xA,createInitialOptions:()=>({labelName:""})}},62284:function(e,a,l){l.d(a,{gB:()=>x,g3:()=>g,xA:()=>p,qT:()=>f,ik:()=>y,LY:()=>j});var r=l(24246),t=l(25283),n=l(90192),s=l(8695),o=l(8887),u=l(75586),d=l(64001),i=l(99176),c=l(36372),h=l(75094),m=l(48565),v=l(74081);function b(e){let{matchers:a,onChange:l,isReadonly:n}=e;return(0,r.jsxs)(t.Z,{spacing:1,mb:2,children:[a.map((e,t)=>(0,r.jsxs)(c.Z,{display:"flex",children:[(0,r.jsx)(s.Z,{fullWidth:!0,label:"Series Selector",value:e,InputProps:{readOnly:n},onChange:e=>{l((0,u.Uy)(a,a=>{a[t]=e.target.value}))}}),(0,r.jsx)(h.Z,{onClick:()=>{l((0,u.Uy)(a,e=>{e.splice(t,1)}))},disabled:n,children:(0,r.jsx)(v.default,{})})]},t)),(0,r.jsx)(c.Z,{children:(0,r.jsx)(m.Z,{fullWidth:!1,color:"secondary",variant:"outlined",onClick:()=>{l((0,u.Uy)(a,e=>{e.push("")}))},disabled:n,children:"Add Series Selector"})})]})}function p(e){let{onChange:a,value:l}=e,{datasource:d}=l,c=d??i.Mm;return(0,r.jsxs)(t.Z,{spacing:2,children:[(0,r.jsx)(n.Z,{margin:"dense",children:(0,r.jsx)(o.DatasourceSelect,{datasourcePluginKind:"PrometheusDatasource",value:c,onChange:e=>{if((0,i.sv)(e))return void a((0,u.Uy)(l,a=>{a.datasource=(0,i.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},readOnly:e.isReadonly,labelId:"prom-datasource-label",label:"Prometheus Datasource"})}),(0,r.jsx)(s.Z,{label:"Label Name",required:!0,value:e.value.labelName,onChange:a=>{e.onChange({...e.value,labelName:a.target.value})},InputProps:{readOnly:e.isReadonly}}),(0,r.jsx)(b,{matchers:e.value.matchers??[],onChange:a=>{e.onChange({...e.value,matchers:a})},isReadonly:e.isReadonly})]})}function g(e){let{onChange:a,value:l}=e,{datasource:s}=l,d=s??i.Mm;return(0,r.jsxs)(t.Z,{spacing:2,children:[(0,r.jsx)(n.Z,{margin:"dense",children:(0,r.jsx)(o.DatasourceSelect,{datasourcePluginKind:"PrometheusDatasource",value:d,onChange:e=>{if((0,i.sv)(e))return void a((0,u.Uy)(l,a=>{a.datasource=(0,i.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},disabled:e.isReadonly,labelId:"prom-datasource-label",label:"Prometheus Datasource"})}),(0,r.jsx)(b,{matchers:e.value.matchers??[],isReadonly:e.isReadonly,onChange:a=>{e.onChange({...e.value,matchers:a})}})]})}function f(e){let{onChange:a,value:l}=e,{datasource:c}=l,h=c??i.Mm,{data:m}=(0,o.useDatasourceClient)(h),v=null==m?void 0:m.options.datasourceUrl;return(0,r.jsxs)(t.Z,{spacing:2,children:[(0,r.jsx)(n.Z,{margin:"dense",children:(0,r.jsx)(o.DatasourceSelect,{datasourcePluginKind:i.nY,value:h,onChange:e=>{if((0,i.sv)(e))return void a((0,u.Uy)(l,a=>{a.datasource=(0,i.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},labelId:"prom-datasource-label",label:"Prometheus Datasource",disabled:e.isReadonly})}),(0,r.jsx)(d.P,{completeConfig:{remote:{url:v}},value:l.expr,datasource:h,onBlur:a=>{e.onChange({...e.value,expr:a.target.textContent??""})},readOnly:e.isReadonly,width:"100%"}),(0,r.jsx)(s.Z,{label:"Label Name",value:e.value.labelName,InputProps:{readOnly:e.isReadonly},onChange:a=>{e.onChange({...e.value,labelName:a.target.value})}})]})}function x(e,a){let l=new Set;for(let r of e.result){let e=r.metric[a];void 0!==e&&l.add(e)}return Array.from(l.values())}function y(e,a){let l=new Set;for(let r of e.result){let e=r.metric[a];void 0!==e&&l.add(e)}return Array.from(l.values())}let j=e=>e?e.map(e=>({value:e,label:e})):[]}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.chunk_Prometheus=self.chunk_Prometheus||[]).push([["3520"],{74081:function(e,a,r){var l;a.default=void 0,a.default=(0,((l=r(30265))&&l.__esModule?l:{default:l}).default)("M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M9,8H11V17H9V8M13,8H15V17H13V8Z","TrashCan")},7909:function(e,a,r){r.r(a),r.d(a,{PrometheusPromQLVariable:()=>s});var l=r(8887),t=r(99176),n=r(62284);let s={getVariableOptions:async(e,a)=>{let r=await a.datasourceStore.getDatasourceClient(e.datasource??t.Mm),{data:s}=await r.instantQuery({query:(0,l.replaceVariables)(e.expr,a.variables)}),o=(0,l.replaceVariables)(e.labelName,a.variables),u=[];return(null==s?void 0:s.resultType)==="matrix"?u=(0,n.gB)(s,o):(null==s?void 0:s.resultType)==="vector"&&(u=(0,n.ik)(s,o)),{data:(0,n.LY)(u)}},dependsOn:e=>({variables:(0,l.parseVariables)(e.expr).concat((0,l.parseVariables)(e.labelName))}),OptionsEditorComponent:n.qT,createInitialOptions:()=>({expr:"",labelName:""})}},62284:function(e,a,r){r.d(a,{gB:()=>y,g3:()=>g,xA:()=>b,qT:()=>x,ik:()=>f,LY:()=>j});var l=r(24246),t=r(25283),n=r(90192),s=r(8695),o=r(8887),u=r(75586),i=r(64001),d=r(99176),c=r(36372),h=r(75094),m=r(48565),v=r(74081);function p(e){let{matchers:a,onChange:r,isReadonly:n}=e;return(0,l.jsxs)(t.Z,{spacing:1,mb:2,children:[a.map((e,t)=>(0,l.jsxs)(c.Z,{display:"flex",children:[(0,l.jsx)(s.Z,{fullWidth:!0,label:"Series Selector",value:e,InputProps:{readOnly:n},onChange:e=>{r((0,u.Uy)(a,a=>{a[t]=e.target.value}))}}),(0,l.jsx)(h.Z,{onClick:()=>{r((0,u.Uy)(a,e=>{e.splice(t,1)}))},disabled:n,children:(0,l.jsx)(v.default,{})})]},t)),(0,l.jsx)(c.Z,{children:(0,l.jsx)(m.Z,{fullWidth:!1,color:"secondary",variant:"outlined",onClick:()=>{r((0,u.Uy)(a,e=>{e.push("")}))},disabled:n,children:"Add Series Selector"})})]})}function b(e){let{onChange:a,value:r}=e,{datasource:i}=r,c=i??d.Mm;return(0,l.jsxs)(t.Z,{spacing:2,children:[(0,l.jsx)(n.Z,{margin:"dense",children:(0,l.jsx)(o.DatasourceSelect,{datasourcePluginKind:"PrometheusDatasource",value:c,onChange:e=>{if((0,d.sv)(e))return void a((0,u.Uy)(r,a=>{a.datasource=(0,d.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},readOnly:e.isReadonly,labelId:"prom-datasource-label",label:"Prometheus Datasource"})}),(0,l.jsx)(s.Z,{label:"Label Name",required:!0,value:e.value.labelName,onChange:a=>{e.onChange({...e.value,labelName:a.target.value})},InputProps:{readOnly:e.isReadonly}}),(0,l.jsx)(p,{matchers:e.value.matchers??[],onChange:a=>{e.onChange({...e.value,matchers:a})},isReadonly:e.isReadonly})]})}function g(e){let{onChange:a,value:r}=e,{datasource:s}=r,i=s??d.Mm;return(0,l.jsxs)(t.Z,{spacing:2,children:[(0,l.jsx)(n.Z,{margin:"dense",children:(0,l.jsx)(o.DatasourceSelect,{datasourcePluginKind:"PrometheusDatasource",value:i,onChange:e=>{if((0,d.sv)(e))return void a((0,u.Uy)(r,a=>{a.datasource=(0,d.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},disabled:e.isReadonly,labelId:"prom-datasource-label",label:"Prometheus Datasource"})}),(0,l.jsx)(p,{matchers:e.value.matchers??[],isReadonly:e.isReadonly,onChange:a=>{e.onChange({...e.value,matchers:a})}})]})}function x(e){let{onChange:a,value:r}=e,{datasource:c}=r,h=c??d.Mm,{data:m}=(0,o.useDatasourceClient)(h),v=null==m?void 0:m.options.datasourceUrl;return(0,l.jsxs)(t.Z,{spacing:2,children:[(0,l.jsx)(n.Z,{margin:"dense",children:(0,l.jsx)(o.DatasourceSelect,{datasourcePluginKind:d.nY,value:h,onChange:e=>{if((0,d.sv)(e))return void a((0,u.Uy)(r,a=>{a.datasource=(0,d.Rv)(e)?void 0:e}));throw Error("Got unexpected non-Prometheus datasource selector")},labelId:"prom-datasource-label",label:"Prometheus Datasource",disabled:e.isReadonly})}),(0,l.jsx)(i.P,{completeConfig:{remote:{url:v}},value:r.expr,datasource:h,onBlur:a=>{e.onChange({...e.value,expr:a.target.textContent??""})},readOnly:e.isReadonly,width:"100%"}),(0,l.jsx)(s.Z,{label:"Label Name",value:e.value.labelName,InputProps:{readOnly:e.isReadonly},onChange:a=>{e.onChange({...e.value,labelName:a.target.value})}})]})}function y(e,a){let r=new Set;for(let l of e.result){let e=l.metric[a];void 0!==e&&r.add(e)}return Array.from(r.values())}function f(e,a){let r=new Set;for(let l of e.result){let e=l.metric[a];void 0!==e&&r.add(e)}return Array.from(r.values())}let j=e=>e?e.map(e=>({value:e,label:e})):[]}}]);
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../../src/test/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,yCAAyC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/test/setup-tests.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport '@testing-library/jest-dom/extend-expect';\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,OAAO,0CAA0C"}
File without changes
File without changes
File without changes