@perses-dev/clickhouse-plugin 0.6.0-rc.1 → 0.7.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/__mf/js/ClickHouse.76a0fbf4.js +7 -0
  2. package/__mf/js/async/1.1e91dea7.js +102 -0
  3. package/__mf/js/async/121.1f2608b3.js +2 -0
  4. package/__mf/js/async/181.e0b3926b.js +2 -0
  5. package/__mf/js/async/192.406c1c63.js +1 -0
  6. package/__mf/js/async/2.05cb4775.js +1 -0
  7. package/__mf/js/async/235.83f7cd2f.js +1 -0
  8. package/__mf/js/async/274.b8ce8e1b.js +2 -0
  9. package/__mf/js/async/356.f08f6910.js +1 -0
  10. package/__mf/js/async/392.d89cad59.js +2 -0
  11. package/__mf/js/async/440.62bb6f89.js +2 -0
  12. package/__mf/js/async/45.37b51769.js +1 -0
  13. package/__mf/js/async/470.3fc1ceb1.js +2 -0
  14. package/__mf/js/async/482.e59722dd.js +7 -0
  15. package/__mf/js/async/482.e59722dd.js.LICENSE.txt +102 -0
  16. package/__mf/js/async/522.69c8ed0a.js +22 -0
  17. package/__mf/js/async/560.0b052d6c.js +37 -0
  18. package/__mf/js/async/562.bc9f9e5a.js +2 -0
  19. package/__mf/js/async/587.8361f462.js +1 -0
  20. package/__mf/js/async/616.2f7b03f4.js +1 -0
  21. package/__mf/js/async/663.40f2ec68.js +1 -0
  22. package/__mf/js/async/700.5b2b12f4.js +3 -0
  23. package/__mf/js/async/862.e7bf5c84.js +2 -0
  24. package/__mf/js/async/865.39675206.js +1 -0
  25. package/__mf/js/async/901.d4978bec.js +1 -0
  26. package/__mf/js/async/941.4bc59208.js +2 -0
  27. package/__mf/js/async/943.62d64363.js +2 -0
  28. package/__mf/js/async/944.f146f769.js +10 -0
  29. package/__mf/js/async/968.4ac56699.js +1 -0
  30. package/__mf/js/async/__federation_expose_ClickHouseDatasource.442c0903.js +2 -0
  31. package/__mf/js/async/__federation_expose_ClickHouseLogQuery.13604af9.js +20 -0
  32. package/__mf/js/async/__federation_expose_ClickHouseTimeSeriesQuery.c9cd60a0.js +20 -0
  33. package/__mf/js/main.1efc6679.js +7 -0
  34. package/lib/bootstrap.js +2 -2
  35. package/lib/components/ClickQLEditor.d.ts +2 -2
  36. package/lib/components/ClickQLEditor.d.ts.map +1 -1
  37. package/lib/components/ClickQLEditor.js +3 -3
  38. package/lib/components/ClickQLEditor.js.map +1 -1
  39. package/lib/components/index.js +1 -1
  40. package/lib/components/index.js.map +1 -1
  41. package/lib/datasources/click-house-datasource/ClickHouseDatasource.d.ts +2 -2
  42. package/lib/datasources/click-house-datasource/ClickHouseDatasource.d.ts.map +1 -1
  43. package/lib/datasources/click-house-datasource/ClickHouseDatasource.js +2 -2
  44. package/lib/datasources/click-house-datasource/ClickHouseDatasource.js.map +1 -1
  45. package/lib/datasources/click-house-datasource/ClickHouseDatasourceEditor.d.ts +2 -2
  46. package/lib/datasources/click-house-datasource/ClickHouseDatasourceEditor.d.ts.map +1 -1
  47. package/lib/datasources/click-house-datasource/ClickHouseDatasourceEditor.js +1 -1
  48. package/lib/datasources/click-house-datasource/ClickHouseDatasourceEditor.js.map +1 -1
  49. package/lib/datasources/click-house-datasource/click-house-datasource-types.d.ts +3 -3
  50. package/lib/datasources/click-house-datasource/click-house-datasource-types.d.ts.map +1 -1
  51. package/lib/datasources/click-house-datasource/click-house-datasource-types.js.map +1 -1
  52. package/lib/datasources/click-house-datasource/index.js +3 -3
  53. package/lib/datasources/click-house-datasource/index.js.map +1 -1
  54. package/lib/datasources/index.js +1 -1
  55. package/lib/datasources/index.js.map +1 -1
  56. package/lib/getPluginModule.d.ts +1 -1
  57. package/lib/getPluginModule.d.ts.map +1 -1
  58. package/lib/getPluginModule.js +3 -1
  59. package/lib/getPluginModule.js.map +1 -1
  60. package/lib/index-federation.js +1 -1
  61. package/lib/index.js +3 -3
  62. package/lib/index.js.map +1 -1
  63. package/lib/model/click-house-client.d.ts +5 -1
  64. package/lib/model/click-house-client.d.ts.map +1 -1
  65. package/lib/model/click-house-client.js +10 -2
  66. package/lib/model/click-house-client.js.map +1 -1
  67. package/lib/model/click-house-data-types.d.ts +2 -2
  68. package/lib/model/click-house-data-types.d.ts.map +1 -1
  69. package/lib/model/click-house-data-types.js.map +1 -1
  70. package/lib/queries/click-house-log-query/ClickHouseLogQuery.d.ts +2 -2
  71. package/lib/queries/click-house-log-query/ClickHouseLogQuery.d.ts.map +1 -1
  72. package/lib/queries/click-house-log-query/ClickHouseLogQuery.js +4 -6
  73. package/lib/queries/click-house-log-query/ClickHouseLogQuery.js.map +1 -1
  74. package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.d.ts +3 -3
  75. package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.d.ts.map +1 -1
  76. package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.js +9 -9
  77. package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.js.map +1 -1
  78. package/lib/queries/click-house-log-query/click-house-log-query-types.d.ts +1 -1
  79. package/lib/queries/click-house-log-query/click-house-log-query-types.d.ts.map +1 -1
  80. package/lib/queries/click-house-log-query/click-house-log-query-types.js.map +1 -1
  81. package/lib/queries/click-house-log-query/get-click-house-log-data.d.ts +2 -2
  82. package/lib/queries/click-house-log-query/get-click-house-log-data.d.ts.map +1 -1
  83. package/lib/queries/click-house-log-query/get-click-house-log-data.js +11 -7
  84. package/lib/queries/click-house-log-query/get-click-house-log-data.js.map +1 -1
  85. package/lib/queries/click-house-log-query/index.js +4 -4
  86. package/lib/queries/click-house-log-query/index.js.map +1 -1
  87. package/lib/queries/click-house-time-series-query/ClickHouseQuery.d.ts +2 -2
  88. package/lib/queries/click-house-time-series-query/ClickHouseQuery.d.ts.map +1 -1
  89. package/lib/queries/click-house-time-series-query/ClickHouseQuery.js +4 -6
  90. package/lib/queries/click-house-time-series-query/ClickHouseQuery.js.map +1 -1
  91. package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.d.ts +3 -3
  92. package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.d.ts.map +1 -1
  93. package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.js +9 -9
  94. package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.js.map +1 -1
  95. package/lib/queries/click-house-time-series-query/click-house-query-types.d.ts +1 -1
  96. package/lib/queries/click-house-time-series-query/click-house-query-types.d.ts.map +1 -1
  97. package/lib/queries/click-house-time-series-query/click-house-query-types.js.map +1 -1
  98. package/lib/queries/click-house-time-series-query/get-click-house-data.d.ts +2 -2
  99. package/lib/queries/click-house-time-series-query/get-click-house-data.d.ts.map +1 -1
  100. package/lib/queries/click-house-time-series-query/get-click-house-data.js +65 -19
  101. package/lib/queries/click-house-time-series-query/get-click-house-data.js.map +1 -1
  102. package/lib/queries/click-house-time-series-query/index.js +4 -4
  103. package/lib/queries/click-house-time-series-query/index.js.map +1 -1
  104. package/lib/queries/index.js +2 -2
  105. package/lib/queries/index.js.map +1 -1
  106. package/lib/queries/query-editor-model.d.ts +1 -1
  107. package/lib/queries/query-editor-model.d.ts.map +1 -1
  108. package/lib/queries/query-editor-model.js +2 -2
  109. package/lib/queries/query-editor-model.js.map +1 -1
  110. package/lib/setup-tests.d.ts +1 -1
  111. package/lib/setup-tests.d.ts.map +1 -1
  112. package/lib/setup-tests.js +2 -2
  113. package/lib/setup-tests.js.map +1 -1
  114. package/mf-manifest.json +55 -136
  115. package/mf-stats.json +55 -148
  116. package/package.json +21 -13
  117. package/__mf/js/ClickHouse.56ee1464.js +0 -7
  118. package/__mf/js/async/1616.c86fdd40.js +0 -1
  119. package/__mf/js/async/1728.645b0066.js +0 -1
  120. package/__mf/js/async/1811.29b51780.js +0 -101
  121. package/__mf/js/async/1825.299edaf9.js +0 -1
  122. package/__mf/js/async/1969.ea0bd5b9.js +0 -1
  123. package/__mf/js/async/2043.13379b9d.js +0 -2
  124. package/__mf/js/async/2043.13379b9d.js.LICENSE.txt +0 -24
  125. package/__mf/js/async/2386.56de292b.js +0 -2
  126. package/__mf/js/async/3059.3d9dad23.js +0 -1
  127. package/__mf/js/async/3181.f3124eab.js +0 -2
  128. package/__mf/js/async/392.c8af2244.js +0 -2
  129. package/__mf/js/async/3981.fe98c70e.js +0 -3
  130. package/__mf/js/async/4121.b6afa425.js +0 -2
  131. package/__mf/js/async/4233.abbba3f6.js +0 -7
  132. package/__mf/js/async/4233.abbba3f6.js.LICENSE.txt +0 -39
  133. package/__mf/js/async/5002.9167d87e.js +0 -1
  134. package/__mf/js/async/5071.a039a221.js +0 -1
  135. package/__mf/js/async/5440.898ddc2f.js +0 -2
  136. package/__mf/js/async/5481.223427f5.js +0 -2
  137. package/__mf/js/async/5562.d4359565.js +0 -2
  138. package/__mf/js/async/5587.72383e00.js +0 -1
  139. package/__mf/js/async/599.37f9fe2f.js +0 -1
  140. package/__mf/js/async/6045.9b807b97.js +0 -1
  141. package/__mf/js/async/6155.1398a410.js +0 -2
  142. package/__mf/js/async/6155.1398a410.js.LICENSE.txt +0 -37
  143. package/__mf/js/async/6274.22bd6f34.js +0 -2
  144. package/__mf/js/async/6688.abdc25f6.js +0 -2
  145. package/__mf/js/async/7177.96ff5c4d.js +0 -1
  146. package/__mf/js/async/7192.c1f998d2.js +0 -1
  147. package/__mf/js/async/7968.ae66f60b.js +0 -1
  148. package/__mf/js/async/7978.a58ed5ff.js +0 -1
  149. package/__mf/js/async/7984.824ae5e8.js +0 -22
  150. package/__mf/js/async/8356.eda63865.js +0 -1
  151. package/__mf/js/async/8470.3ae4fba1.js +0 -2
  152. package/__mf/js/async/873.e4ddcabf.js +0 -1
  153. package/__mf/js/async/9235.aeb9d818.js +0 -1
  154. package/__mf/js/async/941.11ea3ddf.js +0 -2
  155. package/__mf/js/async/9588.d09a1141.js +0 -1
  156. package/__mf/js/async/9754.9ea7778b.js +0 -10
  157. package/__mf/js/async/9836.75f99110.js +0 -1
  158. package/__mf/js/async/9877.8f08e12a.js +0 -38
  159. package/__mf/js/async/__federation_expose_ClickHouseDatasource.68393632.js +0 -2
  160. package/__mf/js/async/__federation_expose_ClickHouseLogQuery.b776db9c.js +0 -20
  161. package/__mf/js/async/__federation_expose_ClickHouseTimeSeriesQuery.12f07a4f.js +0 -20
  162. package/__mf/js/async/__federation_expose_ClickHouseTimeSeriesQuery.12f07a4f.js.LICENSE.txt +0 -9
  163. package/__mf/js/main.1360e83a.js +0 -7
  164. package/lib/cjs/bootstrap.js +0 -26
  165. package/lib/cjs/components/ClickQLEditor.js +0 -72
  166. package/lib/cjs/components/constants.js +0 -41
  167. package/lib/cjs/components/index.js +0 -30
  168. package/lib/cjs/datasources/click-house-datasource/ClickHouseDatasource.js +0 -49
  169. package/lib/cjs/datasources/click-house-datasource/ClickHouseDatasourceEditor.js +0 -51
  170. package/lib/cjs/datasources/click-house-datasource/click-house-datasource-types.js +0 -16
  171. package/lib/cjs/datasources/click-house-datasource/index.js +0 -32
  172. package/lib/cjs/datasources/index.js +0 -30
  173. package/lib/cjs/env.d.js +0 -14
  174. package/lib/cjs/getPluginModule.js +0 -39
  175. package/lib/cjs/index-federation.js +0 -55
  176. package/lib/cjs/index.js +0 -38
  177. package/lib/cjs/model/click-house-client.js +0 -66
  178. package/lib/cjs/model/click-house-data-types.js +0 -16
  179. package/lib/cjs/queries/click-house-log-query/ClickHouseLogQuery.js +0 -45
  180. package/lib/cjs/queries/click-house-log-query/ClickHouseLogQueryEditor.js +0 -104
  181. package/lib/cjs/queries/click-house-log-query/click-house-log-query-types.js +0 -16
  182. package/lib/cjs/queries/click-house-log-query/get-click-house-log-data.js +0 -89
  183. package/lib/cjs/queries/click-house-log-query/index.js +0 -33
  184. package/lib/cjs/queries/click-house-time-series-query/ClickHouseQuery.js +0 -43
  185. package/lib/cjs/queries/click-house-time-series-query/ClickHouseQueryEditor.js +0 -104
  186. package/lib/cjs/queries/click-house-time-series-query/click-house-query-types.js +0 -16
  187. package/lib/cjs/queries/click-house-time-series-query/get-click-house-data.js +0 -70
  188. package/lib/cjs/queries/click-house-time-series-query/index.js +0 -33
  189. package/lib/cjs/queries/constants.js +0 -34
  190. package/lib/cjs/queries/index.js +0 -31
  191. package/lib/cjs/queries/query-editor-model.js +0 -53
  192. package/lib/cjs/setup-tests.js +0 -19
  193. /package/__mf/css/async/{4233.85c2cbf6.css → 482.85c2cbf6.css} +0 -0
  194. /package/__mf/js/async/{4121.b6afa425.js.LICENSE.txt → 121.1f2608b3.js.LICENSE.txt} +0 -0
  195. /package/__mf/js/async/{2386.56de292b.js.LICENSE.txt → 181.e0b3926b.js.LICENSE.txt} +0 -0
  196. /package/__mf/js/async/{6274.22bd6f34.js.LICENSE.txt → 274.b8ce8e1b.js.LICENSE.txt} +0 -0
  197. /package/__mf/js/async/{392.c8af2244.js.LICENSE.txt → 392.d89cad59.js.LICENSE.txt} +0 -0
  198. /package/__mf/js/async/{5440.898ddc2f.js.LICENSE.txt → 440.62bb6f89.js.LICENSE.txt} +0 -0
  199. /package/__mf/js/async/{8470.3ae4fba1.js.LICENSE.txt → 470.3fc1ceb1.js.LICENSE.txt} +0 -0
  200. /package/__mf/js/async/{7984.824ae5e8.js.LICENSE.txt → 522.69c8ed0a.js.LICENSE.txt} +0 -0
  201. /package/__mf/js/async/{3181.f3124eab.js.LICENSE.txt → 562.bc9f9e5a.js.LICENSE.txt} +0 -0
  202. /package/__mf/js/async/{5481.223427f5.js.LICENSE.txt → 862.e7bf5c84.js.LICENSE.txt} +0 -0
  203. /package/__mf/js/async/{5562.d4359565.js.LICENSE.txt → 941.4bc59208.js.LICENSE.txt} +0 -0
  204. /package/__mf/js/async/{6688.abdc25f6.js.LICENSE.txt → 943.62d64363.js.LICENSE.txt} +0 -0
  205. /package/__mf/js/async/{9754.9ea7778b.js.LICENSE.txt → 944.f146f769.js.LICENSE.txt} +0 -0
  206. /package/__mf/js/async/{941.11ea3ddf.js.LICENSE.txt → __federation_expose_ClickHouseDatasource.442c0903.js.LICENSE.txt} +0 -0
  207. /package/__mf/js/async/{__federation_expose_ClickHouseDatasource.68393632.js.LICENSE.txt → __federation_expose_ClickHouseLogQuery.13604af9.js.LICENSE.txt} +0 -0
  208. /package/__mf/js/async/{__federation_expose_ClickHouseLogQuery.b776db9c.js.LICENSE.txt → __federation_expose_ClickHouseTimeSeriesQuery.c9cd60a0.js.LICENSE.txt} +0 -0
@@ -1,104 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "ClickHouseTimeSeriesQueryEditor", {
18
- enumerable: true,
19
- get: function() {
20
- return ClickHouseTimeSeriesQueryEditor;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _pluginsystem = require("@perses-dev/plugin-system");
25
- const _react = require("react");
26
- const _immer = require("immer");
27
- const _material = require("@mui/material");
28
- const _dashboards = require("@perses-dev/dashboards");
29
- const _constants = require("../constants");
30
- const _components = require("../../components");
31
- const _constants1 = require("../../components/constants");
32
- const _queryeditormodel = require("../query-editor-model");
33
- function ClickHouseTimeSeriesQueryEditor(props) {
34
- const { onChange, value } = props;
35
- const { datasource } = value;
36
- const selectedDatasource = datasource ?? _constants.DEFAULT_DATASOURCE;
37
- const { query, handleQueryChange, handleQueryBlur } = (0, _queryeditormodel.useQueryState)(props);
38
- const handleDatasourceChange = (newDatasourceSelection)=>{
39
- if (!(0, _pluginsystem.isVariableDatasource)(newDatasourceSelection) && newDatasourceSelection.kind === _constants.DATASOURCE_KIND) {
40
- onChange((0, _immer.produce)(value, (draft)=>{
41
- draft.datasource = newDatasourceSelection;
42
- }));
43
- return;
44
- }
45
- throw new Error('Got unexpected non ClickHouse datasource selection');
46
- };
47
- // Immediate query execution on Enter or blur
48
- const handleQueryExecute = (query)=>{
49
- onChange((0, _immer.produce)(value, (draft)=>{
50
- draft.query = query;
51
- }));
52
- };
53
- const handleClickHouseQueryChange = (0, _react.useCallback)((e)=>{
54
- handleQueryChange(e);
55
- }, [
56
- handleQueryChange
57
- ]);
58
- const examplesStyle = {
59
- fontSize: '11px',
60
- color: '#777',
61
- backgroundColor: '#f5f5f5',
62
- padding: '8px',
63
- borderRadius: '4px',
64
- fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
65
- whiteSpace: 'pre-wrap',
66
- lineHeight: '1.3'
67
- };
68
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
69
- spacing: 1.5,
70
- children: [
71
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
72
- datasourcePluginKind: _constants.DATASOURCE_KIND,
73
- value: selectedDatasource,
74
- onChange: handleDatasourceChange,
75
- label: "ClickHouse Datasource",
76
- notched: true
77
- }),
78
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ClickQLEditor, {
79
- value: query,
80
- onChange: handleClickHouseQueryChange,
81
- onBlur: handleQueryBlur,
82
- onKeyDown: (0, _dashboards.createModEnterHandler)(()=>handleQueryExecute(query)),
83
- placeholder: "Enter ClickHouse SQL query"
84
- }),
85
- /*#__PURE__*/ (0, _jsxruntime.jsxs)("details", {
86
- children: [
87
- /*#__PURE__*/ (0, _jsxruntime.jsx)("summary", {
88
- style: {
89
- cursor: 'pointer',
90
- fontSize: '12px',
91
- color: '#666',
92
- marginBottom: '8px'
93
- },
94
- children: "Query Examples"
95
- }),
96
- /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
97
- style: examplesStyle,
98
- children: _constants1.queryExample
99
- })
100
- ]
101
- })
102
- ]
103
- });
104
- }
@@ -1,16 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
@@ -1,70 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "getTimeSeriesData", {
18
- enumerable: true,
19
- get: function() {
20
- return getTimeSeriesData;
21
- }
22
- });
23
- const _pluginsystem = require("@perses-dev/plugin-system");
24
- const _constants = require("../constants");
25
- function buildTimeSeries(response) {
26
- const data = response?.data;
27
- if (!response || !data || data.length === 0) {
28
- return [];
29
- }
30
- const values = data.map((row)=>{
31
- const timestamp = new Date(row.time).getTime();
32
- const value = Number(row.log_count);
33
- return [
34
- timestamp,
35
- value
36
- ];
37
- });
38
- return [
39
- {
40
- name: 'log_count',
41
- values
42
- }
43
- ];
44
- }
45
- const getTimeSeriesData = async (spec, context)=>{
46
- if (spec.query === undefined || spec.query === null || spec.query === '') {
47
- return {
48
- series: []
49
- };
50
- }
51
- const query = (0, _pluginsystem.replaceVariables)(spec.query, context.variableState);
52
- const client = await context.datasourceStore.getDatasourceClient(spec.datasource ?? _constants.DEFAULT_DATASOURCE);
53
- const { start, end } = context.timeRange;
54
- const response = await client.query({
55
- start: start.getTime().toString(),
56
- end: end.getTime().toString(),
57
- query
58
- });
59
- return {
60
- series: buildTimeSeries(response),
61
- timeRange: {
62
- start,
63
- end
64
- },
65
- stepMs: 30 * 1000,
66
- metadata: {
67
- executedQueryString: query
68
- }
69
- };
70
- };
@@ -1,33 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- _export_star(require("./get-click-house-data"), exports);
18
- _export_star(require("./ClickHouseQuery"), exports);
19
- _export_star(require("./ClickHouseQueryEditor"), exports);
20
- _export_star(require("./click-house-query-types"), exports);
21
- function _export_star(from, to) {
22
- Object.keys(from).forEach(function(k) {
23
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
24
- Object.defineProperty(to, k, {
25
- enumerable: true,
26
- get: function() {
27
- return from[k];
28
- }
29
- });
30
- }
31
- });
32
- return from;
33
- }
@@ -1,34 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- function _export(target, all) {
18
- for(var name in all)Object.defineProperty(target, name, {
19
- enumerable: true,
20
- get: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get DATASOURCE_KIND () {
25
- return DATASOURCE_KIND;
26
- },
27
- get DEFAULT_DATASOURCE () {
28
- return DEFAULT_DATASOURCE;
29
- }
30
- });
31
- const DATASOURCE_KIND = 'ClickHouseDatasource';
32
- const DEFAULT_DATASOURCE = {
33
- kind: DATASOURCE_KIND
34
- };
@@ -1,31 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- _export_star(require("./click-house-time-series-query"), exports);
18
- _export_star(require("./click-house-log-query"), exports);
19
- function _export_star(from, to) {
20
- Object.keys(from).forEach(function(k) {
21
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
22
- Object.defineProperty(to, k, {
23
- enumerable: true,
24
- get: function() {
25
- return from[k];
26
- }
27
- });
28
- }
29
- });
30
- return from;
31
- }
@@ -1,53 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "useQueryState", {
18
- enumerable: true,
19
- get: function() {
20
- return useQueryState;
21
- }
22
- });
23
- const _react = require("react");
24
- const _immer = require("immer");
25
- function useQueryState(props) {
26
- const { onChange, value } = props;
27
- // Local copy of the query's value
28
- const [query, setQuery] = (0, _react.useState)(value.query || '');
29
- // This is basically "getDerivedStateFromProps" to make sure if spec's value changes external to this component,
30
- // we render with the latest value
31
- const [lastSyncedQuery, setLastSyncedQuery] = (0, _react.useState)(value.query);
32
- if (value.query !== lastSyncedQuery) {
33
- setQuery(value.query || '');
34
- setLastSyncedQuery(value.query);
35
- }
36
- // Update our local state's copy as the user types
37
- const handleQueryChange = (e)=>{
38
- setQuery(e);
39
- };
40
- // Propagate changes to the query's value when the input is blurred to avoid constantly re-running queries in the
41
- // PanelPreview
42
- const handleQueryBlur = ()=>{
43
- setLastSyncedQuery(query);
44
- onChange((0, _immer.produce)(value, (draft)=>{
45
- draft.query = query;
46
- }));
47
- };
48
- return {
49
- query,
50
- handleQueryChange,
51
- handleQueryBlur
52
- };
53
- }
@@ -1,19 +0,0 @@
1
- // Copyright The Perses Authors
2
- // Licensed under the Apache License, Version 2.0 (the "License");
3
- // you may not use this file except in compliance with the License.
4
- // You may obtain a copy of the License at
5
- //
6
- // http://www.apache.org/licenses/LICENSE-2.0
7
- //
8
- // Unless required by applicable law or agreed to in writing, software
9
- // distributed under the License is distributed on an "AS IS" BASIS,
10
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- // See the License for the specific language governing permissions and
12
- // limitations under the License.
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- require("@testing-library/jest-dom");
18
- // Always mock e-charts during tests since we don't have a proper canvas in jsdom
19
- jest.mock('echarts/core');