@perses-dev/clickhouse-plugin 0.2.0 → 0.4.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.
Files changed (151) hide show
  1. package/README.md +1 -1
  2. package/__mf/css/async/1580.d3010b86.css +1 -0
  3. package/__mf/css/async/2341.d3010b86.css +1 -0
  4. package/__mf/js/{ClickHouse.f6211ab5.js → ClickHouse.fef0738b.js} +3 -3
  5. package/__mf/js/async/1360.33f7e672.js +10 -0
  6. package/__mf/js/async/1398.f2193c83.js +2 -0
  7. package/__mf/js/async/2226.1d4436dc.js +1 -0
  8. package/__mf/js/async/2652.fd27ec3f.js +101 -0
  9. package/__mf/js/async/{4075.598f1ee5.js → 4075.b85e5581.js} +1 -1
  10. package/__mf/js/async/{4238.8c8282dc.js → 4238.a8170f41.js} +1 -1
  11. package/__mf/js/async/4421.d9d48d4f.js +1 -0
  12. package/__mf/js/async/4557.aa037aea.js +2 -0
  13. package/__mf/js/async/4676.cae72135.js +22 -0
  14. package/__mf/js/async/58.c1431e49.js +2 -0
  15. package/__mf/js/async/6134.a0f2d3c5.js +38 -0
  16. package/__mf/js/async/7797.36d938e5.js +1 -0
  17. package/__mf/js/async/7991.11320a4d.js +7 -0
  18. package/__mf/js/async/__federation_expose_ClickHouseDatasource.b909c7ef.js +2 -0
  19. package/__mf/js/async/__federation_expose_ClickHouseLogQuery.8e9aa83b.js +20 -0
  20. package/__mf/js/async/__federation_expose_ClickHouseTimeSeriesQuery.b3723b8b.js +20 -0
  21. package/__mf/js/{main.91d879ed.js → main.56f92cce.js} +3 -3
  22. package/lib/cjs/index.js +0 -1
  23. package/lib/cjs/queries/click-house-log-query/ClickHouseLogQueryEditor.js +4 -15
  24. package/lib/cjs/queries/click-house-time-series-query/ClickHouseQueryEditor.js +4 -15
  25. package/lib/index.d.ts +0 -1
  26. package/lib/index.d.ts.map +1 -1
  27. package/lib/index.js +0 -1
  28. package/lib/index.js.map +1 -1
  29. package/lib/model/click-house-data-types.d.ts +2 -15
  30. package/lib/model/click-house-data-types.d.ts.map +1 -1
  31. package/lib/model/click-house-data-types.js.map +1 -1
  32. package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.d.ts.map +1 -1
  33. package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.js +4 -15
  34. package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.js.map +1 -1
  35. package/lib/queries/click-house-log-query/get-click-house-log-data.js.map +1 -1
  36. package/lib/queries/click-house-log-query/log-query-plugin-interface.d.ts +2 -4
  37. package/lib/queries/click-house-log-query/log-query-plugin-interface.d.ts.map +1 -1
  38. package/lib/queries/click-house-log-query/log-query-plugin-interface.js.map +1 -1
  39. package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.d.ts.map +1 -1
  40. package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.js +4 -15
  41. package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.js.map +1 -1
  42. package/mf-manifest.json +44 -104
  43. package/mf-stats.json +44 -106
  44. package/package.json +6 -15
  45. package/__mf/css/async/1580.6b2b0c71.css +0 -1
  46. package/__mf/css/async/2341.6b2b0c71.css +0 -1
  47. package/__mf/css/async/6759.6b2b0c71.css +0 -1
  48. package/__mf/js/async/2226.332707ca.js +0 -1
  49. package/__mf/js/async/2417.1f135170.js +0 -2
  50. package/__mf/js/async/2448.e42be954.js +0 -10
  51. package/__mf/js/async/3632.f88c5ced.js +0 -101
  52. package/__mf/js/async/4168.af4fa8b3.js +0 -2
  53. package/__mf/js/async/4368.8468ec0a.js +0 -2
  54. package/__mf/js/async/4421.de18bb66.js +0 -1
  55. package/__mf/js/async/5035.8a983cd3.js +0 -73
  56. package/__mf/js/async/56.9997e6f8.js +0 -1
  57. package/__mf/js/async/5713.92805154.js +0 -1
  58. package/__mf/js/async/6467.f4e5b898.js +0 -1
  59. package/__mf/js/async/6569.f8ee50db.js +0 -1
  60. package/__mf/js/async/6714.e4b5281a.js +0 -2
  61. package/__mf/js/async/8465.f4c53fef.js +0 -7
  62. package/__mf/js/async/9654.ab803765.js +0 -37
  63. package/__mf/js/async/__federation_expose_ClickHouseDatasource.1ef730b1.js +0 -2
  64. package/__mf/js/async/__federation_expose_ClickHouseLogQuery.4c608fd8.js +0 -20
  65. package/__mf/js/async/__federation_expose_ClickHouseTimeSeriesQuery.12307d25.js +0 -20
  66. package/__mf/js/async/__federation_expose_Logs.88d56eeb.js +0 -2
  67. package/__mf/js/async/__federation_expose_Logs.88d56eeb.js.LICENSE.txt +0 -9
  68. package/lib/cjs/panels/index.js +0 -30
  69. package/lib/cjs/panels/logs/Logs.js +0 -37
  70. package/lib/cjs/panels/logs/LogsComponent.js +0 -47
  71. package/lib/cjs/panels/logs/LogsSettingsEditor.js +0 -57
  72. package/lib/cjs/panels/logs/components/EmptyLogsState.js +0 -49
  73. package/lib/cjs/panels/logs/components/LogRow/LogDetailsTable.js +0 -71
  74. package/lib/cjs/panels/logs/components/LogRow/LogRow.js +0 -163
  75. package/lib/cjs/panels/logs/components/LogRow/LogTimestamp.js +0 -45
  76. package/lib/cjs/panels/logs/components/LogRow/LogsStyles.js +0 -77
  77. package/lib/cjs/panels/logs/components/LogRow/index.js +0 -37
  78. package/lib/cjs/panels/logs/components/LogsList.js +0 -44
  79. package/lib/cjs/panels/logs/components/VirtualizedLogsList.js +0 -60
  80. package/lib/cjs/panels/logs/components/hooks/useExpandedRows.js +0 -45
  81. package/lib/cjs/panels/logs/index.js +0 -33
  82. package/lib/cjs/panels/logs/logs-types.js +0 -16
  83. package/lib/panels/index.d.ts +0 -2
  84. package/lib/panels/index.d.ts.map +0 -1
  85. package/lib/panels/index.js +0 -15
  86. package/lib/panels/index.js.map +0 -1
  87. package/lib/panels/logs/Logs.d.ts +0 -4
  88. package/lib/panels/logs/Logs.d.ts.map +0 -1
  89. package/lib/panels/logs/Logs.js +0 -29
  90. package/lib/panels/logs/Logs.js.map +0 -1
  91. package/lib/panels/logs/LogsComponent.d.ts +0 -4
  92. package/lib/panels/logs/LogsComponent.d.ts.map +0 -1
  93. package/lib/panels/logs/LogsComponent.js +0 -34
  94. package/lib/panels/logs/LogsComponent.js.map +0 -1
  95. package/lib/panels/logs/LogsSettingsEditor.d.ts +0 -7
  96. package/lib/panels/logs/LogsSettingsEditor.d.ts.map +0 -1
  97. package/lib/panels/logs/LogsSettingsEditor.js +0 -49
  98. package/lib/panels/logs/LogsSettingsEditor.js.map +0 -1
  99. package/lib/panels/logs/components/EmptyLogsState.d.ts +0 -7
  100. package/lib/panels/logs/components/EmptyLogsState.d.ts.map +0 -1
  101. package/lib/panels/logs/components/EmptyLogsState.js +0 -36
  102. package/lib/panels/logs/components/EmptyLogsState.js.map +0 -1
  103. package/lib/panels/logs/components/LogRow/LogDetailsTable.d.ts +0 -8
  104. package/lib/panels/logs/components/LogRow/LogDetailsTable.d.ts.map +0 -1
  105. package/lib/panels/logs/components/LogRow/LogDetailsTable.js +0 -58
  106. package/lib/panels/logs/components/LogRow/LogDetailsTable.js.map +0 -1
  107. package/lib/panels/logs/components/LogRow/LogRow.d.ts +0 -14
  108. package/lib/panels/logs/components/LogRow/LogRow.d.ts.map +0 -1
  109. package/lib/panels/logs/components/LogRow/LogRow.js +0 -109
  110. package/lib/panels/logs/components/LogRow/LogRow.js.map +0 -1
  111. package/lib/panels/logs/components/LogRow/LogTimestamp.d.ts +0 -7
  112. package/lib/panels/logs/components/LogRow/LogTimestamp.d.ts.map +0 -1
  113. package/lib/panels/logs/components/LogRow/LogTimestamp.js +0 -32
  114. package/lib/panels/logs/components/LogRow/LogTimestamp.js.map +0 -1
  115. package/lib/panels/logs/components/LogRow/LogsStyles.d.ts +0 -22
  116. package/lib/panels/logs/components/LogRow/LogsStyles.d.ts.map +0 -1
  117. package/lib/panels/logs/components/LogRow/LogsStyles.js +0 -55
  118. package/lib/panels/logs/components/LogRow/LogsStyles.js.map +0 -1
  119. package/lib/panels/logs/components/LogRow/index.d.ts +0 -3
  120. package/lib/panels/logs/components/LogRow/index.d.ts.map +0 -1
  121. package/lib/panels/logs/components/LogRow/index.js +0 -16
  122. package/lib/panels/logs/components/LogRow/index.js.map +0 -1
  123. package/lib/panels/logs/components/LogsList.d.ts +0 -8
  124. package/lib/panels/logs/components/LogsList.d.ts.map +0 -1
  125. package/lib/panels/logs/components/LogsList.js +0 -31
  126. package/lib/panels/logs/components/LogsList.js.map +0 -1
  127. package/lib/panels/logs/components/VirtualizedLogsList.d.ts +0 -10
  128. package/lib/panels/logs/components/VirtualizedLogsList.d.ts.map +0 -1
  129. package/lib/panels/logs/components/VirtualizedLogsList.js +0 -47
  130. package/lib/panels/logs/components/VirtualizedLogsList.js.map +0 -1
  131. package/lib/panels/logs/components/hooks/useExpandedRows.d.ts +0 -6
  132. package/lib/panels/logs/components/hooks/useExpandedRows.d.ts.map +0 -1
  133. package/lib/panels/logs/components/hooks/useExpandedRows.js +0 -37
  134. package/lib/panels/logs/components/hooks/useExpandedRows.js.map +0 -1
  135. package/lib/panels/logs/index.d.ts +0 -5
  136. package/lib/panels/logs/index.d.ts.map +0 -1
  137. package/lib/panels/logs/index.js +0 -18
  138. package/lib/panels/logs/index.js.map +0 -1
  139. package/lib/panels/logs/logs-types.d.ts +0 -16
  140. package/lib/panels/logs/logs-types.d.ts.map +0 -1
  141. package/lib/panels/logs/logs-types.js +0 -15
  142. package/lib/panels/logs/logs-types.js.map +0 -1
  143. /package/__mf/js/async/{2448.e42be954.js.LICENSE.txt → 1360.33f7e672.js.LICENSE.txt} +0 -0
  144. /package/__mf/js/async/{2417.1f135170.js.LICENSE.txt → 1398.f2193c83.js.LICENSE.txt} +0 -0
  145. /package/__mf/js/async/{4368.8468ec0a.js.LICENSE.txt → 4557.aa037aea.js.LICENSE.txt} +0 -0
  146. /package/__mf/js/async/{5035.8a983cd3.js.LICENSE.txt → 4676.cae72135.js.LICENSE.txt} +0 -0
  147. /package/__mf/js/async/{6714.e4b5281a.js.LICENSE.txt → 58.c1431e49.js.LICENSE.txt} +0 -0
  148. /package/__mf/js/async/{8465.f4c53fef.js.LICENSE.txt → 7991.11320a4d.js.LICENSE.txt} +0 -0
  149. /package/__mf/js/async/{__federation_expose_ClickHouseDatasource.1ef730b1.js.LICENSE.txt → __federation_expose_ClickHouseDatasource.b909c7ef.js.LICENSE.txt} +0 -0
  150. /package/__mf/js/async/{__federation_expose_ClickHouseLogQuery.4c608fd8.js.LICENSE.txt → __federation_expose_ClickHouseLogQuery.8e9aa83b.js.LICENSE.txt} +0 -0
  151. /package/__mf/js/async/{__federation_expose_ClickHouseTimeSeriesQuery.12307d25.js.LICENSE.txt → __federation_expose_ClickHouseTimeSeriesQuery.b3723b8b.js.LICENSE.txt} +0 -0
@@ -24,13 +24,13 @@ const _jsxruntime = require("react/jsx-runtime");
24
24
  const _pluginsystem = require("@perses-dev/plugin-system");
25
25
  const _react = require("react");
26
26
  const _immer = require("immer");
27
+ const _material = require("@mui/material");
27
28
  const _constants = require("../constants");
28
29
  const _components = require("../../components");
29
- const _material = require("@mui/material");
30
30
  const _constants1 = require("../../components/constants");
31
31
  const _queryeditormodel = require("../query-editor-model");
32
32
  function ClickHouseLogQueryEditor(props) {
33
- const { onChange, value, queryHandlerSettings } = props;
33
+ const { onChange, value } = props;
34
34
  const { datasource } = value;
35
35
  const selectedDatasource = datasource ?? _constants.DEFAULT_DATASOURCE;
36
36
  const { query, handleQueryChange, handleQueryBlur } = (0, _queryeditormodel.useQueryState)(props);
@@ -39,31 +39,20 @@ function ClickHouseLogQueryEditor(props) {
39
39
  onChange((0, _immer.produce)(value, (draft)=>{
40
40
  draft.datasource = newDatasourceSelection;
41
41
  }));
42
- if (queryHandlerSettings?.setWatchOtherSpecs) queryHandlerSettings.setWatchOtherSpecs({
43
- ...value,
44
- datasource: newDatasourceSelection
45
- });
46
42
  return;
47
43
  }
48
44
  throw new Error('Got unexpected non ClickHouse datasource selection');
49
45
  };
50
46
  // Immediate query execution on Enter or blur
51
47
  const handleQueryExecute = (query)=>{
52
- if (queryHandlerSettings?.watchQueryChanges) {
53
- queryHandlerSettings.watchQueryChanges(query);
54
- }
55
48
  onChange((0, _immer.produce)(value, (draft)=>{
56
49
  draft.query = query;
57
50
  }));
58
51
  };
59
52
  const handleClickHouseQueryChange = (0, _react.useCallback)((e)=>{
60
53
  handleQueryChange(e);
61
- if (queryHandlerSettings?.watchQueryChanges) {
62
- queryHandlerSettings.watchQueryChanges(e);
63
- }
64
54
  }, [
65
- handleQueryChange,
66
- queryHandlerSettings
55
+ handleQueryChange
67
56
  ]);
68
57
  const examplesStyle = {
69
58
  fontSize: '11px',
@@ -88,7 +77,7 @@ function ClickHouseLogQueryEditor(props) {
88
77
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ClickQLEditor, {
89
78
  value: query,
90
79
  onChange: handleClickHouseQueryChange,
91
- onBlur: queryHandlerSettings?.runWithOnBlur ? handleQueryBlur : undefined,
80
+ onBlur: handleQueryBlur,
92
81
  onKeyDown: (event)=>{
93
82
  if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
94
83
  event.preventDefault();
@@ -24,13 +24,13 @@ const _jsxruntime = require("react/jsx-runtime");
24
24
  const _pluginsystem = require("@perses-dev/plugin-system");
25
25
  const _react = require("react");
26
26
  const _immer = require("immer");
27
+ const _material = require("@mui/material");
27
28
  const _constants = require("../constants");
28
29
  const _components = require("../../components");
29
- const _material = require("@mui/material");
30
30
  const _constants1 = require("../../components/constants");
31
31
  const _queryeditormodel = require("../query-editor-model");
32
32
  function ClickHouseTimeSeriesQueryEditor(props) {
33
- const { onChange, value, queryHandlerSettings } = props;
33
+ const { onChange, value } = props;
34
34
  const { datasource } = value;
35
35
  const selectedDatasource = datasource ?? _constants.DEFAULT_DATASOURCE;
36
36
  const { query, handleQueryChange, handleQueryBlur } = (0, _queryeditormodel.useQueryState)(props);
@@ -39,31 +39,20 @@ function ClickHouseTimeSeriesQueryEditor(props) {
39
39
  onChange((0, _immer.produce)(value, (draft)=>{
40
40
  draft.datasource = newDatasourceSelection;
41
41
  }));
42
- if (queryHandlerSettings?.setWatchOtherSpecs) queryHandlerSettings.setWatchOtherSpecs({
43
- ...value,
44
- datasource: newDatasourceSelection
45
- });
46
42
  return;
47
43
  }
48
44
  throw new Error('Got unexpected non ClickHouse datasource selection');
49
45
  };
50
46
  // Immediate query execution on Enter or blur
51
47
  const handleQueryExecute = (query)=>{
52
- if (queryHandlerSettings?.watchQueryChanges) {
53
- queryHandlerSettings.watchQueryChanges(query);
54
- }
55
48
  onChange((0, _immer.produce)(value, (draft)=>{
56
49
  draft.query = query;
57
50
  }));
58
51
  };
59
52
  const handleClickHouseQueryChange = (0, _react.useCallback)((e)=>{
60
53
  handleQueryChange(e);
61
- if (queryHandlerSettings?.watchQueryChanges) {
62
- queryHandlerSettings.watchQueryChanges(e);
63
- }
64
54
  }, [
65
- handleQueryChange,
66
- queryHandlerSettings
55
+ handleQueryChange
67
56
  ]);
68
57
  const examplesStyle = {
69
58
  fontSize: '11px',
@@ -88,7 +77,7 @@ function ClickHouseTimeSeriesQueryEditor(props) {
88
77
  /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ClickQLEditor, {
89
78
  value: query,
90
79
  onChange: handleClickHouseQueryChange,
91
- onBlur: queryHandlerSettings?.runWithOnBlur ? handleQueryBlur : undefined,
80
+ onBlur: handleQueryBlur,
92
81
  onKeyDown: (event)=>{
93
82
  if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
94
83
  event.preventDefault();
package/lib/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export { getPluginModule } from './getPluginModule';
2
- export * from './panels';
3
2
  export * from './queries';
4
3
  export * from './datasources';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
package/lib/index.js CHANGED
@@ -11,7 +11,6 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  export { getPluginModule } from './getPluginModule';
14
- export * from './panels';
15
14
  export * from './queries';
16
15
  export * from './datasources';
17
16
 
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport { getPluginModule } from './getPluginModule';\nexport * from './panels';\nexport * from './queries';\nexport * from './datasources';\n"],"names":["getPluginModule"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,eAAe,QAAQ,oBAAoB;AACpD,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,gBAAgB"}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport { getPluginModule } from './getPluginModule';\nexport * from './queries';\nexport * from './datasources';\n"],"names":["getPluginModule"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,eAAe,QAAQ,oBAAoB;AACpD,cAAc,YAAY;AAC1B,cAAc,gBAAgB"}
@@ -1,19 +1,6 @@
1
- import { TimeSeriesData } from '@perses-dev/core';
2
- export interface LogLabels {
3
- [key: string]: any;
4
- }
5
- export interface LogEntry {
6
- timestamp: number;
7
- labels: LogLabels;
8
- line?: string;
9
- }
10
- export interface LogsData {
11
- entries: LogEntry[];
12
- totalCount: number;
13
- hasMore?: boolean;
14
- }
1
+ import { LogData, TimeSeriesData } from '@perses-dev/core';
15
2
  export interface ClickHouseTimeSeriesData extends TimeSeriesData {
16
- logs?: LogsData;
3
+ logs?: LogData;
17
4
  }
18
5
  export interface TimeSeriesEntry {
19
6
  time: string;
@@ -1 +1 @@
1
- {"version":3,"file":"click-house-data-types.d.ts","sourceRoot":"","sources":["../../../src/model/click-house-data-types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,QAAQ,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,wBAAyB,SAAQ,cAAc;IAC9D,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B"}
1
+ {"version":3,"file":"click-house-data-types.d.ts","sourceRoot":"","sources":["../../../src/model/click-house-data-types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAY,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAErE,MAAM,WAAW,wBAAyB,SAAQ,cAAc;IAC9D,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/model/click-house-data-types.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeriesData } from '@perses-dev/core';\n\nexport interface LogLabels {\n [key: string]: any;\n}\n\nexport interface LogEntry {\n timestamp: number;\n labels: LogLabels;\n line?: string;\n}\n\nexport interface LogsData {\n entries: LogEntry[];\n totalCount: number;\n hasMore?: boolean;\n}\n\nexport interface ClickHouseTimeSeriesData extends TimeSeriesData {\n logs?: LogsData;\n}\n\nexport interface TimeSeriesEntry {\n time: string;\n log_count: number | string;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAwBjC,WAGC"}
1
+ {"version":3,"sources":["../../../src/model/click-house-data-types.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { LogEntry, LogData, TimeSeriesData } from '@perses-dev/core';\n\nexport interface ClickHouseTimeSeriesData extends TimeSeriesData {\n logs?: LogData;\n}\n\nexport interface TimeSeriesEntry {\n time: string;\n log_count: number | string;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAQjC,WAGC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ClickHouseLogQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-log-query/ClickHouseLogQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAe,MAAM,OAAO,CAAC;AAMlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,KAAK,0BAA0B,GAAG,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;AAE7E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,0BAA0B,GAAG,YAAY,CAoFxF"}
1
+ {"version":3,"file":"ClickHouseLogQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-log-query/ClickHouseLogQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAe,MAAM,OAAO,CAAC;AAOlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,KAAK,0BAA0B,GAAG,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;AAE7E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,0BAA0B,GAAG,YAAY,CA2ExF"}
@@ -14,13 +14,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { DatasourceSelect, isVariableDatasource } from '@perses-dev/plugin-system';
15
15
  import { useCallback } from 'react';
16
16
  import { produce } from 'immer';
17
+ import { Stack } from '@mui/material';
17
18
  import { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';
18
19
  import { ClickQLEditor } from '../../components';
19
- import { Stack } from '@mui/material';
20
20
  import { queryExample } from '../../components/constants';
21
21
  import { useQueryState } from '../query-editor-model';
22
22
  export function ClickHouseLogQueryEditor(props) {
23
- const { onChange, value, queryHandlerSettings } = props;
23
+ const { onChange, value } = props;
24
24
  const { datasource } = value;
25
25
  const selectedDatasource = datasource ?? DEFAULT_DATASOURCE;
26
26
  const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);
@@ -29,31 +29,20 @@ export function ClickHouseLogQueryEditor(props) {
29
29
  onChange(produce(value, (draft)=>{
30
30
  draft.datasource = newDatasourceSelection;
31
31
  }));
32
- if (queryHandlerSettings?.setWatchOtherSpecs) queryHandlerSettings.setWatchOtherSpecs({
33
- ...value,
34
- datasource: newDatasourceSelection
35
- });
36
32
  return;
37
33
  }
38
34
  throw new Error('Got unexpected non ClickHouse datasource selection');
39
35
  };
40
36
  // Immediate query execution on Enter or blur
41
37
  const handleQueryExecute = (query)=>{
42
- if (queryHandlerSettings?.watchQueryChanges) {
43
- queryHandlerSettings.watchQueryChanges(query);
44
- }
45
38
  onChange(produce(value, (draft)=>{
46
39
  draft.query = query;
47
40
  }));
48
41
  };
49
42
  const handleClickHouseQueryChange = useCallback((e)=>{
50
43
  handleQueryChange(e);
51
- if (queryHandlerSettings?.watchQueryChanges) {
52
- queryHandlerSettings.watchQueryChanges(e);
53
- }
54
44
  }, [
55
- handleQueryChange,
56
- queryHandlerSettings
45
+ handleQueryChange
57
46
  ]);
58
47
  const examplesStyle = {
59
48
  fontSize: '11px',
@@ -78,7 +67,7 @@ export function ClickHouseLogQueryEditor(props) {
78
67
  /*#__PURE__*/ _jsx(ClickQLEditor, {
79
68
  value: query,
80
69
  onChange: handleClickHouseQueryChange,
81
- onBlur: queryHandlerSettings?.runWithOnBlur ? handleQueryBlur : undefined,
70
+ onBlur: handleQueryBlur,
82
71
  onKeyDown: (event)=>{
83
72
  if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
84
73
  event.preventDefault();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/click-house-log-query/ClickHouseLogQueryEditor.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n} from '@perses-dev/plugin-system';\nimport { ReactElement, useCallback } from 'react';\nimport { produce } from 'immer';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { ClickQLEditor } from '../../components';\nimport { Stack } from '@mui/material';\nimport { queryExample } from '../../components/constants';\nimport { ClickHouseLogQuerySpec } from './click-house-log-query-types';\nimport { useQueryState } from '../query-editor-model';\n\ntype ClickHouseQueryEditorProps = OptionsEditorProps<ClickHouseLogQuerySpec>;\n\nexport function ClickHouseLogQueryEditor(props: ClickHouseQueryEditorProps): ReactElement {\n const { onChange, value, queryHandlerSettings } = props;\n const { datasource } = value;\n const selectedDatasource = datasource ?? DEFAULT_DATASOURCE;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n draft.datasource = newDatasourceSelection;\n })\n );\n\n if (queryHandlerSettings?.setWatchOtherSpecs)\n queryHandlerSettings.setWatchOtherSpecs({ ...value, datasource: newDatasourceSelection });\n return;\n }\n throw new Error('Got unexpected non ClickHouse datasource selection');\n };\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string) => {\n if (queryHandlerSettings?.watchQueryChanges) {\n queryHandlerSettings.watchQueryChanges(query);\n }\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleClickHouseQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n if (queryHandlerSettings?.watchQueryChanges) {\n queryHandlerSettings.watchQueryChanges(e);\n }\n },\n [handleQueryChange, queryHandlerSettings]\n );\n\n const examplesStyle: React.CSSProperties = {\n fontSize: '11px',\n color: '#777',\n backgroundColor: '#f5f5f5',\n padding: '8px',\n borderRadius: '4px',\n fontFamily: 'Monaco, Menlo, \"Ubuntu Mono\", monospace',\n whiteSpace: 'pre-wrap',\n lineHeight: '1.3',\n };\n\n return (\n <Stack spacing={1.5}>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"ClickHouse Datasource\"\n notched\n />\n <ClickQLEditor\n value={query}\n onChange={handleClickHouseQueryChange}\n onBlur={queryHandlerSettings?.runWithOnBlur ? handleQueryBlur : undefined}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\n placeholder=\"Enter ClickHouse SQL query\"\n />\n\n <details>\n <summary style={{ cursor: 'pointer', fontSize: '12px', color: '#666', marginBottom: '8px' }}>\n Query Examples\n </summary>\n <div style={examplesStyle}>{queryExample}</div>\n </details>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useCallback","produce","DATASOURCE_KIND","DEFAULT_DATASOURCE","ClickQLEditor","Stack","queryExample","useQueryState","ClickHouseLogQueryEditor","props","onChange","value","queryHandlerSettings","datasource","selectedDatasource","query","handleQueryChange","handleQueryBlur","handleDatasourceChange","newDatasourceSelection","kind","draft","setWatchOtherSpecs","Error","handleQueryExecute","watchQueryChanges","handleClickHouseQueryChange","e","examplesStyle","fontSize","color","backgroundColor","padding","borderRadius","fontFamily","whiteSpace","lineHeight","spacing","datasourcePluginKind","label","notched","onBlur","runWithOnBlur","undefined","onKeyDown","event","key","ctrlKey","metaKey","preventDefault","placeholder","details","summary","style","cursor","marginBottom","div"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,QAEf,4BAA4B;AACnC,SAAuBC,WAAW,QAAQ,QAAQ;AAClD,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AACnE,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,YA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AOI;gBACPL,UAAUgB;gBACVe,QAAQ7B,sBAAsB8B,gBAAgBzB,kBAAkB0B;gBAChEC,WAAW,CAACC;oBACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;wBAC7DH,MAAMI,cAAc;wBACpBzB,mBAAmBT;oBACrB;gBACF;gBACAmC,aAAY;;0BAGd,MAACC;;kCACC,KAACC;wBAAQC,OAAO;4BAAEC,QAAQ;4BAAWzB,UAAU;4BAAQC,OAAO;4BAAQyB,cAAc;wBAAM;kCAAG;;kCAG7F,KAACC;wBAAIH,OAAOzB;kCAAgBtB;;;;;;AAIpC"}
1
+ {"version":3,"sources":["../../../../src/queries/click-house-log-query/ClickHouseLogQueryEditor.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n} from '@perses-dev/plugin-system';\nimport { ReactElement, useCallback } from 'react';\nimport { produce } from 'immer';\nimport { Stack } from '@mui/material';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { ClickQLEditor } from '../../components';\nimport { queryExample } from '../../components/constants';\nimport { useQueryState } from '../query-editor-model';\nimport { ClickHouseLogQuerySpec } from './click-house-log-query-types';\n\ntype ClickHouseQueryEditorProps = OptionsEditorProps<ClickHouseLogQuerySpec>;\n\nexport function ClickHouseLogQueryEditor(props: ClickHouseQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const selectedDatasource = datasource ?? DEFAULT_DATASOURCE;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n draft.datasource = newDatasourceSelection;\n })\n );\n return;\n }\n throw new Error('Got unexpected non ClickHouse datasource selection');\n };\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string) => {\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleClickHouseQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\n );\n\n const examplesStyle: React.CSSProperties = {\n fontSize: '11px',\n color: '#777',\n backgroundColor: '#f5f5f5',\n padding: '8px',\n borderRadius: '4px',\n fontFamily: 'Monaco, Menlo, \"Ubuntu Mono\", monospace',\n whiteSpace: 'pre-wrap',\n lineHeight: '1.3',\n };\n\n return (\n <Stack spacing={1.5}>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"ClickHouse Datasource\"\n notched\n />\n <ClickQLEditor\n value={query}\n onChange={handleClickHouseQueryChange}\n onBlur={handleQueryBlur}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\n placeholder=\"Enter ClickHouse SQL query\"\n />\n\n <details>\n <summary style={{ cursor: 'pointer', fontSize: '12px', color: '#666', marginBottom: '8px' }}>\n Query Examples\n </summary>\n <div style={examplesStyle}>{queryExample}</div>\n </details>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useCallback","produce","Stack","DATASOURCE_KIND","DEFAULT_DATASOURCE","ClickQLEditor","queryExample","useQueryState","ClickHouseLogQueryEditor","props","onChange","value","datasource","selectedDatasource","query","handleQueryChange","handleQueryBlur","handleDatasourceChange","newDatasourceSelection","kind","draft","Error","handleQueryExecute","handleClickHouseQueryChange","e","examplesStyle","fontSize","color","backgroundColor","padding","borderRadius","fontFamily","whiteSpace","lineHeight","spacing","datasourcePluginKind","label","notched","onBlur","onKeyDown","event","key","ctrlKey","metaKey","preventDefault","placeholder","details","summary","style","cursor","marginBottom","div"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,QAEf,4BAA4B;AACnC,SAAuBC,WAAW,QAAQ,QAAQ;AAClD,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AACnE,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,YAAY,QAAQ,6BAA6B;AAC1D,SAASC,aAAa,QAAQ,wBAAwB;AAKtD,OAAO,SAASC,yBAAyBC,KAAiC;IACxE,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAE,GAAGD;IACvB,MAAME,qBAAqBD,cAAcR;IACzC,MAAM,EAAEU,KAAK,EAAEC,iBAAiB,EAAEC,eAAe,EAAE,GAAGT,cAAcE;IAEpE,MAAMQ,yBAA4D,CAACC;QACjE,IAAI,CAACnB,qBAAqBmB,2BAA2BA,uBAAuBC,IAAI,KAAKhB,iBAAiB;YACpGO,SACET,QAAQU,OAAO,CAACS;gBACdA,MAAMR,UAAU,GAAGM;YACrB;YAEF;QACF;QACA,MAAM,IAAIG,MAAM;IAClB;IAEA,6CAA6C;IAC7C,MAAMC,qBAAqB,CAACR;QAC1BJ,SACET,QAAQU,OAAO,CAACS;YACdA,MAAMN,KAAK,GAAGA;QAChB;IAEJ;IAEA,MAAMS,8BAA8BvB,YAClC,CAACwB;QACCT,kBAAkBS;IACpB,GACA;QAACT;KAAkB;IAGrB,MAAMU,gBAAqC;QACzCC,UAAU;QACVC,OAAO;QACPC,iBAAiB;QACjBC,SAAS;QACTC,cAAc;QACdC,YAAY;QACZC,YAAY;QACZC,YAAY;IACd;IAEA,qBACE,MAAC/B;QAAMgC,SAAS;;0BACd,KAACpC;gBACCqC,sBAAsBhC;gBACtBQ,OAAOE;gBACPH,UAAUO;gBACVmB,OAAM;gBACNC,OAAO;;0BAET,KAAChC;gBACCM,OAAOG;gBACPJ,UAAUa;gBACVe,QAAQtB;gBACRuB,WAAW,CAACC;oBACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;wBAC7DH,MAAMI,cAAc;wBACpBtB,mBAAmBR;oBACrB;gBACF;gBACA+B,aAAY;;0BAGd,MAACC;;kCACC,KAACC;wBAAQC,OAAO;4BAAEC,QAAQ;4BAAWvB,UAAU;4BAAQC,OAAO;4BAAQuB,cAAc;wBAAM;kCAAG;;kCAG7F,KAACC;wBAAIH,OAAOvB;kCAAgBnB;;;;;;AAIpC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/click-house-log-query/get-click-house-log-data.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { replaceVariables } from '@perses-dev/plugin-system';\nimport { LogEntry, LogsData } from '../../model/click-house-data-types';\nimport { ClickHouseClient, ClickHouseQueryResponse } from '../../model/click-house-client';\nimport { ClickHouseLogQuerySpec } from './click-house-log-query-types';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { LogQueryPlugin } from './log-query-plugin-interface';\n\nfunction flattenObject(\n obj: Record<string, any>,\n parentKey = '',\n result: Record<string, any> = {}\n): Record<string, any> {\n for (const [key, value] of Object.entries(obj)) {\n const newKey = parentKey ? `${parentKey}.${key}` : key;\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n flattenObject(value, newKey, result);\n } else {\n result[newKey] = value;\n }\n }\n\n return result;\n}\n\nfunction convertStreamsToLogs(streams: LogEntry[]): LogsData {\n const entries: LogEntry[] = streams.map((entry) => {\n const flattened = flattenObject(entry);\n\n if (!flattened.Timestamp && flattened.log_time) {\n flattened.Timestamp = flattened.log_time;\n }\n\n const sortedEntry: Record<string, any> = {};\n Object.keys(flattened)\n .sort((a, b) => a.localeCompare(b))\n .forEach((key) => {\n sortedEntry[key] = flattened[key];\n });\n\n const line = Object.entries(sortedEntry)\n .filter(([key]) => key !== 'Timestamp')\n .map(([key, value]) => `<${key}> ${value === '' || value === null || value === undefined ? '--' : value}`)\n .join(' ');\n\n return {\n timestamp: sortedEntry?.Timestamp,\n labels: sortedEntry,\n line,\n } as LogEntry;\n });\n\n return {\n entries,\n totalCount: entries.length,\n };\n}\n\nexport const getClickHouseLogData: LogQueryPlugin<ClickHouseLogQuerySpec>['getLogData'] = async (spec, context) => {\n if (spec.query === undefined || spec.query === null || spec.query === '') {\n return {\n logs: { entries: [], totalCount: 0 },\n timeRange: { start: context.timeRange.start, end: context.timeRange.end },\n };\n }\n\n const query = replaceVariables(spec.query, context.variableState);\n\n const client = (await context.datasourceStore.getDatasourceClient(\n spec.datasource ?? DEFAULT_DATASOURCE\n )) as ClickHouseClient;\n\n const { start, end } = context.timeRange;\n\n const response: ClickHouseQueryResponse = await client.query({\n start: start.getTime().toString(),\n end: end.getTime().toString(),\n query,\n });\n\n return {\n timeRange: { start, end },\n logs: convertStreamsToLogs(response.data),\n metadata: {\n executedQueryString: query,\n },\n };\n};\n"],"names":["replaceVariables","DEFAULT_DATASOURCE","flattenObject","obj","parentKey","result","key","value","Object","entries","newKey","Array","isArray","convertStreamsToLogs","streams","map","entry","flattened","Timestamp","log_time","sortedEntry","keys","sort","a","b","localeCompare","forEach","line","filter","undefined","join","timestamp","labels","totalCount","length","getClickHouseLogData","spec","context","query","logs","timeRange","start","end","variableState","client","datasourceStore","getDatasourceClient","datasource","response","getTime","toString","data","metadata","executedQueryString"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,gBAAgB,QAAQ,4BAA4B;AAI7D,SAASC,kBAAkB,QAAQ,eAAe;AAGlD,SAASC,cACPC,GAAwB,EACxBC,YAAY,EAAE,EACdC,SAA8B,CAAC,CAAC;IAEhC,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACN,KAAM;QAC9C,MAAMO,SAASN,YAAY,GAAGA,UAAU,CAAC,EAAEE,KAAK,GAAGA;QACnD,IAAIC,SAAS,OAAOA,UAAU,YAAY,CAACI,MAAMC,OAAO,CAACL,QAAQ;YAC/DL,cAAcK,OAAOG,QAAQL;QAC/B,OAAO;YACLA,MAAM,CAACK,OAAO,GAAGH;QACnB;IACF;IAEA,OAAOF;AACT;AAEA,SAASQ,qBAAqBC,OAAmB;IAC/C,MAAML,UAAsBK,QAAQC,GAAG,CAAC,CAACC;QACvC,MAAMC,YAAYf,cAAcc;QAEhC,IAAI,CAACC,UAAUC,SAAS,IAAID,UAAUE,QAAQ,EAAE;YAC9CF,UAAUC,SAAS,GAAGD,UAAUE,QAAQ;QAC1C;QAEA,MAAMC,cAAmC,CAAC;QAC1CZ,OAAOa,IAAI,CAACJ,WACTK,IAAI,C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AOC;QAAI;QACxBH,MAAM1B,qBAAqBmC,SAASG,IAAI;QACxCC,UAAU;YACRC,qBAAqBf;QACvB;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../src/queries/click-house-log-query/get-click-house-log-data.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { replaceVariables } from '@perses-dev/plugin-system';\nimport { LogEntry, LogData } from '@perses-dev/core';\nimport { ClickHouseClient, ClickHouseQueryResponse } from '../../model/click-house-client';\nimport { ClickHouseLogQuerySpec } from './click-house-log-query-types';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { LogQueryPlugin } from './log-query-plugin-interface';\n\nfunction flattenObject(\n obj: Record<string, any>,\n parentKey = '',\n result: Record<string, any> = {}\n): Record<string, any> {\n for (const [key, value] of Object.entries(obj)) {\n const newKey = parentKey ? `${parentKey}.${key}` : key;\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n flattenObject(value, newKey, result);\n } else {\n result[newKey] = value;\n }\n }\n\n return result;\n}\n\nfunction convertStreamsToLogs(streams: LogEntry[]): LogData {\n const entries: LogEntry[] = streams.map((entry) => {\n const flattened = flattenObject(entry);\n\n if (!flattened.Timestamp && flattened.log_time) {\n flattened.Timestamp = flattened.log_time;\n }\n\n const sortedEntry: Record<string, any> = {};\n Object.keys(flattened)\n .sort((a, b) => a.localeCompare(b))\n .forEach((key) => {\n sortedEntry[key] = flattened[key];\n });\n\n const line = Object.entries(sortedEntry)\n .filter(([key]) => key !== 'Timestamp')\n .map(([key, value]) => `<${key}> ${value === '' || value === null || value === undefined ? '--' : value}`)\n .join(' ');\n\n return {\n timestamp: sortedEntry?.Timestamp,\n labels: sortedEntry,\n line,\n } as LogEntry;\n });\n\n return {\n entries,\n totalCount: entries.length,\n };\n}\n\nexport const getClickHouseLogData: LogQueryPlugin<ClickHouseLogQuerySpec>['getLogData'] = async (spec, context) => {\n if (spec.query === undefined || spec.query === null || spec.query === '') {\n return {\n logs: { entries: [], totalCount: 0 },\n timeRange: { start: context.timeRange.start, end: context.timeRange.end },\n };\n }\n\n const query = replaceVariables(spec.query, context.variableState);\n\n const client = (await context.datasourceStore.getDatasourceClient(\n spec.datasource ?? DEFAULT_DATASOURCE\n )) as ClickHouseClient;\n\n const { start, end } = context.timeRange;\n\n const response: ClickHouseQueryResponse = await client.query({\n start: start.getTime().toString(),\n end: end.getTime().toString(),\n query,\n });\n\n return {\n timeRange: { start, end },\n logs: convertStreamsToLogs(response.data),\n metadata: {\n executedQueryString: query,\n },\n };\n};\n"],"names":["replaceVariables","DEFAULT_DATASOURCE","flattenObject","obj","parentKey","result","key","value","Object","entries","newKey","Array","isArray","convertStreamsToLogs","streams","map","entry","flattened","Timestamp","log_time","sortedEntry","keys","sort","a","b","localeCompare","forEach","line","filter","undefined","join","timestamp","labels","totalCount","length","getClickHouseLogData","spec","context","query","logs","timeRange","start","end","variableState","client","datasourceStore","getDatasourceClient","datasource","response","getTime","toString","data","metadata","executedQueryString"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,gBAAgB,QAAQ,4BAA4B;AAI7D,SAASC,kBAAkB,QAAQ,eAAe;AAGlD,SAASC,cACPC,GAAwB,EACxBC,YAAY,EAAE,EACdC,SAA8B,CAAC,CAAC;IAEhC,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CA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wB,YAAY;YAAE;YACnCO,WAAW;gBAAEC,OAAOJ,QAAQG,SAAS,CAACC,KAAK;gBAAEC,KAAKL,QAAQG,SAAS,CAACE,GAAG;YAAC;QAC1E;IACF;IAEA,MAAMJ,QAAQtC,iBAAiBoC,KAAKE,KAAK,EAAED,QAAQM,aAAa;IAEhE,MAAMC,SAAU,MAAMP,QAAQQ,eAAe,CAACC,mBAAmB,CAC/DV,KAAKW,UAAU,IAAI9C;IAGrB,MAAM,EAAEwC,KAAK,EAAEC,GAAG,EAAE,GAAGL,QAAQG,SAAS;IAExC,MAAMQ,WAAoC,MAAMJ,OAAON,KAAK,CAAC;QAC3DG,OAAOA,MAAMQ,OAAO,GAAGC,QAAQ;QAC/BR,KAAKA,IAAIO,OAAO,GAAGC,QAAQ;QAC3BZ;IACF;IAEA,OAAO;QACLE,WAAW;YAAEC;YAAOC;QAAI;QACxBH,MAAM1B,qBAAqBmC,SAASG,IAAI;QACxCC,UAAU;YACRC,qBAAqBf;QACvB;IACF;AACF,EAAE"}
@@ -1,8 +1,7 @@
1
- import { AbsoluteTimeRange, UnknownSpec } from '@perses-dev/core';
1
+ import { AbsoluteTimeRange, UnknownSpec, LogData } from '@perses-dev/core';
2
2
  import { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';
3
- import { LogsData } from '../../model/click-house-data-types';
4
3
  export interface LogQueryResult {
5
- logs: LogsData;
4
+ logs: LogData;
6
5
  timeRange: AbsoluteTimeRange;
7
6
  metadata?: {
8
7
  executedQueryString: string;
@@ -12,7 +11,6 @@ export interface ClickHouseQueryContext {
12
11
  timeRange: AbsoluteTimeRange;
13
12
  variableState: VariableStateMap;
14
13
  datasourceStore: DatasourceStore;
15
- refreshKey: string;
16
14
  }
17
15
  type LogQueryPluginDependencies = {
18
16
  variables?: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"log-query-plugin-interface.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-log-query/log-query-plugin-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,CAAC,EAAE;QACT,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,cAAc,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACtE,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACjF,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,KAAK,0BAA0B,CAAC;CACrF"}
1
+ {"version":3,"file":"log-query-plugin-interface.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-log-query/log-query-plugin-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,CAAC,EAAE;QACT,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,cAAc,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACtE,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACjF,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,KAAK,0BAA0B,CAAC;CACrF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/click-house-log-query/log-query-plugin-interface.ts"],"sourcesContent":["import { AbsoluteTimeRange, UnknownSpec } from '@perses-dev/core';\nimport { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';\nimport { LogsData } from '../../model/click-house-data-types';\n\nexport interface LogQueryResult {\n logs: LogsData;\n timeRange: AbsoluteTimeRange;\n metadata?: {\n executedQueryString: string;\n };\n}\n\nexport interface ClickHouseQueryContext {\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n refreshKey: string;\n}\n\ntype LogQueryPluginDependencies = {\n variables?: string[];\n};\n\nexport interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getLogData: (spec: Spec, ctx: ClickHouseQueryContext) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: ClickHouseQueryContext) => LogQueryPluginDependencies;\n}\n"],"names":[],"mappings":"AAuBA,WAGC"}
1
+ {"version":3,"sources":["../../../../src/queries/click-house-log-query/log-query-plugin-interface.ts"],"sourcesContent":["import { AbsoluteTimeRange, UnknownSpec, LogData } from '@perses-dev/core';\nimport { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';\n\nexport interface LogQueryResult {\n logs: LogData;\n timeRange: AbsoluteTimeRange;\n metadata?: {\n executedQueryString: string;\n };\n}\n\nexport interface ClickHouseQueryContext {\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n}\n\ntype LogQueryPluginDependencies = {\n variables?: string[];\n};\n\nexport interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getLogData: (spec: Spec, ctx: ClickHouseQueryContext) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: ClickHouseQueryContext) => LogQueryPluginDependencies;\n}\n"],"names":[],"mappings":"AAqBA,WAGC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ClickHouseQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAe,MAAM,OAAO,CAAC;AAElD,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAO1E,KAAK,oCAAoC,GAAG,kBAAkB,CAAC,6BAA6B,CAAC,CAAC;AAE9F,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,oCAAoC,GAAG,YAAY,CAoFzG"}
1
+ {"version":3,"file":"ClickHouseQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAe,MAAM,OAAO,CAAC;AAOlD,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAE1E,KAAK,oCAAoC,GAAG,kBAAkB,CAAC,6BAA6B,CAAC,CAAC;AAE9F,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,oCAAoC,GAAG,YAAY,CA2EzG"}
@@ -14,13 +14,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { DatasourceSelect, isVariableDatasource } from '@perses-dev/plugin-system';
15
15
  import { useCallback } from 'react';
16
16
  import { produce } from 'immer';
17
+ import { Stack } from '@mui/material';
17
18
  import { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';
18
19
  import { ClickQLEditor } from '../../components';
19
- import { Stack } from '@mui/material';
20
20
  import { queryExample } from '../../components/constants';
21
21
  import { useQueryState } from '../query-editor-model';
22
22
  export function ClickHouseTimeSeriesQueryEditor(props) {
23
- const { onChange, value, queryHandlerSettings } = props;
23
+ const { onChange, value } = props;
24
24
  const { datasource } = value;
25
25
  const selectedDatasource = datasource ?? DEFAULT_DATASOURCE;
26
26
  const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);
@@ -29,31 +29,20 @@ export function ClickHouseTimeSeriesQueryEditor(props) {
29
29
  onChange(produce(value, (draft)=>{
30
30
  draft.datasource = newDatasourceSelection;
31
31
  }));
32
- if (queryHandlerSettings?.setWatchOtherSpecs) queryHandlerSettings.setWatchOtherSpecs({
33
- ...value,
34
- datasource: newDatasourceSelection
35
- });
36
32
  return;
37
33
  }
38
34
  throw new Error('Got unexpected non ClickHouse datasource selection');
39
35
  };
40
36
  // Immediate query execution on Enter or blur
41
37
  const handleQueryExecute = (query)=>{
42
- if (queryHandlerSettings?.watchQueryChanges) {
43
- queryHandlerSettings.watchQueryChanges(query);
44
- }
45
38
  onChange(produce(value, (draft)=>{
46
39
  draft.query = query;
47
40
  }));
48
41
  };
49
42
  const handleClickHouseQueryChange = useCallback((e)=>{
50
43
  handleQueryChange(e);
51
- if (queryHandlerSettings?.watchQueryChanges) {
52
- queryHandlerSettings.watchQueryChanges(e);
53
- }
54
44
  }, [
55
- handleQueryChange,
56
- queryHandlerSettings
45
+ handleQueryChange
57
46
  ]);
58
47
  const examplesStyle = {
59
48
  fontSize: '11px',
@@ -78,7 +67,7 @@ export function ClickHouseTimeSeriesQueryEditor(props) {
78
67
  /*#__PURE__*/ _jsx(ClickQLEditor, {
79
68
  value: query,
80
69
  onChange: handleClickHouseQueryChange,
81
- onBlur: queryHandlerSettings?.runWithOnBlur ? handleQueryBlur : undefined,
70
+ onBlur: handleQueryBlur,
82
71
  onKeyDown: (event)=>{
83
72
  if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
84
73
  event.preventDefault();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQueryEditor.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n} from '@perses-dev/plugin-system';\nimport { ReactElement, useCallback } from 'react';\nimport { produce } from 'immer';\nimport { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { ClickQLEditor } from '../../components';\nimport { Stack } from '@mui/material';\nimport { queryExample } from '../../components/constants';\nimport { useQueryState } from '../query-editor-model';\n\ntype ClickHouseTimeSeriesQueryEditorProps = OptionsEditorProps<ClickHouseTimeSeriesQuerySpec>;\n\nexport function ClickHouseTimeSeriesQueryEditor(props: ClickHouseTimeSeriesQueryEditorProps): ReactElement {\n const { onChange, value, queryHandlerSettings } = props;\n const { datasource } = value;\n const selectedDatasource = datasource ?? DEFAULT_DATASOURCE;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n draft.datasource = newDatasourceSelection;\n })\n );\n\n if (queryHandlerSettings?.setWatchOtherSpecs)\n queryHandlerSettings.setWatchOtherSpecs({ ...value, datasource: newDatasourceSelection });\n return;\n }\n throw new Error('Got unexpected non ClickHouse datasource selection');\n };\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string) => {\n if (queryHandlerSettings?.watchQueryChanges) {\n queryHandlerSettings.watchQueryChanges(query);\n }\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleClickHouseQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n if (queryHandlerSettings?.watchQueryChanges) {\n queryHandlerSettings.watchQueryChanges(e);\n }\n },\n [handleQueryChange, queryHandlerSettings]\n );\n\n const examplesStyle: React.CSSProperties = {\n fontSize: '11px',\n color: '#777',\n backgroundColor: '#f5f5f5',\n padding: '8px',\n borderRadius: '4px',\n fontFamily: 'Monaco, Menlo, \"Ubuntu Mono\", monospace',\n whiteSpace: 'pre-wrap',\n lineHeight: '1.3',\n };\n\n return (\n <Stack spacing={1.5}>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"ClickHouse Datasource\"\n notched\n />\n <ClickQLEditor\n value={query}\n onChange={handleClickHouseQueryChange}\n onBlur={queryHandlerSettings?.runWithOnBlur ? handleQueryBlur : undefined}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\n placeholder=\"Enter ClickHouse SQL query\"\n />\n\n <details>\n <summary style={{ cursor: 'pointer', fontSize: '12px', color: '#666', marginBottom: '8px' }}>\n Query Examples\n </summary>\n <div style={examplesStyle}>{queryExample}</div>\n </details>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useCallback","produce","DATASOURCE_KIND","DEFAULT_DATASOURCE","ClickQLEditor","Stack","queryExample","useQueryState","ClickHouseTimeSeriesQueryEditor","props","onChange","value","queryHandlerSettings","datasource","selectedDatasource","query","handleQueryChange","handleQueryBlur","handleDatasourceChange","newDatasourceSelection","kind","draft","setWatchOtherSpecs","Error","handleQueryExecute","watchQueryChanges","handleClickHouseQueryChange","e","examplesStyle","fontSize","color","backgroundColor","padding","borderRadius","fontFamily","whiteSpace","lineHeight","spacing","datasourcePluginKind","label","notched","onBlur","runWithOnBlur","undefined","onKeyDown","event","key","ctrlKey","metaKey","preventDefault","placeholder","details","summary","style","cursor","marginBottom","div"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,QAEf,4BAA4B;AACnC,SAAuBC,WAAW,QAAQ,QAAQ;AAClD,SAASC,OAAO,QAAQ,QAAQ;AAEhC,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AACnE,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,YAAY,QAAQ,6BAA6B;AAC1D,SAASC,aAAa,QAAQ,wBAAwB;AAItD,OAAO,SAASC,gCAAgCC,KAA2C;IACzF,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,oBAAoB,EAAE,GAAGH;IAClD,MAAM,EAAEI,UAAU,EAAE,GAAGF;IACvB,MAAMG,qBAAqBD,cAAcV;IACzC,MAAM,EAAEY,KAAK,EA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BAGd,MAACC;;kCACC,KAACC;wBAAQC,OAAO;4BAAEC,QAAQ;4BAAWzB,UAAU;4BAAQC,OAAO;4BAAQyB,cAAc;wBAAM;kCAAG;;kCAG7F,KAACC;wBAAIH,OAAOzB;kCAAgBtB;;;;;;AAIpC"}
1
+ {"version":3,"sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQueryEditor.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n} from '@perses-dev/plugin-system';\nimport { ReactElement, useCallback } from 'react';\nimport { produce } from 'immer';\nimport { Stack } from '@mui/material';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { ClickQLEditor } from '../../components';\nimport { queryExample } from '../../components/constants';\nimport { useQueryState } from '../query-editor-model';\nimport { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';\n\ntype ClickHouseTimeSeriesQueryEditorProps = OptionsEditorProps<ClickHouseTimeSeriesQuerySpec>;\n\nexport function ClickHouseTimeSeriesQueryEditor(props: ClickHouseTimeSeriesQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const selectedDatasource = datasource ?? DEFAULT_DATASOURCE;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n draft.datasource = newDatasourceSelection;\n })\n );\n return;\n }\n throw new Error('Got unexpected non ClickHouse datasource selection');\n };\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string) => {\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleClickHouseQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\n );\n\n const examplesStyle: React.CSSProperties = {\n fontSize: '11px',\n color: '#777',\n backgroundColor: '#f5f5f5',\n padding: '8px',\n borderRadius: '4px',\n fontFamily: 'Monaco, Menlo, \"Ubuntu Mono\", monospace',\n whiteSpace: 'pre-wrap',\n lineHeight: '1.3',\n };\n\n return (\n <Stack spacing={1.5}>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"ClickHouse Datasource\"\n notched\n />\n <ClickQLEditor\n value={query}\n onChange={handleClickHouseQueryChange}\n onBlur={handleQueryBlur}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\n placeholder=\"Enter ClickHouse SQL query\"\n />\n\n <details>\n <summary style={{ cursor: 'pointer', fontSize: '12px', color: '#666', marginBottom: '8px' }}>\n Query Examples\n </summary>\n <div style={examplesStyle}>{queryExample}</div>\n </details>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useCallback","produce","Stack","DATASOURCE_KIND","DEFAULT_DATASOURCE","ClickQLEditor","queryExample","useQueryState","ClickHouseTimeSeriesQueryEditor","props","onChange","value","datasource","selectedDatasource","query","handleQueryChange","handleQueryBlur","handleDatasourceChange","newDatasourceSelection","kind","draft","Error","handleQueryExecute","handleClickHouseQueryChange","e","examplesStyle","fontSize","color","backgroundColor","padding","borderRadius","fontFamily","whiteSpace","lineHeight","spacing","datasourcePluginKind","label","notched","onBlur","onKeyDown","event","key","ctrlKey","metaKey","preventDefault","placeholder","details","summary","style","cursor","marginB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