@perses-dev/prometheus-plugin 0.9.0 → 0.11.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.
Files changed (55) hide show
  1. package/dist/cjs/model/index.js +34 -0
  2. package/dist/cjs/model/prometheus-client.js +4 -4
  3. package/dist/cjs/model/prometheus-selectors.js +37 -0
  4. package/dist/cjs/plugins/JSONSpecEditor.js +54 -0
  5. package/dist/cjs/plugins/MatcherEditor.js +80 -0
  6. package/dist/cjs/plugins/PrometheusTimeSeriesQueryEditor.js +78 -0
  7. package/dist/cjs/plugins/prometheus-datasource.js +28 -0
  8. package/dist/cjs/plugins/prometheus-variables.js +67 -23
  9. package/dist/cjs/plugins/time-series-query.js +15 -20
  10. package/dist/cjs/plugins/types.js +16 -0
  11. package/dist/cjs/plugins/variable.js +40 -1
  12. package/dist/model/index.d.ts +8 -0
  13. package/dist/model/index.d.ts.map +1 -0
  14. package/dist/model/index.js +21 -0
  15. package/dist/model/index.js.map +1 -0
  16. package/dist/model/prometheus-client.d.ts +7 -8
  17. package/dist/model/prometheus-client.d.ts.map +1 -1
  18. package/dist/model/prometheus-client.js +4 -4
  19. package/dist/model/prometheus-client.js.map +1 -1
  20. package/dist/model/prometheus-selectors.d.ts +22 -0
  21. package/dist/model/prometheus-selectors.d.ts.map +1 -0
  22. package/dist/model/prometheus-selectors.js +30 -0
  23. package/dist/model/prometheus-selectors.js.map +1 -0
  24. package/dist/plugins/JSONSpecEditor.d.ts +4 -0
  25. package/dist/plugins/JSONSpecEditor.d.ts.map +1 -0
  26. package/dist/plugins/JSONSpecEditor.js +48 -0
  27. package/dist/plugins/JSONSpecEditor.js.map +1 -0
  28. package/dist/plugins/MatcherEditor.d.ts +6 -0
  29. package/dist/plugins/MatcherEditor.d.ts.map +1 -0
  30. package/dist/plugins/MatcherEditor.js +69 -0
  31. package/dist/plugins/MatcherEditor.js.map +1 -0
  32. package/dist/plugins/PrometheusTimeSeriesQueryEditor.d.ts +6 -0
  33. package/dist/plugins/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -0
  34. package/dist/plugins/PrometheusTimeSeriesQueryEditor.js +67 -0
  35. package/dist/plugins/PrometheusTimeSeriesQueryEditor.js.map +1 -0
  36. package/dist/plugins/prometheus-datasource.d.ts +5 -2
  37. package/dist/plugins/prometheus-datasource.d.ts.map +1 -1
  38. package/dist/plugins/prometheus-datasource.js +28 -0
  39. package/dist/plugins/prometheus-datasource.js.map +1 -1
  40. package/dist/plugins/prometheus-variables.d.ts +1 -10
  41. package/dist/plugins/prometheus-variables.d.ts.map +1 -1
  42. package/dist/plugins/prometheus-variables.js +65 -21
  43. package/dist/plugins/prometheus-variables.js.map +1 -1
  44. package/dist/plugins/time-series-query.d.ts +2 -4
  45. package/dist/plugins/time-series-query.d.ts.map +1 -1
  46. package/dist/plugins/time-series-query.js +10 -15
  47. package/dist/plugins/time-series-query.js.map +1 -1
  48. package/dist/plugins/types.d.ts +12 -0
  49. package/dist/plugins/types.d.ts.map +1 -0
  50. package/dist/plugins/types.js +15 -0
  51. package/dist/plugins/types.js.map +1 -0
  52. package/dist/plugins/variable.d.ts.map +1 -1
  53. package/dist/plugins/variable.js +40 -1
  54. package/dist/plugins/variable.js.map +1 -1
  55. package/package.json +5 -4
@@ -10,8 +10,53 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { replaceTemplateVariables, parseTemplateVariables } from '../model/utils';
14
- import { labelValues, labelNames } from '../model/prometheus-client';
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { Stack, TextField } from '@mui/material';
15
+ import { replaceTemplateVariables, parseTemplateVariables, DEFAULT_PROM } from '../model';
16
+ import { MatcherEditor } from './MatcherEditor';
17
+ function PrometheusLabelValuesVariableEditor(props) {
18
+ return /*#__PURE__*/ _jsxs(Stack, {
19
+ spacing: 1,
20
+ children: [
21
+ /*#__PURE__*/ _jsx(TextField, {
22
+ sx: {
23
+ mb: 1
24
+ },
25
+ label: "Label Name",
26
+ value: props.value.label_name,
27
+ onChange: (e)=>{
28
+ props.onChange({
29
+ ...props.value,
30
+ label_name: e.target.value
31
+ });
32
+ }
33
+ }),
34
+ /*#__PURE__*/ _jsx(MatcherEditor, {
35
+ initialMatchers: props.value.matchers,
36
+ onChange: (e)=>{
37
+ props.onChange({
38
+ ...props.value,
39
+ matchers: e
40
+ });
41
+ }
42
+ })
43
+ ]
44
+ });
45
+ }
46
+ function PrometheusLabelNamesVariableEditor(props) {
47
+ return /*#__PURE__*/ _jsx(Stack, {
48
+ spacing: 1,
49
+ children: /*#__PURE__*/ _jsx(MatcherEditor, {
50
+ initialMatchers: props.value.matchers,
51
+ onChange: (e)=>{
52
+ props.onChange({
53
+ ...props.value,
54
+ matchers: e
55
+ });
56
+ }
57
+ })
58
+ });
59
+ }
15
60
  /**
16
61
  * Takes a list of strings and returns a list of VariableOptions
17
62
  */ const stringArrayToVariableOptions = (values)=>{
@@ -21,37 +66,32 @@ import { labelValues, labelNames } from '../model/prometheus-client';
21
66
  label: value
22
67
  }));
23
68
  };
24
- async function getQueryOptions(ctx, spec) {
25
- var _datasource;
26
- // Just use the default Prom datatsource if not specified in variable's spec
27
- const datasourceSelector = (_datasource = spec.datasource) !== null && _datasource !== void 0 ? _datasource : {
28
- kind: 'PrometheusDatasource'
29
- };
30
- const datasource = await ctx.datasourceStore.getDatasource(datasourceSelector);
31
- const queryOptions = {
32
- datasource: datasource.plugin.spec
33
- };
34
- return queryOptions;
35
- }
36
69
  export const PrometheusLabelNamesVariable = {
37
70
  getVariableOptions: async (spec, ctx)=>{
38
- const queryOptions = await getQueryOptions(ctx, spec);
39
- const { data: options } = await labelNames({}, queryOptions);
71
+ var _datasource;
72
+ const client = await ctx.datasourceStore.getDatasourceClient((_datasource = spec.datasource) !== null && _datasource !== void 0 ? _datasource : DEFAULT_PROM);
73
+ const match = spec.matchers ? spec.matchers.map((m)=>replaceTemplateVariables(m, ctx.variables)) : undefined;
74
+ const { data: options } = await client.labelNames({
75
+ 'match[]': match
76
+ });
40
77
  return {
41
78
  data: stringArrayToVariableOptions(options)
42
79
  };
43
80
  },
44
- dependsOn: ()=>[]
81
+ dependsOn: ()=>[],
82
+ OptionsEditorComponent: PrometheusLabelNamesVariableEditor,
83
+ createInitialOptions: ()=>({})
45
84
  };
46
85
  export const PrometheusLabelValuesVariable = {
47
86
  getVariableOptions: async (spec, ctx)=>{
48
87
  const pluginDef = spec;
49
- const queryOptions = await getQueryOptions(ctx, spec);
88
+ var _datasource;
89
+ const client = await ctx.datasourceStore.getDatasourceClient((_datasource = spec.datasource) !== null && _datasource !== void 0 ? _datasource : DEFAULT_PROM);
50
90
  const match = pluginDef.matchers ? pluginDef.matchers.map((m)=>replaceTemplateVariables(m, ctx.variables)) : undefined;
51
- const { data: options } = await labelValues({
91
+ const { data: options } = await client.labelValues({
52
92
  labelName: pluginDef.label_name,
53
93
  'match[]': match
54
- }, queryOptions);
94
+ });
55
95
  return {
56
96
  data: stringArrayToVariableOptions(options)
57
97
  };
@@ -59,7 +99,11 @@ export const PrometheusLabelValuesVariable = {
59
99
  dependsOn: (spec)=>{
60
100
  var ref;
61
101
  return ((ref = spec.matchers) === null || ref === void 0 ? void 0 : ref.map((m)=>parseTemplateVariables(m)).flat()) || [];
62
- }
102
+ },
103
+ OptionsEditorComponent: PrometheusLabelValuesVariableEditor,
104
+ createInitialOptions: ()=>({
105
+ label_name: ''
106
+ })
63
107
  };
64
108
 
65
109
  //# sourceMappingURL=prometheus-variables.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugins/prometheus-variables.ts"],"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 { VariablePlugin, VariableOption, GetVariableOptionsContext } from '@perses-dev/plugin-system';\nimport { replaceTemplateVariables, parseTemplateVariables } from '../model/utils';\nimport {\n labelValues,\n labelNames,\n PrometheusDatasourceSpec,\n QueryOptions,\n PrometheusDatasourceSelector,\n} from '../model/prometheus-client';\n\ninterface PrometheusVariableOptionsBase {\n datasource?: PrometheusDatasourceSelector;\n}\n\ntype PrometheusLabelNamesVariableOptions = PrometheusVariableOptionsBase;\n\ntype PrometheusLabelValuesVariableOptions = PrometheusVariableOptionsBase & {\n label_name: string;\n matchers?: [string];\n};\n\n/**\n * Takes a list of strings and returns a list of VariableOptions\n */\nconst stringArrayToVariableOptions = (values?: string[]): VariableOption[] => {\n if (!values) return [];\n return values.map((value) => ({\n value,\n label: value,\n }));\n};\n\nasync function getQueryOptions(\n ctx: GetVariableOptionsContext,\n spec: PrometheusVariableOptionsBase\n): Promise<QueryOptions> {\n // Just use the default Prom datatsource if not specified in variable's spec\n const datasourceSelector = spec.datasource ?? { kind: 'PrometheusDatasource' };\n const datasource = await ctx.datasourceStore.getDatasource(datasourceSelector);\n const queryOptions = {\n datasource: datasource.plugin.spec as PrometheusDatasourceSpec,\n };\n return queryOptions;\n}\n\nexport const PrometheusLabelNamesVariable: VariablePlugin<PrometheusLabelNamesVariableOptions> = {\n getVariableOptions: async (spec, ctx) => {\n const queryOptions = await getQueryOptions(ctx, spec);\n const { data: options } = await labelNames({}, queryOptions);\n return {\n data: stringArrayToVariableOptions(options),\n };\n },\n dependsOn: () => [],\n};\n\nexport const PrometheusLabelValuesVariable: VariablePlugin<PrometheusLabelValuesVariableOptions> = {\n getVariableOptions: async (spec, ctx) => {\n const pluginDef = spec;\n const queryOptions = await getQueryOptions(ctx, spec);\n const match = pluginDef.matchers\n ? pluginDef.matchers.map((m) => replaceTemplateVariables(m, ctx.variables))\n : undefined;\n const { data: options } = await labelValues({ labelName: pluginDef.label_name, 'match[]': match }, queryOptions);\n return {\n data: stringArrayToVariableOptions(options),\n };\n },\n dependsOn: (spec) => {\n return spec.matchers?.map((m) => parseTemplateVariables(m)).flat() || [];\n },\n};\n"],"names":["replaceTemplateVariables","parseTemplateVariables","labelValues","labelNames","stringArrayToVariableOptions","values","map","value","label","getQueryOptions","ctx","spec","datasourceSelector","datasource","kind","datasourceStore","getDatasource","queryOptions","plugin","PrometheusLabelNamesVariable","getVariableOptions","data","options","dependsOn","PrometheusLabelValuesVariable","pluginDef","match","matchers","m","variables","undefined","labelName","label_name","flat"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,wBAAwB,EAAEC,sBAAsB,QAAQ,gBAAgB,CAAC;AAClF,SACEC,WAAW,EACXC,UAAU,QAIL,4BAA4B,CAAC;AAapC;;CAEC,GACD,MAAMC,4BAA4B,GAAG,CAACC,MAAiB,GAAuB;IAC5E,IAAI,CAACA,MAAM,EAAE,OAAO,EAAE,CAAC;IACvB,OAAOA,MAAM,CAACC,GAAG,CAAC,CAACC,KAAK,GAAM,CAAA;YAC5BA,KAAK;YACLC,KAAK,EAAED,KAAK;SACb,CAAA,AAAC,CAAC,CAAC;AACN,CAAC,AAAC;AAEF,eAAeE,eAAe,CAC5BC,GAA8B,EAC9BC,IAAmC,EACZ;QAEIA,WAAe;IAD1C,4EAA4E;IAC5E,MAAMC,kBAAkB,GAAGD,CAAAA,WAAe,GAAfA,IAAI,CAACE,UAAU,cAAfF,WAAe,cAAfA,WAAe,GAAI;QAAEG,IAAI,EAAE,sBAAsB;KAAE,AAAC;IAC/E,MAAMD,UAAU,GAAG,MAAMH,GAAG,CAACK,eAAe,CA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E,CAACZ,IAAI,GAAK;YACZA,GAAa;QAApB,OAAOA,CAAAA,CAAAA,GAAa,GAAbA,IAAI,CAACgB,QAAQ,cAAbhB,GAAa,WAAK,GAAlBA,KAAAA,CAAkB,GAAlBA,GAAa,CAAEL,GAAG,CAAC,CAACsB,CAAC,GAAK3B,sBAAsB,CAAC2B,CAAC,CAAC,CAAC,CAACK,IAAI,EAAE,CAAA,IAAI,EAAE,CAAC;IAC3E,CAAC;CACF,CAAC"}
1
+ {"version":3,"sources":["../../src/plugins/prometheus-variables.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.\nimport { VariablePlugin, VariableOption, OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { Stack, TextField } from '@mui/material';\nimport { replaceTemplateVariables, parseTemplateVariables, PrometheusClient, DEFAULT_PROM } from '../model';\nimport { PrometheusLabelNamesVariableOptions, PrometheusLabelValuesVariableOptions } from './types';\nimport { MatcherEditor } from './MatcherEditor';\n\nfunction PrometheusLabelValuesVariableEditor(props: OptionsEditorProps<PrometheusLabelValuesVariableOptions>) {\n return (\n <Stack spacing={1}>\n <TextField\n sx={{ mb: 1 }}\n label=\"Label Name\"\n value={props.value.label_name}\n onChange={(e) => {\n props.onChange({ ...props.value, label_name: e.target.value });\n }}\n />\n <MatcherEditor\n initialMatchers={props.value.matchers}\n onChange={(e) => {\n props.onChange({ ...props.value, matchers: e });\n }}\n />\n </Stack>\n );\n}\n\nfunction PrometheusLabelNamesVariableEditor(props: OptionsEditorProps<PrometheusLabelNamesVariableOptions>) {\n return (\n <Stack spacing={1}>\n <MatcherEditor\n initialMatchers={props.value.matchers}\n onChange={(e) => {\n props.onChange({ ...props.value, matchers: e });\n }}\n />\n </Stack>\n );\n}\n\n/**\n * Takes a list of strings and returns a list of VariableOptions\n */\nconst stringArrayToVariableOptions = (values?: string[]): VariableOption[] => {\n if (!values) return [];\n return values.map((value) => ({\n value,\n label: value,\n }));\n};\n\nexport const PrometheusLabelNamesVariable: VariablePlugin<PrometheusLabelNamesVariableOptions> = {\n getVariableOptions: async (spec, ctx) => {\n const client: PrometheusClient = await ctx.datasourceStore.getDatasourceClient(spec.datasource ?? DEFAULT_PROM);\n const match = spec.matchers ? spec.matchers.map((m) => replaceTemplateVariables(m, ctx.variables)) : undefined;\n const { data: options } = await client.labelNames({ 'match[]': match });\n return {\n data: stringArrayToVariableOptions(options),\n };\n },\n dependsOn: () => [],\n OptionsEditorComponent: PrometheusLabelNamesVariableEditor,\n createInitialOptions: () => ({}),\n};\n\nexport const PrometheusLabelValuesVariable: VariablePlugin<PrometheusLabelValuesVariableOptions> = {\n getVariableOptions: async (spec, ctx) => {\n const pluginDef = spec;\n const client: PrometheusClient = await ctx.datasourceStore.getDatasourceClient(spec.datasource ?? DEFAULT_PROM);\n const match = pluginDef.matchers\n ? pluginDef.matchers.map((m) => replaceTemplateVariables(m, ctx.variables))\n : undefined;\n const { data: options } = await client.labelValues({ labelName: pluginDef.label_name, 'match[]': match });\n return {\n data: stringArrayToVariableOptions(options),\n };\n },\n dependsOn: (spec) => {\n return spec.matchers?.map((m) => parseTemplateVariables(m)).flat() || [];\n },\n OptionsEditorComponent: PrometheusLabelValuesVariableEditor,\n createInitialOptions: () => ({ label_name: '' }),\n};\n"],"names":["Stack","TextField","replaceTemplateVariables","parseTemplateVariables","DEFAULT_PROM","MatcherEditor","PrometheusLabelValuesVariableEditor","props","spacing","sx","mb","label","value","label_name","onChange","e","target","initialMatchers","matchers","PrometheusLabelNamesVariableEditor","stringArrayToVariableOptions","values","map","PrometheusLabelNamesVariable","getVariableOptions","spec","ctx","client","datasourceStore","getDatasourceClient","datasource","match","m","variables","undefined","data","options","labelNames","dependsOn","OptionsEditorComponent","createInitialOptions","PrometheusLabelValuesVariable","pluginDef","labelValues","labelName","flat"],"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;AACjC;AACA,SAASA,KAAK,EAAEC,SAAS,QAAQ,eAAe,CAAC;AACjD,SAASC,wBAAwB,EAAEC,sBAAsB,EAAoBC,YAAY,QAAQ,UAAU,CAAC;AAE5G,SAASC,aAAa,QAAQ,iBAAiB,CAAC;AAEhD,SAASC,mCAAmC,CAACC,KAA+D,EAAE;IAC5G,qBACE,MAACP,KAAK;QAACQ,OAAO,EAAE,CAAC;;0BACf,KAACP,SAAS;gBACRQ,EAAE,EAAE;oBAAEC,EAAE,EAAE,CAAC;iBAAE;gBACbC,KAAK,EAAC,YAAY;gBAClBC,KAAK,EAAEL,KAAK,CAACK,KAAK,CAACC,UAAU;gBAC7BC,QAAQ,EAAE,CAACC,CAAC,GAAK;oBACfR,KAAK,CAACO,QAAQ,CAAC;wBAAE,GAAGP,KAAK,CAACK,KAAK;wBAAEC,UAAU,EAAEE,CAAC,CAACC,MAAM,CAACJ,KAAK;qBAAE,CAAC,CAAC;gBACjE,CAAC;cACD;0BACF,KAACP,aAAa;gBACZY,eAAe,EAAEV,KAAK,CAACK,KAAK,CAACM,QAAQ;gBACrCJ,QAAQ,EAAE,CAACC,CAAC,GAAK;oBACfR,KAAK,CAACO,QAAQ,CAAC;wBAAE,GAAGP,KAAK,CAACK,KAAK;wBAAEM,QAAQ,EAAEH,CAAC;qBAAE,CAAC,CAAC;gBAClD,CAAC;cACD;;MACI,CACR;AACJ,CAAC;AAED,SAASI,kCAAkC,CAACZ,KAA8D,EAAE;IAC1G,qBACE,KAACP,KAAK;QAAC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AO,CAAA;YAAE3B,UAAU,EAAE,EAAE;SAAE,CAAA,AAAC;CACjD,CAAC"}
@@ -1,8 +1,7 @@
1
1
  import { DurationString } from '@perses-dev/core';
2
2
  import { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
3
- import { PrometheusDatasourceSelector } from '../model/prometheus-client';
4
- import { TemplateString } from '../model/templating';
5
- interface PrometheusTimeSeriesQuerySpec {
3
+ import { PrometheusDatasourceSelector, TemplateString } from '../model';
4
+ export interface PrometheusTimeSeriesQuerySpec {
6
5
  query: TemplateString;
7
6
  min_step?: DurationString;
8
7
  resolution?: number;
@@ -12,5 +11,4 @@ interface PrometheusTimeSeriesQuerySpec {
12
11
  * The core Prometheus TimeSeriesQuery plugin for Perses.
13
12
  */
14
13
  export declare const PrometheusTimeSeriesQuery: TimeSeriesQueryPlugin<PrometheusTimeSeriesQuerySpec>;
15
- export {};
16
14
  //# sourceMappingURL=time-series-query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"time-series-query.d.ts","sourceRoot":"","sources":["../../src/plugins/time-series-query.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAkB,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAIlF,OAAO,EAIL,4BAA4B,EAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIrD,UAAU,6BAA6B;IACrC,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,4BAA4B,CAAC;CAC3C;AAqED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,qBAAqB,CAAC,6BAA6B,CAE1F,CAAC"}
1
+ {"version":3,"file":"time-series-query.d.ts","sourceRoot":"","sources":["../../src/plugins/time-series-query.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAkB,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElF,OAAO,EAEL,4BAA4B,EAE5B,cAAc,EAMf,MAAM,UAAU,CAAC;AAGlB,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,4BAA4B,CAAC;CAC3C;AAgED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,qBAAqB,CAAC,6BAA6B,CAM1F,CAAC"}
@@ -11,10 +11,8 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { fromUnixTime } from 'date-fns';
14
- import { parseValueTuple } from '../model/parse-sample-values';
15
- import { rangeQuery } from '../model/prometheus-client';
16
- import { getDurationStringSeconds, getPrometheusTimeRange, getRangeStep } from '../model/time';
17
- import { replaceTemplateVariables } from '../model/utils';
14
+ import { parseValueTuple, getDurationStringSeconds, getPrometheusTimeRange, getRangeStep, replaceTemplateVariables, DEFAULT_PROM } from '../model';
15
+ import { PrometheusTimeSeriesQueryEditor } from './PrometheusTimeSeriesQueryEditor';
18
16
  const getTimeSeriesData = async (spec, context)=>{
19
17
  var ref;
20
18
  const minStep = getDurationStringSeconds(spec.min_step);
@@ -32,21 +30,14 @@ const getTimeSeriesData = async (spec, context)=>{
32
30
  query = replaceTemplateVariables(query, context.variableState);
33
31
  var _datasource;
34
32
  // Get the datasource, using the default Prom Datasource if one isn't specified in the query
35
- const datasourceSelector = (_datasource = spec.datasource) !== null && _datasource !== void 0 ? _datasource : {
36
- kind: 'PrometheusDatasource'
37
- };
38
- const datasource = await context.datasourceStore.getDatasource(datasourceSelector);
39
- const queryOptions = {
40
- datasource: datasource.plugin.spec
41
- };
33
+ const client = await context.datasourceStore.getDatasourceClient((_datasource = spec.datasource) !== null && _datasource !== void 0 ? _datasource : DEFAULT_PROM);
42
34
  // Make the request to Prom
43
- const request = {
35
+ const response = await client.rangeQuery({
44
36
  query,
45
37
  start,
46
38
  end,
47
39
  step
48
- };
49
- const response = await rangeQuery(request, queryOptions);
40
+ });
50
41
  var ref1;
51
42
  // TODO: What about error responses from Prom that have a response body?
52
43
  const result = (ref1 = (ref = response.data) === null || ref === void 0 ? void 0 : ref.result) !== null && ref1 !== void 0 ? ref1 : [];
@@ -77,7 +68,11 @@ const getTimeSeriesData = async (spec, context)=>{
77
68
  /**
78
69
  * The core Prometheus TimeSeriesQuery plugin for Perses.
79
70
  */ export const PrometheusTimeSeriesQuery = {
80
- getTimeSeriesData
71
+ getTimeSeriesData,
72
+ OptionsEditorComponent: PrometheusTimeSeriesQueryEditor,
73
+ createInitialOptions: ()=>({
74
+ query: ''
75
+ })
81
76
  };
82
77
 
83
78
  //# sourceMappingURL=time-series-query.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugins/time-series-query.ts"],"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 { DurationString } from '@perses-dev/core';\nimport { TimeSeriesData, TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';\nimport { fromUnixTime } from 'date-fns';\nimport { RangeQueryRequestParameters } from '../model/api-types';\nimport { parseValueTuple } from '../model/parse-sample-values';\nimport {\n PrometheusDatasourceSpec,\n QueryOptions,\n rangeQuery,\n PrometheusDatasourceSelector,\n} from '../model/prometheus-client';\nimport { TemplateString } from '../model/templating';\nimport { getDurationStringSeconds, getPrometheusTimeRange, getRangeStep } from '../model/time';\nimport { replaceTemplateVariables } from '../model/utils';\n\ninterface PrometheusTimeSeriesQuerySpec {\n query: TemplateString;\n min_step?: DurationString;\n resolution?: number;\n datasource?: PrometheusDatasourceSelector;\n}\n\nconst getTimeSeriesData: TimeSeriesQueryPlugin<PrometheusTimeSeriesQuerySpec>['getTimeSeriesData'] = async (\n spec,\n context\n) => {\n const minStep = getDurationStringSeconds(spec.min_step);\n const timeRange = getPrometheusTimeRange(context.timeRange);\n const step = getRangeStep(timeRange, minStep, undefined, context.suggestedStepMs);\n\n // Align the time range so that it's a multiple of the step\n let { start, end } = timeRange;\n const utcOffsetSec = new Date().getTimezoneOffset() * 60;\n\n const alignedEnd = Math.floor((end + utcOffsetSec) / step) * step - utcOffsetSec;\n const alignedStart = Math.floor((start + utcOffsetSec) / step) * step - utcOffsetSec;\n start = alignedStart;\n end = alignedEnd;\n\n // Replace template variable placeholders in PromQL query\n let query = spec.query.replace('$__rate_interval', `15s`);\n query = replaceTemplateVariables(query, context.variableState);\n\n // Get the datasource, using the default Prom Datasource if one isn't specified in the query\n const datasourceSelector = spec.datasource ?? { kind: 'PrometheusDatasource' };\n const datasource = await context.datasourceStore.getDatasource(datasourceSelector);\n const queryOptions: QueryOptions = {\n datasource: datasource.plugin.spec as PrometheusDatasourceSpec,\n };\n\n // Make the request to Prom\n const request: RangeQueryRequestParameters = {\n query,\n start,\n end,\n step,\n };\n const response = await rangeQuery(request, queryOptions);\n\n // TODO: What about error responses from Prom that have a response body?\n const result = response.data?.result ?? [];\n\n // Transform response\n const chartData: TimeSeriesData = {\n // Return the time range and step we actually used for the query\n timeRange: { start: fromUnixTime(start), end: fromUnixTime(end) },\n stepMs: step * 1000,\n\n // TODO: Maybe do a proper Iterable implementation that defers some of this\n // processing until its needed\n series: result.map((value) => {\n const { metric, values } = value;\n\n // Name the series after the metric labels or if no metric, just use the\n // overall query\n let name = Object.entries(metric)\n .map(([labelName, labelValue]) => `${labelName}=\"${labelValue}\"`)\n .join(', ');\n if (name === '') name = query;\n\n return {\n name,\n values: values.map(parseValueTuple),\n };\n }),\n };\n return chartData;\n};\n\n/**\n * The core Prometheus TimeSeriesQuery plugin for Perses.\n */\nexport const PrometheusTimeSeriesQuery: TimeSeriesQueryPlugin<PrometheusTimeSeriesQuerySpec> = {\n getTimeSeriesData,\n};\n"],"names":["fromUnixTime","parseValueTuple","rangeQuery","getDurationStringSeconds","getPrometheusTimeRange","getRangeStep","replaceTemplateVariables","getTimeSeriesData","spec","context","response","minStep","min_step","timeRange","step","undefined","suggestedStepMs","start","end","utcOffsetSec","Date","getTimezoneOffset","alignedEnd","Math","floor","alignedStart","query","replace","variableState","datasourceSelector","datasource","kind","datasourceStore","getDatasource","queryOptions","plugin","request","result","data","chartData","stepMs","series","map","value","metric","values","name","Object","entries","labelName","labelValue","join","PrometheusTimeSeriesQuery"],"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;AAIjC,SAASA,YAAY,QAAQ,UAAU,CAAC;AAExC,SAASC,eAAe,QAAQ,8BAA8B,CAAC;AAC/D,SAGEC,UAAU,QAEL,4BAA4B,CAAC;AAEpC,SAASC,wBAAwB,EAAEC,sBAAsB,EAAEC,YAAY,QAAQ,eAAe,CAAC;AAC/F,SAASC,wBAAwB,QAAQ,gBAAgB,CAAC;AAS1D,MAAMC,iBAAiB,GAA8E,OACnGC,IAAI,EACJC,OAAO,GACJ;QAmCYC,GAAa;IAlC5B,MAAMC,OAAO,GAAGR,wBAAwB,CAACK,IAAI,CAACI,QAAQ,CAAC,AAAC;IACxD,MAAMC,SAAS,GAAGT,sBAAsB,CAACK,OAAO,CAACI,SAAS,CAAC,AAAC;IAC5D,MAAMC,IAAI,GAAGT,YAAY,CAACQ,SAAS,EAAEF,OAAO,EAAEI,SAAS,E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,OAAO,MAAMa,yBAAyB,GAAyD;IAC7F7C,iBAAiB;CAClB,CAAC"}
1
+ {"version":3,"sources":["../../src/plugins/time-series-query.ts"],"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 { DurationString } from '@perses-dev/core';\nimport { TimeSeriesData, TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';\nimport { fromUnixTime } from 'date-fns';\nimport {\n parseValueTuple,\n PrometheusDatasourceSelector,\n PrometheusClient,\n TemplateString,\n getDurationStringSeconds,\n getPrometheusTimeRange,\n getRangeStep,\n replaceTemplateVariables,\n DEFAULT_PROM,\n} from '../model';\nimport { PrometheusTimeSeriesQueryEditor } from './PrometheusTimeSeriesQueryEditor';\n\nexport interface PrometheusTimeSeriesQuerySpec {\n query: TemplateString;\n min_step?: DurationString;\n resolution?: number;\n datasource?: PrometheusDatasourceSelector;\n}\n\nconst getTimeSeriesData: TimeSeriesQueryPlugin<PrometheusTimeSeriesQuerySpec>['getTimeSeriesData'] = async (\n spec,\n context\n) => {\n const minStep = getDurationStringSeconds(spec.min_step);\n const timeRange = getPrometheusTimeRange(context.timeRange);\n const step = getRangeStep(timeRange, minStep, undefined, context.suggestedStepMs);\n\n // Align the time range so that it's a multiple of the step\n let { start, end } = timeRange;\n const utcOffsetSec = new Date().getTimezoneOffset() * 60;\n\n const alignedEnd = Math.floor((end + utcOffsetSec) / step) * step - utcOffsetSec;\n const alignedStart = Math.floor((start + utcOffsetSec) / step) * step - utcOffsetSec;\n start = alignedStart;\n end = alignedEnd;\n\n // Replace template variable placeholders in PromQL query\n let query = spec.query.replace('$__rate_interval', `15s`);\n query = replaceTemplateVariables(query, context.variableState);\n\n // Get the datasource, using the default Prom Datasource if one isn't specified in the query\n const client: PrometheusClient = await context.datasourceStore.getDatasourceClient(spec.datasource ?? DEFAULT_PROM);\n\n // Make the request to Prom\n const response = await client.rangeQuery({\n query,\n start,\n end,\n step,\n });\n\n // TODO: What about error responses from Prom that have a response body?\n const result = response.data?.result ?? [];\n\n // Transform response\n const chartData: TimeSeriesData = {\n // Return the time range and step we actually used for the query\n timeRange: { start: fromUnixTime(start), end: fromUnixTime(end) },\n stepMs: step * 1000,\n\n // TODO: Maybe do a proper Iterable implementation that defers some of this\n // processing until its needed\n series: result.map((value) => {\n const { metric, values } = value;\n\n // Name the series after the metric labels or if no metric, just use the\n // overall query\n let name = Object.entries(metric)\n .map(([labelName, labelValue]) => `${labelName}=\"${labelValue}\"`)\n .join(', ');\n if (name === '') name = query;\n\n return {\n name,\n values: values.map(parseValueTuple),\n };\n }),\n };\n return chartData;\n};\n\n/**\n * The core Prometheus TimeSeriesQuery plugin for Perses.\n */\nexport const PrometheusTimeSeriesQuery: TimeSeriesQueryPlugin<PrometheusTimeSeriesQuerySpec> = {\n getTimeSeriesData,\n OptionsEditorComponent: PrometheusTimeSeriesQueryEditor,\n createInitialOptions: () => ({\n query: '',\n }),\n};\n"],"names":["fromUnixTime","parseValueTuple","getDurationStringSeconds","getPrometheusTimeRange","getRangeStep","replaceTemplateVariables","DEFAULT_PROM","PrometheusTimeSeriesQueryEditor","getTimeSeriesData","spec","context","response","minStep","min_step","timeRange","step","undefined","suggestedStepMs","start","end","utcOffsetSec","Date","getTimezoneOffset","alignedEnd","Math","floor","alignedStart","query","replace","variableState","client","datasourceStore","getDatasourceClient","datasource","rangeQuery","result","data","chartData","stepMs","series","map","value","metric","values","name","Object","entries","labelName","labelValue","join","PrometheusTimeSeriesQuery","OptionsEditorComponent","createInitialOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0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ACO,SAAS,EAAEC,UAAU,CAAC,GAAK,CAAC,EAAED,SAAS,CAAC,EAAE,EAAEC,UAAU,CAAC,CAAC,CAAC,CAAC,CAChEC,IAAI,CAAC,IAAI,CAAC,AAAC;YACd,IAAIL,IAAI,KAAK,EAAE,EAAEA,IAAI,GAAGjB,KAAK,CAAC;YAE9B,OAAO;gBACLiB,IAAI;gBACJD,MAAM,EAAEA,MAAM,CAACH,GAAG,CAACvC,eAAe,CAAC;aACpC,CAAC;QACJ,CAAC,CAAC;KACH,AAAC;IACF,OAAOoC,SAAS,CAAC;AACnB,CAAC,AAAC;AAEF;;CAEC,GACD,OAAO,MAAMa,yBAAyB,GAAyD;IAC7F1C,iBAAiB;IACjB2C,sBAAsB,EAAE5C,+BAA+B;IACvD6C,oBAAoB,EAAE,IAAO,CAAA;YAC3BzB,KAAK,EAAE,EAAE;SACV,CAAA,AAAC;CACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { PrometheusDatasourceSelector } from '../model';
2
+ export interface PrometheusVariableOptionsBase {
3
+ datasource?: PrometheusDatasourceSelector;
4
+ }
5
+ export declare type PrometheusLabelNamesVariableOptions = PrometheusVariableOptionsBase & {
6
+ matchers?: string[];
7
+ };
8
+ export declare type PrometheusLabelValuesVariableOptions = PrometheusVariableOptionsBase & {
9
+ label_name: string;
10
+ matchers?: string[];
11
+ };
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAExD,MAAM,WAAW,6BAA6B;IAC5C,UAAU,CAAC,EAAE,4BAA4B,CAAC;CAC3C;AAED,oBAAY,mCAAmC,GAAG,6BAA6B,GAAG;IAChF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,oBAAY,oCAAoC,GAAG,6BAA6B,GAAG;IACjF,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
@@ -0,0 +1,15 @@
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
+ export { };
14
+
15
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugins/types.ts"],"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 { PrometheusDatasourceSelector } from '../model';\n\nexport interface PrometheusVariableOptionsBase {\n datasource?: PrometheusDatasourceSelector;\n}\n\nexport type PrometheusLabelNamesVariableOptions = PrometheusVariableOptionsBase & {\n matchers?: string[];\n};\n\nexport type PrometheusLabelValuesVariableOptions = PrometheusVariableOptionsBase & {\n label_name: string;\n matchers?: string[];\n};\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,WAaE"}
@@ -1 +1 @@
1
- {"version":3,"file":"variable.d.ts","sourceRoot":"","sources":["../../src/plugins/variable.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3E,aAAK,gBAAgB,GAAG,MAAM,GAAG,cAAc,CAAC;AAEhD,aAAK,yBAAyB,GAAG;IAC/B,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,yBAAyB,CAaxE,CAAC"}
1
+ {"version":3,"file":"variable.d.ts","sourceRoot":"","sources":["../../src/plugins/variable.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAsB,MAAM,2BAA2B,CAAC;AAG/F,aAAK,gBAAgB,GAAG,MAAM,GAAG,cAAc,CAAC;AAEhD,aAAK,yBAAyB,GAAG;IAC/B,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AAiCF,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,yBAAyB,CAexE,CAAC"}
@@ -10,6 +10,41 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { Autocomplete, TextField } from '@mui/material';
15
+ function StaticListVariableOptionEditor(props) {
16
+ const value = props.value.values.map((v)=>{
17
+ if (typeof v === 'string') {
18
+ return v;
19
+ } else {
20
+ return v.value;
21
+ }
22
+ });
23
+ const onChange = (__, value)=>{
24
+ props.onChange({
25
+ values: value.map((v)=>{
26
+ return {
27
+ value: v,
28
+ label: v
29
+ };
30
+ })
31
+ });
32
+ };
33
+ return /*#__PURE__*/ _jsx("div", {
34
+ children: /*#__PURE__*/ _jsx(Autocomplete, {
35
+ multiple: true,
36
+ value: value,
37
+ onChange: onChange,
38
+ options: [],
39
+ freeSolo: true,
40
+ renderInput: (params)=>/*#__PURE__*/ _jsx(TextField, {
41
+ ...params,
42
+ label: "Values",
43
+ placeholder: "Values"
44
+ })
45
+ })
46
+ });
47
+ }
13
48
  export const StaticListVariable = {
14
49
  getVariableOptions: async (spec)=>{
15
50
  var ref;
@@ -26,7 +61,11 @@ export const StaticListVariable = {
26
61
  data: values
27
62
  };
28
63
  },
29
- dependsOn: ()=>[]
64
+ dependsOn: ()=>[],
65
+ OptionsEditorComponent: StaticListVariableOptionEditor,
66
+ createInitialOptions: ()=>({
67
+ values: []
68
+ })
30
69
  };
31
70
 
32
71
  //# sourceMappingURL=variable.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugins/variable.ts"],"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 { VariablePlugin, VariableOption } from '@perses-dev/plugin-system';\n\ntype StaticListOption = string | VariableOption;\n\ntype StaticListVariableOptions = {\n values: StaticListOption[];\n};\n\nexport const StaticListVariable: VariablePlugin<StaticListVariableOptions> = {\n getVariableOptions: async (spec) => {\n const values = spec.values?.map((v) => {\n if (typeof v === 'string') {\n return { label: v, value: v };\n }\n return v;\n });\n return {\n data: values,\n };\n },\n dependsOn: () => [],\n};\n"],"names":["StaticListVariable","getVariableOptions","spec","values","map","v","label","value","data","dependsOn"],"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;AAUjC,OAAO,MAAMA,kBAAkB,GAA8C;IAC3EC,kBAAkB,EAAE,OAAOC,IAAI,GAAK;YACnBA,GAAW;QAA1B,MAAMC,MAAM,GAAGD,CAAAA,GAAW,GAAXA,IAAI,CAACC,MAAM,cAAXD,GAAW,WAAK,GAAhBA,KAAAA,CAAgB,GAAhBA,GAAW,CAAEE,GAAG,CAAC,CAACC,CAAC,GAAK;YACrC,IAAI,OAAOA,CAAC,KAAK,QAAQ,EAAE;gBACzB,OAAO;oBAAEC,KAAK,EAAED,CAAC;oBAAEE,KAAK,EAAEF,CAAC;iBAAE,CAAC;YAChC,CAAC;YACD,OAAOA,CAAC,CAAC;QACX,CAAC,CAAC,AAAC;QACH,OAAO;YACLG,IAAI,EAAEL,MAAM;SACb,CAAC;IACJ,CAAC;IACDM,SAAS,EAAE,IAAM,EAAE;CACpB,CAAC"}
1
+ {"version":3,"sources":["../../src/plugins/variable.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 { VariablePlugin, VariableOption, OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { Autocomplete, TextField } from '@mui/material';\n\ntype StaticListOption = string | VariableOption;\n\ntype StaticListVariableOptions = {\n values: StaticListOption[];\n};\n\nfunction StaticListVariableOptionEditor(props: OptionsEditorProps<StaticListVariableOptions>) {\n const value = props.value.values.map((v) => {\n if (typeof v === 'string') {\n return v;\n } else {\n return v.value;\n }\n });\n\n const onChange = (__: unknown, value: string[]) => {\n props.onChange({\n values: value.map((v) => {\n return { value: v, label: v };\n }),\n });\n };\n\n return (\n <div>\n <Autocomplete\n multiple\n value={value}\n onChange={onChange}\n options={[]}\n freeSolo\n renderInput={(params) => <TextField {...params} label=\"Values\" placeholder=\"Values\" />}\n />\n </div>\n );\n}\n\nexport const StaticListVariable: VariablePlugin<StaticListVariableOptions> = {\n getVariableOptions: async (spec) => {\n const values = spec.values?.map((v) => {\n if (typeof v === 'string') {\n return { label: v, value: v };\n }\n return v;\n });\n return {\n data: values,\n };\n },\n dependsOn: () => [],\n OptionsEditorComponent: StaticListVariableOptionEditor,\n createInitialOptions: () => ({ values: [] }),\n};\n"],"names":["Autocomplete","TextField","StaticListVariableOptionEditor","props","value","values","map","v","onChange","__","label","div","multiple","options","freeSolo","renderInput","params","placeholder","StaticListVariable","getVariableOptions","spec","data","dependsOn","OptionsEditorComponent","createInitialOptions"],"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;AACA,SAASA,YAAY,EAAEC,SAAS,QAAQ,eAAe,CAAC;AAQxD,SAASC,8BAA8B,CAACC,KAAoD,EAAE;IAC5F,MAAMC,KAAK,GAAGD,KAAK,CAACC,KAAK,CAACC,MAAM,CAACC,GAAG,CAAC,CAACC,CAAC,GAAK;QAC1C,IAAI,OAAOA,CAAC,KAAK,QAAQ,EAAE;YACzB,OAAOA,CAAC,CAAC;QACX,OAAO;YACL,OAAOA,CAAC,CAACH,KAAK,CAAC;QACjB,CAAC;IACH,CAAC,CAAC,AAAC;IAEH,MAAMI,QAAQ,GAAG,CAACC,EAAW,EAAEL,KAAe,GAAK;QACjDD,KAAK,CAACK,QAAQ,CAAC;YACbH,MAAM,EAAED,KAAK,CAACE,GAAG,CAAC,CAACC,CAAC,GAAK;gBACvB,OAAO;oBAAEH,KAAK,EAAEG,CAAC;oBAAEG,KAAK,EAAEH,CAAC;iBAAE,CAAC;YAChC,CAAC,CAAC;SACH,CAAC,CAAC;IACL,CAAC,AAAC;IAEF,qBACE,KAACI,KAAG;kBACF,cAAA,KAACX,YAAY;YACXY,QAAQ;YACRR,KAAK,EAAEA,KAAK;YACZI,QAAQ,EAAEA,QAAQ;YAClBK,OAAO,EAAE,EAAE;YACXC,QAAQ;YACRC,WAAW,EAAE,CAACC,MAAM,iBAAK,KAACf,SAAS;oBAAE,GAAGe,MAAM;oBAAEN,KAAK,EAAC,QAAQ;oBAACO,WAAW,EAAC,QAAQ;kBAAG;UACtF;MACE,CACN;AACJ,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAA8C;IAC3EC,kBAAkB,EAAE,OAAOC,IAAI,GAAK;YACnBA,GAAW;QAA1B,MAAMf,MAAM,GAAGe,CAAAA,GAAW,GAAXA,IAAI,CAACf,MAAM,cAAXe,GAAW,WAAK,GAAhBA,KAAAA,CAAgB,GAAhBA,GAAW,CAAEd,GAAG,CAAC,CAACC,CAAC,GAAK;YACrC,IAAI,OAAOA,CAAC,KAAK,QAAQ,EAAE;gBACzB,OAAO;oBAAEG,KAAK,EAAEH,CAAC;oBAAEH,KAAK,EAAEG,CAAC;iBAAE,CAAC;YAChC,CAAC;YACD,OAAOA,CAAC,CAAC;QACX,CAAC,CAAC,AAAC;QACH,OAAO;YACLc,IAAI,EAAEhB,MAAM;SACb,CAAC;IACJ,CAAC;IACDiB,SAAS,EAAE,IAAM,EAAE;IACnBC,sBAAsB,EAAErB,8BAA8B;IACtDsB,oBAAoB,EAAE,IAAO,CAAA;YAAEnB,MAAM,EAAE,EAAE;SAAE,CAAA,AAAC;CAC7C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/prometheus-plugin",
3
- "version": "0.9.0",
3
+ "version": "0.11.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,10 +29,11 @@
29
29
  "dependencies": {
30
30
  "@lezer/highlight": "^1.0.0",
31
31
  "@lezer/lr": "^1.2.0",
32
- "@perses-dev/core": "^0.9.0",
33
- "@perses-dev/plugin-system": "^0.9.0",
32
+ "@perses-dev/core": "^0.11.0",
33
+ "@perses-dev/plugin-system": "^0.11.0",
34
34
  "@prometheus-io/lezer-promql": "^0.37.0",
35
- "date-fns": "^2.28.0"
35
+ "date-fns": "^2.28.0",
36
+ "immer": "^9.0.15"
36
37
  },
37
38
  "peerDependencies": {
38
39
  "react": "^17.0.2 || ^18.0.0"