@perses-dev/victorialogs-plugin 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +41 -0
- package/__mf/css/async/1580.d3010b86.css +1 -0
- package/__mf/css/async/2341.d3010b86.css +1 -0
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/VictoriaLogs.9a08c902.js +5 -0
- package/__mf/js/async/158.c35084cf.js +10 -0
- package/__mf/js/async/158.c35084cf.js.LICENSE.txt +17 -0
- package/__mf/js/async/1580.ace454a9.js +2 -0
- package/__mf/js/async/1580.ace454a9.js.LICENSE.txt +9 -0
- package/__mf/js/async/1964.6d84f735.js +2 -0
- package/__mf/js/async/1964.6d84f735.js.LICENSE.txt +9 -0
- package/__mf/js/async/2178.d1785908.js +2 -0
- package/__mf/js/async/2178.d1785908.js.LICENSE.txt +15 -0
- package/__mf/js/async/2292.0696771a.js +2 -0
- package/__mf/js/async/2292.0696771a.js.LICENSE.txt +24 -0
- package/__mf/js/async/2472.3c37aa71.js +22 -0
- package/__mf/js/async/2472.3c37aa71.js.LICENSE.txt +19 -0
- package/__mf/js/async/2558.beff8442.js +101 -0
- package/__mf/js/async/2708.c79893a7.js +1 -0
- package/__mf/js/async/3224.858fb6d6.js +1 -0
- package/__mf/js/async/3431.358ac817.js +1 -0
- package/__mf/js/async/3863.66f8659b.js +2 -0
- package/__mf/js/async/3863.66f8659b.js.LICENSE.txt +9 -0
- package/__mf/js/async/3960.bbacac1d.js +2 -0
- package/__mf/js/async/3960.bbacac1d.js.LICENSE.txt +8 -0
- package/__mf/js/async/3980.03396afa.js +2 -0
- package/__mf/js/async/3980.03396afa.js.LICENSE.txt +9 -0
- package/__mf/js/async/4075.8aae8af4.js +1 -0
- package/__mf/js/async/4238.cd5e3d1f.js +1 -0
- package/__mf/js/async/4269.f9191848.js +2 -0
- package/__mf/js/async/4269.f9191848.js.LICENSE.txt +9 -0
- package/__mf/js/async/4310.b6c0f250.js +7 -0
- package/__mf/js/async/4310.b6c0f250.js.LICENSE.txt +21 -0
- package/__mf/js/async/4421.c442f6d9.js +1 -0
- package/__mf/js/async/5214.bcb7530e.js +1 -0
- package/__mf/js/async/5348.aa77f629.js +2 -0
- package/__mf/js/async/5348.aa77f629.js.LICENSE.txt +9 -0
- package/__mf/js/async/5388.92f525c5.js +1 -0
- package/__mf/js/async/5409.5d25f1db.js +1 -0
- package/__mf/js/async/5628.f229b9f6.js +1 -0
- package/__mf/js/async/5682.a317ee96.js +1 -0
- package/__mf/js/async/5790.f7a41a40.js +1 -0
- package/__mf/js/async/5981.e54ec80b.js +2 -0
- package/__mf/js/async/5981.e54ec80b.js.LICENSE.txt +8 -0
- package/__mf/js/async/6134.6f58094d.js +38 -0
- package/__mf/js/async/6292.fda8a9af.js +1 -0
- package/__mf/js/async/6333.031c68b4.js +2 -0
- package/__mf/js/async/6333.031c68b4.js.LICENSE.txt +9 -0
- package/__mf/js/async/6374.e9650306.js +1 -0
- package/__mf/js/async/6377.e48abaa5.js +2 -0
- package/__mf/js/async/6377.e48abaa5.js.LICENSE.txt +32 -0
- package/__mf/js/async/6620.4f2fc96e.js +2 -0
- package/__mf/js/async/6620.4f2fc96e.js.LICENSE.txt +21 -0
- package/__mf/js/async/6770.5c90a318.js +1 -0
- package/__mf/js/async/694.663f3faf.js +1 -0
- package/__mf/js/async/7376.91743064.js +1 -0
- package/__mf/js/async/738.b4e8c361.js +1 -0
- package/__mf/js/async/7740.82b38509.js +1 -0
- package/__mf/js/async/8216.3417496f.js +1 -0
- package/__mf/js/async/8488.9eb8e6dc.js +1 -0
- package/__mf/js/async/8537.a7ed2e24.js +1 -0
- package/__mf/js/async/8727.e54ca5fd.js +1 -0
- package/__mf/js/async/8930.fa15926d.js +1 -0
- package/__mf/js/async/9173.d784dd69.js +2 -0
- package/__mf/js/async/9173.d784dd69.js.LICENSE.txt +19 -0
- package/__mf/js/async/9563.b88ff7ff.js +2 -0
- package/__mf/js/async/9563.b88ff7ff.js.LICENSE.txt +9 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsDatasource.807e09ec.js +2 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsDatasource.807e09ec.js.LICENSE.txt +9 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsFieldNamesVariable.94ae15a7.js +2 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsFieldNamesVariable.94ae15a7.js.LICENSE.txt +9 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsFieldValuesVariable.eabc284b.js +2 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsFieldValuesVariable.eabc284b.js.LICENSE.txt +9 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsLogQuery.8122cbeb.js +1 -0
- package/__mf/js/async/__federation_expose_VictoriaLogsTimeSeriesQuery.56dd4cab.js +1 -0
- package/__mf/js/main.9f62e593.js +5 -0
- package/lib/bootstrap.d.ts +2 -0
- package/lib/bootstrap.d.ts.map +1 -0
- package/lib/bootstrap.js +7 -0
- package/lib/bootstrap.js.map +1 -0
- package/lib/cjs/bootstrap.js +14 -0
- package/lib/cjs/components/index.js +23 -0
- package/lib/cjs/components/logsql-editor.js +110 -0
- package/lib/cjs/components/logsql-extension.js +55 -0
- package/lib/cjs/components/logsql-highlight.js +40 -0
- package/lib/cjs/datasources/index.js +30 -0
- package/lib/cjs/datasources/victorialogs-datasource/VictoriaLogsDatasource.js +61 -0
- package/lib/cjs/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.js +95 -0
- package/lib/cjs/datasources/victorialogs-datasource/index.js +32 -0
- package/lib/cjs/datasources/victorialogs-datasource/types.js +16 -0
- package/lib/cjs/env.d.js +2 -0
- package/lib/cjs/getPluginModule.js +27 -0
- package/lib/cjs/index-federation.js +43 -0
- package/lib/cjs/index.js +27 -0
- package/lib/cjs/model/client.js +156 -0
- package/lib/cjs/model/index.js +32 -0
- package/lib/cjs/model/selectors.js +47 -0
- package/lib/cjs/model/types.js +16 -0
- package/lib/cjs/queries/constants.js +22 -0
- package/lib/cjs/queries/index.js +31 -0
- package/lib/cjs/queries/victorialogs-log-query/VictoriaLogsLogQuery.js +31 -0
- package/lib/cjs/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.js +118 -0
- package/lib/cjs/queries/victorialogs-log-query/index.js +21 -0
- package/lib/cjs/queries/victorialogs-log-query/interface.js +4 -0
- package/lib/cjs/queries/victorialogs-log-query/query.js +61 -0
- package/lib/cjs/queries/victorialogs-log-query/types.js +4 -0
- package/lib/cjs/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.js +43 -0
- package/lib/cjs/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.js +116 -0
- package/lib/cjs/queries/victorialogs-time-series-query/index.js +33 -0
- package/lib/cjs/queries/victorialogs-time-series-query/query.js +122 -0
- package/lib/cjs/queries/victorialogs-time-series-query/types.js +16 -0
- package/lib/cjs/setup-tests.js +7 -0
- package/lib/cjs/variables/index.js +31 -0
- package/lib/cjs/variables/types.js +4 -0
- package/lib/cjs/variables/utils.js +85 -0
- package/lib/cjs/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.js +45 -0
- package/lib/cjs/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.js +89 -0
- package/lib/cjs/variables/victorialogs-field-names/index.js +30 -0
- package/lib/cjs/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.js +49 -0
- package/lib/cjs/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.js +130 -0
- package/lib/cjs/variables/victorialogs-field-values/index.js +30 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +15 -0
- package/lib/components/index.js.map +1 -0
- package/lib/components/logsql-editor.d.ts +5 -0
- package/lib/components/logsql-editor.d.ts.map +1 -0
- package/lib/components/logsql-editor.js +61 -0
- package/lib/components/logsql-editor.js.map +1 -0
- package/lib/components/logsql-extension.d.ts +4 -0
- package/lib/components/logsql-extension.d.ts.map +1 -0
- package/lib/components/logsql-extension.js +47 -0
- package/lib/components/logsql-extension.js.map +1 -0
- package/lib/components/logsql-highlight.d.ts +2 -0
- package/lib/components/logsql-highlight.d.ts.map +1 -0
- package/lib/components/logsql-highlight.js +32 -0
- package/lib/components/logsql-highlight.js.map +1 -0
- package/lib/datasources/index.d.ts +2 -0
- package/lib/datasources/index.d.ts.map +1 -0
- package/lib/datasources/index.js +15 -0
- package/lib/datasources/index.js.map +1 -0
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasource.d.ts +5 -0
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasource.d.ts.map +1 -0
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasource.js +53 -0
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasource.js.map +1 -0
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.d.ts +9 -0
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.d.ts.map +1 -0
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.js +87 -0
- package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.js.map +1 -0
- package/lib/datasources/victorialogs-datasource/index.d.ts +4 -0
- package/lib/datasources/victorialogs-datasource/index.d.ts.map +1 -0
- package/lib/datasources/victorialogs-datasource/index.js +17 -0
- package/lib/datasources/victorialogs-datasource/index.js.map +1 -0
- package/lib/datasources/victorialogs-datasource/types.d.ts +6 -0
- package/lib/datasources/victorialogs-datasource/types.d.ts.map +1 -0
- package/lib/datasources/victorialogs-datasource/types.js +15 -0
- package/lib/datasources/victorialogs-datasource/types.js.map +1 -0
- package/lib/env.d.js +3 -0
- package/lib/env.d.js.map +1 -0
- package/lib/getPluginModule.d.ts +6 -0
- package/lib/getPluginModule.d.ts.map +1 -0
- package/lib/getPluginModule.js +16 -0
- package/lib/getPluginModule.js.map +1 -0
- package/lib/index-federation.d.ts +1 -0
- package/lib/index-federation.d.ts.map +1 -0
- package/lib/index-federation.js +3 -0
- package/lib/index-federation.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/lib/model/client.d.ts +39 -0
- package/lib/model/client.d.ts.map +1 -0
- package/lib/model/client.js +134 -0
- package/lib/model/client.js.map +1 -0
- package/lib/model/index.d.ts +4 -0
- package/lib/model/index.d.ts.map +1 -0
- package/lib/model/index.js +17 -0
- package/lib/model/index.js.map +1 -0
- package/lib/model/selectors.d.ts +10 -0
- package/lib/model/selectors.d.ts.map +1 -0
- package/lib/model/selectors.js +25 -0
- package/lib/model/selectors.js.map +1 -0
- package/lib/model/types.d.ts +44 -0
- package/lib/model/types.d.ts.map +1 -0
- package/lib/model/types.js +15 -0
- package/lib/model/types.js.map +1 -0
- package/lib/queries/constants.d.ts +5 -0
- package/lib/queries/constants.d.ts.map +1 -0
- package/lib/queries/constants.js +6 -0
- package/lib/queries/constants.js.map +1 -0
- package/lib/queries/index.d.ts +3 -0
- package/lib/queries/index.d.ts.map +1 -0
- package/lib/queries/index.js +16 -0
- package/lib/queries/index.js.map +1 -0
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.d.ts +4 -0
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.d.ts.map +1 -0
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.js +23 -0
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.js.map +1 -0
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.d.ts +7 -0
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.d.ts.map +1 -0
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.js +110 -0
- package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.js.map +1 -0
- package/lib/queries/victorialogs-log-query/index.d.ts +5 -0
- package/lib/queries/victorialogs-log-query/index.d.ts.map +1 -0
- package/lib/queries/victorialogs-log-query/index.js +6 -0
- package/lib/queries/victorialogs-log-query/index.js.map +1 -0
- package/lib/queries/victorialogs-log-query/interface.d.ts +24 -0
- package/lib/queries/victorialogs-log-query/interface.d.ts.map +1 -0
- package/lib/queries/victorialogs-log-query/interface.js +3 -0
- package/lib/queries/victorialogs-log-query/interface.js.map +1 -0
- package/lib/queries/victorialogs-log-query/query.d.ts +4 -0
- package/lib/queries/victorialogs-log-query/query.d.ts.map +1 -0
- package/lib/queries/victorialogs-log-query/query.js +53 -0
- package/lib/queries/victorialogs-log-query/query.js.map +1 -0
- package/lib/queries/victorialogs-log-query/types.d.ts +6 -0
- package/lib/queries/victorialogs-log-query/types.d.ts.map +1 -0
- package/lib/queries/victorialogs-log-query/types.js +3 -0
- package/lib/queries/victorialogs-log-query/types.js.map +1 -0
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.d.ts +4 -0
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.d.ts.map +1 -0
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.js +35 -0
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.js.map +1 -0
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.d.ts +7 -0
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.d.ts.map +1 -0
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.js +108 -0
- package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.js.map +1 -0
- package/lib/queries/victorialogs-time-series-query/index.d.ts +5 -0
- package/lib/queries/victorialogs-time-series-query/index.d.ts.map +1 -0
- package/lib/queries/victorialogs-time-series-query/index.js +18 -0
- package/lib/queries/victorialogs-time-series-query/index.js.map +1 -0
- package/lib/queries/victorialogs-time-series-query/query.d.ts +12 -0
- package/lib/queries/victorialogs-time-series-query/query.d.ts.map +1 -0
- package/lib/queries/victorialogs-time-series-query/query.js +114 -0
- package/lib/queries/victorialogs-time-series-query/query.js.map +1 -0
- package/lib/queries/victorialogs-time-series-query/types.d.ts +7 -0
- package/lib/queries/victorialogs-time-series-query/types.d.ts.map +1 -0
- package/lib/queries/victorialogs-time-series-query/types.js +15 -0
- package/lib/queries/victorialogs-time-series-query/types.js.map +1 -0
- package/lib/setup-tests.d.ts +2 -0
- package/lib/setup-tests.d.ts.map +1 -0
- package/lib/setup-tests.js +5 -0
- package/lib/setup-tests.js.map +1 -0
- package/lib/variables/index.d.ts +3 -0
- package/lib/variables/index.d.ts.map +1 -0
- package/lib/variables/index.js +16 -0
- package/lib/variables/index.js.map +1 -0
- package/lib/variables/types.d.ts +13 -0
- package/lib/variables/types.d.ts.map +1 -0
- package/lib/variables/types.js +3 -0
- package/lib/variables/types.js.map +1 -0
- package/lib/variables/utils.d.ts +12 -0
- package/lib/variables/utils.d.ts.map +1 -0
- package/lib/variables/utils.js +63 -0
- package/lib/variables/utils.js.map +1 -0
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.d.ts +4 -0
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.d.ts.map +1 -0
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.js +37 -0
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.js.map +1 -0
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.d.ts +5 -0
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.d.ts.map +1 -0
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.js +81 -0
- package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.js.map +1 -0
- package/lib/variables/victorialogs-field-names/index.d.ts +2 -0
- package/lib/variables/victorialogs-field-names/index.d.ts.map +1 -0
- package/lib/variables/victorialogs-field-names/index.js +15 -0
- package/lib/variables/victorialogs-field-names/index.js.map +1 -0
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.d.ts +4 -0
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.d.ts.map +1 -0
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.js +41 -0
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.js.map +1 -0
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.d.ts +5 -0
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.d.ts.map +1 -0
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.js +122 -0
- package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.js.map +1 -0
- package/lib/variables/victorialogs-field-values/index.d.ts +2 -0
- package/lib/variables/victorialogs-field-values/index.d.ts.map +1 -0
- package/lib/variables/victorialogs-field-values/index.js +15 -0
- package/lib/variables/victorialogs-field-values/index.js.map +1 -0
- package/mf-manifest.json +556 -0
- package/mf-stats.json +614 -0
- package/package.json +97 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "VictoriaLogsFieldNamesVariable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return VictoriaLogsFieldNamesVariable;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
12
|
+
const _model = require("../../model");
|
|
13
|
+
const _VictoriaLogsFieldNamesVariableEditor = require("./VictoriaLogsFieldNamesVariableEditor");
|
|
14
|
+
const _utils = require("../utils");
|
|
15
|
+
const VictoriaLogsFieldNamesVariable = {
|
|
16
|
+
getVariableOptions: async (spec, ctx)=>{
|
|
17
|
+
const datasourceSelector = (0, _pluginsystem.datasourceSelectValueToSelector)(spec.datasource ?? _model.DEFAULT_VICTORIALOGS, ctx.variables, await ctx.datasourceStore.listDatasourceSelectItems(_model.VICTORIALOGS_DATASOURCE_KIND)) ?? _model.DEFAULT_VICTORIALOGS;
|
|
18
|
+
const client = await ctx.datasourceStore.getDatasourceClient(datasourceSelector);
|
|
19
|
+
const timeRange = (0, _utils.getVictoriaLogsTimeRange)(ctx.timeRange);
|
|
20
|
+
const query = (0, _pluginsystem.replaceVariables)(spec.query, ctx.variables);
|
|
21
|
+
const { values } = query ? await client.fieldNames({
|
|
22
|
+
query: query,
|
|
23
|
+
...timeRange
|
|
24
|
+
}) : {
|
|
25
|
+
values: []
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
data: (0, _utils.fieldItemsToVariableOptions)(values)
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
dependsOn: (spec)=>{
|
|
32
|
+
const queryVariables = (0, _pluginsystem.parseVariables)(spec.query);
|
|
33
|
+
const datasourceVariables = spec.datasource && (0, _pluginsystem.isVariableDatasource)(spec.datasource) ? (0, _pluginsystem.parseVariables)(spec.datasource) : [];
|
|
34
|
+
return {
|
|
35
|
+
variables: [
|
|
36
|
+
...queryVariables,
|
|
37
|
+
...datasourceVariables
|
|
38
|
+
]
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
OptionsEditorComponent: _VictoriaLogsFieldNamesVariableEditor.VictoriaLogsFieldNamesVariableEditor,
|
|
42
|
+
createInitialOptions: ()=>({
|
|
43
|
+
query: ''
|
|
44
|
+
})
|
|
45
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Copyright 2025 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 }, queryHandlerSettings } = 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
|
+
if (queryHandlerSettings?.setWatchOtherSpecs) queryHandlerSettings.setWatchOtherSpecs({
|
|
39
|
+
...value,
|
|
40
|
+
datasource: next
|
|
41
|
+
});
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
throw new Error('Got unexpected non-VictoriaLogs datasource selector');
|
|
45
|
+
}, [
|
|
46
|
+
onChange,
|
|
47
|
+
queryHandlerSettings,
|
|
48
|
+
value
|
|
49
|
+
]);
|
|
50
|
+
const handleQueryChange = (0, _react.useCallback)((event)=>{
|
|
51
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
52
|
+
draft.query = event.target.value;
|
|
53
|
+
}));
|
|
54
|
+
if (queryHandlerSettings?.watchQueryChanges) {
|
|
55
|
+
queryHandlerSettings.watchQueryChanges(event.target.value);
|
|
56
|
+
}
|
|
57
|
+
}, [
|
|
58
|
+
onChange,
|
|
59
|
+
queryHandlerSettings,
|
|
60
|
+
value
|
|
61
|
+
]);
|
|
62
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
63
|
+
spacing: 2,
|
|
64
|
+
children: [
|
|
65
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControl, {
|
|
66
|
+
margin: "dense",
|
|
67
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
|
|
68
|
+
datasourcePluginKind: "VictoriaLogsDatasource",
|
|
69
|
+
value: selectedDatasource,
|
|
70
|
+
onChange: handleDatasourceChange,
|
|
71
|
+
disabled: props.isReadonly,
|
|
72
|
+
labelId: "victorialogs-datasource-field",
|
|
73
|
+
label: "VictoriaLogs Datasource"
|
|
74
|
+
})
|
|
75
|
+
}),
|
|
76
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
77
|
+
label: "Query",
|
|
78
|
+
InputLabelProps: {
|
|
79
|
+
shrink: props.isReadonly ? true : undefined
|
|
80
|
+
},
|
|
81
|
+
InputProps: {
|
|
82
|
+
readOnly: props.isReadonly
|
|
83
|
+
},
|
|
84
|
+
value: query,
|
|
85
|
+
onChange: handleQueryChange
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2025 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
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "VictoriaLogsFieldValuesVariable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return VictoriaLogsFieldValuesVariable;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
12
|
+
const _model = require("../../model");
|
|
13
|
+
const _VictoriaLogsFieldValuesVariableEditor = require("./VictoriaLogsFieldValuesVariableEditor");
|
|
14
|
+
const _utils = require("../utils");
|
|
15
|
+
const VictoriaLogsFieldValuesVariable = {
|
|
16
|
+
getVariableOptions: async (spec, ctx)=>{
|
|
17
|
+
const datasourceSelector = (0, _pluginsystem.datasourceSelectValueToSelector)(spec.datasource ?? _model.DEFAULT_VICTORIALOGS, ctx.variables, await ctx.datasourceStore.listDatasourceSelectItems(_model.VICTORIALOGS_DATASOURCE_KIND)) ?? _model.DEFAULT_VICTORIALOGS;
|
|
18
|
+
const client = await ctx.datasourceStore.getDatasourceClient(datasourceSelector);
|
|
19
|
+
const query = (0, _pluginsystem.replaceVariables)(spec.query, ctx.variables);
|
|
20
|
+
const timeRange = (0, _utils.getVictoriaLogsTimeRange)(ctx.timeRange);
|
|
21
|
+
const { values } = query ? await client.fieldValues({
|
|
22
|
+
field: (0, _pluginsystem.replaceVariables)(spec.field, ctx.variables),
|
|
23
|
+
query: query,
|
|
24
|
+
...timeRange
|
|
25
|
+
}) : {
|
|
26
|
+
values: []
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
data: (0, _utils.fieldItemsToVariableOptions)(values)
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
dependsOn: (spec)=>{
|
|
33
|
+
const queryVariables = (0, _pluginsystem.parseVariables)(spec.query);
|
|
34
|
+
const labelVariables = (0, _pluginsystem.parseVariables)(spec.field);
|
|
35
|
+
const datasourceVariables = spec.datasource && (0, _pluginsystem.isVariableDatasource)(spec.datasource) ? (0, _pluginsystem.parseVariables)(spec.datasource) : [];
|
|
36
|
+
return {
|
|
37
|
+
variables: [
|
|
38
|
+
...queryVariables,
|
|
39
|
+
...labelVariables,
|
|
40
|
+
...datasourceVariables
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
OptionsEditorComponent: _VictoriaLogsFieldValuesVariableEditor.VictoriaLogsFieldValuesVariableEditor,
|
|
45
|
+
createInitialOptions: ()=>({
|
|
46
|
+
field: '',
|
|
47
|
+
query: ''
|
|
48
|
+
})
|
|
49
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// Copyright 2025 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, "VictoriaLogsFieldValuesVariableEditor", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return VictoriaLogsFieldValuesVariableEditor;
|
|
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
|
+
const _utils = require("../utils");
|
|
30
|
+
function VictoriaLogsFieldValuesVariableEditor(props) {
|
|
31
|
+
const { onChange, value, value: { datasource, query, field }, queryHandlerSettings } = props;
|
|
32
|
+
const datasourceSelectValue = datasource ?? _model.DEFAULT_VICTORIALOGS;
|
|
33
|
+
const selectedDatasource = (0, _pluginsystem.useDatasourceSelectValueToSelector)(datasourceSelectValue, _model.VICTORIALOGS_DATASOURCE_KIND);
|
|
34
|
+
const { data: fieldNames, isLoading: isFieldNamesOptionsLoading } = (0, _utils.useFieldNames)(query, selectedDatasource);
|
|
35
|
+
const handleDatasourceChange = (0, _react.useCallback)((next)=>{
|
|
36
|
+
if ((0, _pluginsystem.isVariableDatasource)(next) || (0, _model.isVictoriaLogsDatasourceSelector)(next)) {
|
|
37
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
38
|
+
// If they're using the default, just omit the datasource prop (i.e. set to undefined)
|
|
39
|
+
draft.datasource = !(0, _pluginsystem.isVariableDatasource)(next) && (0, _model.isDefaultVictoriaLogsSelector)(next) ? undefined : next;
|
|
40
|
+
}));
|
|
41
|
+
if (queryHandlerSettings?.setWatchOtherSpecs) queryHandlerSettings.setWatchOtherSpecs({
|
|
42
|
+
...value,
|
|
43
|
+
datasource: next
|
|
44
|
+
});
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
throw new Error('Got unexpected non-VictoriaLogs datasource selector');
|
|
48
|
+
}, [
|
|
49
|
+
onChange,
|
|
50
|
+
queryHandlerSettings,
|
|
51
|
+
value
|
|
52
|
+
]);
|
|
53
|
+
const handleQueryChange = (0, _react.useCallback)((event)=>{
|
|
54
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
55
|
+
draft.query = event.target.value;
|
|
56
|
+
}));
|
|
57
|
+
if (queryHandlerSettings?.watchQueryChanges) {
|
|
58
|
+
queryHandlerSettings.watchQueryChanges(event.target.value);
|
|
59
|
+
}
|
|
60
|
+
}, [
|
|
61
|
+
onChange,
|
|
62
|
+
queryHandlerSettings,
|
|
63
|
+
value
|
|
64
|
+
]);
|
|
65
|
+
const handleFieldChange = (0, _react.useCallback)((_, newValue)=>{
|
|
66
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
67
|
+
draft.field = newValue || "";
|
|
68
|
+
}));
|
|
69
|
+
if (queryHandlerSettings?.setWatchOtherSpecs) {
|
|
70
|
+
queryHandlerSettings.setWatchOtherSpecs({
|
|
71
|
+
...value,
|
|
72
|
+
field: newValue
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}, [
|
|
76
|
+
onChange,
|
|
77
|
+
queryHandlerSettings,
|
|
78
|
+
value
|
|
79
|
+
]);
|
|
80
|
+
const fieldNamesOptions = (0, _react.useMemo)(()=>{
|
|
81
|
+
return fieldNames?.values.map((o)=>o.value) || [];
|
|
82
|
+
}, [
|
|
83
|
+
isFieldNamesOptionsLoading,
|
|
84
|
+
fieldNames
|
|
85
|
+
]);
|
|
86
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
87
|
+
spacing: 2,
|
|
88
|
+
children: [
|
|
89
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.FormControl, {
|
|
90
|
+
margin: "dense",
|
|
91
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
|
|
92
|
+
datasourcePluginKind: "VictoriaLogsDatasource",
|
|
93
|
+
value: datasourceSelectValue,
|
|
94
|
+
onChange: handleDatasourceChange,
|
|
95
|
+
readOnly: props.isReadonly,
|
|
96
|
+
labelId: "victorialogs-datasource-field",
|
|
97
|
+
label: "VictoriaLogs Datasource"
|
|
98
|
+
})
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Autocomplete, {
|
|
101
|
+
freeSolo: true,
|
|
102
|
+
disableClearable: true,
|
|
103
|
+
value: field,
|
|
104
|
+
loading: isFieldNamesOptionsLoading,
|
|
105
|
+
options: fieldNamesOptions,
|
|
106
|
+
renderInput: (params)=>{
|
|
107
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
108
|
+
...params,
|
|
109
|
+
required: true,
|
|
110
|
+
label: "Field Name",
|
|
111
|
+
variant: "outlined"
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
onChange: handleFieldChange
|
|
115
|
+
}),
|
|
116
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
117
|
+
required: true,
|
|
118
|
+
label: "Query",
|
|
119
|
+
InputLabelProps: {
|
|
120
|
+
shrink: props.isReadonly ? true : undefined
|
|
121
|
+
},
|
|
122
|
+
InputProps: {
|
|
123
|
+
readOnly: props.isReadonly
|
|
124
|
+
},
|
|
125
|
+
value: query,
|
|
126
|
+
onChange: handleQueryChange
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2025 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("./VictoriaLogsFieldValuesVariable"), 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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2025 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
|
+
export { LogsQLEditor } from './logsql-editor';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport { LogsQLEditor } from './logsql-editor';\nexport type { LogsQLEditorProps } from './logsql-editor';\n"],"names":["LogsQLEditor"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,YAAY,QAAQ,kBAAkB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ReactCodeMirrorProps } from '@uiw/react-codemirror';
|
|
3
|
+
export type LogsQLEditorProps = Omit<ReactCodeMirrorProps, 'theme' | 'extensions'>;
|
|
4
|
+
export declare function LogsQLEditor(props: LogsQLEditorProps): ReactElement;
|
|
5
|
+
//# sourceMappingURL=logsql-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logsql-editor.d.ts","sourceRoot":"","sources":["../../../src/components/logsql-editor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAE9C,OAAmB,EAAc,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGrF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,YAAY,CAAC,CAAC;AAEnF,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAyCnE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright 2025 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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { useMemo } from 'react';
|
|
15
|
+
import { useTheme } from '@mui/material';
|
|
16
|
+
import CodeMirror, { EditorView } from '@uiw/react-codemirror';
|
|
17
|
+
import { LogsQLExtension } from './logsql-extension';
|
|
18
|
+
export function LogsQLEditor(props) {
|
|
19
|
+
const theme = useTheme();
|
|
20
|
+
const isDarkMode = theme.palette.mode === 'dark';
|
|
21
|
+
const logsqlExtension = useMemo(()=>{
|
|
22
|
+
return LogsQLExtension();
|
|
23
|
+
}, []);
|
|
24
|
+
const codemirrorTheme = useMemo(()=>{
|
|
25
|
+
const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
|
|
26
|
+
return EditorView.theme({
|
|
27
|
+
'&': {
|
|
28
|
+
backgroundColor: 'transparent !important',
|
|
29
|
+
border: `1px solid ${borderColor}`,
|
|
30
|
+
borderRadius: `${theme.shape.borderRadius}px`
|
|
31
|
+
},
|
|
32
|
+
'&.cm-focused.cm-editor': {
|
|
33
|
+
outline: 'none'
|
|
34
|
+
},
|
|
35
|
+
'.cm-content': {
|
|
36
|
+
padding: '8px'
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}, [
|
|
40
|
+
theme
|
|
41
|
+
]);
|
|
42
|
+
return /*#__PURE__*/ _jsx(CodeMirror, {
|
|
43
|
+
...props,
|
|
44
|
+
theme: isDarkMode ? 'dark' : 'light',
|
|
45
|
+
basicSetup: {
|
|
46
|
+
lineNumbers: false,
|
|
47
|
+
highlightActiveLine: false,
|
|
48
|
+
highlightActiveLineGutter: false,
|
|
49
|
+
foldGutter: false,
|
|
50
|
+
syntaxHighlighting: true
|
|
51
|
+
},
|
|
52
|
+
extensions: [
|
|
53
|
+
EditorView.lineWrapping,
|
|
54
|
+
logsqlExtension,
|
|
55
|
+
codemirrorTheme
|
|
56
|
+
],
|
|
57
|
+
placeholder: 'Example: {job="my-service"} |= "error"'
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=logsql-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/logsql-editor.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo } from 'react';\nimport { useTheme } from '@mui/material';\nimport CodeMirror, { EditorView, ReactCodeMirrorProps } from '@uiw/react-codemirror';\nimport { LogsQLExtension } from './logsql-extension';\n\nexport type LogsQLEditorProps = Omit<ReactCodeMirrorProps, 'theme' | 'extensions'>;\n\nexport function LogsQLEditor(props: LogsQLEditorProps): ReactElement {\n const theme = useTheme();\n const isDarkMode = theme.palette.mode === 'dark';\n\n const logsqlExtension = useMemo(() => {\n return LogsQLExtension();\n }, []);\n\n const codemirrorTheme = useMemo(() => {\n const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';\n\n return EditorView.theme({\n '&': {\n backgroundColor: 'transparent !important', // required for dark mode\n border: `1px solid ${borderColor}`,\n borderRadius: `${theme.shape.borderRadius}px`,\n },\n '&.cm-focused.cm-editor': {\n outline: 'none',\n },\n '.cm-content': {\n padding: '8px',\n },\n });\n }, [theme]);\n\n return (\n <CodeMirror\n {...props}\n theme={isDarkMode ? 'dark' : 'light'}\n basicSetup={{\n lineNumbers: false,\n highlightActiveLine: false,\n highlightActiveLineGutter: false,\n foldGutter: false,\n syntaxHighlighting: true,\n }}\n extensions={[EditorView.lineWrapping, logsqlExtension, codemirrorTheme]}\n placeholder='Example: {job=\"my-service\"} |= \"error\"'\n />\n );\n}\n"],"names":["useMemo","useTheme","CodeMirror","EditorView","LogsQLExtension","LogsQLEditor","props","theme","isDarkMode","palette","mode","logsqlExtension","codemirrorTheme","borderColor","backgroundColor","border","borderRadius","shape","outline","padding","basicSetup","lineNumbers","highlightActiveLine","highlightActiveLineGutter","foldGutter","syntaxHighlighting","extensions","lineWrapping","placeholder"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,OAAO,QAAQ,QAAQ;AAC9C,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,cAAcC,UAAU,QAA8B,wBAAwB;AACrF,SAASC,eAAe,QAAQ,qBAAqB;AAIrD,OAAO,SAASC,aAAaC,KAAwB;IACnD,MAAMC,QAAQN;IACd,MAAMO,aAAaD,MAAME,OAAO,CAACC,IAAI,KAAK;IAE1C,MAAMC,kBAAkBX,QAAQ;QAC9B,OAAOI;IACT,GAAG,EAAE;IAEL,MAAMQ,kBAAkBZ,QAAQ;QAC9B,MAAMa,cAAcN,MAAME,OAAO,CAACC,IAAI,KAAK,UAAU,wBAAwB;QAE7E,OAAOP,WAAWI,KAAK,CAAC;YACtB,KAAK;gBACHO,iBAAiB;gBACjBC,QAAQ,CAAC,UAAU,EAAEF,aAAa;gBAClCG,cAAc,GAAGT,MAAMU,KAAK,CAACD,YAAY,CAAC,EAAE,CAAC;YAC/C;YACA,0BAA0B;gBACxBE,SAAS;YACX;YACA,eAAe;gBACbC,SAAS;YACX;QACF;IACF,GAAG;QAACZ;KAAM;IAEV,qBACE,KAACL;QACE,GAAGI,KAAK;QACTC,OAAOC,aAAa,SAAS;QAC7BY,YAAY;YACVC,aAAa;YACbC,qBAAqB;YACrBC,2BAA2B;YAC3BC,YAAY;YACZC,oBAAoB;QACtB;QACAC,YAAY;YAACvB,WAAWwB,YAAY;YAAEhB;YAAiBC;SAAgB;QACvEgB,aAAY;;AAGlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logsql-extension.d.ts","sourceRoot":"","sources":["../../../src/components/logsql-extension.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAelD,wBAAgB,eAAe,IAAI,KAAK,CAAC,UAAU,GAAG,SAAS,CAAC,CAG/D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright 2025 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
|
+
import { LRLanguage } from '@codemirror/language';
|
|
14
|
+
import { parser } from '@grafana/lezer-logql';
|
|
15
|
+
import { logsqlHighlight } from './logsql-highlight';
|
|
16
|
+
function logsqlLanguage() {
|
|
17
|
+
return LRLanguage.define({
|
|
18
|
+
parser: parser.configure({
|
|
19
|
+
props: [
|
|
20
|
+
logsqlHighlight
|
|
21
|
+
]
|
|
22
|
+
}),
|
|
23
|
+
languageData: {
|
|
24
|
+
closeBrackets: {
|
|
25
|
+
brackets: [
|
|
26
|
+
'(',
|
|
27
|
+
'[',
|
|
28
|
+
'{',
|
|
29
|
+
"'",
|
|
30
|
+
'"',
|
|
31
|
+
'`'
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
commentTokens: {
|
|
35
|
+
line: '#'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export function LogsQLExtension() {
|
|
41
|
+
const language = logsqlLanguage();
|
|
42
|
+
return [
|
|
43
|
+
language
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=logsql-extension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/logsql-extension.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { LRLanguage } from '@codemirror/language';\nimport { parser } from '@grafana/lezer-logql';\nimport { Extension } from '@uiw/react-codemirror';\nimport { logsqlHighlight } from './logsql-highlight';\n\nfunction logsqlLanguage(): LRLanguage {\n return LRLanguage.define({\n parser: parser.configure({\n props: [logsqlHighlight],\n }),\n languageData: {\n closeBrackets: { brackets: ['(', '[', '{', \"'\", '\"', '`'] },\n commentTokens: { line: '#' },\n },\n });\n}\n\nexport function LogsQLExtension(): Array<LRLanguage | Extension> {\n const language = logsqlLanguage();\n return [language];\n}\n"],"names":["LRLanguage","parser","logsqlHighlight","logsqlLanguage","define","configure","props","languageData","closeBrackets","brackets","commentTokens","line","LogsQLExtension","language"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,UAAU,QAAQ,uBAAuB;AAClD,SAASC,MAAM,QAAQ,uBAAuB;AAE9C,SAASC,eAAe,QAAQ,qBAAqB;AAErD,SAASC;IACP,OAAOH,WAAWI,MAAM,CAAC;QACvBH,QAAQA,OAAOI,SAAS,CAAC;YACvBC,OAAO;gBAACJ;aAAgB;QAC1B;QACAK,cAAc;YACZC,eAAe;gBAAEC,UAAU;oBAAC;oBAAK;oBAAK;oBAAK;oBAAK;oBAAK;iBAAI;YAAC;YAC1DC,eAAe;gBAAEC,MAAM;YAAI;QAC7B;IACF;AACF;AAEA,OAAO,SAASC;IACd,MAAMC,WAAWV;IACjB,OAAO;QAACU;KAAS;AACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logsql-highlight.d.ts","sourceRoot":"","sources":["../../../src/components/logsql-highlight.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,eAAe,wCAgB1B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 2025 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
|
+
import { styleTags, tags } from '@lezer/highlight';
|
|
14
|
+
export const logsqlHighlight = styleTags({
|
|
15
|
+
LineComment: tags.comment,
|
|
16
|
+
'Identifier StreamSelector': tags.labelName,
|
|
17
|
+
'LabelName LabelMatcher': tags.labelName,
|
|
18
|
+
String: tags.string,
|
|
19
|
+
'Number Float Duration': tags.number,
|
|
20
|
+
'LogRangeAggregation VectorAggregation': tags.function(tags.keyword),
|
|
21
|
+
'And Or Unless': tags.logicOperator,
|
|
22
|
+
'Eq Neq Re Nre Gt Lt Gte Lte': tags.compareOperator,
|
|
23
|
+
'Add Sub Mul Div Mod Pow': tags.arithmeticOperator,
|
|
24
|
+
Pipe: tags.operator,
|
|
25
|
+
'By Without': tags.keyword,
|
|
26
|
+
'( )': tags.paren,
|
|
27
|
+
'[ ]': tags.squareBracket,
|
|
28
|
+
'{ }': tags.brace,
|
|
29
|
+
'⚠': tags.invalid
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=logsql-highlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/logsql-highlight.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { styleTags, tags } from '@lezer/highlight';\n\nexport const logsqlHighlight = styleTags({\n LineComment: tags.comment,\n 'Identifier StreamSelector': tags.labelName,\n 'LabelName LabelMatcher': tags.labelName,\n String: tags.string,\n 'Number Float Duration': tags.number,\n 'LogRangeAggregation VectorAggregation': tags.function(tags.keyword),\n 'And Or Unless': tags.logicOperator,\n 'Eq Neq Re Nre Gt Lt Gte Lte': tags.compareOperator,\n 'Add Sub Mul Div Mod Pow': tags.arithmeticOperator,\n Pipe: tags.operator,\n 'By Without': tags.keyword,\n '( )': tags.paren,\n '[ ]': tags.squareBracket,\n '{ }': tags.brace,\n '⚠': tags.invalid,\n});\n"],"names":["styleTags","tags","logsqlHighlight","LineComment","comment","labelName","String","string","number","function","keyword","logicOperator","compareOperator","arithmeticOperator","Pipe","operator","paren","squareBracket","brace","invalid"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,SAAS,EAAEC,IAAI,QAAQ,mBAAmB;AAEnD,OAAO,MAAMC,kBAAkBF,UAAU;IACvCG,aAAaF,KAAKG,OAAO;IACzB,6BAA6BH,KAAKI,SAAS;IAC3C,0BAA0BJ,KAAKI,SAAS;IACxCC,QAAQL,KAAKM,MAAM;IACnB,yBAAyBN,KAAKO,MAAM;IACpC,yCAAyCP,KAAKQ,QAAQ,CAACR,KAAKS,OAAO;IACnE,iBAAiBT,KAAKU,aAAa;IACnC,+BAA+BV,KAAKW,eAAe;IACnD,2BAA2BX,KAAKY,kBAAkB;IAClDC,MAAMb,KAAKc,QAAQ;IACnB,cAAcd,KAAKS,OAAO;IAC1B,OAAOT,KAAKe,KAAK;IACjB,OAAOf,KAAKgB,aAAa;IACzB,OAAOhB,KAAKiB,KAAK;IACjB,KAAKjB,KAAKkB,OAAO;AACnB,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/datasources/index.ts"],"names":[],"mappings":"AAaA,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2025 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
|
+
export * from './victorialogs-datasource';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/datasources/index.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './victorialogs-datasource';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,4BAA4B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DatasourcePlugin } from '@perses-dev/plugin-system';
|
|
2
|
+
import { VictoriaLogsClient } from '../../model/client';
|
|
3
|
+
import { VictoriaLogsDatasourceSpec } from './types';
|
|
4
|
+
export declare const VictoriaLogsDatasource: DatasourcePlugin<VictoriaLogsDatasourceSpec, VictoriaLogsClient>;
|
|
5
|
+
//# sourceMappingURL=VictoriaLogsDatasource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VictoriaLogsDatasource.d.ts","sourceRoot":"","sources":["../../../../src/datasources/victorialogs-datasource/VictoriaLogsDatasource.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,kBAAkB,EAKnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAyBrD,eAAO,MAAM,sBAAsB,EAAE,gBAAgB,CAAC,0BAA0B,EAAE,kBAAkB,CAInG,CAAC"}
|