@perses-dev/clickhouse-plugin 0.6.0 → 0.7.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/js/{ClickHouse.4e6199f7.js → ClickHouse.d554fc35.js} +4 -4
- package/__mf/js/async/1522.d8e80570.js +22 -0
- package/__mf/js/async/1616.8ee37fc2.js +1 -0
- package/__mf/js/async/2043.33c976ff.js +2 -0
- package/__mf/js/async/2650.27d5a53e.js +3 -0
- package/__mf/js/async/2901.98424a07.js +1 -0
- package/__mf/js/async/3181.7b46b8e9.js +2 -0
- package/__mf/js/async/392.54a0693e.js +2 -0
- package/__mf/js/async/3944.f70c2037.js +10 -0
- package/__mf/js/async/4077.5b0edb67.js +1 -0
- package/__mf/js/async/4121.0b653ee5.js +2 -0
- package/__mf/js/async/4496.23de7e47.js +1 -0
- package/__mf/js/async/4569.ffd2c654.js +7 -0
- package/__mf/js/async/{6155.1398a410.js.LICENSE.txt → 4569.ffd2c654.js.LICENSE.txt} +41 -1
- package/__mf/js/async/5002.2cee2f35.js +1 -0
- package/__mf/js/async/5071.fe3eb282.js +1 -0
- package/__mf/js/async/5440.6cfd6f26.js +2 -0
- package/__mf/js/async/5562.c5ce26e1.js +2 -0
- package/__mf/js/async/5587.9797bc5a.js +1 -0
- package/__mf/js/async/560.acc0c2d1.js +37 -0
- package/__mf/js/async/6045.93765a0a.js +1 -0
- package/__mf/js/async/6274.35dc924b.js +2 -0
- package/__mf/js/async/7192.f4e0055e.js +1 -0
- package/__mf/js/async/7862.306edb3f.js +2 -0
- package/__mf/js/async/7943.a43cb4a7.js +2 -0
- package/__mf/js/async/7968.a73d7acd.js +1 -0
- package/__mf/js/async/7978.e22f59c6.js +1 -0
- package/__mf/js/async/8356.d102e817.js +1 -0
- package/__mf/js/async/8470.4652ca18.js +2 -0
- package/__mf/js/async/873.cae3f07a.js +1 -0
- package/__mf/js/async/9001.0b1d67e2.js +102 -0
- package/__mf/js/async/9207.b184be58.js +1 -0
- package/__mf/js/async/9235.0aff6249.js +1 -0
- package/__mf/js/async/941.26e4a6ef.js +2 -0
- package/__mf/js/async/9588.a36eacf5.js +1 -0
- package/__mf/js/async/__federation_expose_ClickHouseDatasource.1eba91f6.js +2 -0
- package/__mf/js/async/__federation_expose_ClickHouseLogQuery.27676311.js +20 -0
- package/__mf/js/async/__federation_expose_ClickHouseTimeSeriesQuery.3d225a5d.js +20 -0
- package/__mf/js/{main.39993ad6.js → main.5353a8fc.js} +2 -2
- package/lib/bootstrap.js +2 -2
- package/lib/components/ClickQLEditor.d.ts +2 -2
- package/lib/components/ClickQLEditor.d.ts.map +1 -1
- package/lib/components/ClickQLEditor.js +3 -3
- package/lib/components/ClickQLEditor.js.map +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/datasources/click-house-datasource/ClickHouseDatasource.d.ts +2 -2
- package/lib/datasources/click-house-datasource/ClickHouseDatasource.d.ts.map +1 -1
- package/lib/datasources/click-house-datasource/ClickHouseDatasource.js +2 -2
- package/lib/datasources/click-house-datasource/ClickHouseDatasource.js.map +1 -1
- package/lib/datasources/click-house-datasource/ClickHouseDatasourceEditor.d.ts +2 -2
- package/lib/datasources/click-house-datasource/ClickHouseDatasourceEditor.d.ts.map +1 -1
- package/lib/datasources/click-house-datasource/ClickHouseDatasourceEditor.js +1 -1
- package/lib/datasources/click-house-datasource/ClickHouseDatasourceEditor.js.map +1 -1
- package/lib/datasources/click-house-datasource/click-house-datasource-types.d.ts +3 -3
- package/lib/datasources/click-house-datasource/click-house-datasource-types.d.ts.map +1 -1
- package/lib/datasources/click-house-datasource/click-house-datasource-types.js.map +1 -1
- package/lib/datasources/click-house-datasource/index.js +3 -3
- package/lib/datasources/click-house-datasource/index.js.map +1 -1
- package/lib/datasources/index.js +1 -1
- package/lib/datasources/index.js.map +1 -1
- package/lib/getPluginModule.d.ts +1 -1
- package/lib/getPluginModule.d.ts.map +1 -1
- package/lib/getPluginModule.js +3 -1
- package/lib/getPluginModule.js.map +1 -1
- package/lib/index-federation.js +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/model/click-house-client.d.ts +1 -1
- package/lib/model/click-house-client.d.ts.map +1 -1
- package/lib/model/click-house-client.js +3 -1
- package/lib/model/click-house-client.js.map +1 -1
- package/lib/model/click-house-data-types.d.ts +1 -1
- package/lib/model/click-house-data-types.d.ts.map +1 -1
- package/lib/model/click-house-data-types.js.map +1 -1
- package/lib/queries/click-house-log-query/ClickHouseLogQuery.d.ts +2 -2
- package/lib/queries/click-house-log-query/ClickHouseLogQuery.d.ts.map +1 -1
- package/lib/queries/click-house-log-query/ClickHouseLogQuery.js +4 -6
- package/lib/queries/click-house-log-query/ClickHouseLogQuery.js.map +1 -1
- package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.d.ts +3 -3
- package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.d.ts.map +1 -1
- package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.js +9 -9
- package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.js.map +1 -1
- package/lib/queries/click-house-log-query/click-house-log-query-types.d.ts +1 -1
- package/lib/queries/click-house-log-query/click-house-log-query-types.d.ts.map +1 -1
- package/lib/queries/click-house-log-query/click-house-log-query-types.js.map +1 -1
- package/lib/queries/click-house-log-query/get-click-house-log-data.d.ts +2 -2
- package/lib/queries/click-house-log-query/get-click-house-log-data.d.ts.map +1 -1
- package/lib/queries/click-house-log-query/get-click-house-log-data.js +4 -4
- package/lib/queries/click-house-log-query/get-click-house-log-data.js.map +1 -1
- package/lib/queries/click-house-log-query/index.js +4 -4
- package/lib/queries/click-house-log-query/index.js.map +1 -1
- package/lib/queries/click-house-time-series-query/ClickHouseQuery.d.ts +2 -2
- package/lib/queries/click-house-time-series-query/ClickHouseQuery.d.ts.map +1 -1
- package/lib/queries/click-house-time-series-query/ClickHouseQuery.js +4 -6
- package/lib/queries/click-house-time-series-query/ClickHouseQuery.js.map +1 -1
- package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.d.ts +3 -3
- package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.d.ts.map +1 -1
- package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.js +9 -9
- package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.js.map +1 -1
- package/lib/queries/click-house-time-series-query/click-house-query-types.d.ts +1 -1
- package/lib/queries/click-house-time-series-query/click-house-query-types.d.ts.map +1 -1
- package/lib/queries/click-house-time-series-query/click-house-query-types.js.map +1 -1
- package/lib/queries/click-house-time-series-query/get-click-house-data.d.ts +2 -2
- package/lib/queries/click-house-time-series-query/get-click-house-data.d.ts.map +1 -1
- package/lib/queries/click-house-time-series-query/get-click-house-data.js +5 -5
- package/lib/queries/click-house-time-series-query/get-click-house-data.js.map +1 -1
- package/lib/queries/click-house-time-series-query/index.js +4 -4
- package/lib/queries/click-house-time-series-query/index.js.map +1 -1
- package/lib/queries/index.js +2 -2
- package/lib/queries/index.js.map +1 -1
- package/lib/queries/query-editor-model.d.ts +1 -1
- package/lib/queries/query-editor-model.d.ts.map +1 -1
- package/lib/queries/query-editor-model.js +2 -2
- package/lib/queries/query-editor-model.js.map +1 -1
- package/lib/setup-tests.d.ts +1 -1
- package/lib/setup-tests.d.ts.map +1 -1
- package/lib/setup-tests.js +2 -2
- package/lib/setup-tests.js.map +1 -1
- package/mf-manifest.json +69 -98
- package/mf-stats.json +69 -102
- package/package.json +21 -13
- package/__mf/js/async/1616.c86fdd40.js +0 -1
- package/__mf/js/async/1728.a4ac7d54.js +0 -1
- package/__mf/js/async/1811.29b51780.js +0 -101
- package/__mf/js/async/1825.299edaf9.js +0 -1
- package/__mf/js/async/1969.ea0bd5b9.js +0 -1
- package/__mf/js/async/2043.13379b9d.js +0 -2
- package/__mf/js/async/2386.56de292b.js +0 -2
- package/__mf/js/async/3059.3d9dad23.js +0 -1
- package/__mf/js/async/3181.f3124eab.js +0 -2
- package/__mf/js/async/392.c8af2244.js +0 -2
- package/__mf/js/async/3981.9bd5679b.js +0 -3
- package/__mf/js/async/4121.b6afa425.js +0 -2
- package/__mf/js/async/4233.abbba3f6.js +0 -7
- package/__mf/js/async/4233.abbba3f6.js.LICENSE.txt +0 -39
- package/__mf/js/async/5002.9167d87e.js +0 -1
- package/__mf/js/async/5071.a039a221.js +0 -1
- package/__mf/js/async/5440.898ddc2f.js +0 -2
- package/__mf/js/async/5481.223427f5.js +0 -2
- package/__mf/js/async/5562.d4359565.js +0 -2
- package/__mf/js/async/5587.72383e00.js +0 -1
- package/__mf/js/async/599.e213c21c.js +0 -1
- package/__mf/js/async/6045.9b807b97.js +0 -1
- package/__mf/js/async/6155.1398a410.js +0 -2
- package/__mf/js/async/6274.22bd6f34.js +0 -2
- package/__mf/js/async/6688.abdc25f6.js +0 -2
- package/__mf/js/async/7177.96ff5c4d.js +0 -1
- package/__mf/js/async/7192.c1f998d2.js +0 -1
- package/__mf/js/async/7968.ae66f60b.js +0 -1
- package/__mf/js/async/7978.a58ed5ff.js +0 -1
- package/__mf/js/async/7984.549ad1a9.js +0 -22
- package/__mf/js/async/8356.eda63865.js +0 -1
- package/__mf/js/async/8470.3ae4fba1.js +0 -2
- package/__mf/js/async/873.e4ddcabf.js +0 -1
- package/__mf/js/async/9235.aeb9d818.js +0 -1
- package/__mf/js/async/941.11ea3ddf.js +0 -2
- package/__mf/js/async/9588.d09a1141.js +0 -1
- package/__mf/js/async/9754.9ea7778b.js +0 -10
- package/__mf/js/async/9836.75f99110.js +0 -1
- package/__mf/js/async/9877.8f08e12a.js +0 -38
- package/__mf/js/async/__federation_expose_ClickHouseDatasource.0e124aef.js +0 -2
- package/__mf/js/async/__federation_expose_ClickHouseLogQuery.605ad0d2.js +0 -20
- package/__mf/js/async/__federation_expose_ClickHouseTimeSeriesQuery.a7927056.js +0 -20
- package/__mf/js/async/__federation_expose_ClickHouseTimeSeriesQuery.a7927056.js.LICENSE.txt +0 -9
- package/lib/cjs/bootstrap.js +0 -26
- package/lib/cjs/components/ClickQLEditor.js +0 -72
- package/lib/cjs/components/constants.js +0 -41
- package/lib/cjs/components/index.js +0 -30
- package/lib/cjs/datasources/click-house-datasource/ClickHouseDatasource.js +0 -49
- package/lib/cjs/datasources/click-house-datasource/ClickHouseDatasourceEditor.js +0 -51
- package/lib/cjs/datasources/click-house-datasource/click-house-datasource-types.js +0 -16
- package/lib/cjs/datasources/click-house-datasource/index.js +0 -32
- package/lib/cjs/datasources/index.js +0 -30
- package/lib/cjs/env.d.js +0 -14
- package/lib/cjs/getPluginModule.js +0 -39
- package/lib/cjs/index-federation.js +0 -55
- package/lib/cjs/index.js +0 -38
- package/lib/cjs/model/click-house-client.js +0 -83
- package/lib/cjs/model/click-house-data-types.js +0 -16
- package/lib/cjs/queries/click-house-log-query/ClickHouseLogQuery.js +0 -45
- package/lib/cjs/queries/click-house-log-query/ClickHouseLogQueryEditor.js +0 -104
- package/lib/cjs/queries/click-house-log-query/click-house-log-query-types.js +0 -16
- package/lib/cjs/queries/click-house-log-query/get-click-house-log-data.js +0 -93
- package/lib/cjs/queries/click-house-log-query/index.js +0 -33
- package/lib/cjs/queries/click-house-time-series-query/ClickHouseQuery.js +0 -43
- package/lib/cjs/queries/click-house-time-series-query/ClickHouseQueryEditor.js +0 -104
- package/lib/cjs/queries/click-house-time-series-query/click-house-query-types.js +0 -16
- package/lib/cjs/queries/click-house-time-series-query/get-click-house-data.js +0 -116
- package/lib/cjs/queries/click-house-time-series-query/index.js +0 -33
- package/lib/cjs/queries/constants.js +0 -34
- package/lib/cjs/queries/index.js +0 -31
- package/lib/cjs/queries/query-editor-model.js +0 -53
- package/lib/cjs/setup-tests.js +0 -19
- /package/__mf/css/async/{4233.85c2cbf6.css → 4569.85c2cbf6.css} +0 -0
- /package/__mf/js/async/{7984.549ad1a9.js.LICENSE.txt → 1522.d8e80570.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2043.13379b9d.js.LICENSE.txt → 2043.33c976ff.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2386.56de292b.js.LICENSE.txt → 3181.7b46b8e9.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.c8af2244.js.LICENSE.txt → 392.54a0693e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{9754.9ea7778b.js.LICENSE.txt → 3944.f70c2037.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4121.b6afa425.js.LICENSE.txt → 4121.0b653ee5.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5440.898ddc2f.js.LICENSE.txt → 5440.6cfd6f26.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3181.f3124eab.js.LICENSE.txt → 5562.c5ce26e1.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6274.22bd6f34.js.LICENSE.txt → 6274.35dc924b.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5481.223427f5.js.LICENSE.txt → 7862.306edb3f.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5562.d4359565.js.LICENSE.txt → 7943.a43cb4a7.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{8470.3ae4fba1.js.LICENSE.txt → 8470.4652ca18.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6688.abdc25f6.js.LICENSE.txt → 941.26e4a6ef.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.11ea3ddf.js.LICENSE.txt → __federation_expose_ClickHouseDatasource.1eba91f6.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_ClickHouseDatasource.0e124aef.js.LICENSE.txt → __federation_expose_ClickHouseLogQuery.27676311.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_ClickHouseLogQuery.605ad0d2.js.LICENSE.txt → __federation_expose_ClickHouseTimeSeriesQuery.3d225a5d.js.LICENSE.txt} +0 -0
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { replaceVariables } from
|
|
14
|
-
import { formatClickHouseDateTime, replaceTimeRangePlaceholders } from
|
|
15
|
-
import { DEFAULT_DATASOURCE } from
|
|
13
|
+
import { replaceVariables } from "@perses-dev/plugin-system";
|
|
14
|
+
import { formatClickHouseDateTime, replaceTimeRangePlaceholders } from "../../model/click-house-client.js";
|
|
15
|
+
import { DEFAULT_DATASOURCE } from "../constants.js";
|
|
16
16
|
function flattenObject(obj, parentKey = '', result = {}) {
|
|
17
17
|
for (const [key, value] of Object.entries(obj)){
|
|
18
18
|
const newKey = parentKey ? `${parentKey}.${key}` : key;
|
|
@@ -31,7 +31,7 @@ function convertStreamsToLogs(streams) {
|
|
|
31
31
|
flattened['Timestamp'] = flattened['log_time'];
|
|
32
32
|
}
|
|
33
33
|
const sortedEntry = {};
|
|
34
|
-
Object.keys(flattened).
|
|
34
|
+
Object.keys(flattened).toSorted((a, b)=>a.localeCompare(b)).forEach((key)=>{
|
|
35
35
|
sortedEntry[key] = flattened[key];
|
|
36
36
|
});
|
|
37
37
|
const line = Object.entries(sortedEntry).filter(([key])=>key !== 'Timestamp').map(([key, value])=>`<${key}> ${value === '' || value === null || value === undefined ? '--' : value}`).join(' ');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/click-house-log-query/get-click-house-log-data.ts"],"sourcesContent":["// Copyright 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 {
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/click-house-log-query/get-click-house-log-data.ts"],"sourcesContent":["// Copyright 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 type { LogQueryPlugin } from '@perses-dev/plugin-system';\nimport { replaceVariables } from '@perses-dev/plugin-system';\nimport type { LogData, LogEntry } from '@perses-dev/spec';\n\nimport type { ClickHouseClient, ClickHouseQueryResponse } from '../../model/click-house-client';\nimport { formatClickHouseDateTime, replaceTimeRangePlaceholders } from '../../model/click-house-client';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport type { ClickHouseLogQuerySpec } from './click-house-log-query-types';\n\nfunction flattenObject(\n obj: Record<string, unknown>,\n parentKey = '',\n result: Record<string, unknown> = {},\n): Record<string, unknown> {\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 as Record<string, unknown>, 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 as unknown as Record<string, unknown>);\n\n if (!flattened['Timestamp'] && flattened['log_time']) {\n flattened['Timestamp'] = flattened['log_time'];\n }\n\n const sortedEntry: Record<string, unknown> = {};\n Object.keys(flattened)\n .toSorted((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'] as unknown as number,\n labels: sortedEntry as Record<string, string>,\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 const startTime = formatClickHouseDateTime(start);\n const endTime = formatClickHouseDateTime(end);\n const executedQueryString = replaceTimeRangePlaceholders(query, startTime, endTime);\n\n const response: ClickHouseQueryResponse = await client.query({\n start: startTime,\n end: endTime,\n query: executedQueryString,\n });\n\n return {\n timeRange: { start, end },\n logs: convertStreamsToLogs(response.data as LogEntry[]),\n metadata: {\n executedQueryString,\n },\n };\n};\n"],"names":["replaceVariables","formatClickHouseDateTime","replaceTimeRangePlaceholders","DEFAULT_DATASOURCE","flattenObject","obj","parentKey","result","key","value","Object","entries","newKey","Array","isArray","convertStreamsToLogs","streams","map","entry","flattened","sortedEntry","keys","toSorted","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","startTime","endTime","executedQueryString","response","data","metadata"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,gBAAgB,QAAQ,4BAA4B;AAI7D,SAASC,wBAAwB,EAAEC,4BAA4B,QAAQ,oCAAiC;AACxG,SAASC,kBAAkB,QAAQ,kBAAe;AAGlD,SAASC,cACPC,GAA4B,EAC5BC,YAAY,EAAE,EACdC,SAAkC,CAAC,CAAC;IAEpC,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,OAAkCG,QAAQL;QAC1D,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,SAAS,CAAC,YAAY,IAAIA,SAAS,CAAC,WAAW,EAAE;YACpDA,SAAS,CAAC,YAAY,GAAGA,SAAS,CAAC,WAAW;QAChD;QAEA,MAAMC,cAAuC,CAAC;QAC9CV,OAAOW,IAAI,CAACF,WACTG,QAAQ,CAAC,CAACC,GAAGC,IAAMD,EAAEE,aAAa,CAACD,IACnCE,OAAO,CAAC,CAAClB;YACRY,WAAW,CAACZ,IAAI,GAAGW,SAAS,CAACX,IAAI;QACnC;QAEF,MAAMmB,OAAOjB,OAAOC,OAAO,CAACS,aACzBQ,MAAM,CAAC,CAAC,CAACpB,IAAI,GAAKA,QAAQ,aAC1BS,GAAG,CAAC,CAAC,CAACT,KAAKC,MAAM,GAAK,CAAC,CAAC,EAAED,IAAI,EAAE,EAAEC,UAAU,MAAMA,UAAU,QAAQA,UAAUoB,YAAY,OAAOpB,OAAO,EACxGqB,IAAI,CAAC;QAER,OAAO;YACLC,WAAWX,aAAa,CAAC,YAAY;YACrCY,QAAQZ;YACRO;QACF;IACF;IAEA,OAAO;QACLhB;QACAsB,YAAYtB,QAAQuB,MAAM;IAC5B;AACF;AAEA,OAAO,MAAMC,uBAA6E,OAAOC,MAAMC;IACrG,IAAID,KAAKE,KAAK,KAAKT,aAAaO,KAAKE,KAAK,KAAK,QAAQF,KAAKE,KAAK,KAAK,IAAI;QACxE,OAAO;YACLC,MAAM;gBAAE5B,SAAS,EAAE;gBAAEsB,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,IAAI5C;IAGrB,MAAM,EAAEsC,KAAK,EAAEC,GAAG,EAAE,GAAGL,QAAQG,SAAS;IACxC,MAAMQ,YAAY/C,yBAAyBwC;IAC3C,MAAMQ,UAAUhD,yBAAyByC;IACzC,MAAMQ,sBAAsBhD,6BAA6BoC,OAAOU,WAAWC;IAE3E,MAAME,WAAoC,MAAMP,OAAON,KAAK,CAAC;QAC3DG,OAAOO;QACPN,KAAKO;QACLX,OAAOY;IACT;IAEA,OAAO;QACLV,WAAW;YAAEC;YAAOC;QAAI;QACxBH,MAAMxB,qBAAqBoC,SAASC,IAAI;QACxCC,UAAU;YACRH;QACF;IACF;AACF,EAAE"}
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
13
|
+
export * from "./ClickHouseLogQuery.js";
|
|
14
|
+
export * from "./ClickHouseLogQueryEditor.js";
|
|
15
|
+
export * from "./get-click-house-log-data.js";
|
|
16
|
+
export * from "./click-house-log-query-types.js";
|
|
17
17
|
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/click-house-log-query/index.ts"],"sourcesContent":["// Copyright 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 * from './ClickHouseLogQuery';\nexport * from './ClickHouseLogQueryEditor';\nexport * from './get-click-house-log-data';\nexport * from './click-house-log-query-types';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/click-house-log-query/index.ts"],"sourcesContent":["// Copyright 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 * from './ClickHouseLogQuery';\nexport * from './ClickHouseLogQueryEditor';\nexport * from './get-click-house-log-data';\nexport * from './click-house-log-query-types';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,0BAAuB;AACrC,cAAc,gCAA6B;AAC3C,cAAc,gCAA6B;AAC3C,cAAc,mCAAgC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
|
|
2
|
-
import { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';
|
|
1
|
+
import type { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
|
|
2
|
+
import type { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';
|
|
3
3
|
export declare const ClickHouseTimeSeriesQuery: TimeSeriesQueryPlugin<ClickHouseTimeSeriesQuerySpec>;
|
|
4
4
|
//# sourceMappingURL=ClickHouseQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickHouseQuery.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQuery.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"ClickHouseQuery.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQuery.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAI/E,eAAO,MAAM,yBAAyB,EAAE,qBAAqB,CAAC,6BAA6B,CAW1F,CAAC"}
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { parseVariables } from
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
13
|
+
import { parseVariables } from "@perses-dev/plugin-system";
|
|
14
|
+
import { ClickHouseTimeSeriesQueryEditor } from "./ClickHouseQueryEditor.js";
|
|
15
|
+
import { getTimeSeriesData } from "./get-click-house-data.js";
|
|
16
16
|
export const ClickHouseTimeSeriesQuery = {
|
|
17
17
|
getTimeSeriesData,
|
|
18
18
|
OptionsEditorComponent: ClickHouseTimeSeriesQueryEditor,
|
|
@@ -22,9 +22,7 @@ export const ClickHouseTimeSeriesQuery = {
|
|
|
22
22
|
dependsOn: (spec)=>{
|
|
23
23
|
const queryVariables = parseVariables(spec.query);
|
|
24
24
|
const allVariables = [
|
|
25
|
-
...new Set(
|
|
26
|
-
...queryVariables
|
|
27
|
-
])
|
|
25
|
+
...new Set(queryVariables)
|
|
28
26
|
];
|
|
29
27
|
return {
|
|
30
28
|
variables: allVariables
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQuery.tsx"],"sourcesContent":["// Copyright 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 { TimeSeriesQueryPlugin
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQuery.tsx"],"sourcesContent":["// Copyright 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 type { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';\nimport { parseVariables } from '@perses-dev/plugin-system';\n\nimport type { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';\nimport { ClickHouseTimeSeriesQueryEditor } from './ClickHouseQueryEditor';\nimport { getTimeSeriesData } from './get-click-house-data';\n\nexport const ClickHouseTimeSeriesQuery: TimeSeriesQueryPlugin<ClickHouseTimeSeriesQuerySpec> = {\n getTimeSeriesData,\n OptionsEditorComponent: ClickHouseTimeSeriesQueryEditor,\n createInitialOptions: () => ({ query: '' }),\n dependsOn: (spec) => {\n const queryVariables = parseVariables(spec.query);\n const allVariables = [...new Set(queryVariables)];\n return {\n variables: allVariables,\n };\n },\n};\n"],"names":["parseVariables","ClickHouseTimeSeriesQueryEditor","getTimeSeriesData","ClickHouseTimeSeriesQuery","OptionsEditorComponent","createInitialOptions","query","dependsOn","spec","queryVariables","allVariables","Set","variables"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,cAAc,QAAQ,4BAA4B;AAG3D,SAASC,+BAA+B,QAAQ,6BAA0B;AAC1E,SAASC,iBAAiB,QAAQ,4BAAyB;AAE3D,OAAO,MAAMC,4BAAkF;IAC7FD;IACAE,wBAAwBH;IACxBI,sBAAsB,IAAO,CAAA;YAAEC,OAAO;QAAG,CAAA;IACzCC,WAAW,CAACC;QACV,MAAMC,iBAAiBT,eAAeQ,KAAKF,KAAK;QAChD,MAAMI,eAAe;eAAI,IAAIC,IAAIF;SAAgB;QACjD,OAAO;YACLG,WAAWF;QACb;IACF;AACF,EAAE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OptionsEditorProps } from '@perses-dev/plugin-system';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
3
|
-
import { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';
|
|
1
|
+
import type { OptionsEditorProps } from '@perses-dev/plugin-system';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
import type { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';
|
|
4
4
|
type ClickHouseTimeSeriesQueryEditorProps = OptionsEditorProps<ClickHouseTimeSeriesQuerySpec>;
|
|
5
5
|
export declare function ClickHouseTimeSeriesQueryEditor(props: ClickHouseTimeSeriesQueryEditorProps): ReactElement;
|
|
6
6
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickHouseQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQueryEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClickHouseQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQueryEditor.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAyB,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAE/E,KAAK,oCAAoC,GAAG,kBAAkB,CAAC,6BAA6B,CAAC,CAAC;AAE9F,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,oCAAoC,GAAG,YAAY,CAsEzG"}
|
|
@@ -11,15 +11,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { useQueryState } from
|
|
14
|
+
import { Stack } from "@mui/material";
|
|
15
|
+
import { createModEnterHandler } from "@perses-dev/dashboards";
|
|
16
|
+
import { DatasourceSelect, isVariableDatasource } from "@perses-dev/plugin-system";
|
|
17
|
+
import { produce } from "immer";
|
|
18
|
+
import { useCallback } from "react";
|
|
19
|
+
import { ClickQLEditor } from "../../components/index.js";
|
|
20
|
+
import { queryExample } from "../../components/constants.js";
|
|
21
|
+
import { DATASOURCE_KIND, DEFAULT_DATASOURCE } from "../constants.js";
|
|
22
|
+
import { useQueryState } from "../query-editor-model.js";
|
|
23
23
|
export function ClickHouseTimeSeriesQueryEditor(props) {
|
|
24
24
|
const { onChange, value } = props;
|
|
25
25
|
const { datasource } = value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQueryEditor.tsx"],"sourcesContent":["// Copyright 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 {
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQueryEditor.tsx"],"sourcesContent":["// Copyright 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 { Stack } from '@mui/material';\nimport { createModEnterHandler } from '@perses-dev/dashboards';\nimport type { DatasourceSelectProps, OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { DatasourceSelect, isVariableDatasource } from '@perses-dev/plugin-system';\nimport { produce } from 'immer';\nimport type { ReactElement } from 'react';\nimport { useCallback } from 'react';\n\nimport { ClickQLEditor } from '../../components';\nimport { queryExample } from '../../components/constants';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { useQueryState } from '../query-editor-model';\nimport type { 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): void => {\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={createModEnterHandler(() => handleQueryExecute(query))}\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":["Stack","createModEnterHandler","DatasourceSelect","isVariableDatasource","produce","useCallback","ClickQLEditor","queryExample","DATASOURCE_KIND","DEFAULT_DATASOURCE","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","placeholder","details","summary","style","cursor","marginBottom","div"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,QAAQ,gBAAgB;AACtC,SAASC,qBAAqB,QAAQ,yBAAyB;AAE/D,SAASC,gBAAgB,EAAEC,oBAAoB,QAAQ,4BAA4B;AACnF,SAASC,OAAO,QAAQ,QAAQ;AAEhC,SAASC,WAAW,QAAQ,QAAQ;AAEpC,SAASC,aAAa,QAAQ,4BAAmB;AACjD,SAASC,YAAY,QAAQ,gCAA6B;AAC1D,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,kBAAe;AACnE,SAASC,aAAa,QAAQ,2BAAwB;AAKtD,OAAO,SAASC,gCAAgCC,KAA2C;IACzF,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAE,GAAGD;IACvB,MAAME,qBAAqBD,cAAcN;IACzC,MAAM,EAAEQ,KAAK,EAAEC,iBAAiB,EAAEC,eAAe,EAAE,GAAGT,cAAcE;IAEpE,MAAMQ,yBAA4D,CAACC;QACjE,IAAI,CAAClB,qBAAqBkB,2BAA2BA,uBAAuBC,IAAI,KAAKd,iBAAiB;YACpGK,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,8BAA8BrB,YAClC,CAACsB;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,MAACpC;QAAMqC,SAAS;;0BACd,KAACnC;gBACCoC,sBAAsB9B;gBACtBM,OAAOE;gBACPH,UAAUO;gBACVmB,OAAM;gBACNC,OAAO;;0BAET,KAAClC;gBACCQ,OAAOG;gBACPJ,UAAUa;gBACVe,QAAQtB;gBACRuB,WAAWzC,sBAAsB,IAAMwB,mBAAmBR;gBAC1D0B,aAAY;;0BAGd,MAACC;;kCACC,KAACC;wBAAQC,OAAO;4BAAEC,QAAQ;4BAAWlB,UAAU;4BAAQC,OAAO;4BAAQkB,cAAc;wBAAM;kCAAG;;kCAG7F,KAACC;wBAAIH,OAAOlB;kCAAgBrB;;;;;;AAIpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"click-house-query-types.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/click-house-query-types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"click-house-query-types.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/click-house-query-types.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC;AAGD,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/click-house-time-series-query/click-house-query-types.ts"],"sourcesContent":["// Copyright 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 { DatasourceSelector } from '@perses-dev/spec';\n\nexport interface ClickHouseTimeSeriesQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n}\n\n// TODO: import this type from your datasource or an existing datasource plugin\nexport type DatasourceQueryResponse = {\n status: string;\n data: unknown;\n warnings?: string[];\n};\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AASjC,+EAA+E;AAC/E,WAIE"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/click-house-time-series-query/click-house-query-types.ts"],"sourcesContent":["// Copyright 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 type { DatasourceSelector } from '@perses-dev/spec';\n\nexport interface ClickHouseTimeSeriesQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n}\n\n// TODO: import this type from your datasource or an existing datasource plugin\nexport type DatasourceQueryResponse = {\n status: string;\n data: unknown;\n warnings?: string[];\n};\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AASjC,+EAA+E;AAC/E,WAIE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
|
|
2
|
-
import { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';
|
|
1
|
+
import type { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
|
|
2
|
+
import type { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';
|
|
3
3
|
export declare const getTimeSeriesData: TimeSeriesQueryPlugin<ClickHouseTimeSeriesQuerySpec>['getTimeSeriesData'];
|
|
4
4
|
//# sourceMappingURL=get-click-house-data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-click-house-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/get-click-house-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"get-click-house-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/get-click-house-data.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAQvE,OAAO,KAAK,EAAE,6BAA6B,EAA2B,MAAM,2BAA2B,CAAC;AAiFxG,eAAO,MAAM,iBAAiB,EAAE,qBAAqB,CAAC,6BAA6B,CAAC,CAAC,mBAAmB,CAiCvG,CAAC"}
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { replaceVariables } from
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
13
|
+
import { replaceVariables } from "@perses-dev/plugin-system";
|
|
14
|
+
import { formatClickHouseDateTime, replaceTimeRangePlaceholders } from "../../model/click-house-client.js";
|
|
15
|
+
import { DEFAULT_DATASOURCE } from "../constants.js";
|
|
16
16
|
const DEFAULT_STEP_MS = 30 * 1000;
|
|
17
17
|
function buildTimeSeries(response) {
|
|
18
18
|
const data = response?.data;
|
|
@@ -47,7 +47,7 @@ function inferStepMs(response) {
|
|
|
47
47
|
if (!response || !data || data.length < 2) {
|
|
48
48
|
return DEFAULT_STEP_MS;
|
|
49
49
|
}
|
|
50
|
-
const timestamps = data.map((row)=>new Date(row.time).getTime()).filter(Number.isFinite).
|
|
50
|
+
const timestamps = data.map((row)=>new Date(row.time).getTime()).filter(Number.isFinite).toSorted((a, b)=>a - b);
|
|
51
51
|
if (timestamps.length < 2) {
|
|
52
52
|
return DEFAULT_STEP_MS;
|
|
53
53
|
}
|
|
@@ -67,7 +67,7 @@ function inferStepMs(response) {
|
|
|
67
67
|
for (const delta of deltas){
|
|
68
68
|
deltaCounts.set(delta, (deltaCounts.get(delta) ?? 0) + 1);
|
|
69
69
|
}
|
|
70
|
-
const inferredStep = Array.from(deltaCounts.entries()).
|
|
70
|
+
const inferredStep = Array.from(deltaCounts.entries()).toSorted(([deltaA, countA], [deltaB, countB])=>{
|
|
71
71
|
if (countA !== countB) {
|
|
72
72
|
return countB - countA;
|
|
73
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/click-house-time-series-query/get-click-house-data.ts"],"sourcesContent":["// Copyright 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 { TimeSeriesQueryPlugin
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/click-house-time-series-query/get-click-house-data.ts"],"sourcesContent":["// Copyright 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 type { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';\nimport { replaceVariables } from '@perses-dev/plugin-system';\nimport type { TimeSeries } from '@perses-dev/spec';\n\nimport type { ClickHouseClient, ClickHouseQueryResponse } from '../../model/click-house-client';\nimport { formatClickHouseDateTime, replaceTimeRangePlaceholders } from '../../model/click-house-client';\nimport type { TimeSeriesEntry } from '../../model/click-house-data-types';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport type { ClickHouseTimeSeriesQuerySpec, DatasourceQueryResponse } from './click-house-query-types';\n\nconst DEFAULT_STEP_MS = 30 * 1000;\n\nfunction buildTimeSeries(response?: DatasourceQueryResponse): TimeSeries[] {\n const data = response?.data as TimeSeriesEntry[];\n if (!response || !data || data.length === 0) {\n return [];\n }\n\n const metricNames = Object.keys(data[0] ?? {}).filter((key) => key !== 'time');\n\n return metricNames\n .map((metricName) => {\n const values: Array<[number, number | null]> = data.map((row: TimeSeriesEntry) => {\n const timestamp = new Date(row.time).getTime();\n const value = toTimeSeriesValue(row[metricName]);\n return [timestamp, value];\n });\n\n return {\n name: metricName,\n values,\n };\n })\n .filter((series) => series.values.some(([, value]) => value !== null));\n}\n\nfunction toTimeSeriesValue(value: number | string | null | undefined): number | null {\n if (value === null || value === undefined || value === '') {\n return null;\n }\n\n const numericValue = Number(value);\n return Number.isFinite(numericValue) ? numericValue : null;\n}\n\nfunction inferStepMs(response?: DatasourceQueryResponse): number {\n const data = response?.data as TimeSeriesEntry[];\n if (!response || !data || data.length < 2) {\n return DEFAULT_STEP_MS;\n }\n\n const timestamps = data\n .map((row: TimeSeriesEntry) => new Date(row.time).getTime())\n .filter(Number.isFinite)\n .toSorted((a, b) => a - b);\n\n if (timestamps.length < 2) {\n return DEFAULT_STEP_MS;\n }\n\n const deltas: number[] = [];\n for (let i = 1; i < timestamps.length; i++) {\n const previous = timestamps[i - 1];\n const current = timestamps[i];\n if (previous === undefined || current === undefined || current <= previous) {\n continue;\n }\n deltas.push(current - previous);\n }\n\n if (deltas.length === 0) {\n return DEFAULT_STEP_MS;\n }\n\n const deltaCounts = new Map<number, number>();\n for (const delta of deltas) {\n deltaCounts.set(delta, (deltaCounts.get(delta) ?? 0) + 1);\n }\n\n const inferredStep = Array.from(deltaCounts.entries()).toSorted(([deltaA, countA], [deltaB, countB]) => {\n if (countA !== countB) {\n return countB - countA;\n }\n return deltaB - deltaA;\n })[0]?.[0];\n\n return inferredStep ?? DEFAULT_STEP_MS;\n}\n\nexport const getTimeSeriesData: TimeSeriesQueryPlugin<ClickHouseTimeSeriesQuerySpec>['getTimeSeriesData'] = async (\n spec,\n context,\n) => {\n if (spec.query === undefined || spec.query === null || spec.query === '') {\n return { series: [] };\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 const startTime = formatClickHouseDateTime(start);\n const endTime = formatClickHouseDateTime(end);\n const executedQueryString = replaceTimeRangePlaceholders(query, startTime, endTime);\n\n const response: ClickHouseQueryResponse = await client.query({\n start: startTime,\n end: endTime,\n query: executedQueryString,\n });\n\n return {\n series: buildTimeSeries(response),\n timeRange: { start, end },\n stepMs: inferStepMs(response),\n metadata: {\n executedQueryString,\n },\n };\n};\n"],"names":["replaceVariables","formatClickHouseDateTime","replaceTimeRangePlaceholders","DEFAULT_DATASOURCE","DEFAULT_STEP_MS","buildTimeSeries","response","data","length","metricNames","Object","keys","filter","key","map","metricName","values","row","timestamp","Date","time","getTime","value","toTimeSeriesValue","name","series","some","undefined","numericValue","Number","isFinite","inferStepMs","timestamps","toSorted","a","b","deltas","i","previous","current","push","deltaCounts","Map","delta","set","get","inferredStep","Array","from","entries","deltaA","countA","deltaB","countB","getTimeSeriesData","spec","context","query","variableState","client","datasourceStore","getDatasourceClient","datasource","start","end","timeRange","startTime","endTime","executedQueryString","stepMs","metadata"],"mappings":"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"}
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
13
|
+
export * from "./get-click-house-data.js";
|
|
14
|
+
export * from "./ClickHouseQuery.js";
|
|
15
|
+
export * from "./ClickHouseQueryEditor.js";
|
|
16
|
+
export * from "./click-house-query-types.js";
|
|
17
17
|
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/click-house-time-series-query/index.ts"],"sourcesContent":["// Copyright 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 * from './get-click-house-data';\nexport * from './ClickHouseQuery';\nexport * from './ClickHouseQueryEditor';\nexport * from './click-house-query-types';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/click-house-time-series-query/index.ts"],"sourcesContent":["// Copyright 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 * from './get-click-house-data';\nexport * from './ClickHouseQuery';\nexport * from './ClickHouseQueryEditor';\nexport * from './click-house-query-types';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,4BAAyB;AACvC,cAAc,uBAAoB;AAClC,cAAc,6BAA0B;AACxC,cAAc,+BAA4B"}
|
package/lib/queries/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
13
|
+
export * from "./click-house-time-series-query/index.js";
|
|
14
|
+
export * from "./click-house-log-query/index.js";
|
|
15
15
|
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
package/lib/queries/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/queries/index.ts"],"sourcesContent":["// Copyright 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 * from './click-house-time-series-query';\nexport * from './click-house-log-query';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../../src/queries/index.ts"],"sourcesContent":["// Copyright 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 * from './click-house-time-series-query';\nexport * from './click-house-log-query';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,2CAAkC;AAChD,cAAc,mCAA0B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-editor-model.d.ts","sourceRoot":"","sources":["../../../src/queries/query-editor-model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"query-editor-model.d.ts","sourceRoot":"","sources":["../../../src/queries/query-editor-model.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAIpE;;GAEG;AACH,KAAK,mBAAmB,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,mBAAmB,EACzD,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC3B;IACD,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CA+BA"}
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { produce } from "immer";
|
|
14
|
+
import { useState } from "react";
|
|
15
15
|
/**
|
|
16
16
|
* A hook for managing the `query` state in ClickHouse query specs. Returns the `query` value, along with
|
|
17
17
|
* `onChange` and `onBlur` event handlers to the input. Keeps a local copy of the user's input and only syncs those
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/queries/query-editor-model.ts"],"sourcesContent":["// Copyright 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 {
|
|
1
|
+
{"version":3,"sources":["../../../src/queries/query-editor-model.ts"],"sourcesContent":["// Copyright 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 type { OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { produce } from 'immer';\nimport { useState } from 'react';\n\n/**\n * Generic type for any ClickHouse query spec that has a query field\n */\ntype ClickHouseQuerySpec = {\n query?: string;\n};\n\n/**\n * A hook for managing the `query` state in ClickHouse query specs. Returns the `query` value, along with\n * `onChange` and `onBlur` event handlers to the input. Keeps a local copy of the user's input and only syncs those\n * changes with the overall spec value once the input is blurred to prevent re-running queries in the panel's preview\n * every time the user types.\n */\nexport function useQueryState<T extends ClickHouseQuerySpec>(\n props: OptionsEditorProps<T>,\n): {\n query: string;\n handleQueryChange: (e: string) => void;\n handleQueryBlur: () => void;\n} {\n const { onChange, value } = props;\n\n // Local copy of the query's value\n const [query, setQuery] = useState(value.query || '');\n\n // This is basically \"getDerivedStateFromProps\" to make sure if spec's value changes external to this component,\n // we render with the latest value\n const [lastSyncedQuery, setLastSyncedQuery] = useState(value.query);\n if (value.query !== lastSyncedQuery) {\n setQuery(value.query || '');\n setLastSyncedQuery(value.query);\n }\n\n // Update our local state's copy as the user types\n const handleQueryChange = (e: string): void => {\n setQuery(e);\n };\n\n // Propagate changes to the query's value when the input is blurred to avoid constantly re-running queries in the\n // PanelPreview\n const handleQueryBlur = (): void => {\n setLastSyncedQuery(query);\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n }),\n );\n };\n\n return { query, handleQueryChange, handleQueryBlur };\n}\n"],"names":["produce","useState","useQueryState","props","onChange","value","query","setQuery","lastSyncedQuery","setLastSyncedQuery","handleQueryChange","e","handleQueryBlur","draft"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,OAAO,QAAQ,QAAQ;AAChC,SAASC,QAAQ,QAAQ,QAAQ;AASjC;;;;;CAKC,GACD,OAAO,SAASC,cACdC,KAA4B;IAM5B,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAE5B,kCAAkC;IAClC,MAAM,CAACG,OAAOC,SAAS,GAAGN,SAASI,MAAMC,KAAK,IAAI;IAElD,gHAAgH;IAChH,kCAAkC;IAClC,MAAM,CAACE,iBAAiBC,mBAAmB,GAAGR,SAASI,MAAMC,KAAK;IAClE,IAAID,MAAMC,KAAK,KAAKE,iBAAiB;QACnCD,SAASF,MAAMC,KAAK,IAAI;QACxBG,mBAAmBJ,MAAMC,KAAK;IAChC;IAEA,kDAAkD;IAClD,MAAMI,oBAAoB,CAACC;QACzBJ,SAASI;IACX;IAEA,iHAAiH;IACjH,eAAe;IACf,MAAMC,kBAAkB;QACtBH,mBAAmBH;QACnBF,SACEJ,QAAQK,OAAO,CAACQ;YACdA,MAAMP,KAAK,GAAGA;QAChB;IAEJ;IAEA,OAAO;QAAEA;QAAOI;QAAmBE;IAAgB;AACrD"}
|
package/lib/setup-tests.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|
|
2
2
|
//# sourceMappingURL=setup-tests.d.ts.map
|
package/lib/setup-tests.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,
|
|
1
|
+
{"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,kCAAkC,CAAC"}
|
package/lib/setup-tests.js
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import
|
|
13
|
+
import "@testing-library/jest-dom/vitest";
|
|
14
14
|
// Always mock e-charts during tests since we don't have a proper canvas in jsdom
|
|
15
|
-
|
|
15
|
+
vi.mock('echarts/core');
|
|
16
16
|
|
|
17
17
|
//# sourceMappingURL=setup-tests.js.map
|
package/lib/setup-tests.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/setup-tests.ts"],"sourcesContent":["// Copyright 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 '@testing-library/jest-dom';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\
|
|
1
|
+
{"version":3,"sources":["../../src/setup-tests.ts"],"sourcesContent":["// Copyright 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 '@testing-library/jest-dom/vitest';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\nvi.mock('echarts/core');\n"],"names":["vi","mock"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,mCAAmC;AAE1C,iFAAiF;AACjFA,GAAGC,IAAI,CAAC"}
|