@perses-dev/prometheus-plugin 0.0.0-snapshot-panel-extra-content-3-17f9c42 → 0.0.0-snapshot-scatterplot-fix-imports-95e1b59
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/dist/cjs/components/PromQL.js +10 -8
- package/dist/cjs/components/index.js +10 -8
- package/dist/cjs/index.js +33 -19
- package/dist/cjs/model/index.js +14 -13
- package/dist/cjs/model/parse-sample-values.js +6 -2
- package/dist/cjs/model/prometheus-client.js +43 -8
- package/dist/cjs/model/prometheus-selectors.js +12 -4
- package/dist/cjs/model/time.js +15 -9
- package/dist/cjs/plugins/MatcherEditor.js +14 -12
- package/dist/cjs/plugins/PrometheusDatasourceEditor.js +610 -0
- package/dist/cjs/plugins/prometheus-datasource.js +59 -8
- package/dist/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +10 -8
- package/dist/cjs/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +49 -24
- package/dist/cjs/plugins/prometheus-time-series-query/get-time-series-data.js +44 -24
- package/dist/cjs/plugins/prometheus-time-series-query/index.js +10 -8
- package/dist/cjs/plugins/prometheus-time-series-query/query-editor-model.js +44 -11
- package/dist/cjs/plugins/prometheus-variables.js +69 -63
- package/dist/cjs/plugins/types.js +7 -0
- package/dist/cjs/plugins/variable.js +9 -7
- package/dist/cjs/utils/index.js +10 -8
- package/dist/cjs/utils/utils.js +13 -7
- package/dist/components/PromQL.d.ts +2 -3
- package/dist/components/PromQL.d.ts.map +1 -1
- package/dist/components/PromQL.js +1 -1
- package/dist/components/PromQL.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/api-types.d.ts +11 -11
- package/dist/model/api-types.d.ts.map +1 -1
- package/dist/model/api-types.js.map +1 -1
- package/dist/model/index.d.ts +0 -1
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +0 -1
- package/dist/model/index.js.map +1 -1
- package/dist/model/parse-sample-values.d.ts +1 -1
- package/dist/model/parse-sample-values.d.ts.map +1 -1
- package/dist/model/parse-sample-values.js.map +1 -1
- package/dist/model/prometheus-client.d.ts +4 -0
- package/dist/model/prometheus-client.d.ts.map +1 -1
- package/dist/model/prometheus-client.js +27 -3
- package/dist/model/prometheus-client.js.map +1 -1
- package/dist/model/prometheus-selectors.js.map +1 -1
- package/dist/model/time.js +2 -2
- package/dist/model/time.js.map +1 -1
- package/dist/plugins/MatcherEditor.d.ts +2 -3
- package/dist/plugins/MatcherEditor.d.ts.map +1 -1
- package/dist/plugins/MatcherEditor.js +1 -1
- package/dist/plugins/MatcherEditor.js.map +1 -1
- package/dist/plugins/{PrometheusDatasourceEditor/PrometheusDatasourceEditor.d.ts → PrometheusDatasourceEditor.d.ts} +1 -2
- package/dist/plugins/PrometheusDatasourceEditor.d.ts.map +1 -0
- package/dist/plugins/PrometheusDatasourceEditor.js +556 -0
- package/dist/plugins/PrometheusDatasourceEditor.js.map +1 -0
- package/dist/plugins/prometheus-datasource.d.ts +2 -7
- package/dist/plugins/prometheus-datasource.d.ts.map +1 -1
- package/dist/plugins/prometheus-datasource.js +55 -6
- package/dist/plugins/prometheus-datasource.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQuery.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts +1 -2
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js +41 -18
- package/dist/plugins/prometheus-time-series-query/PrometheusTimeSeriesQueryEditor.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.js +37 -19
- package/dist/plugins/prometheus-time-series-query/get-time-series-data.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/index.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/query-editor-model.d.ts +11 -2
- package/dist/plugins/prometheus-time-series-query/query-editor-model.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/query-editor-model.js +38 -10
- package/dist/plugins/prometheus-time-series-query/query-editor-model.js.map +1 -1
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.d.ts +4 -4
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.d.ts.map +1 -1
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.js +3 -1
- package/dist/plugins/prometheus-time-series-query/time-series-query-model.js.map +1 -1
- package/dist/plugins/prometheus-variables.d.ts.map +1 -1
- package/dist/plugins/prometheus-variables.js +37 -37
- package/dist/plugins/prometheus-variables.js.map +1 -1
- package/dist/plugins/types.d.ts +12 -5
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/types.js +1 -1
- package/dist/plugins/types.js.map +1 -1
- package/dist/plugins/variable.d.ts +2 -2
- package/dist/plugins/variable.d.ts.map +1 -1
- package/dist/plugins/variable.js +2 -2
- package/dist/plugins/variable.js.map +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/utils.d.ts +2 -2
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +4 -4
- package/dist/utils/utils.js.map +1 -1
- package/package.json +6 -6
- package/dist/cjs/model/templating.js +0 -26
- package/dist/cjs/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js +0 -392
- package/dist/cjs/plugins/PrometheusDatasourceEditor/index.js +0 -29
- package/dist/cjs/plugins/PrometheusDatasourceEditor/types.js +0 -16
- package/dist/model/templating.d.ts +0 -6
- package/dist/model/templating.d.ts.map +0 -1
- package/dist/model/templating.js +0 -20
- package/dist/model/templating.js.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js +0 -342
- package/dist/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.js.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/index.d.ts +0 -3
- package/dist/plugins/PrometheusDatasourceEditor/index.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/index.js +0 -16
- package/dist/plugins/PrometheusDatasourceEditor/index.js.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/types.d.ts +0 -20
- package/dist/plugins/PrometheusDatasourceEditor/types.d.ts.map +0 -1
- package/dist/plugins/PrometheusDatasourceEditor/types.js +0 -15
- package/dist/plugins/PrometheusDatasourceEditor/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './utils';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './utils';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU"}
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Metric } from '../model/api-types';
|
|
2
2
|
/**
|
|
3
|
-
* Types for metric labels, used in
|
|
3
|
+
* Types for metric labels, used in seriesNameFormat implementation
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type SeriesLabels = Record<string, string>;
|
|
6
6
|
export declare function formatSeriesName(inputFormat: string, seriesLabels: SeriesLabels): string;
|
|
7
7
|
export declare function getUniqueKeyForPrometheusResult(metricLabels: {
|
|
8
8
|
[key: string]: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAOlD,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,MAAM,CAMxF;AAyBD,wBAAgB,+BAA+B,CAC7C,YAAY,EAAE;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,EACD,EAAE,cAAc,EAAE,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,UAqBtD;AAKD,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;;;EAYjG"}
|
package/dist/utils/utils.js
CHANGED
|
@@ -18,8 +18,8 @@ import { isEmptyObject } from '@perses-dev/core';
|
|
|
18
18
|
*/ export function formatSeriesName(inputFormat, seriesLabels) {
|
|
19
19
|
const resolveLabelsRegex = /\{\{\s*(.+?)\s*\}\}/g;
|
|
20
20
|
return inputFormat.replace(resolveLabelsRegex, (_match, token)=>{
|
|
21
|
-
var
|
|
22
|
-
const resolvedValue = (
|
|
21
|
+
var _seriesLabels_token;
|
|
22
|
+
const resolvedValue = (_seriesLabels_token = seriesLabels[token]) !== null && _seriesLabels_token !== void 0 ? _seriesLabels_token : '';
|
|
23
23
|
return resolvedValue;
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -41,7 +41,7 @@ import { isEmptyObject } from '@perses-dev/core';
|
|
|
41
41
|
}
|
|
42
42
|
/*
|
|
43
43
|
* Metric labels formattter which checks for __name__ and outputs valid PromQL for series name
|
|
44
|
-
*/ export function getUniqueKeyForPrometheusResult(metricLabels, { removeExprWrap
|
|
44
|
+
*/ export function getUniqueKeyForPrometheusResult(metricLabels, { removeExprWrap } = {}) {
|
|
45
45
|
const metricNameKey = '__name__';
|
|
46
46
|
if (metricLabels) {
|
|
47
47
|
if (Object.prototype.hasOwnProperty.call(metricLabels, metricNameKey)) {
|
|
@@ -68,7 +68,7 @@ import { isEmptyObject } from '@perses-dev/core';
|
|
|
68
68
|
if (name === '' || isEmptyObject(metric)) {
|
|
69
69
|
name = query;
|
|
70
70
|
}
|
|
71
|
-
// Query editor allows you to define an optional
|
|
71
|
+
// Query editor allows you to define an optional seriesNameFormat property.
|
|
72
72
|
// This controls the regex used to customize legend and tooltip display.
|
|
73
73
|
const formattedName = formatter ? formatSeriesName(formatter, metric) : name;
|
|
74
74
|
return {
|
package/dist/utils/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/utils.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 { isEmptyObject } from '@perses-dev/core';\nimport { Metric } from '../model/api-types';\n\n/**\n * Types for metric labels, used in
|
|
1
|
+
{"version":3,"sources":["../../src/utils/utils.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 { isEmptyObject } from '@perses-dev/core';\nimport { Metric } from '../model/api-types';\n\n/**\n * Types for metric labels, used in seriesNameFormat implementation\n */\nexport type SeriesLabels = Record<string, string>;\n\n/*\n * Formatter used for series name display in legends and tooltips.\n * Regex replaces label {{ name }} with resolved label value.\n * If no resolved value, return empty string instead of the token inside double curly braces.\n */\nexport function formatSeriesName(inputFormat: string, seriesLabels: SeriesLabels): string {\n const resolveLabelsRegex = /\\{\\{\\s*(.+?)\\s*\\}\\}/g;\n return inputFormat.replace(resolveLabelsRegex, (_match, token) => {\n const resolvedValue = seriesLabels[token] ?? '';\n return resolvedValue;\n });\n}\n\n/*\n * Stringifies object of labels into valid PromQL for querying metric by label\n */\nfunction stringifyPrometheusMetricLabels(labels: { [key: string]: unknown }, removeExprWrap?: boolean) {\n const labelStrings: string[] = [];\n Object.keys(labels)\n .sort()\n .forEach((labelName) => {\n const labelValue = labels[labelName];\n if (labelValue !== undefined) {\n if (removeExprWrap) {\n labelStrings.push(`\"${labelName}\":\"${labelValue}\"`);\n } else {\n labelStrings.push(`${labelName}=\"${labelValue}\"`);\n }\n }\n });\n return `{${labelStrings.join(',')}}`;\n}\n\n/*\n * Metric labels formattter which checks for __name__ and outputs valid PromQL for series name\n */\nexport function getUniqueKeyForPrometheusResult(\n metricLabels: {\n [key: string]: string;\n },\n { removeExprWrap }: { removeExprWrap?: boolean } = {}\n) {\n const metricNameKey = '__name__';\n if (metricLabels) {\n if (Object.prototype.hasOwnProperty.call(metricLabels, metricNameKey)) {\n const stringifiedLabels = stringifyPrometheusMetricLabels(\n {\n ...metricLabels,\n [metricNameKey]: undefined,\n },\n removeExprWrap\n );\n if (removeExprWrap === true) {\n return `${stringifiedLabels}`;\n } else {\n return `${metricLabels[metricNameKey]}${stringifiedLabels}`;\n }\n }\n return stringifyPrometheusMetricLabels(metricLabels, removeExprWrap);\n }\n return '';\n}\n\n/*\n * Determine human-readable series name to be used in legend and tooltip\n */\nexport function getFormattedPrometheusSeriesName(query: string, metric: Metric, formatter?: string) {\n // Name the series after the metric labels by default.\n // Use the query if no metric or metric labels are empty.\n let name = getUniqueKeyForPrometheusResult(metric);\n if (name === '' || isEmptyObject(metric)) {\n name = query;\n }\n\n // Query editor allows you to define an optional seriesNameFormat property.\n // This controls the regex used to customize legend and tooltip display.\n const formattedName = formatter ? formatSeriesName(formatter, metric) : name;\n return { name, formattedName };\n}\n"],"names":["isEmptyObject","formatSeriesName","inputFormat","seriesLabels","resolveLabelsRegex","replace","_match","token","resolvedValue","stringifyPrometheusMetricLabels","labels","removeExprWrap","labelStrings","Object","keys","sort","forEach","labelName","labelValue","undefined","push","join","getUniqueKeyForPrometheusResult","metricLabels","metricNameKey","prototype","hasOwnProperty","call","stringifiedLabels","getFormattedPrometheusSeriesName","query","metric","formatter","name","formattedName"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,aAAa,QAAQ,mBAAmB;AAQjD;;;;CAIC,GACD,OAAO,SAASC,iBAAiBC,WAAmB,EAAEC,YAA0B;IAC9E,MAAMC,qBAAqB;IAC3B,OAAOF,YAAYG,OAAO,CAACD,oBAAoB,CAACE,QAAQC;YAChCJ;QAAtB,MAAMK,gBAAgBL,CAAAA,sBAAAA,YAAY,CAACI,MAAM,cAAnBJ,iCAAAA,sBAAuB;QAC7C,OAAOK;IACT;AACF;AAEA;;CAEC,GACD,SAASC,gCAAgCC,MAAkC,EAAEC,cAAwB;IACnG,MAAMC,eAAyB,EAAE;IACjCC,OAAOC,IAAI,CAACJ,QACTK,IAAI,GACJC,OAAO,CAAC,CAACC;QACR,MAAMC,aAAaR,MAAM,CAACO,UAAU;QACpC,IAAIC,eAAeC,WAAW;YAC5B,IAAIR,gBAAgB;gBAClBC,aAAaQ,IAAI,CAAC,CAAC,CAAC,EAAEH,UAAU,GAAG,EAAEC,WAAW,CAAC,CAAC;YACpD,OAAO;gBACLN,aAAaQ,IAAI,CAAC,CAAC,EAAEH,UAAU,EAAE,EAAEC,WAAW,CAAC,CAAC;YAClD;QACF;IACF;IACF,OAAO,CAAC,CAAC,EAAEN,aAAaS,IAAI,CAAC,KAAK,CAAC,CAAC;AACtC;AAEA;;CAEC,GACD,OAAO,SAASC,gCACdC,YAEC,EACD,EAAEZ,cAAc,EAAgC,GAAG,CAAC,CAAC;IAErD,MAAMa,gBAAgB;IACtB,IAAID,cAAc;QAChB,IAAIV,OAAOY,SAAS,CAACC,cAAc,CAACC,IAAI,CAACJ,cAAcC,gBAAgB;YACrE,MAAMI,oBAAoBnB,gCACxB;gBACE,GAAGc,YAAY;gBACf,CAACC,cAAc,EAAEL;YACnB,GACAR;YAEF,IAAIA,mBAAmB,MAAM;gBAC3B,OAAO,CAAC,EAAEiB,kBAAkB,CAAC;YAC/B,OAAO;gBACL,OAAO,CAAC,EAAEL,YAAY,CAACC,cAAc,CAAC,EAAEI,kBAAkB,CAAC;YAC7D;QACF;QACA,OAAOnB,gCAAgCc,cAAcZ;IACvD;IACA,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,SAASkB,iCAAiCC,KAAa,EAAEC,MAAc,EAAEC,SAAkB;IAChG,sDAAsD;IACtD,yDAAyD;IACzD,IAAIC,OAAOX,gCAAgCS;IAC3C,IAAIE,SAAS,MAAMjC,cAAc+B,SAAS;QACxCE,OAAOH;IACT;IAEA,2EAA2E;IAC3E,wEAAwE;IACxE,MAAMI,gBAAgBF,YAAY/B,iBAAiB+B,WAAWD,UAAUE;IACxE,OAAO;QAAEA;QAAMC;IAAc;AAC/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/prometheus-plugin",
|
|
3
|
-
"version": "0.0.0-snapshot-
|
|
3
|
+
"version": "0.0.0-snapshot-scatterplot-fix-imports-95e1b59",
|
|
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",
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
"build:types": "tsc --project tsconfig.build.json",
|
|
24
24
|
"type-check": "tsc --noEmit",
|
|
25
25
|
"start": "concurrently -P \"npm:build:* -- {*}\" -- --watch",
|
|
26
|
-
"test": "TZ=UTC jest",
|
|
27
|
-
"test:watch": "TZ=UTC jest --watch",
|
|
26
|
+
"test": "cross-env TZ=UTC jest",
|
|
27
|
+
"test:watch": "cross-env TZ=UTC jest --watch",
|
|
28
28
|
"lint": "eslint src --ext .ts,.tsx",
|
|
29
29
|
"lint:fix": "eslint --fix src --ext .ts,.tsx"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@lezer/highlight": "^1.0.0",
|
|
33
33
|
"@lezer/lr": "^1.2.0",
|
|
34
|
-
"@perses-dev/components": "0.0.0-snapshot-
|
|
35
|
-
"@perses-dev/core": "0.0.0-snapshot-
|
|
36
|
-
"@perses-dev/plugin-system": "0.0.0-snapshot-
|
|
34
|
+
"@perses-dev/components": "0.0.0-snapshot-scatterplot-fix-imports-95e1b59",
|
|
35
|
+
"@perses-dev/core": "0.0.0-snapshot-scatterplot-fix-imports-95e1b59",
|
|
36
|
+
"@perses-dev/plugin-system": "0.0.0-snapshot-scatterplot-fix-imports-95e1b59",
|
|
37
37
|
"@prometheus-io/codemirror-promql": "^0.43.0",
|
|
38
38
|
"@uiw/react-codemirror": "^4.19.1",
|
|
39
39
|
"date-fns": "^2.28.0",
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "useReplaceTemplateString", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: ()=>useReplaceTemplateString
|
|
20
|
-
});
|
|
21
|
-
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
22
|
-
function useReplaceTemplateString(templateString) {
|
|
23
|
-
const templateVariablesInTemplate = (0, _pluginSystem.parseTemplateVariables)(templateString || '');
|
|
24
|
-
const variables = (0, _pluginSystem.useTemplateVariableValues)(templateVariablesInTemplate);
|
|
25
|
-
return (0, _pluginSystem.replaceTemplateVariables)(templateString || '', variables);
|
|
26
|
-
}
|
|
@@ -1,392 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "PrometheusDatasourceEditor", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: ()=>PrometheusDatasourceEditor
|
|
20
|
-
});
|
|
21
|
-
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _pluginSystem = require("@perses-dev/plugin-system");
|
|
23
|
-
const _material = require("@mui/material");
|
|
24
|
-
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
25
|
-
const _minus = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Minus"));
|
|
26
|
-
const _plus = /*#__PURE__*/ _interopRequireDefault(require("mdi-material-ui/Plus"));
|
|
27
|
-
function _interopRequireDefault(obj) {
|
|
28
|
-
return obj && obj.__esModule ? obj : {
|
|
29
|
-
default: obj
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
33
|
-
if (typeof WeakMap !== "function") return null;
|
|
34
|
-
var cacheBabelInterop = new WeakMap();
|
|
35
|
-
var cacheNodeInterop = new WeakMap();
|
|
36
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
37
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
38
|
-
})(nodeInterop);
|
|
39
|
-
}
|
|
40
|
-
function _interopRequireWildcard(obj, nodeInterop) {
|
|
41
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
42
|
-
return obj;
|
|
43
|
-
}
|
|
44
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
45
|
-
return {
|
|
46
|
-
default: obj
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
50
|
-
if (cache && cache.has(obj)) {
|
|
51
|
-
return cache.get(obj);
|
|
52
|
-
}
|
|
53
|
-
var newObj = {};
|
|
54
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
55
|
-
for(var key in obj){
|
|
56
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
57
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
58
|
-
if (desc && (desc.get || desc.set)) {
|
|
59
|
-
Object.defineProperty(newObj, key, desc);
|
|
60
|
-
} else {
|
|
61
|
-
newObj[key] = obj[key];
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
newObj.default = obj;
|
|
66
|
-
if (cache) {
|
|
67
|
-
cache.set(obj, newObj);
|
|
68
|
-
}
|
|
69
|
-
return newObj;
|
|
70
|
-
}
|
|
71
|
-
function PrometheusDatasourceEditor(props) {
|
|
72
|
-
var ref, ref1, ref2, ref3;
|
|
73
|
-
const { value , onChange , isReadonly } = props;
|
|
74
|
-
const strDirect = 'Direct access';
|
|
75
|
-
const strProxy = 'Proxy';
|
|
76
|
-
// TODO refactor with useImmer to avoid doing so much destructuring? feasibility & performances to be checked
|
|
77
|
-
// utilitary function used for headers when renaming a property
|
|
78
|
-
// -> TODO it would be cleaner to manipulate headers as a list instead, to avoid doing this.
|
|
79
|
-
// This could be a pure frontend trick, but change in the backend datamodel should also be considered
|
|
80
|
-
const buildNewHeaders = (oldHeaders, oldName, newName)=>{
|
|
81
|
-
if (oldHeaders === undefined) return oldHeaders;
|
|
82
|
-
const keys = Object.keys(oldHeaders);
|
|
83
|
-
const newHeaders = keys.reduce((acc, val)=>{
|
|
84
|
-
if (val === oldName) {
|
|
85
|
-
acc[newName] = oldHeaders[oldName] || '';
|
|
86
|
-
} else {
|
|
87
|
-
acc[val] = oldHeaders[val] || '';
|
|
88
|
-
}
|
|
89
|
-
return acc;
|
|
90
|
-
}, {});
|
|
91
|
-
return {
|
|
92
|
-
...newHeaders
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
const tabs = [
|
|
96
|
-
{
|
|
97
|
-
label: strDirect,
|
|
98
|
-
content: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
99
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
100
|
-
fullWidth: true,
|
|
101
|
-
label: "URL",
|
|
102
|
-
value: value.direct_url || '',
|
|
103
|
-
InputProps: {
|
|
104
|
-
readOnly: isReadonly
|
|
105
|
-
},
|
|
106
|
-
onChange: (e)=>onChange({
|
|
107
|
-
...value,
|
|
108
|
-
direct_url: e.target.value
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
})
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
label: strProxy,
|
|
115
|
-
content: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
116
|
-
children: [
|
|
117
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
118
|
-
fullWidth: true,
|
|
119
|
-
label: "URL",
|
|
120
|
-
value: ((ref = value.proxy) === null || ref === void 0 ? void 0 : ref.spec.url) || '',
|
|
121
|
-
InputProps: {
|
|
122
|
-
readOnly: isReadonly
|
|
123
|
-
},
|
|
124
|
-
onChange: (e)=>onChange({
|
|
125
|
-
...value,
|
|
126
|
-
...value.proxy && {
|
|
127
|
-
proxy: {
|
|
128
|
-
...value.proxy,
|
|
129
|
-
spec: {
|
|
130
|
-
...value.proxy.spec,
|
|
131
|
-
url: e.target.value
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
})
|
|
136
|
-
}),
|
|
137
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
138
|
-
py: 2,
|
|
139
|
-
variant: "h4",
|
|
140
|
-
children: "Allowed endpoints"
|
|
141
|
-
}),
|
|
142
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
143
|
-
container: true,
|
|
144
|
-
spacing: 2,
|
|
145
|
-
mb: 2,
|
|
146
|
-
children: ((ref1 = value.proxy) === null || ref1 === void 0 ? void 0 : ref1.spec.allowed_endpoints) && value.proxy.spec.allowed_endpoints.map(({ endpoint_pattern , method }, i)=>{
|
|
147
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_react.default.Fragment, {
|
|
148
|
-
children: [
|
|
149
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
150
|
-
item: true,
|
|
151
|
-
xs: 8,
|
|
152
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
153
|
-
disabled: true,
|
|
154
|
-
fullWidth: true,
|
|
155
|
-
label: "Endpoint pattern",
|
|
156
|
-
value: endpoint_pattern,
|
|
157
|
-
InputProps: {
|
|
158
|
-
readOnly: isReadonly
|
|
159
|
-
}
|
|
160
|
-
})
|
|
161
|
-
}),
|
|
162
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
163
|
-
item: true,
|
|
164
|
-
xs: 4,
|
|
165
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
166
|
-
disabled: true,
|
|
167
|
-
fullWidth: true,
|
|
168
|
-
label: "URL",
|
|
169
|
-
value: method,
|
|
170
|
-
InputProps: {
|
|
171
|
-
readOnly: isReadonly
|
|
172
|
-
}
|
|
173
|
-
})
|
|
174
|
-
})
|
|
175
|
-
]
|
|
176
|
-
}, i);
|
|
177
|
-
})
|
|
178
|
-
}),
|
|
179
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
180
|
-
pb: 2,
|
|
181
|
-
variant: "h4",
|
|
182
|
-
children: "Request Headers"
|
|
183
|
-
}),
|
|
184
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
185
|
-
container: true,
|
|
186
|
-
spacing: 2,
|
|
187
|
-
mb: 2,
|
|
188
|
-
children: [
|
|
189
|
-
((ref2 = value.proxy) === null || ref2 === void 0 ? void 0 : ref2.spec.headers) !== undefined && Object.keys(value.proxy.spec.headers).map((headerName, i)=>{
|
|
190
|
-
var ref, ref1;
|
|
191
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_react.default.Fragment, {
|
|
192
|
-
children: [
|
|
193
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
194
|
-
item: true,
|
|
195
|
-
xs: 4,
|
|
196
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
197
|
-
fullWidth: true,
|
|
198
|
-
label: "Header name",
|
|
199
|
-
value: headerName,
|
|
200
|
-
InputProps: {
|
|
201
|
-
readOnly: isReadonly
|
|
202
|
-
},
|
|
203
|
-
onChange: (e)=>onChange({
|
|
204
|
-
...value,
|
|
205
|
-
...value.proxy && {
|
|
206
|
-
proxy: {
|
|
207
|
-
...value.proxy,
|
|
208
|
-
spec: {
|
|
209
|
-
...value.proxy.spec,
|
|
210
|
-
headers: buildNewHeaders(value.proxy.spec.headers, headerName, e.target.value)
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
})
|
|
215
|
-
})
|
|
216
|
-
}),
|
|
217
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
218
|
-
item: true,
|
|
219
|
-
xs: 7,
|
|
220
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
221
|
-
fullWidth: true,
|
|
222
|
-
label: "Header value",
|
|
223
|
-
value: (ref1 = (ref = value.proxy) === null || ref === void 0 ? void 0 : ref.spec.headers) === null || ref1 === void 0 ? void 0 : ref1[headerName],
|
|
224
|
-
InputProps: {
|
|
225
|
-
readOnly: isReadonly
|
|
226
|
-
},
|
|
227
|
-
onChange: (e)=>onChange({
|
|
228
|
-
...value,
|
|
229
|
-
...value.proxy && {
|
|
230
|
-
proxy: {
|
|
231
|
-
...value.proxy,
|
|
232
|
-
spec: {
|
|
233
|
-
...value.proxy.spec,
|
|
234
|
-
headers: {
|
|
235
|
-
...value.proxy.spec.headers,
|
|
236
|
-
[headerName]: e.target.value
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
})
|
|
242
|
-
})
|
|
243
|
-
}),
|
|
244
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
245
|
-
item: true,
|
|
246
|
-
xs: 1,
|
|
247
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
248
|
-
disabled: isReadonly,
|
|
249
|
-
onClick: ()=>{
|
|
250
|
-
var ref;
|
|
251
|
-
const newHeaders = {
|
|
252
|
-
...(ref = value.proxy) === null || ref === void 0 ? void 0 : ref.spec.headers
|
|
253
|
-
};
|
|
254
|
-
delete newHeaders[headerName];
|
|
255
|
-
onChange({
|
|
256
|
-
...value,
|
|
257
|
-
...value.proxy && {
|
|
258
|
-
proxy: {
|
|
259
|
-
...value.proxy,
|
|
260
|
-
spec: {
|
|
261
|
-
...value.proxy.spec,
|
|
262
|
-
headers: newHeaders
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
},
|
|
268
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_minus.default, {})
|
|
269
|
-
})
|
|
270
|
-
})
|
|
271
|
-
]
|
|
272
|
-
}, i);
|
|
273
|
-
}),
|
|
274
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Grid, {
|
|
275
|
-
item: true,
|
|
276
|
-
xs: 12,
|
|
277
|
-
sx: {
|
|
278
|
-
paddingTop: '5px !important'
|
|
279
|
-
},
|
|
280
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
281
|
-
disabled: isReadonly,
|
|
282
|
-
onClick: ()=>onChange({
|
|
283
|
-
...value,
|
|
284
|
-
...value.proxy && {
|
|
285
|
-
proxy: {
|
|
286
|
-
...value.proxy,
|
|
287
|
-
spec: {
|
|
288
|
-
...value.proxy.spec,
|
|
289
|
-
headers: {
|
|
290
|
-
...value.proxy.spec.headers,
|
|
291
|
-
'': ''
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}),
|
|
297
|
-
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_plus.default, {})
|
|
298
|
-
})
|
|
299
|
-
})
|
|
300
|
-
]
|
|
301
|
-
}),
|
|
302
|
-
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.TextField, {
|
|
303
|
-
fullWidth: true,
|
|
304
|
-
label: "Secret",
|
|
305
|
-
value: ((ref3 = value.proxy) === null || ref3 === void 0 ? void 0 : ref3.spec.secret) || '',
|
|
306
|
-
InputProps: {
|
|
307
|
-
readOnly: isReadonly
|
|
308
|
-
},
|
|
309
|
-
onChange: (e)=>onChange({
|
|
310
|
-
...value,
|
|
311
|
-
...value.proxy && {
|
|
312
|
-
proxy: {
|
|
313
|
-
...value.proxy,
|
|
314
|
-
spec: {
|
|
315
|
-
...value.proxy.spec,
|
|
316
|
-
secret: e.target.value
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
})
|
|
321
|
-
})
|
|
322
|
-
]
|
|
323
|
-
})
|
|
324
|
-
}
|
|
325
|
-
];
|
|
326
|
-
// Use of findIndex instead of providing hardcoded values to avoid desynchronisatio or
|
|
327
|
-
// bug in case the tabs get eventually swapped in the future.
|
|
328
|
-
const directModeId = tabs.findIndex((tab)=>tab.label == strDirect);
|
|
329
|
-
const proxyModeId = tabs.findIndex((tab)=>tab.label == strProxy);
|
|
330
|
-
// In "update datasource" case, set defaultTab to the mode that this datasource is currently relying on.
|
|
331
|
-
// Otherwise (create datasource), set defaultTab to Direct access.
|
|
332
|
-
const defaultTab = value.proxy ? proxyModeId : directModeId;
|
|
333
|
-
const initialSpecDirect = {
|
|
334
|
-
direct_url: ''
|
|
335
|
-
};
|
|
336
|
-
const initialSpecProxy = {
|
|
337
|
-
proxy: {
|
|
338
|
-
kind: 'HTTPProxy',
|
|
339
|
-
spec: {
|
|
340
|
-
allowed_endpoints: [
|
|
341
|
-
// hardcoded list of allowed endpoints for now since those are enforced by the backend
|
|
342
|
-
{
|
|
343
|
-
endpoint_pattern: '/api/v1/labels',
|
|
344
|
-
method: 'POST'
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
endpoint_pattern: '/api/v1/series',
|
|
348
|
-
method: 'POST'
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
endpoint_pattern: '/api/v1/metadata',
|
|
352
|
-
method: 'GET'
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
endpoint_pattern: '/api/v1/query',
|
|
356
|
-
method: 'POST'
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
endpoint_pattern: '/api/v1/query_range',
|
|
360
|
-
method: 'POST'
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
endpoint_pattern: '/api/v1/label/([a-zA-Z0-9_-]+)/values',
|
|
364
|
-
method: 'GET'
|
|
365
|
-
}
|
|
366
|
-
],
|
|
367
|
-
url: ''
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
// For better user experience, save previous states in mind for both mode.
|
|
372
|
-
// This avoids losing everything when the user changes their mind back.
|
|
373
|
-
const [previousSpecDirect, setPreviousSpecDirect] = (0, _react.useState)(initialSpecDirect);
|
|
374
|
-
const [previousSpecProxy, setPreviousSpecProxy] = (0, _react.useState)(initialSpecProxy);
|
|
375
|
-
// When changing mode, remove previous mode's config + append default values for the new mode.
|
|
376
|
-
const handleModeChange = (v)=>{
|
|
377
|
-
var ref, ref1;
|
|
378
|
-
if (((ref = tabs[v]) === null || ref === void 0 ? void 0 : ref.label) == strDirect) {
|
|
379
|
-
setPreviousSpecProxy(value);
|
|
380
|
-
onChange(previousSpecDirect);
|
|
381
|
-
} else if (((ref1 = tabs[v]) === null || ref1 === void 0 ? void 0 : ref1.label) == strProxy) {
|
|
382
|
-
setPreviousSpecDirect(value);
|
|
383
|
-
onChange(previousSpecProxy);
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginSystem.OptionsEditorRadios, {
|
|
387
|
-
isReadonly: isReadonly,
|
|
388
|
-
tabs: tabs,
|
|
389
|
-
defaultTab: defaultTab,
|
|
390
|
-
onModeChange: handleModeChange
|
|
391
|
-
});
|
|
392
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
_exportStar(require("./PrometheusDatasourceEditor"), exports);
|
|
18
|
-
_exportStar(require("./types"), exports);
|
|
19
|
-
function _exportStar(from, to) {
|
|
20
|
-
Object.keys(from).forEach(function(k) {
|
|
21
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function() {
|
|
24
|
-
return from[k];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
return from;
|
|
29
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templating.d.ts","sourceRoot":"","sources":["../../src/model/templating.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,oBAAY,cAAc,GAAG,MAAM,CAAC;AAEpC,wBAAgB,wBAAwB,CAAC,cAAc,CAAC,EAAE,cAAc,UAIvE"}
|
package/dist/model/templating.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
import { useTemplateVariableValues, replaceTemplateVariables, parseTemplateVariables } from '@perses-dev/plugin-system';
|
|
14
|
-
export function useReplaceTemplateString(templateString) {
|
|
15
|
-
const templateVariablesInTemplate = parseTemplateVariables(templateString || '');
|
|
16
|
-
const variables = useTemplateVariableValues(templateVariablesInTemplate);
|
|
17
|
-
return replaceTemplateVariables(templateString || '', variables);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=templating.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/templating.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 { useTemplateVariableValues, replaceTemplateVariables, parseTemplateVariables } from '@perses-dev/plugin-system';\n\n/**\n * Type alias to indicate what parts of the API support template variables.\n */\nexport type TemplateString = string;\n\nexport function useReplaceTemplateString(templateString?: TemplateString) {\n const templateVariablesInTemplate = parseTemplateVariables(templateString || '');\n const variables = useTemplateVariableValues(templateVariablesInTemplate);\n return replaceTemplateVariables(templateString || '', variables);\n}\n"],"names":["useTemplateVariableValues","replaceTemplateVariables","parseTemplateVariables","useReplaceTemplateString","templateString","templateVariablesInTemplate","variables"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,yBAAyB,EAAEC,wBAAwB,EAAEC,sBAAsB,QAAQ,2BAA2B,CAAC;AAOxH,OAAO,SAASC,wBAAwB,CAACC,cAA+B,EAAE;IACxE,MAAMC,2BAA2B,GAAGH,sBAAsB,CAACE,cAAc,IAAI,EAAE,CAAC,AAAC;IACjF,MAAME,SAAS,GAAGN,yBAAyB,CAACK,2BAA2B,CAAC,AAAC;IACzE,OAAOJ,wBAAwB,CAACG,cAAc,IAAI,EAAE,EAAEE,SAAS,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrometheusDatasourceEditor.d.ts","sourceRoot":"","sources":["../../../src/plugins/PrometheusDatasourceEditor/PrometheusDatasourceEditor.tsx"],"names":[],"mappings":";AAmBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,wBAAwB,CAAC;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,eA6ShF"}
|