@grafana/plugin-ui 0.3.4 → 0.3.5

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 (29) hide show
  1. package/dist/components/ConfigEditor/SecureSocksProxyToggle.js +29 -0
  2. package/dist/components/ConfigEditor/SecureSocksProxyToggle.js.map +1 -0
  3. package/dist/components/ConfigEditor/index.js +3 -1
  4. package/dist/components/ConfigEditor/index.js.map +1 -1
  5. package/dist/src/components/ConfigEditor/InlineLabel.d.ts +1 -1
  6. package/dist/src/components/ConfigEditor/SecureSocksProxyToggle.d.ts +10 -0
  7. package/dist/src/components/ConfigEditor/index.d.ts +1 -0
  8. package/dist/src/components/CustomHeadersSettings/CustomHeadersSettings.d.ts +1 -1
  9. package/dist/src/components/DataLinks/DataLink.d.ts +1 -1
  10. package/dist/src/components/DataLinks/DataLinks.d.ts +1 -1
  11. package/dist/src/components/DataLinks/types.d.ts +1 -1
  12. package/dist/src/components/QueryEditor/ConfirmModal.d.ts +1 -1
  13. package/dist/src/components/QueryEditor/ErrorBoundary.d.ts +1 -1
  14. package/dist/src/components/QueryEditor/QueryEditor.d.ts +1 -1
  15. package/dist/src/components/QueryEditor/RunQueryButton.d.ts +1 -1
  16. package/dist/src/components/QueryEditor/defaults.d.ts +1 -1
  17. package/dist/src/components/QueryEditor/expressions.d.ts +3 -3
  18. package/dist/src/components/QueryEditor/query-editor-raw/QueryEditorRaw.d.ts +1 -1
  19. package/dist/src/components/QueryEditor/types.d.ts +2 -2
  20. package/dist/src/components/QueryEditor/visual-query-builder/OrderByRow.d.ts +1 -1
  21. package/dist/src/components/QueryEditor/visual-query-builder/Preview.d.ts +1 -1
  22. package/dist/src/components/QueryEditor/visual-query-builder/SQLOrderByRow.d.ts +1 -1
  23. package/dist/src/unreleasedComponents/SecretInput.d.ts +1 -1
  24. package/dist/src/unreleasedComponents/SecretTextarea.d.ts +1 -1
  25. package/dist/src/utils/compatibility.d.ts +2 -1
  26. package/dist/src/utils/testDatasource.d.ts +3 -3
  27. package/dist/utils/compatibility.js +3 -0
  28. package/dist/utils/compatibility.js.map +1 -1
  29. package/package.json +4 -4
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SecureSocksProxyToggle = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = tslib_1.__importDefault(require("react"));
6
+ const ui_1 = require("@grafana/ui");
7
+ const runtime_1 = require("@grafana/runtime");
8
+ const compatibility_1 = require("../../utils/compatibility");
9
+ const SecureSocksProxyToggle = (_a) => {
10
+ var { labelWidth = 10 } = _a, props = tslib_1.__rest(_a, ["labelWidth"]);
11
+ const { dataSourceConfig, onChange } = props;
12
+ const handleSwitchChange = (e) => {
13
+ onChange(Object.assign(Object.assign({}, dataSourceConfig), { jsonData: Object.assign(Object.assign({}, dataSourceConfig.jsonData), { enableSecureSocksProxy: e.target.checked }) }));
14
+ };
15
+ return (
16
+ /* if the compatibility check returns true, secureSocksDSProxyEnabled will be an option in the Grafana config */
17
+ (0, compatibility_1.hasCompatibility)(compatibility_1.CompatibilityFeature.SECURE_SOCKS_PROXY) && runtime_1.config.secureSocksDSProxyEnabled
18
+ &&
19
+ (react_1.default.createElement("div", null,
20
+ react_1.default.createElement("div", { className: "gf-form" },
21
+ react_1.default.createElement("div", { className: "gf-form gf-form-inline" },
22
+ react_1.default.createElement(ui_1.InlineField, { label: "Secure Socks Proxy Enabled", labelWidth: labelWidth, tooltip: react_1.default.createElement(react_1.default.Fragment, null,
23
+ "Proxy the datasource connection through the secure socks proxy to a different network. To learn more about configuring the datasource connection proxy, ",
24
+ ' ',
25
+ react_1.default.createElement("a", { href: "https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/proxy/", target: "_blank", rel: "noopener noreferrer" }, "click here.")) },
26
+ react_1.default.createElement(ui_1.InlineSwitch, { value: dataSourceConfig.jsonData.enableSecureSocksProxy, onChange: handleSwitchChange })))))));
27
+ };
28
+ exports.SecureSocksProxyToggle = SecureSocksProxyToggle;
29
+ //# sourceMappingURL=SecureSocksProxyToggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecureSocksProxyToggle.js","sourceRoot":"","sources":["../../../src/components/ConfigEditor/SecureSocksProxyToggle.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,oCAA0F;AAC1F,8CAA0C;AAE1C,6DAAmF;AAQ5E,MAAM,sBAAsB,GAAoB,CAAC,EAGvD,EAAE,EAAE;QAHmD,EACtD,UAAU,GAAC,EAAE,OAEd,EADI,KAAK,sBAF8C,cAGvD,CADS;IAER,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC7C,MAAM,kBAAkB,GAAG,CAAC,CAAsC,EAAE,EAAE;QACpE,QAAQ,iCACH,gBAAgB,KACnB,QAAQ,kCACH,gBAAgB,CAAC,QAAQ,KAC5B,sBAAsB,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,OAE1C,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;IACH,gHAAgH;IAChH,IAAA,gCAAgB,EAAC,oCAAoB,CAAC,kBAAkB,CAAC,IAAK,gBAAc,CAAC,yBAAyB;;YAEtG,CACA;gBACE,uCAAK,SAAS,EAAC,SAAS;oBACtB,uCAAK,SAAS,EAAC,wBAAwB;wBACrC,8BAAC,gBAAW,IACV,KAAK,EAAC,4BAA4B,EAClC,UAAU,EAAE,UAAU,EACtB,OAAO,EACL;;gCAC2J,GAAG;gCAC5J,qCACE,IAAI,EAAC,gFAAgF,EACrF,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,kBAGvB,CACH;4BAGP,8BAAC,iBAAY,IACX,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,sBAAsB,EACvD,QAAQ,EAAE,kBAAkB,GAC5B,CACY,CACV,CACF,CACA,CACP,CACJ,CAAC;AACJ,CAAC,CAAC;AAjDW,QAAA,sBAAsB,0BAiDjC"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InlineLabel = void 0;
3
+ exports.SecureSocksProxyToggle = exports.InlineLabel = void 0;
4
4
  var InlineLabel_1 = require("./InlineLabel");
5
5
  Object.defineProperty(exports, "InlineLabel", { enumerable: true, get: function () { return InlineLabel_1.InlineLabel; } });
6
+ var SecureSocksProxyToggle_1 = require("./SecureSocksProxyToggle");
7
+ Object.defineProperty(exports, "SecureSocksProxyToggle", { enumerable: true, get: function () { return SecureSocksProxyToggle_1.SecureSocksProxyToggle; } });
6
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ConfigEditor/index.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAAnC,0GAAA,WAAW,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ConfigEditor/index.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA"}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { InlineLabel as OriginalInlineLabel } from "@grafana/ui";
3
- declare type Props = React.ComponentProps<typeof OriginalInlineLabel> & {
3
+ type Props = React.ComponentProps<typeof OriginalInlineLabel> & {
4
4
  required?: boolean;
5
5
  };
6
6
  export declare const InlineLabel: React.FC<Props>;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { InlineLabel as OriginalInlineLabel } from "@grafana/ui";
3
+ import { DataSourceSettings } from "@grafana/data";
4
+ type Props = Omit<React.ComponentProps<typeof OriginalInlineLabel>, 'children'> & {
5
+ dataSourceConfig: DataSourceSettings<any, any>;
6
+ onChange: (config: DataSourceSettings) => void;
7
+ labelWidth: number;
8
+ };
9
+ export declare const SecureSocksProxyToggle: React.FC<Props>;
10
+ export {};
@@ -1 +1,2 @@
1
1
  export { InlineLabel } from "./InlineLabel";
2
+ export { SecureSocksProxyToggle } from "./SecureSocksProxyToggle";
@@ -6,7 +6,7 @@ export interface CustomHeader {
6
6
  value: string;
7
7
  configured: boolean;
8
8
  }
9
- export declare type CustomHeaders = CustomHeader[];
9
+ export type CustomHeaders = CustomHeader[];
10
10
  export interface Props {
11
11
  dataSourceConfig: DataSourceSettings<any, any>;
12
12
  onChange: (config: DataSourceSettings) => void;
@@ -1,6 +1,6 @@
1
1
  import { VariableSuggestion, DataSourceInstanceSettings, DataSourceJsonData } from '@grafana/data';
2
2
  import { DataLinkConfig } from './types';
3
- declare type Props = {
3
+ type Props = {
4
4
  value: DataLinkConfig;
5
5
  datasources?: DataSourceInstanceSettings<DataSourceJsonData>[];
6
6
  onChange: (value: DataLinkConfig) => void;
@@ -1,5 +1,5 @@
1
1
  import { DataLinkConfig } from './types';
2
- declare type Props = {
2
+ type Props = {
3
3
  value?: DataLinkConfig[];
4
4
  onChange: (value: DataLinkConfig[]) => void;
5
5
  };
@@ -1,4 +1,4 @@
1
- export declare type DataLinkConfig = {
1
+ export type DataLinkConfig = {
2
2
  field: string;
3
3
  label: string;
4
4
  matcherRegex: string;
@@ -1,4 +1,4 @@
1
- declare type ConfirmModalProps = {
1
+ type ConfirmModalProps = {
2
2
  isOpen: boolean;
3
3
  onCancel?: () => void;
4
4
  onDiscard?: () => void;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- declare type Props = {
2
+ type Props = {
3
3
  fallBackComponent?: React.ReactNode;
4
4
  };
5
5
  export declare class ErrorBoundary extends React.Component<Props, {
@@ -1,6 +1,6 @@
1
1
  import { QueryEditorProps } from '@grafana/data';
2
2
  import { SQLQuery, SQLOptions } from './types';
3
3
  import { SqlDatasource } from '../../datasource/SqlDatasource';
4
- declare type Props = QueryEditorProps<SqlDatasource, SQLQuery, SQLOptions>;
4
+ type Props = QueryEditorProps<SqlDatasource, SQLQuery, SQLOptions>;
5
5
  export declare function SqlQueryEditor({ datasource, query, onChange, onRunQuery, range }: Props): JSX.Element | null;
6
6
  export {};
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { PopoverContent } from "@grafana/ui";
3
- declare type RunQueryButtonProps = {
3
+ type RunQueryButtonProps = {
4
4
  ariaLabel?: string;
5
5
  queryInvalid?: boolean;
6
6
  invalidQueryTooltip?: PopoverContent;
@@ -1,3 +1,3 @@
1
1
  import { SQLQuery } from './types';
2
2
  export declare function applyQueryDefaults(q?: SQLQuery): SQLQuery;
3
- export declare type QueryWithDefaults = ReturnType<typeof applyQueryDefaults>;
3
+ export type QueryWithDefaults = ReturnType<typeof applyQueryDefaults>;
@@ -5,8 +5,8 @@ export interface QueryEditorProperty {
5
5
  type: QueryEditorPropertyType;
6
6
  name?: string;
7
7
  }
8
- export declare type QueryEditorOperatorType = string | boolean | number;
9
- declare type QueryEditorOperatorValueType = QueryEditorOperatorType | QueryEditorOperatorType[];
8
+ export type QueryEditorOperatorType = string | boolean | number;
9
+ type QueryEditorOperatorValueType = QueryEditorOperatorType | QueryEditorOperatorType[];
10
10
  export interface QueryEditorOperator<T extends QueryEditorOperatorValueType> {
11
11
  name?: string;
12
12
  value?: T;
@@ -33,7 +33,7 @@ export declare enum QueryEditorExpressionType {
33
33
  Function = "function",
34
34
  FunctionParameter = "functionParameter"
35
35
  }
36
- export declare type QueryEditorExpression = QueryEditorArrayExpression | QueryEditorPropertyExpression | QueryEditorGroupByExpression | QueryEditorFunctionExpression | QueryEditorFunctionParameterExpression | QueryEditorOperatorExpression;
36
+ export type QueryEditorExpression = QueryEditorArrayExpression | QueryEditorPropertyExpression | QueryEditorGroupByExpression | QueryEditorFunctionExpression | QueryEditorFunctionParameterExpression | QueryEditorOperatorExpression;
37
37
  export interface QueryEditorGroupByExpression {
38
38
  type: QueryEditorExpressionType.GroupBy;
39
39
  property: QueryEditorProperty;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { LanguageCompletionProvider } from '@grafana/experimental';
3
3
  import { SQLQuery } from '../types';
4
- declare type Props = {
4
+ type Props = {
5
5
  query: SQLQuery;
6
6
  onChange: (value: SQLQuery, processQuery: boolean) => void;
7
7
  children?: (props: {
@@ -48,7 +48,7 @@ export interface NameValue {
48
48
  name: string;
49
49
  value: string;
50
50
  }
51
- export declare type SQLFilters = NameValue[];
51
+ export type SQLFilters = NameValue[];
52
52
  export interface SQLExpression {
53
53
  columns?: QueryEditorFunctionExpression[];
54
54
  whereJsonTree?: JsonTree;
@@ -87,7 +87,7 @@ export interface ResourceSelectorProps {
87
87
  className?: string;
88
88
  applyDefault?: boolean;
89
89
  }
90
- export declare type RAQBFieldTypes = 'text' | 'number' | 'boolean' | 'datetime' | 'date' | 'time';
90
+ export type RAQBFieldTypes = 'text' | 'number' | 'boolean' | 'datetime' | 'date' | 'time';
91
91
  export interface SQLSelectableValue extends SelectableValue {
92
92
  type?: string;
93
93
  raqbFieldType?: RAQBFieldTypes;
@@ -1,6 +1,6 @@
1
1
  import { SelectableValue } from '@grafana/data';
2
2
  import { SQLExpression } from '../types';
3
- declare type OrderByRowProps = {
3
+ type OrderByRowProps = {
4
4
  sql: SQLExpression;
5
5
  onSqlChange: (sql: SQLExpression) => void;
6
6
  columns?: Array<SelectableValue<string>>;
@@ -1,4 +1,4 @@
1
- declare type PreviewProps = {
1
+ type PreviewProps = {
2
2
  rawSql: string;
3
3
  };
4
4
  export declare function Preview({ rawSql }: PreviewProps): JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { SelectableValue } from '@grafana/data';
2
2
  import { QueryWithDefaults } from '../defaults';
3
3
  import { SQLQuery, DB } from '../types';
4
- declare type SQLOrderByRowProps = {
4
+ type SQLOrderByRowProps = {
5
5
  fields: SelectableValue[];
6
6
  query: QueryWithDefaults;
7
7
  onQueryChange: (query: SQLQuery) => void;
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import * as React from "react";
6
6
  import { Input } from "@grafana/ui";
7
- export declare type Props = React.ComponentProps<typeof Input> & {
7
+ export type Props = React.ComponentProps<typeof Input> & {
8
8
  /** TRUE if the secret was already configured. (It is needed as often the backend doesn't send back the actual secret, only the information that it was configured) */
9
9
  isConfigured: boolean;
10
10
  /** Called when the user clicks on the "Reset" button in order to clear the secret */
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import * as React from "react";
6
6
  import { TextArea } from "@grafana/ui";
7
- export declare type Props = React.ComponentProps<typeof TextArea> & {
7
+ export type Props = React.ComponentProps<typeof TextArea> & {
8
8
  /** TRUE if the secret was already configured. (It is needed as often the backend doesn't send back the actual secret, only the information that it was configured) */
9
9
  isConfigured: boolean;
10
10
  /** Called when the user clicks on the "Reset" button in order to clear the secret */
@@ -1,5 +1,6 @@
1
1
  export declare enum CompatibilityFeature {
2
- HEALTH_DIAGNOSTICS_ERRORS = 0
2
+ HEALTH_DIAGNOSTICS_ERRORS = 0,
3
+ SECURE_SOCKS_PROXY = 1
3
4
  }
4
5
  /**
5
6
  * Checks if the currently running version of Grafana supports the feature.
@@ -1,11 +1,11 @@
1
1
  import { HealthCheckResult } from '@grafana/runtime';
2
- export declare type HealthCheckResultDetails = Record<string, any> | undefined;
2
+ export type HealthCheckResultDetails = Record<string, any> | undefined;
3
3
  export declare class HealthCheckError extends Error {
4
4
  details: HealthCheckResultDetails;
5
5
  constructor(message: string, details: HealthCheckResultDetails);
6
6
  }
7
- export declare type TestDatasourceReturn = Partial<HealthCheckResult> | Error;
8
- export declare type BaseTestDatasource = () => Promise<TestDatasourceReturn>;
7
+ export type TestDatasourceReturn = Partial<HealthCheckResult> | Error;
8
+ export type BaseTestDatasource = () => Promise<TestDatasourceReturn>;
9
9
  /**
10
10
  * Override function for testDatasource in Grafana for the health check
11
11
  *
@@ -6,6 +6,7 @@ const semver_1 = require("semver");
6
6
  var CompatibilityFeature;
7
7
  (function (CompatibilityFeature) {
8
8
  CompatibilityFeature[CompatibilityFeature["HEALTH_DIAGNOSTICS_ERRORS"] = 0] = "HEALTH_DIAGNOSTICS_ERRORS";
9
+ CompatibilityFeature[CompatibilityFeature["SECURE_SOCKS_PROXY"] = 1] = "SECURE_SOCKS_PROXY";
9
10
  })(CompatibilityFeature = exports.CompatibilityFeature || (exports.CompatibilityFeature = {}));
10
11
  /**
11
12
  * Checks if the currently running version of Grafana supports the feature.
@@ -20,6 +21,8 @@ const hasCompatibility = (feature) => {
20
21
  switch (feature) {
21
22
  case CompatibilityFeature.HEALTH_DIAGNOSTICS_ERRORS:
22
23
  return (0, semver_1.gte)(version, "8.0.0");
24
+ case CompatibilityFeature.SECURE_SOCKS_PROXY:
25
+ return (0, semver_1.gte)(version, "10.0.0");
23
26
  default:
24
27
  return false;
25
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"compatibility.js","sourceRoot":"","sources":["../../src/utils/compatibility.ts"],"names":[],"mappings":";;;AAAA,8CAA0C;AAC1C,mCAA6B;AAE7B,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC9B,yGAAyB,CAAA;AAC3B,CAAC,EAFW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAE/B;AAED;;;;;;;GAOG;AACK,MAAM,gBAAgB,GAAG,CAAC,OAA6B,EAAW,EAAE;IAC1E,MAAM,OAAO,GAAG,gBAAM,CAAC,SAAS,CAAC,OAAO,CAAC;IAEzC,QAAQ,OAAO,EAAE;QACf,KAAK,oBAAoB,CAAC,yBAAyB;YACjD,OAAO,IAAA,YAAG,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/B;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC,CAAC;AATY,QAAA,gBAAgB,oBAS5B"}
1
+ {"version":3,"file":"compatibility.js","sourceRoot":"","sources":["../../src/utils/compatibility.ts"],"names":[],"mappings":";;;AAAA,8CAA0C;AAC1C,mCAA6B;AAE7B,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,yGAAyB,CAAA;IACzB,2FAAkB,CAAA;AACpB,CAAC,EAHW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAG/B;AAED;;;;;;;GAOG;AACK,MAAM,gBAAgB,GAAG,CAAC,OAA6B,EAAW,EAAE;IAC1E,MAAM,OAAO,GAAG,gBAAM,CAAC,SAAS,CAAC,OAAO,CAAC;IAEzC,QAAQ,OAAO,EAAE;QACf,KAAK,oBAAoB,CAAC,yBAAyB;YACjD,OAAO,IAAA,YAAG,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/B,KAAK,oBAAoB,CAAC,kBAAkB;YAC1C,OAAO,IAAA,YAAG,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAChC;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC,CAAC;AAXY,QAAA,gBAAgB,oBAW5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-ui",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "repository": "git@github.com:grafana/plugin-ui.git",
5
5
  "author": "Grafana Labs",
6
6
  "main": "dist/index.js",
@@ -37,8 +37,7 @@
37
37
  "react-use": "17.3.1",
38
38
  "react-virtualized-auto-sizer": "^1.0.6",
39
39
  "semver": "^7.3.5",
40
- "sql-formatter-plus": "^1.3.6",
41
- "typescript": "^4.7.4"
40
+ "sql-formatter-plus": "^1.3.6"
42
41
  },
43
42
  "devDependencies": {
44
43
  "@babel/core": "^7.12.9",
@@ -64,7 +63,8 @@
64
63
  "babel-loader": "^8.2.2",
65
64
  "jest-fetch-mock": "^3.0.3",
66
65
  "mockdate": "^3.0.2",
67
- "ts-jest": "^26.4.4"
66
+ "ts-jest": "^26.4.4",
67
+ "typescript": "^4.9.5"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@changesets/cli": ">=2.x"