@perses-dev/prometheus-plugin 0.11.0 → 0.12.0

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.
@@ -37,6 +37,7 @@ function MatcherEditor(props) {
37
37
  display: "flex",
38
38
  children: [
39
39
  /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
40
+ fullWidth: true,
40
41
  onBlur: ()=>{
41
42
  props.onChange(matchers);
42
43
  },
@@ -1 +1 @@
1
- {"version":3,"file":"MatcherEditor.d.ts","sourceRoot":"","sources":["../../src/plugins/MatcherEditor.tsx"],"names":[],"mappings":";AAiBA,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CAAE,eA0C1G"}
1
+ {"version":3,"file":"MatcherEditor.d.ts","sourceRoot":"","sources":["../../src/plugins/MatcherEditor.tsx"],"names":[],"mappings":";AAiBA,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CAAE,eA2C1G"}
@@ -24,6 +24,7 @@ export function MatcherEditor(props) {
24
24
  display: "flex",
25
25
  children: [
26
26
  /*#__PURE__*/ _jsx(TextField, {
27
+ fullWidth: true,
27
28
  onBlur: ()=>{
28
29
  props.onChange(matchers);
29
30
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugins/MatcherEditor.tsx"],"sourcesContent":["// Copyright 2022 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 { useState } from 'react';\nimport { Stack, TextField, Button, Box, IconButton } from '@mui/material';\nimport TrashIcon from 'mdi-material-ui/TrashCan';\n\nexport function MatcherEditor(props: { initialMatchers?: string[]; onChange: (matchers: string[]) => void }) {\n const [matchers, setMatchers] = useState<string[]>(props.initialMatchers ?? []);\n return (\n <Stack spacing={1}>\n {matchers.map((matcher, index) => (\n <Box key={index} display=\"flex\">\n <TextField\n onBlur={() => {\n props.onChange(matchers);\n }}\n label=\"Series Selector\"\n value={matcher}\n onChange={(e) => {\n const newMatchers = [...matchers];\n newMatchers[index] = e.target.value;\n setMatchers(newMatchers);\n }}\n />\n <IconButton\n onClick={() => {\n const newMatchers = [...matchers];\n newMatchers.splice(index, 1);\n setMatchers(newMatchers);\n }}\n >\n <TrashIcon />\n </IconButton>\n </Box>\n ))}\n <Box>\n <Button\n fullWidth={false}\n variant=\"outlined\"\n onClick={() => {\n setMatchers([...matchers, '']);\n }}\n >\n Add Series Selector\n </Button>\n </Box>\n </Stack>\n );\n}\n"],"names":["useState","Stack","TextField","Button","Box","IconButton","TrashIcon","MatcherEditor","props","matchers","setMatchers","initialMatchers","spacing","map","matcher","index","display","onBlur","onChange","label","value","e","newMatchers","target","onClick","splice","fullWidth","variant"],"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;AAAA,SAASA,QAAQ,QAAQ,OAAO,CAAC;AACjC,SAASC,KAAK,EAAEC,SAAS,EAAEC,MAAM,EAAEC,GAAG,EAAEC,UAAU,QAAQ,eAAe,CAAC;AAC1E,OAAOC,SAAS,MAAM,0BAA0B,CAAC;AAEjD,OAAO,SAASC,aAAa,CAACC,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BACF,qBAED;kBAAS;cACL;;MACA,CACR;AACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/plugins/MatcherEditor.tsx"],"sourcesContent":["// Copyright 2022 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 { useState } from 'react';\nimport { Stack, TextField, Button, Box, IconButton } from '@mui/material';\nimport TrashIcon from 'mdi-material-ui/TrashCan';\n\nexport function MatcherEditor(props: { initialMatchers?: string[]; onChange: (matchers: string[]) => void }) {\n const [matchers, setMatchers] = useState<string[]>(props.initialMatchers ?? []);\n return (\n <Stack spacing={1}>\n {matchers.map((matcher, index) => (\n <Box key={index} display=\"flex\">\n <TextField\n fullWidth\n onBlur={() => {\n props.onChange(matchers);\n }}\n label=\"Series Selector\"\n value={matcher}\n onChange={(e) => {\n const newMatchers = [...matchers];\n newMatchers[index] = e.target.value;\n setMatchers(newMatchers);\n }}\n />\n <IconButton\n onClick={() => {\n const newMatchers = [...matchers];\n newMatchers.splice(index, 1);\n setMatchers(newMatchers);\n }}\n >\n <TrashIcon />\n </IconButton>\n </Box>\n ))}\n <Box>\n <Button\n fullWidth={false}\n variant=\"outlined\"\n onClick={() => {\n setMatchers([...matchers, '']);\n }}\n >\n Add Series Selector\n </Button>\n </Box>\n </Stack>\n );\n}\n"],"names":["useState","Stack","TextField","Button","Box","IconButton","TrashIcon","MatcherEditor","props","matchers","setMatchers","initialMatchers","spacing","map","matcher","index","display","fullWidth","onBlur","onChange","label","value","e","newMatchers","target","onClick","splice","variant"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;A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AW,CAACa,WAAW,CAAC,CAAC;4BAC3B,CAAC;sCAED,cAAA,KAACjB,SAAS,KAAG;0BACF;;mBAtBLS,KAAK,CAuBT,AACP,CAAC;0BACF,KAACX,GAAG;0BACF,cAAA,KAACD,MAAM;oBACLc,SAAS,EAAE,KAAK;oBAChBU,OAAO,EAAC,UAAU;oBAClBF,OAAO,EAAE,IAAM;wBACbf,WAAW,CAAC;+BAAID,QAAQ;4BAAE,EAAE;yBAAC,CAAC,CAAC;oBACjC,CAAC;8BACF,qBAED;kBAAS;cACL;;MACA,CACR;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/prometheus-plugin",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Prometheus plugin for Perses",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -29,8 +29,8 @@
29
29
  "dependencies": {
30
30
  "@lezer/highlight": "^1.0.0",
31
31
  "@lezer/lr": "^1.2.0",
32
- "@perses-dev/core": "^0.11.0",
33
- "@perses-dev/plugin-system": "^0.11.0",
32
+ "@perses-dev/core": "^0.12.0",
33
+ "@perses-dev/plugin-system": "^0.12.0",
34
34
  "@prometheus-io/lezer-promql": "^0.37.0",
35
35
  "date-fns": "^2.28.0",
36
36
  "immer": "^9.0.15"
@@ -1,54 +0,0 @@
1
- // Copyright 2022 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
- Object.defineProperty(exports, "JSONSpecEditor", {
18
- enumerable: true,
19
- get: ()=>JSONSpecEditor
20
- });
21
- const _jsxRuntime = require("react/jsx-runtime");
22
- const _react = require("react");
23
- const _material = require("@mui/material");
24
- function JSONSpecEditor(props) {
25
- const ref = (0, _react.useRef)(null);
26
- const [value, setValue] = (0, _react.useState)(JSON.stringify(props.value, null, 2));
27
- const [invalidJSON, setInvalidJSON] = (0, _react.useState)(false);
28
- (0, _react.useEffect)(()=>{
29
- setValue(JSON.stringify(props.value, null, 2));
30
- setInvalidJSON(false);
31
- }, [
32
- props.value
33
- ]);
34
- return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
35
- label: "JSON",
36
- error: invalidJSON,
37
- helperText: invalidJSON ? 'Invalid JSON' : '',
38
- multiline: true,
39
- inputRef: ref,
40
- value: value,
41
- onChange: (event)=>{
42
- setValue(event.target.value);
43
- },
44
- onBlur: ()=>{
45
- try {
46
- const json = JSON.parse(value !== null && value !== void 0 ? value : '{}');
47
- setInvalidJSON(false);
48
- props.onChange(json);
49
- } catch (e) {
50
- setInvalidJSON(true);
51
- }
52
- }
53
- });
54
- }
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import { OptionsEditorProps } from '@perses-dev/plugin-system';
3
- export declare function JSONSpecEditor<T>(props: OptionsEditorProps<T>): JSX.Element;
4
- //# sourceMappingURL=JSONSpecEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JSONSpecEditor.d.ts","sourceRoot":"","sources":["../../src/plugins/JSONSpecEditor.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,eAgC7D"}
@@ -1,48 +0,0 @@
1
- // Copyright 2022 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 } from "react/jsx-runtime";
14
- import { useEffect, useRef, useState } from 'react';
15
- import { TextField } from '@mui/material';
16
- export function JSONSpecEditor(props) {
17
- const ref = useRef(null);
18
- const [value, setValue] = useState(JSON.stringify(props.value, null, 2));
19
- const [invalidJSON, setInvalidJSON] = useState(false);
20
- useEffect(()=>{
21
- setValue(JSON.stringify(props.value, null, 2));
22
- setInvalidJSON(false);
23
- }, [
24
- props.value
25
- ]);
26
- return /*#__PURE__*/ _jsx(TextField, {
27
- label: "JSON",
28
- error: invalidJSON,
29
- helperText: invalidJSON ? 'Invalid JSON' : '',
30
- multiline: true,
31
- inputRef: ref,
32
- value: value,
33
- onChange: (event)=>{
34
- setValue(event.target.value);
35
- },
36
- onBlur: ()=>{
37
- try {
38
- const json = JSON.parse(value !== null && value !== void 0 ? value : '{}');
39
- setInvalidJSON(false);
40
- props.onChange(json);
41
- } catch (e) {
42
- setInvalidJSON(true);
43
- }
44
- }
45
- });
46
- }
47
-
48
- //# sourceMappingURL=JSONSpecEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/plugins/JSONSpecEditor.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useEffect, useRef, useState } from 'react';\nimport { TextField } from '@mui/material';\nimport { OptionsEditorProps } from '@perses-dev/plugin-system';\n\nexport function JSONSpecEditor<T>(props: OptionsEditorProps<T>) {\n const ref = useRef<HTMLInputElement>(null);\n const [value, setValue] = useState(JSON.stringify(props.value, null, 2));\n const [invalidJSON, setInvalidJSON] = useState(false);\n\n useEffect(() => {\n setValue(JSON.stringify(props.value, null, 2));\n setInvalidJSON(false);\n }, [props.value]);\n\n return (\n <TextField\n label=\"JSON\"\n error={invalidJSON}\n helperText={invalidJSON ? 'Invalid JSON' : ''}\n multiline\n inputRef={ref}\n value={value}\n onChange={(event) => {\n setValue(event.target.value);\n }}\n onBlur={() => {\n try {\n const json = JSON.parse(value ?? '{}');\n setInvalidJSON(false);\n props.onChange(json);\n } catch (e) {\n setInvalidJSON(true);\n }\n }}\n />\n );\n}\n"],"names":["useEffect","useRef","useState","TextField","JSONSpecEditor","props","ref","value","setValue","JSON","stringify","invalidJSON","setInvalidJSON","label","error","helperText","multiline","inputRef","onChange","event","target","onBlur","json","parse","e"],"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;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO,CAAC;AACpD,SAASC,SAAS,QAAQ,eAAe,CAAC;AAG1C,OAAO,SAASC,cAAc,CAAIC,KAA4B,EAAE;IAC9D,MAAMC,GAAG,GAAGL,MAAM,CAAmB,IAAI,CAAC,AAAC;IAC3C,MAAM,CAACM,KAAK,EAAEC,QAAQ,CAAC,GAAGN,QAAQ,CAACO,IAAI,CAACC,SAAS,CAACL,KAAK,CAACE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,AAAC;IACzE,MAAM,CAACI,WAAW,EAAEC,cAAc,CAAC,GAAGV,QAAQ,CAAC,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