@grafana/plugin-ui 0.1.10
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 +45 -0
- package/dist/8x/fixtures/index.js +7 -0
- package/dist/8x/fixtures/index.js.map +1 -0
- package/dist/8x/fixtures/select.js +43 -0
- package/dist/8x/fixtures/select.js.map +1 -0
- package/dist/8x/index.js +5 -0
- package/dist/8x/index.js.map +1 -0
- package/dist/components/AsyncButtonCascader/AsyncButtonCascader.js +34 -0
- package/dist/components/AsyncButtonCascader/AsyncButtonCascader.js.map +1 -0
- package/dist/components/Cascader/Cascader.js +6 -0
- package/dist/components/Cascader/Cascader.js.map +1 -0
- package/dist/components/DataLinks/DataLink.js +79 -0
- package/dist/components/DataLinks/DataLink.js.map +1 -0
- package/dist/components/DataLinks/DataLinks.js +59 -0
- package/dist/components/DataLinks/DataLinks.js.map +1 -0
- package/dist/components/DataLinks/index.js +7 -0
- package/dist/components/DataLinks/index.js.map +1 -0
- package/dist/components/DataLinks/types.js +3 -0
- package/dist/components/DataLinks/types.js.map +1 -0
- package/dist/components/DataSourcePicker/DataSourcePicker.js +90 -0
- package/dist/components/DataSourcePicker/DataSourcePicker.js.map +1 -0
- package/dist/components/DatePicker/DatePicker.js +29 -0
- package/dist/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/components/DatePicker/styles.js +156 -0
- package/dist/components/DatePicker/styles.js.map +1 -0
- package/dist/components/DatePickerWithInput/DatePickerWithInput.js +19 -0
- package/dist/components/DatePickerWithInput/DatePickerWithInput.js.map +1 -0
- package/dist/components/DatePickerWithInput/style.css +6 -0
- package/dist/components/DebounceInput/DebounceInput.js +17 -0
- package/dist/components/DebounceInput/DebounceInput.js.map +1 -0
- package/dist/components/Plugins/PluginSignatureBadge.js +65 -0
- package/dist/components/Plugins/PluginSignatureBadge.js.map +1 -0
- package/dist/components/QueryEditor/AccessoryButton.js +21 -0
- package/dist/components/QueryEditor/AccessoryButton.js.map +1 -0
- package/dist/components/QueryEditor/ConfirmModal.js +28 -0
- package/dist/components/QueryEditor/ConfirmModal.js.map +1 -0
- package/dist/components/QueryEditor/DatasetSelector.js +36 -0
- package/dist/components/QueryEditor/DatasetSelector.js.map +1 -0
- package/dist/components/QueryEditor/EditorField.js +51 -0
- package/dist/components/QueryEditor/EditorField.js.map +1 -0
- package/dist/components/QueryEditor/EditorFieldGroup.js +11 -0
- package/dist/components/QueryEditor/EditorFieldGroup.js.map +1 -0
- package/dist/components/QueryEditor/EditorHeader.js +23 -0
- package/dist/components/QueryEditor/EditorHeader.js.map +1 -0
- package/dist/components/QueryEditor/EditorList.js +28 -0
- package/dist/components/QueryEditor/EditorList.js.map +1 -0
- package/dist/components/QueryEditor/EditorRow.js +24 -0
- package/dist/components/QueryEditor/EditorRow.js.map +1 -0
- package/dist/components/QueryEditor/EditorRows.js +11 -0
- package/dist/components/QueryEditor/EditorRows.js.map +1 -0
- package/dist/components/QueryEditor/EditorSwitch.js +24 -0
- package/dist/components/QueryEditor/EditorSwitch.js.map +1 -0
- package/dist/components/QueryEditor/ErrorBoundary.js +23 -0
- package/dist/components/QueryEditor/ErrorBoundary.js.map +1 -0
- package/dist/components/QueryEditor/FlexItem.js +10 -0
- package/dist/components/QueryEditor/FlexItem.js.map +1 -0
- package/dist/components/QueryEditor/InlineSelect.js +60 -0
- package/dist/components/QueryEditor/InlineSelect.js.map +1 -0
- package/dist/components/QueryEditor/InputGroup.js +46 -0
- package/dist/components/QueryEditor/InputGroup.js.map +1 -0
- package/dist/components/QueryEditor/QueryEditor.js +73 -0
- package/dist/components/QueryEditor/QueryEditor.js.map +1 -0
- package/dist/components/QueryEditor/QueryHeader.js +92 -0
- package/dist/components/QueryEditor/QueryHeader.js.map +1 -0
- package/dist/components/QueryEditor/Space.js +36 -0
- package/dist/components/QueryEditor/Space.js.map +1 -0
- package/dist/components/QueryEditor/Stack.js +27 -0
- package/dist/components/QueryEditor/Stack.js.map +1 -0
- package/dist/components/QueryEditor/TableSelector.js +20 -0
- package/dist/components/QueryEditor/TableSelector.js.map +1 -0
- package/dist/components/QueryEditor/defaults.js +20 -0
- package/dist/components/QueryEditor/defaults.js.map +1 -0
- package/dist/components/QueryEditor/expressions.js +18 -0
- package/dist/components/QueryEditor/expressions.js.map +1 -0
- package/dist/components/QueryEditor/index.js +35 -0
- package/dist/components/QueryEditor/index.js.map +1 -0
- package/dist/components/QueryEditor/query-editor-raw/QueryEditorRaw.js +21 -0
- package/dist/components/QueryEditor/query-editor-raw/QueryEditorRaw.js.map +1 -0
- package/dist/components/QueryEditor/query-editor-raw/QueryToolbox.js +59 -0
- package/dist/components/QueryEditor/query-editor-raw/QueryToolbox.js.map +1 -0
- package/dist/components/QueryEditor/query-editor-raw/QueryValidator.js +79 -0
- package/dist/components/QueryEditor/query-editor-raw/QueryValidator.js.map +1 -0
- package/dist/components/QueryEditor/query-editor-raw/RawEditor.js +60 -0
- package/dist/components/QueryEditor/query-editor-raw/RawEditor.js.map +1 -0
- package/dist/components/QueryEditor/types.js +21 -0
- package/dist/components/QueryEditor/types.js.map +1 -0
- package/dist/components/QueryEditor/utils/formatSQL.js +13 -0
- package/dist/components/QueryEditor/utils/formatSQL.js.map +1 -0
- package/dist/components/QueryEditor/utils/sql.utils.js +94 -0
- package/dist/components/QueryEditor/utils/sql.utils.js.map +1 -0
- package/dist/components/QueryEditor/utils/useSqlChange.js +16 -0
- package/dist/components/QueryEditor/utils/useSqlChange.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/AwesomeQueryBuilder.js +109 -0
- package/dist/components/QueryEditor/visual-query-builder/AwesomeQueryBuilder.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/EditorField.js +51 -0
- package/dist/components/QueryEditor/visual-query-builder/EditorField.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/EditorRow.js +24 -0
- package/dist/components/QueryEditor/visual-query-builder/EditorRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/EditorRows.js +11 -0
- package/dist/components/QueryEditor/visual-query-builder/EditorRows.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/GroupByRow.js +33 -0
- package/dist/components/QueryEditor/visual-query-builder/GroupByRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/OrderByRow.js +50 -0
- package/dist/components/QueryEditor/visual-query-builder/OrderByRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/Preview.js +28 -0
- package/dist/components/QueryEditor/visual-query-builder/Preview.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLGroupByRow.js +13 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLGroupByRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLOrderByRow.js +34 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLOrderByRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLSelectRow.js +19 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLSelectRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLWhereRow.js +35 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLWhereRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/SelectRow.js +68 -0
- package/dist/components/QueryEditor/visual-query-builder/SelectRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/Stack.js +27 -0
- package/dist/components/QueryEditor/visual-query-builder/Stack.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/VisualEditor.js +38 -0
- package/dist/components/QueryEditor/visual-query-builder/VisualEditor.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/WhereRow.js +67 -0
- package/dist/components/QueryEditor/visual-query-builder/WhereRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/index.js +6 -0
- package/dist/components/QueryEditor/visual-query-builder/index.js.map +1 -0
- package/dist/components/QueryEditorRow/QueryEditorRow.js +17 -0
- package/dist/components/QueryEditorRow/QueryEditorRow.js.map +1 -0
- package/dist/components/Segment/Segment.js +18 -0
- package/dist/components/Segment/Segment.js.map +1 -0
- package/dist/components/index.js +25 -0
- package/dist/components/index.js.map +1 -0
- package/dist/datasource/SqlDatasource.js +161 -0
- package/dist/datasource/SqlDatasource.js.map +1 -0
- package/dist/datasource/constants.js +19 -0
- package/dist/datasource/constants.js.map +1 -0
- package/dist/hooks/useDebounce.js +19 -0
- package/dist/hooks/useDebounce.js.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/src/8x/fixtures/index.d.ts +1 -0
- package/dist/src/8x/fixtures/select.d.ts +11 -0
- package/dist/src/8x/index.d.ts +1 -0
- package/dist/src/components/AsyncButtonCascader/AsyncButtonCascader.d.ts +18 -0
- package/dist/src/components/Cascader/Cascader.d.ts +1 -0
- package/dist/src/components/DataLinks/DataLink.d.ts +13 -0
- package/dist/src/components/DataLinks/DataLinks.d.ts +8 -0
- package/dist/src/components/DataLinks/index.d.ts +3 -0
- package/dist/src/components/DataLinks/types.d.ts +7 -0
- package/dist/src/components/DataSourcePicker/DataSourcePicker.d.ts +34 -0
- package/dist/src/components/DatePicker/DatePicker.d.ts +8 -0
- package/dist/src/components/DatePicker/styles.d.ts +11 -0
- package/dist/src/components/DatePickerWithInput/DatePickerWithInput.d.ts +9 -0
- package/dist/src/components/DebounceInput/DebounceInput.d.ts +8 -0
- package/dist/src/components/Plugins/PluginSignatureBadge.d.ts +9 -0
- package/dist/src/components/QueryEditor/AccessoryButton.d.ts +6 -0
- package/dist/src/components/QueryEditor/ConfirmModal.d.ts +9 -0
- package/dist/src/components/QueryEditor/DatasetSelector.d.ts +12 -0
- package/dist/src/components/QueryEditor/EditorField.d.ts +11 -0
- package/dist/src/components/QueryEditor/EditorFieldGroup.d.ts +5 -0
- package/dist/src/components/QueryEditor/EditorHeader.d.ts +5 -0
- package/dist/src/components/QueryEditor/EditorList.d.ts +8 -0
- package/dist/src/components/QueryEditor/EditorRow.d.ts +5 -0
- package/dist/src/components/QueryEditor/EditorRows.d.ts +5 -0
- package/dist/src/components/QueryEditor/EditorSwitch.d.ts +3 -0
- package/dist/src/components/QueryEditor/ErrorBoundary.d.ts +14 -0
- package/dist/src/components/QueryEditor/FlexItem.d.ts +7 -0
- package/dist/src/components/QueryEditor/InlineSelect.d.ts +7 -0
- package/dist/src/components/QueryEditor/InputGroup.d.ts +5 -0
- package/dist/src/components/QueryEditor/QueryEditor.d.ts +7 -0
- package/dist/src/components/QueryEditor/QueryHeader.d.ts +15 -0
- package/dist/src/components/QueryEditor/Space.d.ts +14 -0
- package/dist/src/components/QueryEditor/Stack.d.ts +9 -0
- package/dist/src/components/QueryEditor/TableSelector.d.ts +12 -0
- package/dist/src/components/QueryEditor/defaults.d.ts +3 -0
- package/dist/src/components/QueryEditor/expressions.d.ts +50 -0
- package/dist/src/components/QueryEditor/index.d.ts +16 -0
- package/dist/src/components/QueryEditor/query-editor-raw/QueryEditorRaw.d.ts +15 -0
- package/dist/src/components/QueryEditor/query-editor-raw/QueryToolbox.d.ts +11 -0
- package/dist/src/components/QueryEditor/query-editor-raw/QueryValidator.d.ts +10 -0
- package/dist/src/components/QueryEditor/query-editor-raw/RawEditor.d.ts +10 -0
- package/dist/src/components/QueryEditor/types.d.ts +149 -0
- package/dist/src/components/QueryEditor/utils/formatSQL.d.ts +1 -0
- package/dist/src/components/QueryEditor/utils/sql.utils.d.ts +13 -0
- package/dist/src/components/QueryEditor/utils/useSqlChange.d.ts +10 -0
- package/dist/src/components/QueryEditor/visual-query-builder/AwesomeQueryBuilder.d.ts +7 -0
- package/dist/src/components/QueryEditor/visual-query-builder/EditorField.d.ts +11 -0
- package/dist/src/components/QueryEditor/visual-query-builder/EditorRow.d.ts +5 -0
- package/dist/src/components/QueryEditor/visual-query-builder/EditorRows.d.ts +5 -0
- package/dist/src/components/QueryEditor/visual-query-builder/GroupByRow.d.ts +10 -0
- package/dist/src/components/QueryEditor/visual-query-builder/OrderByRow.d.ts +11 -0
- package/dist/src/components/QueryEditor/visual-query-builder/Preview.d.ts +6 -0
- package/dist/src/components/QueryEditor/visual-query-builder/SQLGroupByRow.d.ts +12 -0
- package/dist/src/components/QueryEditor/visual-query-builder/SQLOrderByRow.d.ts +12 -0
- package/dist/src/components/QueryEditor/visual-query-builder/SQLSelectRow.d.ts +12 -0
- package/dist/src/components/QueryEditor/visual-query-builder/SQLWhereRow.d.ts +12 -0
- package/dist/src/components/QueryEditor/visual-query-builder/SelectRow.d.ts +11 -0
- package/dist/src/components/QueryEditor/visual-query-builder/Stack.d.ts +9 -0
- package/dist/src/components/QueryEditor/visual-query-builder/VisualEditor.d.ts +14 -0
- package/dist/src/components/QueryEditor/visual-query-builder/WhereRow.d.ts +10 -0
- package/dist/src/components/QueryEditor/visual-query-builder/index.d.ts +1 -0
- package/dist/src/components/QueryEditorRow/QueryEditorRow.d.ts +8 -0
- package/dist/src/components/Segment/Segment.d.ts +8 -0
- package/dist/src/components/index.d.ts +11 -0
- package/dist/src/datasource/SqlDatasource.d.ts +64 -0
- package/dist/src/datasource/constants.d.ts +1 -0
- package/dist/src/hooks/useDebounce.d.ts +2 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/test/mocks/DataQuery.d.ts +2 -0
- package/dist/src/test/mocks/Datasource.d.ts +4 -0
- package/dist/src/test/mocks/Plugin.d.ts +10 -0
- package/dist/src/test/mocks/QueryEditorProps.d.ts +4 -0
- package/dist/src/test/mocks/TestDatasource.d.ts +6 -0
- package/dist/src/test/mocks/index.d.ts +5 -0
- package/dist/src/test/mocks/style.d.ts +1 -0
- package/dist/src/test/mocks/utils.d.ts +18 -0
- package/dist/src/test/setupTests.d.ts +1 -0
- package/dist/src/unreleasedComponents/index.d.ts +1 -0
- package/dist/src/utils/compatFeatures.d.ts +9 -0
- package/dist/src/utils/compatibility.d.ts +12 -0
- package/dist/src/utils/index.d.ts +3 -0
- package/dist/src/utils/testDatasource.d.ts +19 -0
- package/dist/test/mocks/DataQuery.js +14 -0
- package/dist/test/mocks/DataQuery.js.map +1 -0
- package/dist/test/mocks/Datasource.js +73 -0
- package/dist/test/mocks/Datasource.js.map +1 -0
- package/dist/test/mocks/Plugin.js +114 -0
- package/dist/test/mocks/Plugin.js.map +1 -0
- package/dist/test/mocks/QueryEditorProps.js +47 -0
- package/dist/test/mocks/QueryEditorProps.js.map +1 -0
- package/dist/test/mocks/TestDatasource.js +24 -0
- package/dist/test/mocks/TestDatasource.js.map +1 -0
- package/dist/test/mocks/index.js +9 -0
- package/dist/test/mocks/index.js.map +1 -0
- package/dist/test/mocks/style.js +5 -0
- package/dist/test/mocks/style.js.map +1 -0
- package/dist/test/mocks/utils.js +48 -0
- package/dist/test/mocks/utils.js.map +1 -0
- package/dist/test/setupTests.js +17 -0
- package/dist/test/setupTests.js.map +1 -0
- package/dist/unreleasedComponents/index.js +3 -0
- package/dist/unreleasedComponents/index.js.map +1 -0
- package/dist/utils/compatFeatures.js +20 -0
- package/dist/utils/compatFeatures.js.map +1 -0
- package/dist/utils/compatibility.js +28 -0
- package/dist/utils/compatibility.js.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/testDatasource.js +30 -0
- package/dist/utils/testDatasource.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mockDatasourceInstanceSettings = exports.mockDatasource = void 0;
|
|
4
|
+
const chance_1 = require("chance");
|
|
5
|
+
const Plugin_1 = require("./Plugin");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
const mockDatasource = () => ({
|
|
8
|
+
// DataSourceWithBackend
|
|
9
|
+
query: jest.fn(),
|
|
10
|
+
filterQuery: (0, utils_1.undefinedOr)(utils_1.generateBoolean),
|
|
11
|
+
applyTemplateVariables: jest.fn(),
|
|
12
|
+
getResource: jest.fn(),
|
|
13
|
+
postResource: jest.fn(),
|
|
14
|
+
callHealthCheck: jest.fn(),
|
|
15
|
+
testDatasource: jest.fn(),
|
|
16
|
+
// DataSourceApi
|
|
17
|
+
uid: (0, chance_1.Chance)().guid(),
|
|
18
|
+
name: (0, chance_1.Chance)().word(),
|
|
19
|
+
id: 1,
|
|
20
|
+
type: (0, chance_1.Chance)().word(),
|
|
21
|
+
interval: (0, chance_1.Chance)().word(),
|
|
22
|
+
importQueries: jest.fn(),
|
|
23
|
+
init: jest.fn(),
|
|
24
|
+
getQueryHints: jest.fn().mockReturnValue([mockQueryHint()]),
|
|
25
|
+
getQueryDisplayText: jest.fn().mockReturnValue((0, chance_1.Chance)().word()),
|
|
26
|
+
getLogRowContext: jest.fn(),
|
|
27
|
+
metricFindQuery: jest.fn(),
|
|
28
|
+
getTagKeys: jest.fn(),
|
|
29
|
+
getTagValues: jest.fn(),
|
|
30
|
+
components: {},
|
|
31
|
+
meta: (0, Plugin_1.mockDataSourcePluginMeta)(),
|
|
32
|
+
targetContainsTemplate: jest.fn(),
|
|
33
|
+
modifyQuery: jest.fn(),
|
|
34
|
+
getHighlighterExpression: jest.fn(),
|
|
35
|
+
languageProvider: jest.fn(),
|
|
36
|
+
getVersion: jest.fn(),
|
|
37
|
+
showContextToggle: jest.fn(),
|
|
38
|
+
interpolateVariablesInQueries: jest.fn(),
|
|
39
|
+
annotations: {},
|
|
40
|
+
annotationQuery: jest.fn(),
|
|
41
|
+
streamOptionsProvider: jest.fn(),
|
|
42
|
+
getRef: jest.fn(),
|
|
43
|
+
});
|
|
44
|
+
exports.mockDatasource = mockDatasource;
|
|
45
|
+
const mockQueryHint = () => ({
|
|
46
|
+
type: (0, chance_1.Chance)().word(),
|
|
47
|
+
label: (0, chance_1.Chance)().word(),
|
|
48
|
+
fix: {
|
|
49
|
+
label: (0, chance_1.Chance)().word(),
|
|
50
|
+
action: {
|
|
51
|
+
type: (0, chance_1.Chance)().word(),
|
|
52
|
+
query: (0, chance_1.Chance)().word(),
|
|
53
|
+
preventSubmit: (0, utils_1.generateBoolean)(),
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
const mockDatasourceInstanceSettings = () => ({
|
|
58
|
+
id: (0, chance_1.Chance)().integer(),
|
|
59
|
+
uid: (0, chance_1.Chance)().word(),
|
|
60
|
+
type: (0, chance_1.Chance)().word(),
|
|
61
|
+
name: (0, chance_1.Chance)().word(),
|
|
62
|
+
meta: (0, Plugin_1.mockDataSourcePluginMeta)(),
|
|
63
|
+
url: (0, chance_1.Chance)().word(),
|
|
64
|
+
jsonData: {},
|
|
65
|
+
username: (0, chance_1.Chance)().word(),
|
|
66
|
+
password: (0, chance_1.Chance)().word(),
|
|
67
|
+
database: (0, chance_1.Chance)().word(),
|
|
68
|
+
basicAuth: (0, chance_1.Chance)().word(),
|
|
69
|
+
withCredentials: (0, utils_1.generateBoolean)(),
|
|
70
|
+
access: (0, chance_1.Chance)().pickone(["direct", "proxy"]),
|
|
71
|
+
});
|
|
72
|
+
exports.mockDatasourceInstanceSettings = mockDatasourceInstanceSettings;
|
|
73
|
+
//# sourceMappingURL=Datasource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Datasource.js","sourceRoot":"","sources":["../../../src/test/mocks/Datasource.ts"],"names":[],"mappings":";;;AAEA,mCAAgC;AAChC,qCAAoD;AACpD,mCAAuD;AAEhD,MAAM,cAAc,GAAG,GAA0B,EAAE,CAAC,CAAC;IAC1D,wBAAwB;IACxB,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE;IAChB,WAAW,EAAE,IAAA,mBAAW,EAAC,uBAAe,CAAC;IACzC,sBAAsB,EAAE,IAAI,CAAC,EAAE,EAAE;IACjC,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;IACtB,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE;IACvB,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE;IAC1B,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;IACzB,gBAAgB;IAChB,GAAG,EAAE,IAAA,eAAM,GAAE,CAA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
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mockPluginSignatureStatus = exports.mockPluginDependencies = exports.mockPluginState = exports.mockPluginIncludeType = exports.mockPluginType = exports.mockPluginInclude = exports.mockPluginMeta = exports.mockPluginMetaInfo = exports.mockDataSourcePluginMeta = void 0;
|
|
4
|
+
const chance_1 = require("chance");
|
|
5
|
+
const data_1 = require("@grafana/data");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
const mockDataSourcePluginMeta = () => ({
|
|
8
|
+
builtIn: (0, utils_1.generateBoolean)(),
|
|
9
|
+
metrics: (0, utils_1.generateBoolean)(),
|
|
10
|
+
logs: (0, utils_1.generateBoolean)(),
|
|
11
|
+
annotations: (0, utils_1.generateBoolean)(),
|
|
12
|
+
alerting: (0, utils_1.generateBoolean)(),
|
|
13
|
+
tracing: (0, utils_1.generateBoolean)(),
|
|
14
|
+
mixed: (0, utils_1.generateBoolean)(),
|
|
15
|
+
hasQueryHelp: (0, utils_1.generateBoolean)(),
|
|
16
|
+
category: (0, chance_1.Chance)().word(),
|
|
17
|
+
queryOptions: {
|
|
18
|
+
cacheTimeout: (0, utils_1.generateBoolean)(),
|
|
19
|
+
maxDataPoints: (0, utils_1.generateBoolean)(),
|
|
20
|
+
minInterval: (0, utils_1.generateBoolean)(),
|
|
21
|
+
},
|
|
22
|
+
sort: 1,
|
|
23
|
+
streaming: (0, utils_1.generateBoolean)(),
|
|
24
|
+
unlicensed: (0, utils_1.generateBoolean)(),
|
|
25
|
+
id: (0, chance_1.Chance)().word(),
|
|
26
|
+
name: (0, chance_1.Chance)().word(),
|
|
27
|
+
type: (0, exports.mockPluginType)(),
|
|
28
|
+
info: (0, exports.mockPluginMetaInfo)(),
|
|
29
|
+
module: (0, chance_1.Chance)().word(),
|
|
30
|
+
baseUrl: (0, chance_1.Chance)().word(),
|
|
31
|
+
});
|
|
32
|
+
exports.mockDataSourcePluginMeta = mockDataSourcePluginMeta;
|
|
33
|
+
const mockPluginMetaInfo = () => ({
|
|
34
|
+
author: {
|
|
35
|
+
name: (0, chance_1.Chance)().word(),
|
|
36
|
+
url: (0, chance_1.Chance)().word(),
|
|
37
|
+
},
|
|
38
|
+
description: (0, chance_1.Chance)().word(),
|
|
39
|
+
links: [],
|
|
40
|
+
logos: {
|
|
41
|
+
large: (0, chance_1.Chance)().word(),
|
|
42
|
+
small: (0, chance_1.Chance)().word(),
|
|
43
|
+
},
|
|
44
|
+
screenshots: [],
|
|
45
|
+
updated: (0, chance_1.Chance)().word(),
|
|
46
|
+
version: (0, chance_1.Chance)().word(),
|
|
47
|
+
});
|
|
48
|
+
exports.mockPluginMetaInfo = mockPluginMetaInfo;
|
|
49
|
+
const mockPluginMeta = () => ({
|
|
50
|
+
id: (0, chance_1.Chance)().word(),
|
|
51
|
+
name: (0, chance_1.Chance)().word(),
|
|
52
|
+
type: (0, exports.mockPluginType)(),
|
|
53
|
+
info: (0, exports.mockPluginMetaInfo)(),
|
|
54
|
+
includes: [(0, exports.mockPluginInclude)()],
|
|
55
|
+
state: (0, exports.mockPluginState)(),
|
|
56
|
+
module: (0, chance_1.Chance)().word(),
|
|
57
|
+
baseUrl: (0, chance_1.Chance)().word(),
|
|
58
|
+
dependencies: (0, exports.mockPluginDependencies)(),
|
|
59
|
+
jsonData: {},
|
|
60
|
+
secureJsonData: {},
|
|
61
|
+
enabled: (0, utils_1.generateBoolean)(),
|
|
62
|
+
defaultNavUrl: (0, chance_1.Chance)().word(),
|
|
63
|
+
hasUpdate: (0, utils_1.generateBoolean)(),
|
|
64
|
+
enterprise: (0, utils_1.generateBoolean)(),
|
|
65
|
+
latestVersion: (0, chance_1.Chance)().word(),
|
|
66
|
+
pinned: (0, utils_1.generateBoolean)(),
|
|
67
|
+
signature: (0, exports.mockPluginSignatureStatus)(),
|
|
68
|
+
live: (0, utils_1.generateBoolean)(),
|
|
69
|
+
});
|
|
70
|
+
exports.mockPluginMeta = mockPluginMeta;
|
|
71
|
+
const mockPluginInclude = () => ({
|
|
72
|
+
type: (0, exports.mockPluginIncludeType)(),
|
|
73
|
+
name: (0, chance_1.Chance)().word(),
|
|
74
|
+
path: (0, chance_1.Chance)().word(),
|
|
75
|
+
icon: (0, chance_1.Chance)().word(),
|
|
76
|
+
role: (0, chance_1.Chance)().word(),
|
|
77
|
+
addToNav: (0, utils_1.generateBoolean)(),
|
|
78
|
+
component: (0, chance_1.Chance)().word(),
|
|
79
|
+
});
|
|
80
|
+
exports.mockPluginInclude = mockPluginInclude;
|
|
81
|
+
const mockPluginType = () => (0, chance_1.Chance)().pickone([
|
|
82
|
+
data_1.PluginType.panel,
|
|
83
|
+
data_1.PluginType.datasource,
|
|
84
|
+
data_1.PluginType.app,
|
|
85
|
+
data_1.PluginType.renderer,
|
|
86
|
+
]);
|
|
87
|
+
exports.mockPluginType = mockPluginType;
|
|
88
|
+
const mockPluginIncludeType = () => (0, chance_1.Chance)().pickone([
|
|
89
|
+
data_1.PluginIncludeType.dashboard,
|
|
90
|
+
data_1.PluginIncludeType.page,
|
|
91
|
+
data_1.PluginIncludeType.panel,
|
|
92
|
+
data_1.PluginIncludeType.datasource,
|
|
93
|
+
]);
|
|
94
|
+
exports.mockPluginIncludeType = mockPluginIncludeType;
|
|
95
|
+
const mockPluginState = () => (0, chance_1.Chance)().pickone([
|
|
96
|
+
data_1.PluginState.alpha,
|
|
97
|
+
data_1.PluginState.beta,
|
|
98
|
+
data_1.PluginState.deprecated,
|
|
99
|
+
]);
|
|
100
|
+
exports.mockPluginState = mockPluginState;
|
|
101
|
+
const mockPluginDependencies = () => ({
|
|
102
|
+
grafanaVersion: (0, chance_1.Chance)().word(),
|
|
103
|
+
plugins: [],
|
|
104
|
+
});
|
|
105
|
+
exports.mockPluginDependencies = mockPluginDependencies;
|
|
106
|
+
const mockPluginSignatureStatus = () => (0, chance_1.Chance)().pickone([
|
|
107
|
+
data_1.PluginSignatureStatus.internal,
|
|
108
|
+
data_1.PluginSignatureStatus.valid,
|
|
109
|
+
data_1.PluginSignatureStatus.invalid,
|
|
110
|
+
data_1.PluginSignatureStatus.modified,
|
|
111
|
+
data_1.PluginSignatureStatus.missing,
|
|
112
|
+
]);
|
|
113
|
+
exports.mockPluginSignatureStatus = mockPluginSignatureStatus;
|
|
114
|
+
//# sourceMappingURL=Plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../../src/test/mocks/Plugin.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,wCAUuB;AACvB,mCAA0C;AAEnC,MAAM,wBAAwB,GAAG,GAAyB,EAAE,CAAC,CAAC;IACnE,OAAO,EAAE,IAAA,uBAAe,GAAE;IAC1B,OAAO,EAAE,IAAA,uBAAe,GAAE;IAC1B,IAAI,EAAE,IAAA,uBAAe,GAAE;IACvB,WAAW,EAAE,IAAA,uBAAe,GAAE;IAC9B,QAAQ,EAAE,IAAA,uBAAe,GAAE;IAC3B,OAAO,EAAE,IAAA,uBAAe,GAAE;IAC1B,KAAK,EAAE,IAAA,uBAAe,GAAE;IACxB,YAAY,EAAE,IAAA,uBAAe,GAAE;IAC/B,QAAQ,EAAE,IAAA,eAAM,GAAE,CAAC,IAAI,EAAE;IACzB,YAAY,EAAE;QACZ,YAAY,EAAE,IAAA,uBAAe,GAAE;QAC/B,aAAa,EAAE,IAAA,uBAAe,GAAE;QAChC,WAAW,EAAE,IAAA,uBAAe,GAAE;KAC/B;IACD,IAAI,EAAE,CAAC;IACP,SAAS,EAAE,IAAA,uBAAe,GAAE;IAC5B,UAAU,EAAE,IAAA,uBAAe,GAAE;IAC7B,EAAE,EAAE,IAAA,eAAM,GAAE,CAAC,IAAI,EAAE;IACnB,IAAI,EAAE,IAAA,eAAM,GAAE,CAAC,IAAI,EAAE;IACrB,IAAI,EAAE,IAAA,sBAAc,GAAE;IACtB,IAAI,EAAE,IAAA,0BAAkB,GAAE;IAC1B,MAAM,EAAE,IAAA,eAAM,GAAE,C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CAAC,CAAC;AANQ,QAAA,qBAAqB,yBAM7B;AAEE,MAAM,eAAe,GAAG,GAAgB,EAAE,CAC/C,IAAA,eAAM,GAAE,CAAC,OAAO,CAAC;IACf,kBAAW,CAAC,KAAK;IACjB,kBAAW,CAAC,IAAI;IAChB,kBAAW,CAAC,UAAU;CACvB,CAAC,CAAC;AALQ,QAAA,eAAe,mBAKvB;AAEE,MAAM,sBAAsB,GAAG,GAAuB,EAAE,CAAC,CAAC;IAC/D,cAAc,EAAE,IAAA,eAAM,GAAE,CAAC,IAAI,EAAE;IAC/B,OAAO,EAAE,EAAE;CACZ,CAAC,CAAC;AAHU,QAAA,sBAAsB,0BAGhC;AAEI,MAAM,yBAAyB,GAAG,GAA0B,EAAE,CACnE,IAAA,eAAM,GAAE,CAAC,OAAO,CAAC;IACf,4BAAqB,CAAC,QAAQ;IAC9B,4BAAqB,CAAC,KAAK;IAC3B,4BAAqB,CAAC,OAAO;IAC7B,4BAAqB,CAAC,QAAQ;IAC9B,4BAAqB,CAAC,OAAO;CAC9B,CAAC,CAAC;AAPQ,QAAA,yBAAyB,6BAOjC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mockTimeRange = exports.mockLoadingState = exports.mockQueryEditorProps = void 0;
|
|
4
|
+
const data_1 = require("@grafana/data");
|
|
5
|
+
const chance_1 = require("chance");
|
|
6
|
+
const mockQueryEditorProps = () => ({
|
|
7
|
+
datasource: {},
|
|
8
|
+
query: {
|
|
9
|
+
refId: (0, chance_1.Chance)().word(),
|
|
10
|
+
hide: false,
|
|
11
|
+
key: (0, chance_1.Chance)().word(),
|
|
12
|
+
queryType: (0, chance_1.Chance)().word(),
|
|
13
|
+
dataTopic: data_1.DataTopic.Annotations,
|
|
14
|
+
datasource: (0, chance_1.Chance)().pickone([(0, chance_1.Chance)().word(), null]),
|
|
15
|
+
},
|
|
16
|
+
onRunQuery: jest.fn(),
|
|
17
|
+
onChange: jest.fn(),
|
|
18
|
+
onBlur: jest.fn(),
|
|
19
|
+
data: {
|
|
20
|
+
state: (0, exports.mockLoadingState)(),
|
|
21
|
+
series: [],
|
|
22
|
+
annotations: [],
|
|
23
|
+
timeRange: (0, exports.mockTimeRange)(),
|
|
24
|
+
},
|
|
25
|
+
range: (0, exports.mockTimeRange)(),
|
|
26
|
+
exploreId: (0, chance_1.Chance)().guid(),
|
|
27
|
+
history: [],
|
|
28
|
+
});
|
|
29
|
+
exports.mockQueryEditorProps = mockQueryEditorProps;
|
|
30
|
+
const mockLoadingState = () => (0, chance_1.Chance)().pickone([
|
|
31
|
+
data_1.LoadingState.NotStarted,
|
|
32
|
+
data_1.LoadingState.Loading,
|
|
33
|
+
data_1.LoadingState.Streaming,
|
|
34
|
+
data_1.LoadingState.Done,
|
|
35
|
+
data_1.LoadingState.Error,
|
|
36
|
+
]);
|
|
37
|
+
exports.mockLoadingState = mockLoadingState;
|
|
38
|
+
const mockTimeRange = () => ({
|
|
39
|
+
from: (0, data_1.dateTime)(),
|
|
40
|
+
to: (0, data_1.dateTime)(),
|
|
41
|
+
raw: {
|
|
42
|
+
from: (0, data_1.dateTime)(),
|
|
43
|
+
to: (0, data_1.dateTime)(),
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
exports.mockTimeRange = mockTimeRange;
|
|
47
|
+
//# sourceMappingURL=QueryEditorProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryEditorProps.js","sourceRoot":"","sources":["../../../src/test/mocks/QueryEditorProps.ts"],"names":[],"mappings":";;;AAAA,wCAMuB;AACvB,mCAAgC;AAEzB,MAAM,oBAAoB,GAAG,GAAoC,EAAE,CAAC,CAAC;IAC1E,UAAU,EAAE,EAAE;IACd,KAAK,EAAE;QACL,KAAK,EAAE,IAAA,eAAM,GAAE,CAAC,IAAI,EAAE;QACtB,IAAI,EAAE,KAAK;QACX,GAAG,EAAE,IAA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
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mockHealthCheckResultError = exports.mockHealthCheckDetails = exports.mockHealthCheckResult = exports.mockTestDatasourceReturn = void 0;
|
|
4
|
+
const runtime_1 = require("@grafana/runtime");
|
|
5
|
+
const chance_1 = require("chance");
|
|
6
|
+
const testDatasource_1 = require("../../utils/testDatasource");
|
|
7
|
+
const mockTestDatasourceReturn = () => {
|
|
8
|
+
return (0, chance_1.Chance)().pickone([(0, exports.mockHealthCheckResult)(), (0, exports.mockHealthCheckResultError)()]);
|
|
9
|
+
};
|
|
10
|
+
exports.mockTestDatasourceReturn = mockTestDatasourceReturn;
|
|
11
|
+
const mockHealthCheckResult = () => ({
|
|
12
|
+
status: (0, chance_1.Chance)().pickone(Object.values(runtime_1.HealthStatus)),
|
|
13
|
+
message: (0, chance_1.Chance)().sentence(),
|
|
14
|
+
details: (0, exports.mockHealthCheckDetails)()
|
|
15
|
+
});
|
|
16
|
+
exports.mockHealthCheckResult = mockHealthCheckResult;
|
|
17
|
+
const mockHealthCheckDetails = () => ({
|
|
18
|
+
message: (0, chance_1.Chance)().sentence(),
|
|
19
|
+
verboseMessage: (0, chance_1.Chance)().sentence()
|
|
20
|
+
});
|
|
21
|
+
exports.mockHealthCheckDetails = mockHealthCheckDetails;
|
|
22
|
+
const mockHealthCheckResultError = (details) => new testDatasource_1.HealthCheckError((0, chance_1.Chance)().sentence(), details || (0, exports.mockHealthCheckDetails)());
|
|
23
|
+
exports.mockHealthCheckResultError = mockHealthCheckResultError;
|
|
24
|
+
//# sourceMappingURL=TestDatasource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestDatasource.js","sourceRoot":"","sources":["../../../src/test/mocks/TestDatasource.ts"],"names":[],"mappings":";;;AAAA,8CAAkE;AAClE,mCAA+B;AAC/B,+DAA6G;AAEtG,MAAM,wBAAwB,GAAG,GAAyB,EAAE;IACjE,OAAO,IAAA,eAAM,GAAE,CAAC,OAAO,CAAC,CAAC,IAAA,6BAAqB,GAAE,EAAE,IAAA,kCAA0B,GAAE,CAAC,CAAC,CAAA;AAClF,CAAC,CAAA;AAFY,QAAA,wBAAwB,4BAEpC;AAEM,MAAM,qBAAqB,GAAG,GAAsB,EAAE,CAAC,CAAC;IAC7D,MAAM,EAAE,IAAA,eAAM,GAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAY,CAAC,CAAC;IACrD,OAAO,EAAE,IAAA,eAAM,GAAE,CAAC,QAAQ,EAAE;IAC5B,OAAO,EAAE,IAAA,8BAAsB,GAAE;CAClC,CAAC,CAAA;AAJW,QAAA,qBAAqB,yBAIhC;AAEK,MAAM,sBAAsB,GAAG,GAA6B,EAAE,CAAC,CAAC;IACrE,OAAO,EAAE,IAAA,eAAM,GAAE,CAAC,QAAQ,EAAE;IAC5B,cAAc,EAAE,IAAA,eAAM,GAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAA;AAHW,QAAA,sBAAsB,0BAGjC;AAEK,MAAM,0BAA0B,GAAG,CAAC,OAAkC,EAAoB,EAAE,CACjG,IAAI,iCAAgB,CAAC,IAAA,eAAM,GAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,IAAI,IAAA,8BAAsB,GAAE,CAAC,CAAA;AADnE,QAAA,0BAA0B,8BACyC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./Datasource"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./DataQuery"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./Plugin"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./QueryEditorProps"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./utils"), exports);
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/test/mocks/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,sDAA4B;AAC5B,mDAAyB;AACzB,6DAAmC;AACnC,kDAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/test/mocks/style.ts"],"names":[],"mappings":";;;AAAa,QAAA,KAAK,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectOption = exports.openSelect = exports.generateArrayOf = exports.undefinedOr = exports.generateBoolean = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chance_1 = require("chance");
|
|
6
|
+
const react_1 = require("@testing-library/react");
|
|
7
|
+
const user_event_1 = tslib_1.__importDefault(require("@testing-library/user-event"));
|
|
8
|
+
const generateBoolean = () => (0, chance_1.Chance)().pickone([true, false]);
|
|
9
|
+
exports.generateBoolean = generateBoolean;
|
|
10
|
+
const undefinedOr = (fn) => (0, chance_1.Chance)().pickone([undefined, fn()]);
|
|
11
|
+
exports.undefinedOr = undefinedOr;
|
|
12
|
+
const generateArrayOf = (fn, numberOf = 3) => Array.from(new Array(numberOf), () => fn());
|
|
13
|
+
exports.generateArrayOf = generateArrayOf;
|
|
14
|
+
// react-select (used by @grafana/ui) renders very differently from the native Select HTML element
|
|
15
|
+
// and because they are not accessible and do not pass data-testid or aria-labels down,
|
|
16
|
+
// it is difficult to grab the correct element and simulate selecting different options
|
|
17
|
+
// the helper functions below can be used instead
|
|
18
|
+
/**
|
|
19
|
+
* Opens a Select or MultiSelect dropdown
|
|
20
|
+
*
|
|
21
|
+
* @param {HTMLElement} container The container wrapping the Select or MultiSelect component
|
|
22
|
+
* @param {string} optionLabel The option text we want to type or search
|
|
23
|
+
*/
|
|
24
|
+
const openSelect = (container, optionLabel) => {
|
|
25
|
+
const selectInput = (0, react_1.within)(container).getByRole('textbox');
|
|
26
|
+
// this needs to be here to support autoFocus=true prop
|
|
27
|
+
react_1.fireEvent.blur(selectInput);
|
|
28
|
+
// if we have an async Select, we want to type the option label to make the option available
|
|
29
|
+
// otherwise, just press down to open the dropdown
|
|
30
|
+
user_event_1.default.type(selectInput, optionLabel !== null && optionLabel !== void 0 ? optionLabel : '{arrowdown}');
|
|
31
|
+
};
|
|
32
|
+
exports.openSelect = openSelect;
|
|
33
|
+
/**
|
|
34
|
+
* Selects an option from the Select or MultiSelect component
|
|
35
|
+
*
|
|
36
|
+
* @param {HTMLElement} container The container wrapping the Select or MultiSelect component
|
|
37
|
+
* @param {string} optionLabel The option we want to select
|
|
38
|
+
* @param {boolean} [typeOptionLabel=false] If we should type the optional label after opening - this is useful for AsyncSelect
|
|
39
|
+
*/
|
|
40
|
+
const selectOption = (container, optionLabel, typeOptionLabel) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
(0, exports.openSelect)(container, typeOptionLabel ? optionLabel : undefined);
|
|
42
|
+
// wait for the list to show
|
|
43
|
+
const option = yield (0, react_1.waitFor)(() => (0, react_1.within)(container).getByText(optionLabel));
|
|
44
|
+
// select the option
|
|
45
|
+
user_event_1.default.click(option);
|
|
46
|
+
});
|
|
47
|
+
exports.selectOption = selectOption;
|
|
48
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/test/mocks/utils.ts"],"names":[],"mappings":";;;;AAAA,mCAAgC;AAChC,kDAAoE;AACpE,qFAAoD;AAE7C,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,IAAA,eAAM,GAAE,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AAAxD,QAAA,eAAe,mBAAyC;AAE9D,MAAM,WAAW,GAAG,CAAC,EA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,CAAC;AAZW,QAAA,YAAY,gBAYvB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("@testing-library/jest-dom");
|
|
4
|
+
Object.defineProperty(global, 'matchMedia', {
|
|
5
|
+
writable: true,
|
|
6
|
+
value: jest.fn().mockImplementation((query) => ({
|
|
7
|
+
matches: false,
|
|
8
|
+
media: query,
|
|
9
|
+
onchange: null,
|
|
10
|
+
addListener: jest.fn(),
|
|
11
|
+
removeListener: jest.fn(),
|
|
12
|
+
addEventListener: jest.fn(),
|
|
13
|
+
removeEventListener: jest.fn(),
|
|
14
|
+
dispatchEvent: jest.fn(),
|
|
15
|
+
})),
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=setupTests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupTests.js","sourceRoot":"","sources":["../../src/test/setupTests.ts"],"names":[],"mappings":";;AAAA,qCAAmC;AAEnC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE;IACxC,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC3B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC9B,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;KACzB,CAAC,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/unreleasedComponents/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.healthDiagnosticsErrorsCompat = void 0;
|
|
4
|
+
const compatibility_1 = require("./compatibility");
|
|
5
|
+
const testDatasource_1 = require("./testDatasource");
|
|
6
|
+
/**
|
|
7
|
+
* Calls the override testDatasource function for backwards compatibility if needed.
|
|
8
|
+
*
|
|
9
|
+
* @param baseTestDatasource The original testDatasource function
|
|
10
|
+
* @param toggle Accepts a feature toggle. Defaults to false so it is clear when we want this feature turned on.
|
|
11
|
+
* @returns The result in the expected format for the Grafana version
|
|
12
|
+
*/
|
|
13
|
+
const healthDiagnosticsErrorsCompat = (baseTestDatasource, toggle) => {
|
|
14
|
+
if (toggle && (0, compatibility_1.hasCompatibility)(compatibility_1.CompatibilityFeature.HEALTH_DIAGNOSTICS_ERRORS)) {
|
|
15
|
+
return baseTestDatasource();
|
|
16
|
+
}
|
|
17
|
+
return (0, testDatasource_1.testDatasource)(baseTestDatasource);
|
|
18
|
+
};
|
|
19
|
+
exports.healthDiagnosticsErrorsCompat = healthDiagnosticsErrorsCompat;
|
|
20
|
+
//# sourceMappingURL=compatFeatures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compatFeatures.js","sourceRoot":"","sources":["../../src/utils/compatFeatures.ts"],"names":[],"mappings":";;;AAAA,mDAAyE;AACzE,qDAA4F;AAE5F;;;;;;GAMG;AACI,MAAM,6BAA6B,GAAG,CAAC,kBAAsC,EAAE,MAAgB,EAAiC,EAAE;IACvI,IAAI,MAAM,IAAI,IAAA,gCAAgB,EAAC,oCAAoB,CAAC,yBAAyB,CAAC,EAAE;QAC9E,OAAO,kBAAkB,EAAE,CAAA;KAC5B;IAED,OAAO,IAAA,+BAAc,EAAC,kBAAkB,CAAC,CAAC;AAC5C,CAAC,CAAC;AANW,QAAA,6BAA6B,iCAMxC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasCompatibility = exports.CompatibilityFeature = void 0;
|
|
4
|
+
const runtime_1 = require("@grafana/runtime");
|
|
5
|
+
const semver_1 = require("semver");
|
|
6
|
+
var CompatibilityFeature;
|
|
7
|
+
(function (CompatibilityFeature) {
|
|
8
|
+
CompatibilityFeature[CompatibilityFeature["HEALTH_DIAGNOSTICS_ERRORS"] = 0] = "HEALTH_DIAGNOSTICS_ERRORS";
|
|
9
|
+
})(CompatibilityFeature = exports.CompatibilityFeature || (exports.CompatibilityFeature = {}));
|
|
10
|
+
/**
|
|
11
|
+
* Checks if the currently running version of Grafana supports the feature.
|
|
12
|
+
*
|
|
13
|
+
* Enables graceful degradation for earlier versions that don't support a given capability.
|
|
14
|
+
*
|
|
15
|
+
* @param feature The feature that requires backwards compatibility
|
|
16
|
+
* @returns True if the Grafana version running can support the feature, otherwise false
|
|
17
|
+
*/
|
|
18
|
+
const hasCompatibility = (feature) => {
|
|
19
|
+
const version = runtime_1.config.buildInfo.version;
|
|
20
|
+
switch (feature) {
|
|
21
|
+
case CompatibilityFeature.HEALTH_DIAGNOSTICS_ERRORS:
|
|
22
|
+
return (0, semver_1.gte)(version, "8.0.0");
|
|
23
|
+
default:
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.hasCompatibility = hasCompatibility;
|
|
28
|
+
//# sourceMappingURL=compatibility.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compatFeatures = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
tslib_1.__exportStar(require("./compatibility"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./compatFeatures"), exports);
|
|
7
|
+
exports.compatFeatures = tslib_1.__importStar(require("./compatFeatures"));
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;AAAA,0DAA+B;AAC/B,2DAAgC;AAChC,2EAAkD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testDatasource = exports.HealthCheckError = void 0;
|
|
4
|
+
class HealthCheckError extends Error {
|
|
5
|
+
constructor(message, details) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.details = details;
|
|
8
|
+
this.name = 'HealthCheckError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.HealthCheckError = HealthCheckError;
|
|
12
|
+
/**
|
|
13
|
+
* Override function for testDatasource in Grafana for the health check
|
|
14
|
+
*
|
|
15
|
+
* There is a new error format that is introduced in Grafana 8 which is not backwards compatible by default
|
|
16
|
+
*
|
|
17
|
+
* This transforms the health check result into the old format if Grafana <8 is being used
|
|
18
|
+
*
|
|
19
|
+
* @param baseTestDatasource The original testDatasource function
|
|
20
|
+
* @returns Either the health check result if the health check was successful or an error that is handled later by Grafana
|
|
21
|
+
*/
|
|
22
|
+
const testDatasource = (baseTestDatasource) => baseTestDatasource()
|
|
23
|
+
// the backwards compatibility only affects the health check error messages
|
|
24
|
+
// so only transform the error we give to Grafana
|
|
25
|
+
.catch(ex => {
|
|
26
|
+
var _a, _b, _c, _d;
|
|
27
|
+
throw new Error((_d = (_b = (_a = ex.details) === null || _a === void 0 ? void 0 : _a.verboseMessage) !== null && _b !== void 0 ? _b : (_c = ex.details) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : ex.message);
|
|
28
|
+
});
|
|
29
|
+
exports.testDatasource = testDatasource;
|
|
30
|
+
//# sourceMappingURL=testDatasource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testDatasource.js","sourceRoot":"","sources":["../../src/utils/testDatasource.ts"],"names":[],"mappings":";;;AAIA,MAAa,gBAAiB,SAAQ,KAAK;IAGzC,YAAY,OAAe,EAAE,OAAiC;QAC5D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AARD,4CAQC;AAKD;;;;;;;;;GASG;AACI,MAAM,cAAc,GAAG,CAAC,kBAAsC,EAAiC,EAAE,CACtG,kBAAkB,EAAE;IACpB,2EAA2E;IAC3E,iDAAiD;KAChD,KAAK,CAAC,EAAE,CAAC,EAAE;;IACV,MAAM,IAAI,KAAK,CAAC,MAAA,MAAA,MAAA,EAAE,CAAC,OAAO,0CAAE,cAAc,mCAAI,MAAA,EAAE,CAAC,OAAO,0CAAE,OAAO,mCAAI,EAAE,CAAC,OAAO,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA;AANS,QAAA,cAAc,kBAMvB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@grafana/plugin-ui",
|
|
3
|
+
"version": "0.1.10",
|
|
4
|
+
"repository": "git@github.com:grafana/plugin-ui.git",
|
|
5
|
+
"author": "Grafana Labs",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc -p tsconfig.build.json && yarn copy-files",
|
|
9
|
+
"copy-files": "copyfiles -u 1 src/**/*.css dist/",
|
|
10
|
+
"test": "jest",
|
|
11
|
+
"storybook": "start-storybook -p 6006",
|
|
12
|
+
"storybook:build": "build-storybook"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@grafana/data": "^8.4.7",
|
|
16
|
+
"@grafana/experimental": "^0.0.2-canary.39",
|
|
17
|
+
"@grafana/runtime": "^8.4.7",
|
|
18
|
+
"@grafana/toolkit": "^8.4.7",
|
|
19
|
+
"@grafana/tsconfig": "1.2.0-rc1",
|
|
20
|
+
"@grafana/ui": "^8.4.7",
|
|
21
|
+
"@types/chance": "^1.1.0",
|
|
22
|
+
"@types/memoize-one": "^5.1.2",
|
|
23
|
+
"@types/react-calendar": "^3.1.2",
|
|
24
|
+
"chance": "^1.1.7",
|
|
25
|
+
"copyfiles": "^2.4.1",
|
|
26
|
+
"memoize-one": "^5.1.1",
|
|
27
|
+
"rc-cascader": "1.0.1",
|
|
28
|
+
"react-awesome-query-builder": "^5.3.1",
|
|
29
|
+
"react-use": "17.3.1",
|
|
30
|
+
"react-virtualized-auto-sizer": "^1.0.6",
|
|
31
|
+
"semver": "^7.3.5",
|
|
32
|
+
"sql-formatter-plus": "^1.3.6",
|
|
33
|
+
"typescript": "^4.7.4"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@babel/core": "^7.12.9",
|
|
37
|
+
"@babel/plugin-transform-classes": "7.10.4",
|
|
38
|
+
"@babel/plugin-transform-runtime": "^7.12.10",
|
|
39
|
+
"@babel/preset-env": "^7.12.7",
|
|
40
|
+
"@babel/preset-react": "^7.12.7",
|
|
41
|
+
"@babel/preset-typescript": "^7.12.7",
|
|
42
|
+
"@storybook/addon-actions": "^6.1.7",
|
|
43
|
+
"@storybook/addon-essentials": "^6.1.7",
|
|
44
|
+
"@storybook/addon-links": "^6.1.7",
|
|
45
|
+
"@storybook/addons": "^6.1.7",
|
|
46
|
+
"@storybook/react": "^6.1.7",
|
|
47
|
+
"@storybook/theming": "^6.1.7",
|
|
48
|
+
"@testing-library/jest-dom": "^5.11.6",
|
|
49
|
+
"@testing-library/react": "^11.2.2",
|
|
50
|
+
"@testing-library/user-event": "^12.8.3",
|
|
51
|
+
"@types/react": "17.0.22",
|
|
52
|
+
"@types/testing-library__jest-dom": "^5.9.5",
|
|
53
|
+
"babel-loader": "^8.2.2",
|
|
54
|
+
"jest-fetch-mock": "^3.0.3",
|
|
55
|
+
"mockdate": "^3.0.2",
|
|
56
|
+
"ts-jest": "^26.4.4"
|
|
57
|
+
},
|
|
58
|
+
"files": [
|
|
59
|
+
"dist/**/*",
|
|
60
|
+
"package.json"
|
|
61
|
+
]
|
|
62
|
+
}
|