@perses-dev/victorialogs-plugin 0.4.0 → 0.5.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/{VictoriaLogs.db5cc46b.js → VictoriaLogs.a8769935.js} +3 -3
- package/__mf/js/async/1522.952455c8.js +22 -0
- package/__mf/js/async/1616.5bfbc6c9.js +1 -0
- package/__mf/js/async/198.0747c3c4.js +2 -0
- package/__mf/js/async/2043.15dfcaf2.js +2 -0
- package/__mf/js/async/2377.becaacc4.js +1 -0
- package/__mf/js/async/2650.a7bdaf49.js +3 -0
- package/__mf/js/async/2786.f183253f.js +2 -0
- package/__mf/js/async/2901.d2d83345.js +1 -0
- package/__mf/js/async/392.e0ccad9b.js +2 -0
- package/__mf/js/async/4077.5440638f.js +1 -0
- package/__mf/js/async/4121.e0b41fa2.js +2 -0
- package/__mf/js/async/4248.2c62b66c.js +1 -0
- package/__mf/js/async/4496.46c01862.js +1 -0
- package/__mf/js/async/4960.fd41e601.js +2 -0
- package/__mf/js/async/5019.6f35fcfe.js +1 -0
- package/__mf/js/async/5071.dbccdae6.js +1 -0
- package/__mf/js/async/5440.5a93fae0.js +2 -0
- package/__mf/js/async/5587.5e3cc249.js +1 -0
- package/__mf/js/async/560.56b83614.js +37 -0
- package/__mf/js/async/5623.f2841bc8.js +1 -0
- package/__mf/js/async/5650.8e02c19d.js +7 -0
- package/__mf/js/async/{5405.004a286a.js.LICENSE.txt → 5650.8e02c19d.js.LICENSE.txt} +41 -1
- package/__mf/js/async/5706.4665b04a.js +1 -0
- package/__mf/js/async/6274.05a0c6f1.js +2 -0
- package/__mf/js/async/6854.88725ad0.js +1 -0
- package/__mf/js/async/7192.34127278.js +1 -0
- package/__mf/js/async/7740.802c9257.js +101 -0
- package/__mf/js/async/7817.63122fff.js +2 -0
- package/__mf/js/async/7862.5530d38c.js +2 -0
- package/__mf/js/async/7873.1ef3480e.js +2 -0
- package/__mf/js/async/7968.960f80da.js +1 -0
- package/__mf/js/async/7978.1899f369.js +1 -0
- package/__mf/js/async/8356.21af7a90.js +1 -0
- package/__mf/js/async/8470.b2bd6ab1.js +2 -0
- package/__mf/js/async/873.42d5c5c0.js +1 -0
- package/__mf/js/async/9207.f6612692.js +1 -0
- package/__mf/js/async/9235.2e62d2f5.js +1 -0
- package/__mf/js/async/941.3d0f5a01.js +2 -0
- package/__mf/js/async/9440.ddd37afc.js +10 -0
- package/__mf/js/async/9588.96579f82.js +1 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsDatasource.03128f7e.js +2 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsFieldNamesVariable.0ceb2243.js +2 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsFieldValuesVariable.72183be9.js +2 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsLogQuery.916adf8b.js +1 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsTimeSeriesQuery.1f986674.js +1 -0
- package/__mf/js/{main.0d99a16b.js → main.7c22713c.js} +2 -2
- package/lib/bootstrap.js +2 -2
- package/lib/components/index.js +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/components/logsql-editor.d.ts +2 -2
- package/lib/components/logsql-editor.d.ts.map +1 -1
- package/lib/components/logsql-editor.js +4 -4
- package/lib/components/logsql-editor.js.map +1 -1
- package/lib/components/logsql-extension.d.ts +1 -1
- package/lib/components/logsql-extension.d.ts.map +1 -1
- package/lib/components/logsql-extension.js +3 -3
- package/lib/components/logsql-extension.js.map +1 -1
- package/lib/components/logsql-highlight.js +1 -1
- package/lib/datasources/index.js +1 -1
- package/lib/datasources/index.js.map +1 -1
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasource.d.ts +3 -3
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasource.d.ts.map +1 -1
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasource.js +2 -2
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasource.js.map +1 -1
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.d.ts +2 -2
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.d.ts.map +1 -1
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.js +1 -1
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.js.map +1 -1
- package/lib/datasources/victorialogs-datasource/index.js +3 -3
- package/lib/datasources/victorialogs-datasource/index.js.map +1 -1
- package/lib/datasources/victorialogs-datasource/types.d.ts +1 -1
- package/lib/datasources/victorialogs-datasource/types.d.ts.map +1 -1
- package/lib/datasources/victorialogs-datasource/types.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 +4 -4
- package/lib/index.js.map +1 -1
- package/lib/model/client.d.ts +1 -1
- package/lib/model/client.d.ts.map +1 -1
- package/lib/model/client.js.map +1 -1
- package/lib/model/index.js +3 -3
- package/lib/model/index.js.map +1 -1
- package/lib/model/selectors.d.ts +2 -2
- package/lib/model/selectors.d.ts.map +1 -1
- package/lib/model/selectors.js +1 -1
- package/lib/model/selectors.js.map +1 -1
- package/lib/queries/index.js +2 -2
- package/lib/queries/index.js.map +1 -1
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.d.ts +2 -2
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.d.ts.map +1 -1
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.js +4 -6
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.js.map +1 -1
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.d.ts +3 -3
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.d.ts.map +1 -1
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.js +7 -7
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.js.map +1 -1
- package/lib/queries/victorialogs-log-query/index.js +4 -4
- package/lib/queries/victorialogs-log-query/index.js.map +1 -1
- package/lib/queries/victorialogs-log-query/query.d.ts +2 -2
- package/lib/queries/victorialogs-log-query/query.d.ts.map +1 -1
- package/lib/queries/victorialogs-log-query/query.js +2 -2
- package/lib/queries/victorialogs-log-query/query.js.map +1 -1
- package/lib/queries/victorialogs-log-query/types.d.ts +1 -1
- package/lib/queries/victorialogs-log-query/types.d.ts.map +1 -1
- package/lib/queries/victorialogs-log-query/types.js.map +1 -1
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.d.ts +2 -2
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.d.ts.map +1 -1
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.js +4 -6
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.js.map +1 -1
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.d.ts +3 -3
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.d.ts.map +1 -1
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.js +7 -7
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.js.map +1 -1
- package/lib/queries/victorialogs-time-series-query/index.js +4 -4
- package/lib/queries/victorialogs-time-series-query/index.js.map +1 -1
- package/lib/queries/victorialogs-time-series-query/query.d.ts +2 -2
- package/lib/queries/victorialogs-time-series-query/query.d.ts.map +1 -1
- package/lib/queries/victorialogs-time-series-query/query.js +4 -4
- package/lib/queries/victorialogs-time-series-query/query.js.map +1 -1
- package/lib/queries/victorialogs-time-series-query/types.d.ts +1 -1
- package/lib/queries/victorialogs-time-series-query/types.d.ts.map +1 -1
- package/lib/queries/victorialogs-time-series-query/types.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/lib/variables/index.js +2 -2
- package/lib/variables/index.js.map +1 -1
- package/lib/variables/types.d.ts +2 -2
- package/lib/variables/types.d.ts.map +1 -1
- package/lib/variables/types.js.map +1 -1
- package/lib/variables/utils.d.ts +5 -5
- package/lib/variables/utils.d.ts.map +1 -1
- package/lib/variables/utils.js +2 -2
- package/lib/variables/utils.js.map +1 -1
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.d.ts +2 -2
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.d.ts.map +1 -1
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.js +4 -4
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.js.map +1 -1
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.d.ts +3 -3
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.d.ts.map +1 -1
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.js +5 -5
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.js.map +1 -1
- package/lib/variables/victorialogs-field-names/index.js +1 -1
- package/lib/variables/victorialogs-field-names/index.js.map +1 -1
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.d.ts +2 -2
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.d.ts.map +1 -1
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.js +4 -4
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.js.map +1 -1
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.d.ts +3 -3
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.d.ts.map +1 -1
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.js +6 -6
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.js.map +1 -1
- package/lib/variables/victorialogs-field-values/index.js +1 -1
- package/lib/variables/victorialogs-field-values/index.js.map +1 -1
- package/mf-manifest.json +140 -192
- package/mf-stats.json +140 -196
- package/package.json +20 -12
- package/__mf/js/async/1170.532d9fb3.js +0 -101
- package/__mf/js/async/1616.5a6b8ab3.js +0 -1
- package/__mf/js/async/1728.b01c38aa.js +0 -1
- package/__mf/js/async/1969.fc35e1b4.js +0 -1
- package/__mf/js/async/198.fbb67f8a.js +0 -2
- package/__mf/js/async/2043.b149adfd.js +0 -2
- package/__mf/js/async/2377.9265b0a7.js +0 -1
- package/__mf/js/async/2728.fd6779e6.js +0 -1
- package/__mf/js/async/2749.71c38fe0.js +0 -2
- package/__mf/js/async/2842.3740ca9b.js +0 -1
- package/__mf/js/async/3059.fe1cdfc3.js +0 -1
- package/__mf/js/async/392.c6e57bd8.js +0 -2
- package/__mf/js/async/3981.02c66856.js +0 -3
- package/__mf/js/async/3998.e9a3cf1a.js +0 -2
- package/__mf/js/async/4121.5468ac01.js +0 -2
- package/__mf/js/async/4225.744952e9.js +0 -10
- package/__mf/js/async/4248.9b99209c.js +0 -1
- package/__mf/js/async/5019.51d94aab.js +0 -1
- package/__mf/js/async/5071.6ac86637.js +0 -1
- package/__mf/js/async/5405.004a286a.js +0 -2
- package/__mf/js/async/5440.7765ad14.js +0 -2
- package/__mf/js/async/5481.b7b48b8f.js +0 -2
- package/__mf/js/async/5587.12959dbf.js +0 -1
- package/__mf/js/async/5706.55b9ef2f.js +0 -1
- package/__mf/js/async/6274.0634d636.js +0 -2
- package/__mf/js/async/6408.2bc7e8f4.js +0 -7
- package/__mf/js/async/6408.2bc7e8f4.js.LICENSE.txt +0 -39
- package/__mf/js/async/6410.63a88be6.js +0 -1
- package/__mf/js/async/6592.24e266ac.js +0 -1
- package/__mf/js/async/6854.21ddded3.js +0 -1
- package/__mf/js/async/6864.66bc6315.js +0 -2
- package/__mf/js/async/7177.dfbac40a.js +0 -1
- package/__mf/js/async/7192.339adba2.js +0 -1
- package/__mf/js/async/7793.43841fdc.js +0 -1
- package/__mf/js/async/7817.5e96b0dd.js +0 -2
- package/__mf/js/async/7968.d586d9f8.js +0 -1
- package/__mf/js/async/7978.895bbb5f.js +0 -1
- package/__mf/js/async/7984.194982d6.js +0 -22
- package/__mf/js/async/8356.053c21d0.js +0 -1
- package/__mf/js/async/8470.cb89de3b.js +0 -2
- package/__mf/js/async/873.4df0ea19.js +0 -1
- package/__mf/js/async/8787.c3298397.js +0 -2
- package/__mf/js/async/9235.3e1de7b9.js +0 -1
- package/__mf/js/async/941.a44f722e.js +0 -2
- package/__mf/js/async/9588.c379dd44.js +0 -1
- package/__mf/js/async/9836.fd9de3af.js +0 -1
- package/__mf/js/async/9877.8b83de3c.js +0 -38
- package/__mf/js/async/9944.4d41cb7b.js +0 -1
- package/__mf/js/async/__federation_expose_VictoriaLogsDatasource.807ae747.js +0 -2
- package/__mf/js/async/__federation_expose_VictoriaLogsFieldNamesVariable.ccafeb36.js +0 -1
- package/__mf/js/async/__federation_expose_VictoriaLogsFieldValuesVariable.5e29c327.js +0 -1
- package/__mf/js/async/__federation_expose_VictoriaLogsLogQuery.6e607640.js +0 -1
- package/__mf/js/async/__federation_expose_VictoriaLogsTimeSeriesQuery.91a8ad9d.js +0 -1
- package/lib/cjs/bootstrap.js +0 -26
- package/lib/cjs/components/index.js +0 -23
- package/lib/cjs/components/logsql-editor.js +0 -110
- package/lib/cjs/components/logsql-extension.js +0 -55
- package/lib/cjs/components/logsql-highlight.js +0 -40
- package/lib/cjs/datasources/index.js +0 -30
- package/lib/cjs/datasources/victorialogs-datasource/VictoriaLogsDatasource.js +0 -61
- package/lib/cjs/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.js +0 -95
- package/lib/cjs/datasources/victorialogs-datasource/index.js +0 -32
- package/lib/cjs/datasources/victorialogs-datasource/types.js +0 -16
- 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 -39
- package/lib/cjs/model/client.js +0 -156
- package/lib/cjs/model/index.js +0 -32
- package/lib/cjs/model/selectors.js +0 -47
- package/lib/cjs/model/types.js +0 -16
- package/lib/cjs/queries/constants.js +0 -34
- package/lib/cjs/queries/index.js +0 -31
- package/lib/cjs/queries/victorialogs-log-query/VictoriaLogsLogQuery.js +0 -63
- package/lib/cjs/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.js +0 -114
- package/lib/cjs/queries/victorialogs-log-query/index.js +0 -33
- package/lib/cjs/queries/victorialogs-log-query/query.js +0 -73
- package/lib/cjs/queries/victorialogs-log-query/types.js +0 -16
- package/lib/cjs/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.js +0 -43
- package/lib/cjs/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.js +0 -112
- package/lib/cjs/queries/victorialogs-time-series-query/index.js +0 -33
- package/lib/cjs/queries/victorialogs-time-series-query/query.js +0 -126
- package/lib/cjs/queries/victorialogs-time-series-query/types.js +0 -16
- package/lib/cjs/setup-tests.js +0 -19
- package/lib/cjs/variables/index.js +0 -31
- package/lib/cjs/variables/types.js +0 -16
- package/lib/cjs/variables/utils.js +0 -97
- package/lib/cjs/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.js +0 -57
- package/lib/cjs/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.js +0 -80
- package/lib/cjs/variables/victorialogs-field-names/index.js +0 -30
- package/lib/cjs/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.js +0 -61
- package/lib/cjs/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.js +0 -113
- package/lib/cjs/variables/victorialogs-field-values/index.js +0 -30
- /package/__mf/css/async/{6408.85c2cbf6.css → 5650.85c2cbf6.css} +0 -0
- /package/__mf/js/async/{7984.194982d6.js.LICENSE.txt → 1522.952455c8.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{198.fbb67f8a.js.LICENSE.txt → 198.0747c3c4.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2043.b149adfd.js.LICENSE.txt → 2043.15dfcaf2.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{2749.71c38fe0.js.LICENSE.txt → 2786.f183253f.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.c6e57bd8.js.LICENSE.txt → 392.e0ccad9b.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4121.5468ac01.js.LICENSE.txt → 4121.e0b41fa2.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3998.e9a3cf1a.js.LICENSE.txt → 4960.fd41e601.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5440.7765ad14.js.LICENSE.txt → 5440.5a93fae0.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6274.0634d636.js.LICENSE.txt → 6274.05a0c6f1.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6864.66bc6315.js.LICENSE.txt → 7817.63122fff.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5481.b7b48b8f.js.LICENSE.txt → 7862.5530d38c.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{8470.cb89de3b.js.LICENSE.txt → 8470.b2bd6ab1.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{7817.5e96b0dd.js.LICENSE.txt → 941.3d0f5a01.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4225.744952e9.js.LICENSE.txt → 9440.ddd37afc.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{8787.c3298397.js.LICENSE.txt → __federation_expose_VictoriaLogsDatasource.03128f7e.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.a44f722e.js.LICENSE.txt → __federation_expose_VictoriaLogsFieldNamesVariable.0ceb2243.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_VictoriaLogsDatasource.807ae747.js.LICENSE.txt → __federation_expose_VictoriaLogsFieldValuesVariable.72183be9.js.LICENSE.txt} +0 -0
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "VictoriaLogsQueryEditor", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return VictoriaLogsQueryEditor;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
-
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
25
|
-
const _material = require("@mui/material");
|
|
26
|
-
const _react = require("react");
|
|
27
|
-
const _dashboards = require("@perses-dev/dashboards");
|
|
28
|
-
const _logsqleditor = require("../../components/logsql-editor");
|
|
29
|
-
const _model = require("../../model");
|
|
30
|
-
const _constants = require("../constants");
|
|
31
|
-
function VictoriaLogsQueryEditor(props) {
|
|
32
|
-
const { onChange, value } = props;
|
|
33
|
-
const { datasource } = value;
|
|
34
|
-
const datasourceSelectValue = datasource ?? _constants.DEFAULT_DATASOURCE;
|
|
35
|
-
const selectedDatasource = (0, _pluginsystem.useDatasourceSelectValueToSelector)(datasourceSelectValue, _model.VICTORIALOGS_DATASOURCE_KIND);
|
|
36
|
-
// Local state for editor value to prevent query_range calls on every keystroke
|
|
37
|
-
const [localQuery, setLocalQuery] = (0, _react.useState)(value.query);
|
|
38
|
-
// Update local state when prop changes
|
|
39
|
-
(0, _react.useEffect)(()=>{
|
|
40
|
-
setLocalQuery(value.query);
|
|
41
|
-
}, [
|
|
42
|
-
value.query
|
|
43
|
-
]);
|
|
44
|
-
const handleDatasourceChange = (newDatasourceSelection)=>{
|
|
45
|
-
if (!(0, _pluginsystem.isVariableDatasource)(newDatasourceSelection) && newDatasourceSelection.kind === _constants.DATASOURCE_KIND) {
|
|
46
|
-
onChange({
|
|
47
|
-
...value,
|
|
48
|
-
datasource: newDatasourceSelection
|
|
49
|
-
});
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
throw new Error('Got unexpected non VictoriaLogsQuery datasource selection');
|
|
53
|
-
};
|
|
54
|
-
// Debounced query change handler to prevent excessive query_range calls
|
|
55
|
-
const handleQueryChange = (0, _react.useCallback)((newQuery)=>{
|
|
56
|
-
setLocalQuery(newQuery);
|
|
57
|
-
}, []);
|
|
58
|
-
// Immediate query execution on Enter or blur
|
|
59
|
-
const handleQueryExecute = (0, _react.useCallback)((query)=>{
|
|
60
|
-
onChange({
|
|
61
|
-
...value,
|
|
62
|
-
query
|
|
63
|
-
});
|
|
64
|
-
}, [
|
|
65
|
-
onChange,
|
|
66
|
-
value
|
|
67
|
-
]);
|
|
68
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
69
|
-
spacing: 1.5,
|
|
70
|
-
paddingBottom: 1,
|
|
71
|
-
children: [
|
|
72
|
-
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
73
|
-
children: [
|
|
74
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputLabel, {
|
|
75
|
-
sx: {
|
|
76
|
-
display: 'block',
|
|
77
|
-
marginBottom: '4px',
|
|
78
|
-
fontWeight: 500
|
|
79
|
-
},
|
|
80
|
-
children: "Datasource"
|
|
81
|
-
}),
|
|
82
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
|
|
83
|
-
datasourcePluginKind: _constants.DATASOURCE_KIND,
|
|
84
|
-
value: selectedDatasource,
|
|
85
|
-
onChange: handleDatasourceChange,
|
|
86
|
-
label: "VictoriaLogs Datasource",
|
|
87
|
-
notched: true
|
|
88
|
-
})
|
|
89
|
-
]
|
|
90
|
-
}),
|
|
91
|
-
/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
|
92
|
-
children: [
|
|
93
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputLabel, {
|
|
94
|
-
sx: {
|
|
95
|
-
display: 'block',
|
|
96
|
-
marginBottom: '4px',
|
|
97
|
-
fontWeight: 500
|
|
98
|
-
},
|
|
99
|
-
children: "LogsQL Query"
|
|
100
|
-
}),
|
|
101
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_logsqleditor.LogsQLEditor, {
|
|
102
|
-
value: localQuery,
|
|
103
|
-
onChange: handleQueryChange,
|
|
104
|
-
onBlur: ()=>handleQueryExecute(localQuery),
|
|
105
|
-
onKeyDown: (0, _dashboards.createModEnterHandler)(()=>handleQueryExecute(localQuery)),
|
|
106
|
-
placeholder: 'Enter LogsQL query (e.g. {job="mysql"} |= "error")'
|
|
107
|
-
})
|
|
108
|
-
]
|
|
109
|
-
})
|
|
110
|
-
]
|
|
111
|
-
});
|
|
112
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
_export_star(require("./query"), exports);
|
|
18
|
-
_export_star(require("./VictoriaLogsTimeSeriesQuery"), exports);
|
|
19
|
-
_export_star(require("./VictoriaLogsTimeSeriesQueryEditor"), exports);
|
|
20
|
-
_export_star(require("./types"), exports);
|
|
21
|
-
function _export_star(from, to) {
|
|
22
|
-
Object.keys(from).forEach(function(k) {
|
|
23
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
24
|
-
Object.defineProperty(to, k, {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function() {
|
|
27
|
-
return from[k];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return from;
|
|
33
|
-
}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "getVictoriaLogsTimeSeriesData", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return getVictoriaLogsTimeSeriesData;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
24
|
-
const _datefns = require("date-fns");
|
|
25
|
-
const _spec = require("@perses-dev/spec");
|
|
26
|
-
const _constants = require("../constants");
|
|
27
|
-
// Constants for VictoriaLogs step calculation
|
|
28
|
-
const MAX_VICTORIALOGS_DATA_POINTS = 10000; // Similar to Prometheus
|
|
29
|
-
const DEFAULT_MIN_STEP_SECONDS = 15; // 15 seconds default minimum
|
|
30
|
-
/**
|
|
31
|
-
* Converts a duration string (like "15s", "1m") to seconds
|
|
32
|
-
*/ function getDurationStringSeconds(durationString) {
|
|
33
|
-
if (!durationString) return undefined;
|
|
34
|
-
const duration = (0, _spec.parseDurationString)(durationString);
|
|
35
|
-
const ms = (0, _datefns.milliseconds)(duration);
|
|
36
|
-
return Math.floor(ms / 1000);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Calculates appropriate step for VictoriaLogs range queries
|
|
40
|
-
*/ function getVictoriaLogsRangeStep(startMs, endMs, minStepSeconds = DEFAULT_MIN_STEP_SECONDS, suggestedStepMs = 0) {
|
|
41
|
-
const suggestedStepSeconds = suggestedStepMs / 1000;
|
|
42
|
-
const querySeconds = (endMs - startMs) / 1000;
|
|
43
|
-
let safeStep = querySeconds / MAX_VICTORIALOGS_DATA_POINTS;
|
|
44
|
-
if (safeStep > 1) {
|
|
45
|
-
safeStep = Math.ceil(safeStep);
|
|
46
|
-
}
|
|
47
|
-
return Math.max(suggestedStepSeconds, minStepSeconds, safeStep);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Formats step in seconds as a duration string for VictoriaLogs API
|
|
51
|
-
*/ function formatStepForVictoriaLogs(stepSeconds) {
|
|
52
|
-
if (stepSeconds < 60) {
|
|
53
|
-
return `${Math.round(stepSeconds)}s`;
|
|
54
|
-
} else if (stepSeconds < 3600) {
|
|
55
|
-
return `${Math.round(stepSeconds / 60)}m`;
|
|
56
|
-
} else {
|
|
57
|
-
return `${Math.round(stepSeconds / 3600)}h`;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function convertMatrixToTimeSeries(matrix) {
|
|
61
|
-
return matrix.map((series)=>{
|
|
62
|
-
const labels = {
|
|
63
|
-
...series.metric
|
|
64
|
-
};
|
|
65
|
-
delete labels._stream;
|
|
66
|
-
delete labels.__name__;
|
|
67
|
-
if (series.metric._stream) {
|
|
68
|
-
const match = series.metric._stream.match(/{([^}]+)}/);
|
|
69
|
-
if (match && match[1]) {
|
|
70
|
-
match[1].split(',').forEach((labelPair)=>{
|
|
71
|
-
const [key, val] = labelPair.split('=').map((s)=>s.trim().replace(/^"|"$/g, ''));
|
|
72
|
-
if (key && val) labels[key] = val;
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
const name = Object.entries(labels).map(([k, v])=>`${k}=${v}`).join(', ');
|
|
77
|
-
return {
|
|
78
|
-
name: name,
|
|
79
|
-
values: series.values.map(([timestamp, value])=>[
|
|
80
|
-
Number(timestamp) * 1000,
|
|
81
|
-
Number(value)
|
|
82
|
-
]),
|
|
83
|
-
labels
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
const getVictoriaLogsTimeSeriesData = async (spec, context)=>{
|
|
88
|
-
if (!spec.query) {
|
|
89
|
-
return {
|
|
90
|
-
series: [],
|
|
91
|
-
timeRange: {
|
|
92
|
-
start: context.timeRange.start,
|
|
93
|
-
end: context.timeRange.end
|
|
94
|
-
},
|
|
95
|
-
stepMs: DEFAULT_MIN_STEP_SECONDS * 1000
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
const query = (0, _pluginsystem.replaceVariables)(spec.query, context.variableState);
|
|
99
|
-
const client = await context.datasourceStore.getDatasourceClient(spec.datasource ?? _constants.DEFAULT_DATASOURCE);
|
|
100
|
-
const { start, end } = context.timeRange;
|
|
101
|
-
const minStepSeconds = spec.step ? getDurationStringSeconds(spec.step) ?? DEFAULT_MIN_STEP_SECONDS : DEFAULT_MIN_STEP_SECONDS;
|
|
102
|
-
const stepSeconds = getVictoriaLogsRangeStep(start.getTime(), end.getTime(), minStepSeconds, context.suggestedStepMs);
|
|
103
|
-
const stepString = formatStepForVictoriaLogs(stepSeconds);
|
|
104
|
-
const stepMs = stepSeconds * 1000;
|
|
105
|
-
const response = await client.statsQueryRange({
|
|
106
|
-
query,
|
|
107
|
-
step: stepString,
|
|
108
|
-
start: start.toISOString(),
|
|
109
|
-
end: end.toISOString()
|
|
110
|
-
});
|
|
111
|
-
if (response.status === 'error') {
|
|
112
|
-
throw new Error(response.error);
|
|
113
|
-
}
|
|
114
|
-
const series = convertMatrixToTimeSeries(response.data.result);
|
|
115
|
-
return {
|
|
116
|
-
series: series,
|
|
117
|
-
timeRange: {
|
|
118
|
-
start,
|
|
119
|
-
end
|
|
120
|
-
},
|
|
121
|
-
stepMs,
|
|
122
|
-
metadata: {
|
|
123
|
-
executedQueryString: query
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
package/lib/cjs/setup-tests.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
require("@testing-library/jest-dom");
|
|
18
|
-
// Always mock e-charts during tests since we don't have a proper canvas in jsdom
|
|
19
|
-
jest.mock('echarts/core');
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
_export_star(require("./victorialogs-field-names"), exports);
|
|
18
|
-
_export_star(require("./victorialogs-field-values"), exports);
|
|
19
|
-
function _export_star(from, to) {
|
|
20
|
-
Object.keys(from).forEach(function(k) {
|
|
21
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
22
|
-
Object.defineProperty(to, k, {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function() {
|
|
25
|
-
return from[k];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
return from;
|
|
31
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
function _export(target, all) {
|
|
18
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
get fieldItemsToVariableOptions () {
|
|
25
|
-
return fieldItemsToVariableOptions;
|
|
26
|
-
},
|
|
27
|
-
get getVictoriaLogsTimeRange () {
|
|
28
|
-
return getVictoriaLogsTimeRange;
|
|
29
|
-
},
|
|
30
|
-
get useFieldNames () {
|
|
31
|
-
return useFieldNames;
|
|
32
|
-
},
|
|
33
|
-
get useFieldValues () {
|
|
34
|
-
return useFieldValues;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
38
|
-
const _reactquery = require("@tanstack/react-query");
|
|
39
|
-
const fieldItemsToVariableOptions = (values)=>{
|
|
40
|
-
if (!values) return [];
|
|
41
|
-
return values.map((value)=>({
|
|
42
|
-
value: value.value,
|
|
43
|
-
label: value.value
|
|
44
|
-
}));
|
|
45
|
-
};
|
|
46
|
-
function getVictoriaLogsTimeRange(timeRange) {
|
|
47
|
-
const { start, end } = timeRange;
|
|
48
|
-
return {
|
|
49
|
-
start: start.toISOString(),
|
|
50
|
-
end: end.toISOString()
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function useFieldNames(query, datasource) {
|
|
54
|
-
const { absoluteTimeRange: { start, end } } = (0, _pluginsystem.useTimeRange)();
|
|
55
|
-
const { data: client } = (0, _pluginsystem.useDatasourceClient)(datasource);
|
|
56
|
-
const enabled = !!client && !!query;
|
|
57
|
-
return (0, _reactquery.useQuery)({
|
|
58
|
-
enabled: enabled,
|
|
59
|
-
queryKey: [
|
|
60
|
-
'datasource',
|
|
61
|
-
datasource.name,
|
|
62
|
-
'query',
|
|
63
|
-
query
|
|
64
|
-
],
|
|
65
|
-
queryFn: async ()=>{
|
|
66
|
-
return await client.fieldNames({
|
|
67
|
-
start: start.toISOString(),
|
|
68
|
-
end: end.toISOString(),
|
|
69
|
-
query: query
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function useFieldValues(field, query, datasource) {
|
|
75
|
-
const { absoluteTimeRange: { start, end } } = (0, _pluginsystem.useTimeRange)();
|
|
76
|
-
const { data: client } = (0, _pluginsystem.useDatasourceClient)(datasource);
|
|
77
|
-
const enabled = !!client && !!query;
|
|
78
|
-
return (0, _reactquery.useQuery)({
|
|
79
|
-
enabled: enabled,
|
|
80
|
-
queryKey: [
|
|
81
|
-
'field',
|
|
82
|
-
field,
|
|
83
|
-
'datasource',
|
|
84
|
-
datasource.name,
|
|
85
|
-
'query',
|
|
86
|
-
query
|
|
87
|
-
],
|
|
88
|
-
queryFn: async ()=>{
|
|
89
|
-
return await client.fieldValues({
|
|
90
|
-
query: query,
|
|
91
|
-
field: field,
|
|
92
|
-
start: start.toISOString(),
|
|
93
|
-
end: end.toISOString()
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "VictoriaLogsFieldNamesVariable", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return VictoriaLogsFieldNamesVariable;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
24
|
-
const _model = require("../../model");
|
|
25
|
-
const _utils = require("../utils");
|
|
26
|
-
const _VictoriaLogsFieldNamesVariableEditor = require("./VictoriaLogsFieldNamesVariableEditor");
|
|
27
|
-
const VictoriaLogsFieldNamesVariable = {
|
|
28
|
-
getVariableOptions: async (spec, ctx)=>{
|
|
29
|
-
const datasourceSelector = (0, _pluginsystem.datasourceSelectValueToSelector)(spec.datasource ?? _model.DEFAULT_VICTORIALOGS, ctx.variables, await ctx.datasourceStore.listDatasourceSelectItems(_model.VICTORIALOGS_DATASOURCE_KIND)) ?? _model.DEFAULT_VICTORIALOGS;
|
|
30
|
-
const client = await ctx.datasourceStore.getDatasourceClient(datasourceSelector);
|
|
31
|
-
const timeRange = (0, _utils.getVictoriaLogsTimeRange)(ctx.timeRange);
|
|
32
|
-
const query = (0, _pluginsystem.replaceVariables)(spec.query, ctx.variables);
|
|
33
|
-
const { values } = query ? await client.fieldNames({
|
|
34
|
-
query: query,
|
|
35
|
-
...timeRange
|
|
36
|
-
}) : {
|
|
37
|
-
values: []
|
|
38
|
-
};
|
|
39
|
-
return {
|
|
40
|
-
data: (0, _utils.fieldItemsToVariableOptions)(values)
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
dependsOn: (spec)=>{
|
|
44
|
-
const queryVariables = (0, _pluginsystem.parseVariables)(spec.query);
|
|
45
|
-
const datasourceVariables = spec.datasource && (0, _pluginsystem.isVariableDatasource)(spec.datasource) ? (0, _pluginsystem.parseVariables)(spec.datasource) : [];
|
|
46
|
-
return {
|
|
47
|
-
variables: [
|
|
48
|
-
...queryVariables,
|
|
49
|
-
...datasourceVariables
|
|
50
|
-
]
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
OptionsEditorComponent: _VictoriaLogsFieldNamesVariableEditor.VictoriaLogsFieldNamesVariableEditor,
|
|
54
|
-
createInitialOptions: ()=>({
|
|
55
|
-
query: ''
|
|
56
|
-
})
|
|
57
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "VictoriaLogsFieldNamesVariableEditor", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return VictoriaLogsFieldNamesVariableEditor;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
-
const _material = require("@mui/material");
|
|
25
|
-
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
26
|
-
const _immer = require("immer");
|
|
27
|
-
const _react = require("react");
|
|
28
|
-
const _model = require("../../model");
|
|
29
|
-
function VictoriaLogsFieldNamesVariableEditor(props) {
|
|
30
|
-
const { onChange, value, value: { datasource, query } } = props;
|
|
31
|
-
const datasourceSelectValue = datasource ?? _model.DEFAULT_VICTORIALOGS;
|
|
32
|
-
const selectedDatasource = (0, _pluginsystem.useDatasourceSelectValueToSelector)(datasourceSelectValue, _model.VICTORIALOGS_DATASOURCE_KIND);
|
|
33
|
-
const handleDatasourceChange = (0, _react.useCallback)((next)=>{
|
|
34
|
-
if ((0, _pluginsystem.isVariableDatasource)(next) || (0, _model.isVictoriaLogsDatasourceSelector)(next)) {
|
|
35
|
-
onChange((0, _immer.produce)(value, (draft)=>{
|
|
36
|
-
draft.datasource = !(0, _pluginsystem.isVariableDatasource)(next) && (0, _model.isDefaultVictoriaLogsSelector)(next) ? undefined : next;
|
|
37
|
-
}));
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
throw new Error('Got unexpected non-VictoriaLogs datasource selector');
|
|
41
|
-
}, [
|
|
42
|
-
onChange,
|
|
43
|
-
value
|
|
44
|
-
]);
|
|
45
|
-
const handleQueryChange = (0, _react.useCallback)((event)=>{
|
|
46
|
-
onChange((0, _immer.produce)(value, (draft)=>{
|
|
47
|
-
draft.query = event.target.value;
|
|
48
|
-
}));
|
|
49
|
-
}, [
|
|
50
|
-
onChange,
|
|
51
|
-
value
|
|
52
|
-
]);
|
|
53
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
54
|
-
spacing: 2,
|
|
55
|
-
children: [
|
|
56
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControl, {
|
|
57
|
-
margin: "dense",
|
|
58
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
|
|
59
|
-
datasourcePluginKind: "VictoriaLogsDatasource",
|
|
60
|
-
value: selectedDatasource,
|
|
61
|
-
onChange: handleDatasourceChange,
|
|
62
|
-
disabled: props.isReadonly,
|
|
63
|
-
labelId: "victorialogs-datasource-field",
|
|
64
|
-
label: "VictoriaLogs Datasource"
|
|
65
|
-
})
|
|
66
|
-
}),
|
|
67
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
68
|
-
label: "Query",
|
|
69
|
-
InputLabelProps: {
|
|
70
|
-
shrink: props.isReadonly ? true : undefined
|
|
71
|
-
},
|
|
72
|
-
InputProps: {
|
|
73
|
-
readOnly: props.isReadonly
|
|
74
|
-
},
|
|
75
|
-
value: query,
|
|
76
|
-
onChange: handleQueryChange
|
|
77
|
-
})
|
|
78
|
-
]
|
|
79
|
-
});
|
|
80
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Copyright The Perses Authors
|
|
2
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
// you may not use this file except in compliance with the License.
|
|
4
|
-
// You may obtain a copy of the License at
|
|
5
|
-
//
|
|
6
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
//
|
|
8
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
// See the License for the specific language governing permissions and
|
|
12
|
-
// limitations under the License.
|
|
13
|
-
"use strict";
|
|
14
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15
|
-
value: true
|
|
16
|
-
});
|
|
17
|
-
_export_star(require("./VictoriaLogsFieldNamesVariable"), exports);
|
|
18
|
-
function _export_star(from, to) {
|
|
19
|
-
Object.keys(from).forEach(function(k) {
|
|
20
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
-
Object.defineProperty(to, k, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function() {
|
|
24
|
-
return from[k];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return from;
|
|
30
|
-
}
|