@grafana/plugin-ui 0.13.1 → 0.14.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.
- package/README.md +9 -3
- package/dist/cjs/index.cjs +3196 -168
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +102 -39
- package/dist/cjs/test-utils.cjs +7880 -61
- package/dist/cjs/test-utils.cjs.map +1 -1
- package/dist/cjs/test-utils.d.cts +23 -23
- package/dist/esm/_virtual/chance.js +6 -0
- package/dist/esm/_virtual/chance.js.map +1 -0
- package/dist/esm/_virtual/chance2.js +4 -0
- package/dist/esm/_virtual/chance2.js.map +1 -0
- package/dist/esm/_virtual/index.js +6 -0
- package/dist/esm/_virtual/index.js.map +1 -0
- package/dist/esm/_virtual/re.js +4 -0
- package/dist/esm/_virtual/re.js.map +1 -0
- package/dist/esm/async-query-data/DatasourceWithAsyncBackend.js +155 -0
- package/dist/esm/async-query-data/DatasourceWithAsyncBackend.js.map +1 -0
- package/dist/esm/async-query-data/RunQueryButtons.js +52 -0
- package/dist/esm/async-query-data/RunQueryButtons.js.map +1 -0
- package/dist/esm/async-query-data/requestLooper.js +74 -0
- package/dist/esm/async-query-data/requestLooper.js.map +1 -0
- package/dist/esm/components/QueryEditor/InlineSelect.js +1 -1
- package/dist/esm/components/QueryEditor/InlineSelect.js.map +1 -1
- package/dist/esm/components/QueryEditor/QueryEditor.js +3 -1
- package/dist/esm/components/QueryEditor/QueryEditor.js.map +1 -1
- package/dist/esm/components/QueryEditor/QueryHeader.js +2 -2
- package/dist/esm/components/QueryEditor/QueryHeader.js.map +1 -1
- package/dist/esm/components/QueryEditor/TableSelector.js +0 -1
- package/dist/esm/components/QueryEditor/TableSelector.js.map +1 -1
- package/dist/esm/components/QueryEditor/defaults.js.map +1 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryEditorRaw.js +10 -2
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryEditorRaw.js.map +1 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryToolbox.js +6 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/QueryToolbox.js.map +1 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/RawEditor.js +11 -1
- package/dist/esm/components/QueryEditor/query-editor-raw/RawEditor.js.map +1 -1
- package/dist/esm/components/QueryEditor/types.js +0 -1
- package/dist/esm/components/QueryEditor/types.js.map +1 -1
- package/dist/esm/components/QueryEditor/utils/formatSQL.js +15 -4
- package/dist/esm/components/QueryEditor/utils/formatSQL.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/Preview.js +2 -2
- package/dist/esm/components/QueryEditor/visual-query-builder/Preview.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLGroupByRow.js +0 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLGroupByRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLOrderByRow.js +0 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLOrderByRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLSelectRow.js +0 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLSelectRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLWhereRow.js +0 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/SQLWhereRow.js.map +1 -1
- package/dist/esm/components/QueryEditor/visual-query-builder/VisualEditor.js +10 -2
- package/dist/esm/components/QueryEditor/visual-query-builder/VisualEditor.js.map +1 -1
- package/dist/esm/components/SQLEditor/components/SQLEditor.js.map +1 -1
- package/dist/esm/components/SQLEditor/hooks/useLatestCallback.js +1 -1
- package/dist/esm/components/SQLEditor/hooks/useLatestCallback.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/definition.js +0 -6
- package/dist/esm/components/SQLEditor/standardSql/definition.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/getStatementPosition.js +2 -1
- package/dist/esm/components/SQLEditor/standardSql/getStatementPosition.js.map +1 -1
- package/dist/esm/components/SQLEditor/standardSql/statementPositionResolversRegistry.js +2 -1
- package/dist/esm/components/SQLEditor/standardSql/statementPositionResolversRegistry.js.map +1 -1
- package/dist/esm/components/SQLEditor/types.js +1 -17
- package/dist/esm/components/SQLEditor/types.js.map +1 -1
- package/dist/esm/components/SQLEditor/utils/LinkedToken.js +1 -1
- package/dist/esm/components/SQLEditor/utils/LinkedToken.js.map +1 -1
- package/dist/esm/components/SQLEditor/utils/linkedTokenBuilder.js +2 -2
- package/dist/esm/components/SQLEditor/utils/tokenType.js +18 -0
- package/dist/esm/components/SQLEditor/utils/tokenType.js.map +1 -0
- package/dist/esm/components/SQLEditor/utils/tokenUtils.js +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationEditorBody.js +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationList.js +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationParamEditor.js +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/OperationsEditorRow.js +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/QueryHeaderSwitch.js +1 -1
- package/dist/esm/components/VisualQueryBuilder/components/QueryOptionGroup.js +1 -1
- package/dist/esm/index.d.ts +102 -39
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node_modules/chance/chance.js +7820 -0
- package/dist/esm/node_modules/chance/chance.js.map +1 -0
- package/dist/esm/node_modules/semver/classes/comparator.js +160 -0
- package/dist/esm/node_modules/semver/classes/comparator.js.map +1 -0
- package/dist/esm/node_modules/semver/classes/range.js +575 -0
- package/dist/esm/node_modules/semver/classes/range.js.map +1 -0
- package/dist/esm/node_modules/semver/classes/semver.js +349 -0
- package/dist/esm/node_modules/semver/classes/semver.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/clean.js +20 -0
- package/dist/esm/node_modules/semver/functions/clean.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/cmp.js +71 -0
- package/dist/esm/node_modules/semver/functions/cmp.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/coerce.js +76 -0
- package/dist/esm/node_modules/semver/functions/coerce.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/compare-build.js +21 -0
- package/dist/esm/node_modules/semver/functions/compare-build.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/compare-loose.js +17 -0
- package/dist/esm/node_modules/semver/functions/compare-loose.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/compare.js +19 -0
- package/dist/esm/node_modules/semver/functions/compare.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/diff.js +72 -0
- package/dist/esm/node_modules/semver/functions/diff.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/eq.js +17 -0
- package/dist/esm/node_modules/semver/functions/eq.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/gt.js +17 -0
- package/dist/esm/node_modules/semver/functions/gt.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/gte.js +17 -0
- package/dist/esm/node_modules/semver/functions/gte.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/inc.js +33 -0
- package/dist/esm/node_modules/semver/functions/inc.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/lt.js +17 -0
- package/dist/esm/node_modules/semver/functions/lt.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/lte.js +17 -0
- package/dist/esm/node_modules/semver/functions/lte.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/major.js +17 -0
- package/dist/esm/node_modules/semver/functions/major.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/minor.js +17 -0
- package/dist/esm/node_modules/semver/functions/minor.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/neq.js +17 -0
- package/dist/esm/node_modules/semver/functions/neq.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/parse.js +30 -0
- package/dist/esm/node_modules/semver/functions/parse.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/patch.js +17 -0
- package/dist/esm/node_modules/semver/functions/patch.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/prerelease.js +20 -0
- package/dist/esm/node_modules/semver/functions/prerelease.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/rcompare.js +17 -0
- package/dist/esm/node_modules/semver/functions/rcompare.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/rsort.js +17 -0
- package/dist/esm/node_modules/semver/functions/rsort.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/satisfies.js +24 -0
- package/dist/esm/node_modules/semver/functions/satisfies.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/sort.js +17 -0
- package/dist/esm/node_modules/semver/functions/sort.js.map +1 -0
- package/dist/esm/node_modules/semver/functions/valid.js +20 -0
- package/dist/esm/node_modules/semver/functions/valid.js.map +1 -0
- package/dist/esm/node_modules/semver/index.js +143 -0
- package/dist/esm/node_modules/semver/index.js.map +1 -0
- package/dist/esm/node_modules/semver/internal/constants.js +47 -0
- package/dist/esm/node_modules/semver/internal/constants.js.map +1 -0
- package/dist/esm/node_modules/semver/internal/debug.js +21 -0
- package/dist/esm/node_modules/semver/internal/debug.js.map +1 -0
- package/dist/esm/node_modules/semver/internal/identifiers.js +39 -0
- package/dist/esm/node_modules/semver/internal/identifiers.js.map +1 -0
- package/dist/esm/node_modules/semver/internal/lrucache.js +52 -0
- package/dist/esm/node_modules/semver/internal/lrucache.js.map +1 -0
- package/dist/esm/node_modules/semver/internal/parse-options.js +27 -0
- package/dist/esm/node_modules/semver/internal/parse-options.js.map +1 -0
- package/dist/esm/node_modules/semver/internal/re.js +238 -0
- package/dist/esm/node_modules/semver/internal/re.js.map +1 -0
- package/dist/esm/node_modules/semver/ranges/gtr.js +18 -0
- package/dist/esm/node_modules/semver/ranges/gtr.js.map +1 -0
- package/dist/esm/node_modules/semver/ranges/intersects.js +21 -0
- package/dist/esm/node_modules/semver/ranges/intersects.js.map +1 -0
- package/dist/esm/node_modules/semver/ranges/ltr.js +18 -0
- package/dist/esm/node_modules/semver/ranges/ltr.js.map +1 -0
- package/dist/esm/node_modules/semver/ranges/max-satisfying.js +40 -0
- package/dist/esm/node_modules/semver/ranges/max-satisfying.js.map +1 -0
- package/dist/esm/node_modules/semver/ranges/min-satisfying.js +39 -0
- package/dist/esm/node_modules/semver/ranges/min-satisfying.js.map +1 -0
- package/dist/esm/node_modules/semver/ranges/min-version.js +77 -0
- package/dist/esm/node_modules/semver/ranges/min-version.js.map +1 -0
- package/dist/esm/node_modules/semver/ranges/outside.js +101 -0
- package/dist/esm/node_modules/semver/ranges/outside.js.map +1 -0
- package/dist/esm/node_modules/semver/ranges/simplify.js +62 -0
- package/dist/esm/node_modules/semver/ranges/simplify.js.map +1 -0
- package/dist/esm/node_modules/semver/ranges/subset.js +264 -0
- package/dist/esm/node_modules/semver/ranges/subset.js.map +1 -0
- package/dist/esm/node_modules/semver/ranges/to-comparators.js +22 -0
- package/dist/esm/node_modules/semver/ranges/to-comparators.js.map +1 -0
- package/dist/esm/node_modules/semver/ranges/valid.js +25 -0
- package/dist/esm/node_modules/semver/ranges/valid.js.map +1 -0
- package/dist/esm/test/mocks/DataQuery.js +5 -5
- package/dist/esm/test/mocks/DataQuery.js.map +1 -1
- package/dist/esm/test/mocks/Datasource.js +21 -21
- package/dist/esm/test/mocks/Datasource.js.map +1 -1
- package/dist/esm/test/mocks/Plugin.js +29 -29
- package/dist/esm/test/mocks/Plugin.js.map +1 -1
- package/dist/esm/test/mocks/QueryEditorProps.js +6 -6
- package/dist/esm/test/mocks/QueryEditorProps.js.map +1 -1
- package/dist/esm/test/mocks/utils.js +4 -4
- package/dist/esm/test/mocks/utils.js.map +1 -1
- package/dist/esm/test-utils.d.ts +23 -23
- package/package.json +80 -87
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valid.js","sources":["../../../../../node_modules/semver/ranges/valid.js"],"sourcesContent":["'use strict'\n\nconst Range = require('../classes/range')\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\nmodule.exports = validRange\n"],"names":["require$$0"],"mappings":";;;;;;;;;AAEA,CAAA,MAAM,KAAK,GAAGA,YAAA;AACd,CAAA,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK;AACvC,GAAE,IAAI;AACN;AACA;KACI,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI;IAC3C,CAAC,OAAO,EAAE,EAAE;AACf,KAAI,OAAO;AACX;AACA;AACA,CAAA,KAAc,GAAG;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import '@grafana/data';
|
|
2
|
-
import {
|
|
2
|
+
import { c as chanceExports } from '../../_virtual/chance.js';
|
|
3
3
|
import { undefinedOr } from './utils.js';
|
|
4
4
|
|
|
5
5
|
const mockDataQuery = () => ({
|
|
6
|
-
refId: Chance().word(),
|
|
6
|
+
refId: chanceExports.Chance().word(),
|
|
7
7
|
hide: false,
|
|
8
|
-
key: Chance().guid(),
|
|
9
|
-
queryType: Chance().word(),
|
|
10
|
-
datasource: undefinedOr(() => Chance().word())
|
|
8
|
+
key: chanceExports.Chance().guid(),
|
|
9
|
+
queryType: chanceExports.Chance().word(),
|
|
10
|
+
datasource: undefinedOr(() => chanceExports.Chance().word())
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
export { mockDataQuery };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataQuery.js","sources":["../../../../src/test/mocks/DataQuery.ts"],"sourcesContent":["import { type DataQuery } from '@grafana/data';\nimport { Chance } from 'chance';\nimport { undefinedOr } from './utils';\n\nexport const mockDataQuery = (): DataQuery => ({\n refId: Chance().word(),\n hide: false,\n key: Chance().guid(),\n queryType: Chance().word(),\n datasource: undefinedOr(() => Chance().word()),\n});\n"],"names":[],"mappings":";;;;AAIO,MAAM,gBAAgB,OAAkB;AAAA,EAC7C,KAAA,
|
|
1
|
+
{"version":3,"file":"DataQuery.js","sources":["../../../../src/test/mocks/DataQuery.ts"],"sourcesContent":["import { type DataQuery } from '@grafana/data';\nimport { Chance } from 'chance';\nimport { undefinedOr } from './utils';\n\nexport const mockDataQuery = (): DataQuery => ({\n refId: Chance().word(),\n hide: false,\n key: Chance().guid(),\n queryType: Chance().word(),\n datasource: undefinedOr(() => Chance().word()),\n});\n"],"names":["Chance"],"mappings":";;;;AAIO,MAAM,gBAAgB,OAAkB;AAAA,EAC7C,KAAA,EAAOA,oBAAO,EAAA,CAAE,IAAK,EAAA;AAAA,EACrB,IAAM,EAAA,KAAA;AAAA,EACN,GAAA,EAAKA,oBAAO,EAAA,CAAE,IAAK,EAAA;AAAA,EACnB,SAAA,EAAWA,oBAAO,EAAA,CAAE,IAAK,EAAA;AAAA,EACzB,YAAY,WAAY,CAAA,MAAMA,oBAAO,EAAA,CAAE,MAAM;AAC/C,CAAA;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@grafana/data';
|
|
2
2
|
import { DataSourceWithBackend } from '@grafana/runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { c as chanceExports } from '../../_virtual/chance.js';
|
|
4
4
|
import { mockDataSourcePluginMeta } from './Plugin.js';
|
|
5
5
|
import { generateBoolean, undefinedOr } from './utils.js';
|
|
6
6
|
|
|
@@ -19,15 +19,15 @@ class DatasourceMock extends DataSourceWithBackend {
|
|
|
19
19
|
__publicField(this, "callHealthCheck", jest.fn());
|
|
20
20
|
__publicField(this, "testDatasource", jest.fn());
|
|
21
21
|
// DataSourceApi
|
|
22
|
-
__publicField(this, "uid", Chance().guid());
|
|
23
|
-
__publicField(this, "name", Chance().word());
|
|
22
|
+
__publicField(this, "uid", chanceExports.Chance().guid());
|
|
23
|
+
__publicField(this, "name", chanceExports.Chance().word());
|
|
24
24
|
__publicField(this, "id", 1);
|
|
25
|
-
__publicField(this, "type", Chance().word());
|
|
26
|
-
__publicField(this, "interval", Chance().word());
|
|
25
|
+
__publicField(this, "type", chanceExports.Chance().word());
|
|
26
|
+
__publicField(this, "interval", chanceExports.Chance().word());
|
|
27
27
|
__publicField(this, "importQueries", jest.fn());
|
|
28
28
|
__publicField(this, "init", jest.fn());
|
|
29
29
|
__publicField(this, "getQueryHints", jest.fn().mockReturnValue([mockQueryHint()]));
|
|
30
|
-
__publicField(this, "getQueryDisplayText", jest.fn().mockReturnValue(Chance().word()));
|
|
30
|
+
__publicField(this, "getQueryDisplayText", jest.fn().mockReturnValue(chanceExports.Chance().word()));
|
|
31
31
|
__publicField(this, "metricFindQuery", jest.fn());
|
|
32
32
|
__publicField(this, "getTagKeys", jest.fn());
|
|
33
33
|
__publicField(this, "getTagValues", jest.fn());
|
|
@@ -48,31 +48,31 @@ class DatasourceMock extends DataSourceWithBackend {
|
|
|
48
48
|
}
|
|
49
49
|
const mockDatasource = () => new DatasourceMock(mockDatasourceInstanceSettings());
|
|
50
50
|
const mockQueryHint = () => ({
|
|
51
|
-
type: Chance().word(),
|
|
52
|
-
label: Chance().word(),
|
|
51
|
+
type: chanceExports.Chance().word(),
|
|
52
|
+
label: chanceExports.Chance().word(),
|
|
53
53
|
fix: {
|
|
54
|
-
label: Chance().word(),
|
|
54
|
+
label: chanceExports.Chance().word(),
|
|
55
55
|
action: {
|
|
56
|
-
type: Chance().word(),
|
|
57
|
-
query: Chance().word(),
|
|
56
|
+
type: chanceExports.Chance().word(),
|
|
57
|
+
query: chanceExports.Chance().word(),
|
|
58
58
|
preventSubmit: generateBoolean()
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
const mockDatasourceInstanceSettings = () => ({
|
|
63
|
-
id: Chance().integer(),
|
|
64
|
-
uid: Chance().word(),
|
|
65
|
-
type: Chance().word(),
|
|
66
|
-
name: Chance().word(),
|
|
63
|
+
id: chanceExports.Chance().integer(),
|
|
64
|
+
uid: chanceExports.Chance().word(),
|
|
65
|
+
type: chanceExports.Chance().word(),
|
|
66
|
+
name: chanceExports.Chance().word(),
|
|
67
67
|
meta: mockDataSourcePluginMeta(),
|
|
68
|
-
url: Chance().word(),
|
|
68
|
+
url: chanceExports.Chance().word(),
|
|
69
69
|
jsonData: {},
|
|
70
|
-
username: Chance().word(),
|
|
71
|
-
password: Chance().word(),
|
|
72
|
-
database: Chance().word(),
|
|
73
|
-
basicAuth: Chance().word(),
|
|
70
|
+
username: chanceExports.Chance().word(),
|
|
71
|
+
password: chanceExports.Chance().word(),
|
|
72
|
+
database: chanceExports.Chance().word(),
|
|
73
|
+
basicAuth: chanceExports.Chance().word(),
|
|
74
74
|
withCredentials: generateBoolean(),
|
|
75
|
-
access: Chance().pickone(["direct", "proxy"]),
|
|
75
|
+
access: chanceExports.Chance().pickone(["direct", "proxy"]),
|
|
76
76
|
readOnly: false
|
|
77
77
|
});
|
|
78
78
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Datasource.js","sources":["../../../../src/test/mocks/Datasource.ts"],"sourcesContent":["import { type DataSourceInstanceSettings, type QueryHint } from '@grafana/data';\nimport { DataSourceWithBackend } from '@grafana/runtime';\nimport { Chance } from 'chance';\nimport { mockDataSourcePluginMeta } from './Plugin';\nimport { generateBoolean, undefinedOr } from './utils';\n\nclass DatasourceMock extends DataSourceWithBackend {\n // DataSourceWithBackend\n query = jest.fn();\n filterQuery = undefinedOr(generateBoolean);\n applyTemplateVariables = jest.fn();\n getResource = jest.fn();\n postResource = jest.fn();\n callHealthCheck = jest.fn();\n testDatasource = jest.fn();\n // DataSourceApi\n uid = Chance().guid();\n name = Chance().word();\n id = 1;\n type = Chance().word();\n interval = Chance().word();\n importQueries = jest.fn();\n init = jest.fn();\n getQueryHints = jest.fn().mockReturnValue([mockQueryHint()]);\n getQueryDisplayText = jest.fn().mockReturnValue(Chance().word());\n metricFindQuery = jest.fn();\n getTagKeys = jest.fn();\n getTagValues = jest.fn();\n components = {};\n meta = mockDataSourcePluginMeta();\n targetContainsTemplate = jest.fn();\n modifyQuery = jest.fn();\n getHighlighterExpression = jest.fn();\n languageProvider = jest.fn();\n getVersion = jest.fn();\n interpolateVariablesInQueries = jest.fn();\n annotations = {};\n annotationQuery = jest.fn();\n streamOptionsProvider = jest.fn();\n getRef = jest.fn();\n protected getRequestHeaders = jest.fn();\n}\n\nexport const mockDatasource = () => new DatasourceMock(mockDatasourceInstanceSettings());\n\nconst mockQueryHint = (): QueryHint => ({\n type: Chance().word(),\n label: Chance().word(),\n fix: {\n label: Chance().word(),\n action: {\n type: Chance().word(),\n query: Chance().word(),\n preventSubmit: generateBoolean(),\n },\n },\n});\n\nexport const mockDatasourceInstanceSettings = (): DataSourceInstanceSettings => ({\n id: Chance().integer(),\n uid: Chance().word(),\n type: Chance().word(),\n name: Chance().word(),\n meta: mockDataSourcePluginMeta(),\n url: Chance().word(),\n jsonData: {},\n username: Chance().word(),\n password: Chance().word(),\n database: Chance().word(),\n basicAuth: Chance().word(),\n withCredentials: generateBoolean(),\n access: Chance().pickone(['direct', 'proxy']),\n readOnly: false,\n});\n"],"names":[],"mappings":";;;;;;;;;AAMA,MAAM,uBAAuB,qBAAsB,CAAA;AAAA,EAAnD,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AAEE;AAAA,IAAA,aAAA,CAAA,IAAA,EAAA,OAAA,EAAQ,KAAK,EAAG,EAAA,CAAA;AAChB,IAAA,aAAA,CAAA,IAAA,EAAA,aAAA,EAAc,YAAY,eAAe,CAAA,CAAA;AACzC,IAAA,aAAA,CAAA,IAAA,EAAA,wBAAA,EAAyB,KAAK,EAAG,EAAA,CAAA;AACjC,IAAA,aAAA,CAAA,IAAA,EAAA,aAAA,EAAc,KAAK,EAAG,EAAA,CAAA;AACtB,IAAA,aAAA,CAAA,IAAA,EAAA,cAAA,EAAe,KAAK,EAAG,EAAA,CAAA;AACvB,IAAA,aAAA,CAAA,IAAA,EAAA,iBAAA,EAAkB,KAAK,EAAG,EAAA,CAAA;AAC1B,IAAA,aAAA,CAAA,IAAA,EAAA,gBAAA,EAAiB,KAAK,EAAG,EAAA,CAAA;AAEzB;AAAA,IAAM,aAAA,CAAA,IAAA,EAAA,KAAA,
|
|
1
|
+
{"version":3,"file":"Datasource.js","sources":["../../../../src/test/mocks/Datasource.ts"],"sourcesContent":["import { type DataSourceInstanceSettings, type QueryHint } from '@grafana/data';\nimport { DataSourceWithBackend } from '@grafana/runtime';\nimport { Chance } from 'chance';\nimport { mockDataSourcePluginMeta } from './Plugin';\nimport { generateBoolean, undefinedOr } from './utils';\n\nclass DatasourceMock extends DataSourceWithBackend {\n // DataSourceWithBackend\n query = jest.fn();\n filterQuery = undefinedOr(generateBoolean);\n applyTemplateVariables = jest.fn();\n getResource = jest.fn();\n postResource = jest.fn();\n callHealthCheck = jest.fn();\n testDatasource = jest.fn();\n // DataSourceApi\n uid = Chance().guid();\n name = Chance().word();\n id = 1;\n type = Chance().word();\n interval = Chance().word();\n importQueries = jest.fn();\n init = jest.fn();\n getQueryHints = jest.fn().mockReturnValue([mockQueryHint()]);\n getQueryDisplayText = jest.fn().mockReturnValue(Chance().word());\n metricFindQuery = jest.fn();\n getTagKeys = jest.fn();\n getTagValues = jest.fn();\n components = {};\n meta = mockDataSourcePluginMeta();\n targetContainsTemplate = jest.fn();\n modifyQuery = jest.fn();\n getHighlighterExpression = jest.fn();\n languageProvider = jest.fn();\n getVersion = jest.fn();\n interpolateVariablesInQueries = jest.fn();\n annotations = {};\n annotationQuery = jest.fn();\n streamOptionsProvider = jest.fn();\n getRef = jest.fn();\n protected getRequestHeaders = jest.fn();\n}\n\nexport const mockDatasource = () => new DatasourceMock(mockDatasourceInstanceSettings());\n\nconst mockQueryHint = (): QueryHint => ({\n type: Chance().word(),\n label: Chance().word(),\n fix: {\n label: Chance().word(),\n action: {\n type: Chance().word(),\n query: Chance().word(),\n preventSubmit: generateBoolean(),\n },\n },\n});\n\nexport const mockDatasourceInstanceSettings = (): DataSourceInstanceSettings => ({\n id: Chance().integer(),\n uid: Chance().word(),\n type: Chance().word(),\n name: Chance().word(),\n meta: mockDataSourcePluginMeta(),\n url: Chance().word(),\n jsonData: {},\n username: Chance().word(),\n password: Chance().word(),\n database: Chance().word(),\n basicAuth: Chance().word(),\n withCredentials: generateBoolean(),\n access: Chance().pickone(['direct', 'proxy']),\n readOnly: false,\n});\n"],"names":["Chance"],"mappings":";;;;;;;;;AAMA,MAAM,uBAAuB,qBAAsB,CAAA;AAAA,EAAnD,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AAEE;AAAA,IAAA,aAAA,CAAA,IAAA,EAAA,OAAA,EAAQ,KAAK,EAAG,EAAA,CAAA;AAChB,IAAA,aAAA,CAAA,IAAA,EAAA,aAAA,EAAc,YAAY,eAAe,CAAA,CAAA;AACzC,IAAA,aAAA,CAAA,IAAA,EAAA,wBAAA,EAAyB,KAAK,EAAG,EAAA,CAAA;AACjC,IAAA,aAAA,CAAA,IAAA,EAAA,aAAA,EAAc,KAAK,EAAG,EAAA,CAAA;AACtB,IAAA,aAAA,CAAA,IAAA,EAAA,cAAA,EAAe,KAAK,EAAG,EAAA,CAAA;AACvB,IAAA,aAAA,CAAA,IAAA,EAAA,iBAAA,EAAkB,KAAK,EAAG,EAAA,CAAA;AAC1B,IAAA,aAAA,CAAA,IAAA,EAAA,gBAAA,EAAiB,KAAK,EAAG,EAAA,CAAA;AAEzB;AAAA,IAAM,aAAA,CAAA,IAAA,EAAA,KAAA,EAAAA,oBAAA,GAAS,IAAK,EAAA,CAAA;AACpB,IAAO,aAAA,CAAA,IAAA,EAAA,MAAA,EAAAA,oBAAA,GAAS,IAAK,EAAA,CAAA;AACrB,IAAK,aAAA,CAAA,IAAA,EAAA,IAAA,EAAA,CAAA,CAAA;AACL,IAAO,aAAA,CAAA,IAAA,EAAA,MAAA,EAAAA,oBAAA,GAAS,IAAK,EAAA,CAAA;AACrB,IAAW,aAAA,CAAA,IAAA,EAAA,UAAA,EAAAA,oBAAA,GAAS,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AAA,EACxB,QAAA,EAAUA,oBAAO,EAAA,CAAE,IAAK,EAAA;AAAA,EACxB,QAAA,EAAUA,oBAAO,EAAA,CAAE,IAAK,EAAA;AAAA,EACxB,SAAA,EAAWA,oBAAO,EAAA,CAAE,IAAK,EAAA;AAAA,EACzB,iBAAiB,eAAgB,EAAA;AAAA,EACjC,QAAQA,oBAAO,EAAA,CAAE,QAAQ,CAAC,QAAA,EAAU,OAAO,CAAC,CAAA;AAAA,EAC5C,QAAU,EAAA;AACZ,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as chanceExports } from '../../_virtual/chance.js';
|
|
2
2
|
import { PluginType, PluginIncludeType, PluginState, PluginSignatureStatus } from '@grafana/data';
|
|
3
3
|
import { generateBoolean } from './utils.js';
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ const mockDataSourcePluginMeta = () => ({
|
|
|
11
11
|
tracing: generateBoolean(),
|
|
12
12
|
mixed: generateBoolean(),
|
|
13
13
|
hasQueryHelp: generateBoolean(),
|
|
14
|
-
category: Chance().word(),
|
|
14
|
+
category: chanceExports.Chance().word(),
|
|
15
15
|
queryOptions: {
|
|
16
16
|
cacheTimeout: generateBoolean(),
|
|
17
17
|
maxDataPoints: generateBoolean(),
|
|
@@ -20,71 +20,71 @@ const mockDataSourcePluginMeta = () => ({
|
|
|
20
20
|
sort: 1,
|
|
21
21
|
streaming: generateBoolean(),
|
|
22
22
|
unlicensed: generateBoolean(),
|
|
23
|
-
id: Chance().word(),
|
|
24
|
-
name: Chance().word(),
|
|
23
|
+
id: chanceExports.Chance().word(),
|
|
24
|
+
name: chanceExports.Chance().word(),
|
|
25
25
|
type: mockPluginType(),
|
|
26
26
|
info: mockPluginMetaInfo(),
|
|
27
|
-
module: Chance().word(),
|
|
28
|
-
baseUrl: Chance().word()
|
|
27
|
+
module: chanceExports.Chance().word(),
|
|
28
|
+
baseUrl: chanceExports.Chance().word()
|
|
29
29
|
});
|
|
30
30
|
const mockPluginMetaInfo = () => ({
|
|
31
31
|
author: {
|
|
32
|
-
name: Chance().word(),
|
|
33
|
-
url: Chance().word()
|
|
32
|
+
name: chanceExports.Chance().word(),
|
|
33
|
+
url: chanceExports.Chance().word()
|
|
34
34
|
},
|
|
35
|
-
description: Chance().word(),
|
|
35
|
+
description: chanceExports.Chance().word(),
|
|
36
36
|
links: [],
|
|
37
37
|
logos: {
|
|
38
|
-
large: Chance().word(),
|
|
39
|
-
small: Chance().word()
|
|
38
|
+
large: chanceExports.Chance().word(),
|
|
39
|
+
small: chanceExports.Chance().word()
|
|
40
40
|
},
|
|
41
41
|
screenshots: [],
|
|
42
|
-
updated: Chance().word(),
|
|
43
|
-
version: Chance().word()
|
|
42
|
+
updated: chanceExports.Chance().word(),
|
|
43
|
+
version: chanceExports.Chance().word()
|
|
44
44
|
});
|
|
45
45
|
const mockPluginMeta = () => ({
|
|
46
|
-
id: Chance().word(),
|
|
47
|
-
name: Chance().word(),
|
|
46
|
+
id: chanceExports.Chance().word(),
|
|
47
|
+
name: chanceExports.Chance().word(),
|
|
48
48
|
type: mockPluginType(),
|
|
49
49
|
info: mockPluginMetaInfo(),
|
|
50
50
|
includes: [mockPluginInclude()],
|
|
51
51
|
state: mockPluginState(),
|
|
52
|
-
module: Chance().word(),
|
|
53
|
-
baseUrl: Chance().word(),
|
|
52
|
+
module: chanceExports.Chance().word(),
|
|
53
|
+
baseUrl: chanceExports.Chance().word(),
|
|
54
54
|
dependencies: mockPluginDependencies(),
|
|
55
55
|
jsonData: {},
|
|
56
56
|
secureJsonData: {},
|
|
57
57
|
enabled: generateBoolean(),
|
|
58
|
-
defaultNavUrl: Chance().word(),
|
|
58
|
+
defaultNavUrl: chanceExports.Chance().word(),
|
|
59
59
|
hasUpdate: generateBoolean(),
|
|
60
60
|
enterprise: generateBoolean(),
|
|
61
|
-
latestVersion: Chance().word(),
|
|
61
|
+
latestVersion: chanceExports.Chance().word(),
|
|
62
62
|
pinned: generateBoolean(),
|
|
63
63
|
signature: mockPluginSignatureStatus(),
|
|
64
64
|
live: generateBoolean()
|
|
65
65
|
});
|
|
66
66
|
const mockPluginInclude = () => ({
|
|
67
67
|
type: mockPluginIncludeType(),
|
|
68
|
-
name: Chance().word(),
|
|
69
|
-
path: Chance().word(),
|
|
70
|
-
icon: Chance().word(),
|
|
71
|
-
role: Chance().word(),
|
|
68
|
+
name: chanceExports.Chance().word(),
|
|
69
|
+
path: chanceExports.Chance().word(),
|
|
70
|
+
icon: chanceExports.Chance().word(),
|
|
71
|
+
role: chanceExports.Chance().word(),
|
|
72
72
|
addToNav: generateBoolean(),
|
|
73
|
-
component: Chance().word()
|
|
73
|
+
component: chanceExports.Chance().word()
|
|
74
74
|
});
|
|
75
|
-
const mockPluginType = () => Chance().pickone([PluginType.panel, PluginType.datasource, PluginType.app, PluginType.renderer]);
|
|
76
|
-
const mockPluginIncludeType = () => Chance().pickone([
|
|
75
|
+
const mockPluginType = () => chanceExports.Chance().pickone([PluginType.panel, PluginType.datasource, PluginType.app, PluginType.renderer]);
|
|
76
|
+
const mockPluginIncludeType = () => chanceExports.Chance().pickone([
|
|
77
77
|
PluginIncludeType.dashboard,
|
|
78
78
|
PluginIncludeType.page,
|
|
79
79
|
PluginIncludeType.panel,
|
|
80
80
|
PluginIncludeType.datasource
|
|
81
81
|
]);
|
|
82
|
-
const mockPluginState = () => Chance().pickone([PluginState.alpha, PluginState.beta, PluginState.deprecated]);
|
|
82
|
+
const mockPluginState = () => chanceExports.Chance().pickone([PluginState.alpha, PluginState.beta, PluginState.deprecated]);
|
|
83
83
|
const mockPluginDependencies = () => ({
|
|
84
|
-
grafanaVersion: Chance().word(),
|
|
84
|
+
grafanaVersion: chanceExports.Chance().word(),
|
|
85
85
|
plugins: []
|
|
86
86
|
});
|
|
87
|
-
const mockPluginSignatureStatus = () => Chance().pickone([
|
|
87
|
+
const mockPluginSignatureStatus = () => chanceExports.Chance().pickone([
|
|
88
88
|
PluginSignatureStatus.internal,
|
|
89
89
|
PluginSignatureStatus.valid,
|
|
90
90
|
PluginSignatureStatus.invalid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.js","sources":["../../../../src/test/mocks/Plugin.ts"],"sourcesContent":["import { Chance } from 'chance';\nimport {\n type DataSourcePluginMeta,\n type PluginMetaInfo,\n type PluginMeta,\n PluginState,\n PluginSignatureStatus,\n type PluginInclude,\n PluginIncludeType,\n type PluginDependencies,\n PluginType,\n} from '@grafana/data';\nimport { generateBoolean } from './utils';\n\nexport const mockDataSourcePluginMeta = (): DataSourcePluginMeta => ({\n builtIn: generateBoolean(),\n metrics: generateBoolean(),\n logs: generateBoolean(),\n annotations: generateBoolean(),\n alerting: generateBoolean(),\n tracing: generateBoolean(),\n mixed: generateBoolean(),\n hasQueryHelp: generateBoolean(),\n category: Chance().word(),\n queryOptions: {\n cacheTimeout: generateBoolean(),\n maxDataPoints: generateBoolean(),\n minInterval: generateBoolean(),\n },\n sort: 1,\n streaming: generateBoolean(),\n unlicensed: generateBoolean(),\n id: Chance().word(),\n name: Chance().word(),\n type: mockPluginType(),\n info: mockPluginMetaInfo(),\n module: Chance().word(),\n baseUrl: Chance().word(),\n});\n\nexport const mockPluginMetaInfo = (): PluginMetaInfo => ({\n author: {\n name: Chance().word(),\n url: Chance().word(),\n },\n description: Chance().word(),\n links: [],\n logos: {\n large: Chance().word(),\n small: Chance().word(),\n },\n screenshots: [],\n updated: Chance().word(),\n version: Chance().word(),\n});\n\nexport const mockPluginMeta = (): PluginMeta => ({\n id: Chance().word(),\n name: Chance().word(),\n type: mockPluginType(),\n info: mockPluginMetaInfo(),\n includes: [mockPluginInclude()],\n state: mockPluginState(),\n module: Chance().word(),\n baseUrl: Chance().word(),\n dependencies: mockPluginDependencies(),\n jsonData: {},\n secureJsonData: {},\n enabled: generateBoolean(),\n defaultNavUrl: Chance().word(),\n hasUpdate: generateBoolean(),\n enterprise: generateBoolean(),\n latestVersion: Chance().word(),\n pinned: generateBoolean(),\n signature: mockPluginSignatureStatus(),\n live: generateBoolean(),\n});\n\nexport const mockPluginInclude = (): PluginInclude => ({\n type: mockPluginIncludeType(),\n name: Chance().word(),\n path: Chance().word(),\n icon: Chance().word(),\n role: Chance().word(),\n addToNav: generateBoolean(),\n component: Chance().word(),\n});\n\nexport const mockPluginType = (): PluginType =>\n Chance().pickone([PluginType.panel, PluginType.datasource, PluginType.app, PluginType.renderer]);\n\nexport const mockPluginIncludeType = (): PluginIncludeType =>\n Chance().pickone([\n PluginIncludeType.dashboard,\n PluginIncludeType.page,\n PluginIncludeType.panel,\n PluginIncludeType.datasource,\n ]);\n\nexport const mockPluginState = (): PluginState =>\n Chance().pickone([PluginState.alpha, PluginState.beta, PluginState.deprecated]);\n\nexport const mockPluginDependencies = (): PluginDependencies => ({\n grafanaVersion: Chance().word(),\n plugins: [],\n});\n\nexport const mockPluginSignatureStatus = (): PluginSignatureStatus =>\n Chance().pickone([\n PluginSignatureStatus.internal,\n PluginSignatureStatus.valid,\n PluginSignatureStatus.invalid,\n PluginSignatureStatus.modified,\n PluginSignatureStatus.missing,\n ]);\n"],"names":[],"mappings":";;;;AAcO,MAAM,2BAA2B,OAA6B;AAAA,EACnE,SAAS,eAAgB,EAAA;AAAA,EACzB,SAAS,eAAgB,EAAA;AAAA,EACzB,MAAM,eAAgB,EAAA;AAAA,EACtB,aAAa,eAAgB,EAAA;AAAA,EAC7B,UAAU,eAAgB,EAAA;AAAA,EAC1B,SAAS,eAAgB,EAAA;AAAA,EACzB,OAAO,eAAgB,EAAA;AAAA,EACvB,cAAc,eAAgB,EAAA;AAAA,EAC9B,QAAA,
|
|
1
|
+
{"version":3,"file":"Plugin.js","sources":["../../../../src/test/mocks/Plugin.ts"],"sourcesContent":["import { Chance } from 'chance';\nimport {\n type DataSourcePluginMeta,\n type PluginMetaInfo,\n type PluginMeta,\n PluginState,\n PluginSignatureStatus,\n type PluginInclude,\n PluginIncludeType,\n type PluginDependencies,\n PluginType,\n} from '@grafana/data';\nimport { generateBoolean } from './utils';\n\nexport const mockDataSourcePluginMeta = (): DataSourcePluginMeta => ({\n builtIn: generateBoolean(),\n metrics: generateBoolean(),\n logs: generateBoolean(),\n annotations: generateBoolean(),\n alerting: generateBoolean(),\n tracing: generateBoolean(),\n mixed: generateBoolean(),\n hasQueryHelp: generateBoolean(),\n category: Chance().word(),\n queryOptions: {\n cacheTimeout: generateBoolean(),\n maxDataPoints: generateBoolean(),\n minInterval: generateBoolean(),\n },\n sort: 1,\n streaming: generateBoolean(),\n unlicensed: generateBoolean(),\n id: Chance().word(),\n name: Chance().word(),\n type: mockPluginType(),\n info: mockPluginMetaInfo(),\n module: Chance().word(),\n baseUrl: Chance().word(),\n});\n\nexport const mockPluginMetaInfo = (): PluginMetaInfo => ({\n author: {\n name: Chance().word(),\n url: Chance().word(),\n },\n description: Chance().word(),\n links: [],\n logos: {\n large: Chance().word(),\n small: Chance().word(),\n },\n screenshots: [],\n updated: Chance().word(),\n version: Chance().word(),\n});\n\nexport const mockPluginMeta = (): PluginMeta => ({\n id: Chance().word(),\n name: Chance().word(),\n type: mockPluginType(),\n info: mockPluginMetaInfo(),\n includes: [mockPluginInclude()],\n state: mockPluginState(),\n module: Chance().word(),\n baseUrl: Chance().word(),\n dependencies: mockPluginDependencies(),\n jsonData: {},\n secureJsonData: {},\n enabled: generateBoolean(),\n defaultNavUrl: Chance().word(),\n hasUpdate: generateBoolean(),\n enterprise: generateBoolean(),\n latestVersion: Chance().word(),\n pinned: generateBoolean(),\n signature: mockPluginSignatureStatus(),\n live: generateBoolean(),\n});\n\nexport const mockPluginInclude = (): PluginInclude => ({\n type: mockPluginIncludeType(),\n name: Chance().word(),\n path: Chance().word(),\n icon: Chance().word(),\n role: Chance().word(),\n addToNav: generateBoolean(),\n component: Chance().word(),\n});\n\nexport const mockPluginType = (): PluginType =>\n Chance().pickone([PluginType.panel, PluginType.datasource, PluginType.app, PluginType.renderer]);\n\nexport const mockPluginIncludeType = (): PluginIncludeType =>\n Chance().pickone([\n PluginIncludeType.dashboard,\n PluginIncludeType.page,\n PluginIncludeType.panel,\n PluginIncludeType.datasource,\n ]);\n\nexport const mockPluginState = (): PluginState =>\n Chance().pickone([PluginState.alpha, PluginState.beta, PluginState.deprecated]);\n\nexport const mockPluginDependencies = (): PluginDependencies => ({\n grafanaVersion: Chance().word(),\n plugins: [],\n});\n\nexport const mockPluginSignatureStatus = (): PluginSignatureStatus =>\n Chance().pickone([\n PluginSignatureStatus.internal,\n PluginSignatureStatus.valid,\n PluginSignatureStatus.invalid,\n PluginSignatureStatus.modified,\n PluginSignatureStatus.missing,\n ]);\n"],"names":["Chance"],"mappings":";;;;AAcO,MAAM,2BAA2B,OAA6B;AAAA,EACnE,SAAS,eAAgB,EAAA;AAAA,EACzB,SAAS,eAAgB,EAAA;AAAA,EACzB,MAAM,eAAgB,EAAA;AAAA,EACtB,aAAa,eAAgB,EAAA;AAAA,EAC7B,UAAU,eAAgB,EAAA;AAAA,EAC1B,SAAS,eAAgB,EAAA;AAAA,EACzB,OAAO,eAAgB,EAAA;AAAA,EACvB,cAAc,eAAgB,EAAA;AAAA,EAC9B,QAAA,EAAUA,oBAAO,EAAA,CAAE,IAAK,EAAA;AAAA,EACxB,YAAc,EAAA;AAAA,IACZ,cAAc,eAAgB,EAAA;AAAA,IAC9B,eAAe,eAAgB,EAAA;AAAA,IAC/B,aAAa,eAAgB;AAAA,GAC/B;AAAA,EACA,IAAM,EAAA,CAAA;AAAA,EACN,WAAW,eAAgB,EAAA;AAAA,EAC3B,YAAY,eAAgB,EAAA;AAAA,EAC5B,EAAA,EAAIA,oBAAO,EAAA,CAAE,IAAK,EAAA;AAAA,EAClB,IAAA,EAAMA,oBAAO,EAAA,CAAE,IAAK,EAAA;AAAA,EACpB,MAAM,cAAe,EAAA;AAAA,EACrB,MAAM,kBAAmB,EAAA;AAAA,EACzB,MAAA,EAAQA,oBAAO,EAAA,CAAE,IAAK,EAAA;AAAA,EACtB,OAAA,EAASA,oBAAO,EAAA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A,EACtB,qBAAsB,CAAA,KAAA;AAAA,EACtB,qBAAsB,CAAA,OAAA;AAAA,EACtB,qBAAsB,CAAA,QAAA;AAAA,EACtB,qBAAsB,CAAA;AACxB,CAAC;;;;"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { DataTopic, LoadingState, dateTime } from '@grafana/data';
|
|
2
|
-
import {
|
|
2
|
+
import { c as chanceExports } from '../../_virtual/chance.js';
|
|
3
3
|
|
|
4
4
|
const mockQueryEditorProps = () => ({
|
|
5
5
|
datasource: {},
|
|
6
6
|
query: {
|
|
7
|
-
refId: Chance().word(),
|
|
7
|
+
refId: chanceExports.Chance().word(),
|
|
8
8
|
hide: false,
|
|
9
|
-
key: Chance().word(),
|
|
10
|
-
queryType: Chance().word(),
|
|
9
|
+
key: chanceExports.Chance().word(),
|
|
10
|
+
queryType: chanceExports.Chance().word(),
|
|
11
11
|
dataTopic: DataTopic.Annotations,
|
|
12
|
-
datasource: Chance().pickone([Chance().word(), null])
|
|
12
|
+
datasource: chanceExports.Chance().pickone([chanceExports.Chance().word(), null])
|
|
13
13
|
},
|
|
14
14
|
onRunQuery: jest.fn(),
|
|
15
15
|
onChange: jest.fn(),
|
|
@@ -23,7 +23,7 @@ const mockQueryEditorProps = () => ({
|
|
|
23
23
|
range: mockTimeRange(),
|
|
24
24
|
history: []
|
|
25
25
|
});
|
|
26
|
-
const mockLoadingState = () => Chance().pickone([
|
|
26
|
+
const mockLoadingState = () => chanceExports.Chance().pickone([
|
|
27
27
|
LoadingState.NotStarted,
|
|
28
28
|
LoadingState.Loading,
|
|
29
29
|
LoadingState.Streaming,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryEditorProps.js","sources":["../../../../src/test/mocks/QueryEditorProps.ts"],"sourcesContent":["import { type QueryEditorProps, DataTopic, dateTime, LoadingState, type TimeRange } from '@grafana/data';\nimport { Chance } from 'chance';\n\nexport const mockQueryEditorProps = (): QueryEditorProps<any, any, any> => ({\n datasource: {},\n query: {\n refId: Chance().word(),\n hide: false,\n key: Chance().word(),\n queryType: Chance().word(),\n dataTopic: DataTopic.Annotations,\n datasource: Chance().pickone([Chance().word(), null]),\n },\n onRunQuery: jest.fn(),\n onChange: jest.fn(),\n onBlur: jest.fn(),\n data: {\n state: mockLoadingState(),\n series: [],\n annotations: [],\n timeRange: mockTimeRange(),\n },\n range: mockTimeRange(),\n history: [],\n});\n\nexport const mockLoadingState = (): LoadingState =>\n Chance().pickone([\n LoadingState.NotStarted,\n LoadingState.Loading,\n LoadingState.Streaming,\n LoadingState.Done,\n LoadingState.Error,\n ]);\n\nexport const mockTimeRange = (): TimeRange => ({\n from: dateTime(),\n to: dateTime(),\n raw: {\n from: dateTime(),\n to: dateTime(),\n },\n});\n"],"names":[],"mappings":";;;AAGO,MAAM,uBAAuB,OAAwC;AAAA,EAC1E,YAAY,EAAC;AAAA,EACb,KAAO,EAAA;AAAA,IACL,KAAA,
|
|
1
|
+
{"version":3,"file":"QueryEditorProps.js","sources":["../../../../src/test/mocks/QueryEditorProps.ts"],"sourcesContent":["import { type QueryEditorProps, DataTopic, dateTime, LoadingState, type TimeRange } from '@grafana/data';\nimport { Chance } from 'chance';\n\nexport const mockQueryEditorProps = (): QueryEditorProps<any, any, any> => ({\n datasource: {},\n query: {\n refId: Chance().word(),\n hide: false,\n key: Chance().word(),\n queryType: Chance().word(),\n dataTopic: DataTopic.Annotations,\n datasource: Chance().pickone([Chance().word(), null]),\n },\n onRunQuery: jest.fn(),\n onChange: jest.fn(),\n onBlur: jest.fn(),\n data: {\n state: mockLoadingState(),\n series: [],\n annotations: [],\n timeRange: mockTimeRange(),\n },\n range: mockTimeRange(),\n history: [],\n});\n\nexport const mockLoadingState = (): LoadingState =>\n Chance().pickone([\n LoadingState.NotStarted,\n LoadingState.Loading,\n LoadingState.Streaming,\n LoadingState.Done,\n LoadingState.Error,\n ]);\n\nexport const mockTimeRange = (): TimeRange => ({\n from: dateTime(),\n to: dateTime(),\n raw: {\n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11 @@
|
|
|
1
1
|
import '@grafana/data';
|
|
2
|
-
import {
|
|
2
|
+
import { c as chanceExports } from '../../_virtual/chance.js';
|
|
3
3
|
import { within, fireEvent, waitFor } from '@testing-library/react';
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
|
5
5
|
import { kebabCase } from 'lodash';
|
|
6
6
|
|
|
7
|
-
const generateBoolean = () => Chance().pickone([true, false]);
|
|
8
|
-
const undefinedOr = (fn) => Chance().pickone([undefined, fn()]);
|
|
7
|
+
const generateBoolean = () => chanceExports.Chance().pickone([true, false]);
|
|
8
|
+
const undefinedOr = (fn) => chanceExports.Chance().pickone([undefined, fn()]);
|
|
9
9
|
const generateArrayOf = (fn, numberOf = 3) => Array.from(new Array(numberOf), () => fn());
|
|
10
10
|
const openSelect = (container, optionLabel) => {
|
|
11
11
|
const selectInput = within(container).getByRole("textbox");
|
|
@@ -20,7 +20,7 @@ const selectOption = async (container, optionLabel, typeOptionLabel) => {
|
|
|
20
20
|
const generateOptions = () => {
|
|
21
21
|
const numberOfOptions = 5;
|
|
22
22
|
return Array.from(new Array(numberOfOptions), () => {
|
|
23
|
-
const name = Chance().name();
|
|
23
|
+
const name = chanceExports.Chance().name();
|
|
24
24
|
return {
|
|
25
25
|
label: name,
|
|
26
26
|
value: kebabCase(name)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/test/mocks/utils.ts"],"sourcesContent":["import { type SelectableValue } from '@grafana/data';\nimport { Chance } from 'chance';\nimport { within, fireEvent, waitFor } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { kebabCase } from 'lodash';\n\nexport const generateBoolean = () => Chance().pickone([true, false]);\n\nexport const undefinedOr = (fn: Function) => Chance().pickone([undefined, fn()]);\n\nexport const generateArrayOf = (fn: Function, numberOf = 3) => Array.from(new Array(numberOf), () => fn());\n\n// react-select (used by @grafana/ui) renders very differently from the native Select HTML element\n// and because they are not accessible and do not pass data-testid or aria-labels down,\n// it is difficult to grab the correct element and simulate selecting different options\n// the helper functions below can be used instead\n\n/**\n * Opens a Select or MultiSelect dropdown\n *\n * @param {HTMLElement} container The container wrapping the Select or MultiSelect component\n * @param {string} optionLabel The option text we want to type or search\n */\nexport const openSelect = (container: HTMLElement, optionLabel?: string) => {\n const selectInput = within(container).getByRole('textbox');\n\n // this needs to be here to support autoFocus=true prop\n fireEvent.blur(selectInput);\n\n // if we have an async Select, we want to type the option label to make the option available\n // otherwise, just press down to open the dropdown\n userEvent.type(selectInput, optionLabel ?? '{arrowdown}');\n};\n\n/**\n * Selects an option from the Select or MultiSelect component\n *\n * @param {HTMLElement} container The container wrapping the Select or MultiSelect component\n * @param {string} optionLabel The option we want to select\n * @param {boolean} [typeOptionLabel=false] If we should type the optional label after opening - this is useful for AsyncSelect\n */\nexport const selectOption = async (container: HTMLElement, optionLabel: string, typeOptionLabel?: boolean) => {\n openSelect(container, typeOptionLabel ? optionLabel : undefined);\n\n // wait for the list to show\n const option = await waitFor(() => within(container).getByText(optionLabel));\n\n // select the option\n userEvent.click(option);\n};\n\nexport const generateOptions = (): Array<SelectableValue<string>> => {\n const numberOfOptions = 5;\n\n return Array.from(new Array(numberOfOptions), () => {\n const name = Chance().name();\n\n return {\n label: name,\n value: kebabCase(name),\n };\n });\n};\n"],"names":[],"mappings":";;;;;;AAMa,MAAA,eAAA,GAAkB,
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/test/mocks/utils.ts"],"sourcesContent":["import { type SelectableValue } from '@grafana/data';\nimport { Chance } from 'chance';\nimport { within, fireEvent, waitFor } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { kebabCase } from 'lodash';\n\nexport const generateBoolean = () => Chance().pickone([true, false]);\n\nexport const undefinedOr = (fn: Function) => Chance().pickone([undefined, fn()]);\n\nexport const generateArrayOf = (fn: Function, numberOf = 3) => Array.from(new Array(numberOf), () => fn());\n\n// react-select (used by @grafana/ui) renders very differently from the native Select HTML element\n// and because they are not accessible and do not pass data-testid or aria-labels down,\n// it is difficult to grab the correct element and simulate selecting different options\n// the helper functions below can be used instead\n\n/**\n * Opens a Select or MultiSelect dropdown\n *\n * @param {HTMLElement} container The container wrapping the Select or MultiSelect component\n * @param {string} optionLabel The option text we want to type or search\n */\nexport const openSelect = (container: HTMLElement, optionLabel?: string) => {\n const selectInput = within(container).getByRole('textbox');\n\n // this needs to be here to support autoFocus=true prop\n fireEvent.blur(selectInput);\n\n // if we have an async Select, we want to type the option label to make the option available\n // otherwise, just press down to open the dropdown\n userEvent.type(selectInput, optionLabel ?? '{arrowdown}');\n};\n\n/**\n * Selects an option from the Select or MultiSelect component\n *\n * @param {HTMLElement} container The container wrapping the Select or MultiSelect component\n * @param {string} optionLabel The option we want to select\n * @param {boolean} [typeOptionLabel=false] If we should type the optional label after opening - this is useful for AsyncSelect\n */\nexport const selectOption = async (container: HTMLElement, optionLabel: string, typeOptionLabel?: boolean) => {\n openSelect(container, typeOptionLabel ? optionLabel : undefined);\n\n // wait for the list to show\n const option = await waitFor(() => within(container).getByText(optionLabel));\n\n // select the option\n userEvent.click(option);\n};\n\nexport const generateOptions = (): Array<SelectableValue<string>> => {\n const numberOfOptions = 5;\n\n return Array.from(new Array(numberOfOptions), () => {\n const name = Chance().name();\n\n return {\n label: name,\n value: kebabCase(name),\n };\n });\n};\n"],"names":["Chance"],"mappings":";;;;;;AAMa,MAAA,eAAA,GAAkB,MAAMA,oBAAO,EAAA,CAAE,QAAQ,CAAC,IAAA,EAAM,KAAK,CAAC;AAEtD,MAAA,WAAA,GAAc,CAAC,EAAA,KAAiBA,oBAAO,EAAA,CAAE,QAAQ,CAAC,SAAA,EAAW,EAAG,EAAC,CAAC;AAExE,MAAM,eAAkB,GAAA,CAAC,EAAc,EAAA,QAAA,GAAW,CAAM,KAAA,KAAA,CAAM,IAAK,CAAA,IAAI,KAAM,CAAA,QAAQ,CAAG,EAAA,MAAM,IAAI;AAa5F,MAAA,UAAA,GAAa,CAAC,SAAA,EAAwB,WAAyB,KAAA;AAC1E,EAAA,MAAM,WAAc,GAAA,MAAA,CAAO,SAAS,CAAA,CAAE,UAAU,SAAS,CAAA;AAGzD,EAAA,SAAA,CAAU,KAAK,WAAW,CAAA;AAI1B,EAAU,SAAA,CAAA,IAAA,CAAK,WAAa,EAAA,WAAA,IAAA,IAAA,GAAA,WAAA,GAAe,aAAa,CAAA;AAC1D;AASO,MAAM,YAAe,GAAA,OAAO,SAAwB,EAAA,WAAA,EAAqB,eAA8B,KAAA;AAC5G,EAAW,UAAA,CAAA,SAAA,EAAW,eAAkB,GAAA,WAAA,GAAc,SAAS,CAAA;AAG/D,EAAM,MAAA,MAAA,GAAS,MAAM,OAAQ,CAAA,MAAM,OAAO,SAAS,CAAA,CAAE,SAAU,CAAA,WAAW,CAAC,CAAA;AAG3E,EAAA,SAAA,CAAU,MAAM,MAAM,CAAA;AACxB;AAEO,MAAM,kBAAkB,MAAsC;AACnE,EAAA,MAAM,eAAkB,GAAA,CAAA;AAExB,EAAA,OAAO,MAAM,IAAK,CAAA,IAAI,KAAM,CAAA,eAAe,GAAG,MAAM;AAClD,IAAM,MAAA,IAAA,GAAOA,oBAAO,EAAA,CAAE,IAAK,EAAA;AAE3B,IAAO,OAAA;AAAA,MACL,KAAO,EAAA,IAAA;AAAA,MACP,KAAA,EAAO,UAAU,IAAI;AAAA,KACvB;AAAA,GACD,CAAA;AACH;;;;"}
|
package/dist/esm/test-utils.d.ts
CHANGED
|
@@ -3,38 +3,38 @@ import { DataSourceInstanceSettings, DataQuery, DataSourcePluginMeta, PluginMeta
|
|
|
3
3
|
import { DataSourceWithBackend } from '@grafana/runtime';
|
|
4
4
|
|
|
5
5
|
declare class DatasourceMock extends DataSourceWithBackend {
|
|
6
|
-
query: jest.Mock<any, any>;
|
|
6
|
+
query: jest.Mock<any, any, any>;
|
|
7
7
|
filterQuery: any;
|
|
8
|
-
applyTemplateVariables: jest.Mock<any, any>;
|
|
9
|
-
getResource: jest.Mock<any, any>;
|
|
10
|
-
postResource: jest.Mock<any, any>;
|
|
11
|
-
callHealthCheck: jest.Mock<any, any>;
|
|
12
|
-
testDatasource: jest.Mock<any, any>;
|
|
8
|
+
applyTemplateVariables: jest.Mock<any, any, any>;
|
|
9
|
+
getResource: jest.Mock<any, any, any>;
|
|
10
|
+
postResource: jest.Mock<any, any, any>;
|
|
11
|
+
callHealthCheck: jest.Mock<any, any, any>;
|
|
12
|
+
testDatasource: jest.Mock<any, any, any>;
|
|
13
13
|
uid: string;
|
|
14
14
|
name: string;
|
|
15
15
|
id: number;
|
|
16
16
|
type: string;
|
|
17
17
|
interval: string;
|
|
18
|
-
importQueries: jest.Mock<any, any>;
|
|
19
|
-
init: jest.Mock<any, any>;
|
|
20
|
-
getQueryHints: jest.Mock<any, any>;
|
|
21
|
-
getQueryDisplayText: jest.Mock<any, any>;
|
|
22
|
-
metricFindQuery: jest.Mock<any, any>;
|
|
23
|
-
getTagKeys: jest.Mock<any, any>;
|
|
24
|
-
getTagValues: jest.Mock<any, any>;
|
|
18
|
+
importQueries: jest.Mock<any, any, any>;
|
|
19
|
+
init: jest.Mock<any, any, any>;
|
|
20
|
+
getQueryHints: jest.Mock<any, any, any>;
|
|
21
|
+
getQueryDisplayText: jest.Mock<any, any, any>;
|
|
22
|
+
metricFindQuery: jest.Mock<any, any, any>;
|
|
23
|
+
getTagKeys: jest.Mock<any, any, any>;
|
|
24
|
+
getTagValues: jest.Mock<any, any, any>;
|
|
25
25
|
components: {};
|
|
26
26
|
meta: _grafana_data.DataSourcePluginMeta<{}>;
|
|
27
|
-
targetContainsTemplate: jest.Mock<any, any>;
|
|
28
|
-
modifyQuery: jest.Mock<any, any>;
|
|
29
|
-
getHighlighterExpression: jest.Mock<any, any>;
|
|
30
|
-
languageProvider: jest.Mock<any, any>;
|
|
31
|
-
getVersion: jest.Mock<any, any>;
|
|
32
|
-
interpolateVariablesInQueries: jest.Mock<any, any>;
|
|
27
|
+
targetContainsTemplate: jest.Mock<any, any, any>;
|
|
28
|
+
modifyQuery: jest.Mock<any, any, any>;
|
|
29
|
+
getHighlighterExpression: jest.Mock<any, any, any>;
|
|
30
|
+
languageProvider: jest.Mock<any, any, any>;
|
|
31
|
+
getVersion: jest.Mock<any, any, any>;
|
|
32
|
+
interpolateVariablesInQueries: jest.Mock<any, any, any>;
|
|
33
33
|
annotations: {};
|
|
34
|
-
annotationQuery: jest.Mock<any, any>;
|
|
35
|
-
streamOptionsProvider: jest.Mock<any, any>;
|
|
36
|
-
getRef: jest.Mock<any, any>;
|
|
37
|
-
protected getRequestHeaders: jest.Mock<any, any>;
|
|
34
|
+
annotationQuery: jest.Mock<any, any, any>;
|
|
35
|
+
streamOptionsProvider: jest.Mock<any, any, any>;
|
|
36
|
+
getRef: jest.Mock<any, any, any>;
|
|
37
|
+
protected getRequestHeaders: jest.Mock<any, any, any>;
|
|
38
38
|
}
|
|
39
39
|
declare const mockDatasource: () => DatasourceMock;
|
|
40
40
|
declare const mockDatasourceInstanceSettings: () => DataSourceInstanceSettings;
|