plugin-elastic-report 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/skills/elastic-report/SKILLS.md +32 -0
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/index.js +10 -0
- package/dist/client-v2/851.488fdbf5bc5b6a36.js +10 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/externalVersion.js +20 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +99 -0
- package/dist/locale/vi-VN.json +99 -0
- package/dist/locale/zh-CN.json +99 -0
- package/dist/node_modules/@elastic/elasticsearch/.dockerignore +11 -0
- package/dist/node_modules/@elastic/elasticsearch/LICENSE +202 -0
- package/dist/node_modules/@elastic/elasticsearch/NOTICE.txt +2 -0
- package/dist/node_modules/@elastic/elasticsearch/catalog-info.yaml +50 -0
- package/dist/node_modules/@elastic/elasticsearch/codecov.yml +14 -0
- package/dist/node_modules/@elastic/elasticsearch/index.d.ts +28 -0
- package/dist/node_modules/@elastic/elasticsearch/index.js +85525 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/async_search.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/async_search.js +155 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/autoscaling.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/autoscaling.js +130 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/bulk.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/bulk.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/capabilities.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/capabilities.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cat.d.ts +193 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cat.js +766 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ccr.d.ts +102 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ccr.js +395 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/clear_scroll.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/clear_scroll.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/close_point_in_time.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/close_point_in_time.js +56 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cluster.d.ts +123 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cluster.js +482 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/connector.d.ts +245 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/connector.js +1121 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/count.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/count.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/create.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/create.js +53 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/dangling_indices.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/dangling_indices.js +100 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query_rethrottle.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query_rethrottle.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_script.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_script.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/enrich.d.ts +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/enrich.js +169 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/eql.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/eql.js +139 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/esql.d.ts +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/esql.js +170 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists_source.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists_source.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/explain.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/explain.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/features.d.ts +25 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/features.js +75 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/field_caps.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/field_caps.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/fleet.d.ts +50 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/fleet.js +211 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_context.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_context.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_languages.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_languages.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_source.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_source.js +46 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/graph.d.ts +18 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/graph.js +70 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/health_report.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/health_report.js +54 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ilm.d.ts +88 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ilm.js +329 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/index.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/index.js +61 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/indices.d.ts +494 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/indices.js +2133 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/inference.d.ts +221 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/inference.js +1167 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/info.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/info.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ingest.d.ts +95 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ingest.js +389 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/knn_search.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/knn_search.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/license.d.ts +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/license.js +194 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/logstash.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/logstash.js +118 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mget.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mget.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/migration.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/migration.js +107 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ml.d.ts +522 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ml.js +2468 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/monitoring.d.ts +18 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/monitoring.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch_template.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch_template.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mtermvectors.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mtermvectors.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/nodes.d.ts +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/nodes.js +290 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/open_point_in_time.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/open_point_in_time.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ping.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ping.js +43 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/profiling.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/profiling.js +135 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/put_script.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/put_script.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/query_rules.d.ts +67 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/query_rules.js +260 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rank_eval.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rank_eval.js +67 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex.js +56 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex_rethrottle.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex_rethrottle.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/render_search_template.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/render_search_template.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rollup.d.ts +67 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rollup.js +263 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scripts_painless_execute.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scripts_painless_execute.js +57 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scroll.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scroll.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search.js +75 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_application.d.ts +81 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_application.js +313 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_mvt.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_mvt.js +63 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_shards.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_shards.js +54 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_template.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_template.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/searchable_snapshots.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/searchable_snapshots.js +167 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/security.d.ts +459 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/security.js +1982 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/shutdown.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/shutdown.js +125 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/simulate.d.ts +18 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/simulate.js +78 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/slm.d.ts +74 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/slm.js +253 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/snapshot.d.ts +102 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/snapshot.js +410 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/sql.d.ts +53 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/sql.js +205 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ssl.d.ts +18 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ssl.js +54 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/streams.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/streams.js +96 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/synonyms.d.ts +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/synonyms.js +223 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/tasks.d.ts +32 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/tasks.js +109 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/terms_enum.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/terms_enum.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/termvectors.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/termvectors.js +68 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/text_structure.d.ts +39 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/text_structure.js +148 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/transform.d.ts +101 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/transform.js +386 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update.js +60 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query.js +59 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query_rethrottle.d.ts +14 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query_rethrottle.js +45 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/watcher.d.ts +102 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/watcher.js +405 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/xpack.d.ts +25 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/api/xpack.js +75 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/index.d.ts +265 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/index.js +632 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/types.d.ts +19933 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/types.js +21 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey.d.ts +20606 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey.js +21 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/client.d.ts +152 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/client.js +369 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/helpers.d.ts +184 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/helpers.js +889 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/sniffingTransport.d.ts +4 -0
- package/dist/node_modules/@elastic/elasticsearch/lib/sniffingTransport.js +56 -0
- package/dist/node_modules/@elastic/elasticsearch/node_modules/.bin/arrow2csv +15 -0
- package/dist/node_modules/@elastic/elasticsearch/node_modules/.bin/arrow2csv.cmd +7 -0
- package/dist/node_modules/@elastic/elasticsearch/package.json +1 -0
- package/dist/node_modules/@elastic/elasticsearch/tsconfig.json +38 -0
- package/dist/server/acl-guard.js +107 -0
- package/dist/server/collections/es-report-data-views.js +79 -0
- package/dist/server/collections/es-reports.js +95 -0
- package/dist/server/index.js +58 -0
- package/dist/server/mcp/ElasticReportMcpServer.js +344 -0
- package/dist/server/mcp/ElasticReportToolCatalog.js +417 -0
- package/dist/server/plugin.js +395 -0
- package/dist/server/services/ElasticReportService.js +263 -0
- package/dist/server/services/ElasticsearchConnectionService.js +332 -0
- package/dist/server/services/ReportQueryCompiler.js +858 -0
- package/dist/shared/constants.js +81 -0
- package/dist/shared/types.js +24 -0
- package/package.json +61 -4
- package/server.d.ts +2 -0
- package/server.js +1 -0
- package/src/client/index.tsx +19 -0
- package/src/client-v2/__tests__/elastic-report.test.tsx +311 -0
- package/src/client-v2/api.ts +224 -0
- package/src/client-v2/components/ElasticBasicCharts.tsx +399 -0
- package/src/client-v2/components/ElasticReportBlock.tsx +160 -0
- package/src/client-v2/components/ElasticReportRenderer.tsx +707 -0
- package/src/client-v2/components/HighlightText.tsx +50 -0
- package/src/client-v2/components/ReportSelect.tsx +72 -0
- package/src/client-v2/index.tsx +14 -0
- package/src/client-v2/locale.ts +23 -0
- package/src/client-v2/models/ElasticReportBlockModel.tsx +85 -0
- package/src/client-v2/pages/ElasticReportManager.tsx +1047 -0
- package/src/client-v2/plugin.tsx +52 -0
- package/src/index.ts +11 -0
- package/src/locale/en-US.json +99 -0
- package/src/locale/vi-VN.json +99 -0
- package/src/locale/zh-CN.json +99 -0
- package/src/server/__tests__/query-compiler.test.ts +231 -0
- package/src/server/__tests__/report-mcp-acl.integration.test.ts +377 -0
- package/src/server/acl-guard.ts +103 -0
- package/src/server/collections/es-report-data-views.ts +58 -0
- package/src/server/collections/es-reports.ts +74 -0
- package/src/server/index.ts +15 -0
- package/src/server/mcp/ElasticReportMcpServer.ts +391 -0
- package/src/server/mcp/ElasticReportToolCatalog.ts +417 -0
- package/src/server/plugin.ts +431 -0
- package/src/server/services/ElasticReportService.ts +326 -0
- package/src/server/services/ElasticsearchConnectionService.ts +401 -0
- package/src/server/services/ReportQueryCompiler.ts +1017 -0
- package/src/shared/constants.ts +29 -0
- package/src/shared/types.ts +175 -0
- package/README.md +0 -3
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var constants_exports = {};
|
|
28
|
+
__export(constants_exports, {
|
|
29
|
+
ACL_SNIPPET: () => ACL_SNIPPET,
|
|
30
|
+
DATA_VIEWS_COLLECTION: () => DATA_VIEWS_COLLECTION,
|
|
31
|
+
DEFAULT_PAGE_SIZE: () => DEFAULT_PAGE_SIZE,
|
|
32
|
+
HIGHLIGHT_POST_TAG: () => HIGHLIGHT_POST_TAG,
|
|
33
|
+
HIGHLIGHT_PRE_TAG: () => HIGHLIGHT_PRE_TAG,
|
|
34
|
+
MAX_MCP_PREVIEW_SIZE: () => MAX_MCP_PREVIEW_SIZE,
|
|
35
|
+
MAX_RESULT_WINDOW: () => MAX_RESULT_WINDOW,
|
|
36
|
+
MAX_TERMS_BUCKETS: () => MAX_TERMS_BUCKETS,
|
|
37
|
+
MAX_UI_PAGE_SIZE: () => MAX_UI_PAGE_SIZE,
|
|
38
|
+
MCP_RELATIVE_PATH: () => MCP_RELATIVE_PATH,
|
|
39
|
+
MCP_RESOURCE_NAME: () => MCP_RESOURCE_NAME,
|
|
40
|
+
MCP_SERVER_NAME: () => MCP_SERVER_NAME,
|
|
41
|
+
PLUGIN_NAME: () => PLUGIN_NAME,
|
|
42
|
+
REPORTS_COLLECTION: () => REPORTS_COLLECTION,
|
|
43
|
+
SERVICE_RESOURCE: () => SERVICE_RESOURCE,
|
|
44
|
+
SETTINGS_MENU_KEY: () => SETTINGS_MENU_KEY
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(constants_exports);
|
|
47
|
+
const PLUGIN_NAME = "plugin-elastic-report";
|
|
48
|
+
const SETTINGS_MENU_KEY = "elastic-report";
|
|
49
|
+
const ACL_SNIPPET = "pm.elastic-report";
|
|
50
|
+
const DATA_VIEWS_COLLECTION = "esReportDataViews";
|
|
51
|
+
const REPORTS_COLLECTION = "esReports";
|
|
52
|
+
const SERVICE_RESOURCE = "esReportService";
|
|
53
|
+
const MCP_SERVER_NAME = "elastic-report";
|
|
54
|
+
const MCP_RESOURCE_NAME = "elastic-report-mcp";
|
|
55
|
+
const MCP_RELATIVE_PATH = "/elastic-report-mcp";
|
|
56
|
+
const HIGHLIGHT_PRE_TAG = "__ES_HL_START__";
|
|
57
|
+
const HIGHLIGHT_POST_TAG = "__ES_HL_END__";
|
|
58
|
+
const DEFAULT_PAGE_SIZE = 20;
|
|
59
|
+
const MAX_UI_PAGE_SIZE = 200;
|
|
60
|
+
const MAX_MCP_PREVIEW_SIZE = 20;
|
|
61
|
+
const MAX_RESULT_WINDOW = 1e4;
|
|
62
|
+
const MAX_TERMS_BUCKETS = 50;
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
ACL_SNIPPET,
|
|
66
|
+
DATA_VIEWS_COLLECTION,
|
|
67
|
+
DEFAULT_PAGE_SIZE,
|
|
68
|
+
HIGHLIGHT_POST_TAG,
|
|
69
|
+
HIGHLIGHT_PRE_TAG,
|
|
70
|
+
MAX_MCP_PREVIEW_SIZE,
|
|
71
|
+
MAX_RESULT_WINDOW,
|
|
72
|
+
MAX_TERMS_BUCKETS,
|
|
73
|
+
MAX_UI_PAGE_SIZE,
|
|
74
|
+
MCP_RELATIVE_PATH,
|
|
75
|
+
MCP_RESOURCE_NAME,
|
|
76
|
+
MCP_SERVER_NAME,
|
|
77
|
+
PLUGIN_NAME,
|
|
78
|
+
REPORTS_COLLECTION,
|
|
79
|
+
SERVICE_RESOURCE,
|
|
80
|
+
SETTINGS_MENU_KEY
|
|
81
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
+
var types_exports = {};
|
|
24
|
+
module.exports = __toCommonJS(types_exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plugin-elastic-report",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"displayName": "Elastic Report",
|
|
4
|
+
"displayName.vi-VN": "Báo cáo Elasticsearch",
|
|
5
|
+
"displayName.zh-CN": "Elasticsearch 报表",
|
|
6
|
+
"description": "Kibana-style Elasticsearch Discover & Visualization reports with reusable blocks and a dedicated MCP server for AI Employees.",
|
|
7
|
+
"description.vi-VN": "Tạo báo cáo bảng và biểu đồ từ dữ liệu Elasticsearch theo phong cách Kibana, gắn dưới dạng Block và cung cấp MCP riêng cho AI Employee.",
|
|
8
|
+
"description.zh-CN": "连接 Elasticsearch 构建类 Kibana 的检索、筛选、排序与基础图表报表区块,并提供专属 MCP 服务供 AI 员工调用。",
|
|
9
|
+
"version": "0.1.1",
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"main": "dist/server/index.js",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"AI",
|
|
14
|
+
"Blocks",
|
|
15
|
+
"Charts",
|
|
16
|
+
"Data sources",
|
|
17
|
+
"Elasticsearch",
|
|
18
|
+
"MCP",
|
|
19
|
+
"Reports"
|
|
20
|
+
],
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"ai",
|
|
24
|
+
"src",
|
|
25
|
+
"client.js",
|
|
26
|
+
"client.d.ts",
|
|
27
|
+
"client-v2.js",
|
|
28
|
+
"client-v2.d.ts",
|
|
29
|
+
"server.js",
|
|
30
|
+
"server.d.ts"
|
|
31
|
+
],
|
|
32
|
+
"nocobase": {
|
|
33
|
+
"supportedVersions": [
|
|
34
|
+
"2.x"
|
|
35
|
+
],
|
|
36
|
+
"editionLevel": 0
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@elastic/elasticsearch": "^8.17.0",
|
|
40
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
41
|
+
"@nocobase/acl": "2.x",
|
|
42
|
+
"@nocobase/actions": "2.x",
|
|
43
|
+
"@nocobase/ai": "2.x",
|
|
44
|
+
"@nocobase/client": "2.x",
|
|
45
|
+
"@nocobase/client-v2": "2.x",
|
|
46
|
+
"@nocobase/data-source-manager": "2.x",
|
|
47
|
+
"@nocobase/database": "2.x",
|
|
48
|
+
"@nocobase/flow-engine": "2.x",
|
|
49
|
+
"@nocobase/plugin-ai": "2.x",
|
|
50
|
+
"@nocobase/plugin-data-source-manager": "2.x",
|
|
51
|
+
"@nocobase/server": "2.x"
|
|
52
|
+
},
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/OrgGem/nocobase-beta.git",
|
|
56
|
+
"directory": "packages/plugins/plugin-elastic-report"
|
|
57
|
+
},
|
|
58
|
+
"gitHead": "321fce51621d4b8d6b5995e448fc66ce4cb67f58",
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public",
|
|
61
|
+
"registry": "https://registry.npmjs.org/"
|
|
62
|
+
}
|
|
63
|
+
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/server/index.js');
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Plugin } from '@nocobase/client';
|
|
11
|
+
import { ElasticReportBlockModel } from '../client-v2/models/ElasticReportBlockModel';
|
|
12
|
+
|
|
13
|
+
export class PluginElasticReportLegacyClient extends Plugin {
|
|
14
|
+
async load() {
|
|
15
|
+
this.flowEngine?.registerModels?.({ ElasticReportBlockModel });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default PluginElasticReportLegacyClient;
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { cleanup, render, screen, waitFor } from '@testing-library/react';
|
|
11
|
+
import userEvent from '@testing-library/user-event';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
14
|
+
import { HIGHLIGHT_POST_TAG, HIGHLIGHT_PRE_TAG } from '../../shared/constants';
|
|
15
|
+
|
|
16
|
+
const mocks = vi.hoisted(() => {
|
|
17
|
+
const request = vi.fn();
|
|
18
|
+
const apiClient = { request };
|
|
19
|
+
const registerModelLoaders = vi.fn();
|
|
20
|
+
const addMenuItem = vi.fn();
|
|
21
|
+
const addPageTabItem = vi.fn();
|
|
22
|
+
const setPluginSettingsLink = vi.fn();
|
|
23
|
+
|
|
24
|
+
class MockBlockModel {
|
|
25
|
+
props: Record<string, unknown> = {};
|
|
26
|
+
static definedMeta: Record<string, unknown> | undefined;
|
|
27
|
+
static registeredFlows: Record<string, unknown>[] = [];
|
|
28
|
+
|
|
29
|
+
static define(meta: Record<string, unknown>) {
|
|
30
|
+
this.definedMeta = meta;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static registerFlow(flow: Record<string, unknown>) {
|
|
34
|
+
this.registeredFlows.push(flow);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
setProps(next: Record<string, unknown>) {
|
|
38
|
+
this.props = { ...this.props, ...next };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
class MockPlugin {
|
|
43
|
+
options: Record<string, unknown>;
|
|
44
|
+
flowEngine = { registerModelLoaders };
|
|
45
|
+
pluginSettingsManager = {
|
|
46
|
+
addMenuItem,
|
|
47
|
+
addPageTabItem,
|
|
48
|
+
setPluginSettingsLink,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
constructor(options: Record<string, unknown> = {}) {
|
|
52
|
+
this.options = options;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
t(key: string) {
|
|
56
|
+
return key;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
request,
|
|
62
|
+
apiClient,
|
|
63
|
+
registerModelLoaders,
|
|
64
|
+
addMenuItem,
|
|
65
|
+
addPageTabItem,
|
|
66
|
+
setPluginSettingsLink,
|
|
67
|
+
MockBlockModel,
|
|
68
|
+
MockPlugin,
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
vi.mock('@nocobase/client-v2', () => ({
|
|
73
|
+
BlockModel: mocks.MockBlockModel,
|
|
74
|
+
Plugin: mocks.MockPlugin,
|
|
75
|
+
Application: class {},
|
|
76
|
+
useApp: () => ({
|
|
77
|
+
apiClient: mocks.apiClient,
|
|
78
|
+
}),
|
|
79
|
+
}));
|
|
80
|
+
|
|
81
|
+
vi.mock('@nocobase/flow-engine', () => ({
|
|
82
|
+
tExpr: (key: string) => key,
|
|
83
|
+
useFlowEngine: () => ({
|
|
84
|
+
context: {
|
|
85
|
+
t: (key: string) => key,
|
|
86
|
+
},
|
|
87
|
+
}),
|
|
88
|
+
}));
|
|
89
|
+
|
|
90
|
+
import { ElasticBasicChart } from '../components/ElasticBasicCharts';
|
|
91
|
+
import { ElasticReportBlock } from '../components/ElasticReportBlock';
|
|
92
|
+
import { HighlightText } from '../components/HighlightText';
|
|
93
|
+
import { ElasticReportBlockModel } from '../models/ElasticReportBlockModel';
|
|
94
|
+
import { PluginElasticReportClient } from '../plugin';
|
|
95
|
+
|
|
96
|
+
describe('plugin-elastic-report client-v2', () => {
|
|
97
|
+
beforeEach(() => {
|
|
98
|
+
mocks.request.mockReset();
|
|
99
|
+
mocks.registerModelLoaders.mockClear();
|
|
100
|
+
mocks.addMenuItem.mockClear();
|
|
101
|
+
mocks.addPageTabItem.mockClear();
|
|
102
|
+
mocks.setPluginSettingsLink.mockClear();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
afterEach(() => {
|
|
106
|
+
cleanup();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('registers ElasticReportBlockModel loader and settings page on load()', async () => {
|
|
110
|
+
const plugin = new PluginElasticReportClient({ name: 'plugin-elastic-report' } as never, {} as never);
|
|
111
|
+
await plugin.load();
|
|
112
|
+
|
|
113
|
+
expect(mocks.registerModelLoaders).toHaveBeenCalledWith(
|
|
114
|
+
expect.objectContaining({
|
|
115
|
+
ElasticReportBlockModel: expect.objectContaining({
|
|
116
|
+
extends: 'BlockModel',
|
|
117
|
+
}),
|
|
118
|
+
}),
|
|
119
|
+
);
|
|
120
|
+
expect(mocks.addMenuItem).toHaveBeenCalledWith(
|
|
121
|
+
expect.objectContaining({
|
|
122
|
+
key: 'elastic-report',
|
|
123
|
+
aclSnippet: 'pm.elastic-report',
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
126
|
+
expect(mocks.addPageTabItem).toHaveBeenCalledTimes(1);
|
|
127
|
+
expect(ElasticReportBlockModel.definedMeta).toMatchObject({
|
|
128
|
+
label: 'Elastic Report',
|
|
129
|
+
createModelOptions: { use: 'ElasticReportBlockModel' },
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('renders Elasticsearch highlights safely with <mark> without injecting raw HTML', () => {
|
|
134
|
+
const text = ` Normal <img src=x onerror=alert(1)> ${HIGHLIGHT_PRE_TAG}matched term${HIGHLIGHT_POST_TAG} tail`;
|
|
135
|
+
const { container } = render(<HighlightText text={text} />);
|
|
136
|
+
|
|
137
|
+
const mark = container.querySelector('mark');
|
|
138
|
+
expect(mark?.textContent).toBe('matched term');
|
|
139
|
+
expect(container.querySelector('img')).toBeNull();
|
|
140
|
+
expect(container.textContent).toContain('<img src=x onerror=alert(1)>');
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('renders accessible SVG bar chart and switches to data table view on demand', async () => {
|
|
144
|
+
const user = userEvent.setup();
|
|
145
|
+
render(
|
|
146
|
+
<ElasticBasicChart
|
|
147
|
+
title="Requests by Service"
|
|
148
|
+
visualization="bar"
|
|
149
|
+
metricLabel="Requests"
|
|
150
|
+
metricValue={null}
|
|
151
|
+
totalHits={42}
|
|
152
|
+
series={[
|
|
153
|
+
{ key: 'checkout', label: 'checkout', value: 30, count: 30 },
|
|
154
|
+
{ key: 'catalog', label: 'catalog', value: 12, count: 12 },
|
|
155
|
+
]}
|
|
156
|
+
/>,
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
expect(screen.getByRole('img', { name: /Requests by Service/i })).toBeTruthy();
|
|
160
|
+
await user.click(screen.getByRole('button', { name: 'Show data table' }));
|
|
161
|
+
expect(screen.getByText('checkout')).toBeTruthy();
|
|
162
|
+
expect(screen.getByText('catalog')).toBeTruthy();
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('preserves KQL and inline-edited filter pills when server returns unchanged saved report spec', async () => {
|
|
166
|
+
const user = userEvent.setup();
|
|
167
|
+
const savedSpec = {
|
|
168
|
+
visualization: 'table' as const,
|
|
169
|
+
query: 'status >= 400',
|
|
170
|
+
filters: [{ id: 'f1', field: 'service', operator: 'eq' as const, value: 'checkout-api', enabled: true }],
|
|
171
|
+
timeRange: { preset: 'last_7d' as const },
|
|
172
|
+
columns: ['@timestamp', 'service', 'status'],
|
|
173
|
+
pageSize: 20,
|
|
174
|
+
allowInteractiveControls: true,
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
mocks.request.mockImplementation(async (cfg: { url: string; data?: Record<string, unknown> }) => {
|
|
178
|
+
if (cfg.url === 'esReportService:getReportMeta') {
|
|
179
|
+
return {
|
|
180
|
+
data: {
|
|
181
|
+
data: {
|
|
182
|
+
report: {
|
|
183
|
+
id: 10,
|
|
184
|
+
title: 'Gateway Error Logs (Discover Table)',
|
|
185
|
+
dataViewId: 1,
|
|
186
|
+
visualization: 'table',
|
|
187
|
+
published: true,
|
|
188
|
+
spec: { ...savedSpec },
|
|
189
|
+
},
|
|
190
|
+
dataView: {
|
|
191
|
+
id: 1,
|
|
192
|
+
title: 'Logs',
|
|
193
|
+
dataSourceKey: 'es_main',
|
|
194
|
+
indexPattern: 'logs-*',
|
|
195
|
+
timeField: '@timestamp',
|
|
196
|
+
},
|
|
197
|
+
fields: [
|
|
198
|
+
{ name: '@timestamp', type: 'date', searchable: true, aggregatable: true },
|
|
199
|
+
{ name: 'service', type: 'keyword', searchable: true, aggregatable: true },
|
|
200
|
+
{ name: 'status', type: 'integer', searchable: true, aggregatable: true },
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (cfg.url === 'esReportService:runReport') {
|
|
208
|
+
return {
|
|
209
|
+
data: {
|
|
210
|
+
data: {
|
|
211
|
+
report: {
|
|
212
|
+
id: 10,
|
|
213
|
+
title: 'Gateway Error Logs (Discover Table)',
|
|
214
|
+
dataViewId: 1,
|
|
215
|
+
visualization: 'table',
|
|
216
|
+
published: true,
|
|
217
|
+
// Real server always returns the persisted spec (with a fresh object reference), NOT overrides
|
|
218
|
+
spec: {
|
|
219
|
+
...savedSpec,
|
|
220
|
+
filters: savedSpec.filters.map((f) => ({ ...f })),
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
dataView: {
|
|
224
|
+
id: 1,
|
|
225
|
+
title: 'Logs',
|
|
226
|
+
dataSourceKey: 'es_main',
|
|
227
|
+
indexPattern: 'logs-*',
|
|
228
|
+
timeField: '@timestamp',
|
|
229
|
+
},
|
|
230
|
+
result: {
|
|
231
|
+
total: 1,
|
|
232
|
+
totalRelation: 'eq',
|
|
233
|
+
tookMs: 4,
|
|
234
|
+
visualization: 'table',
|
|
235
|
+
columns: ['@timestamp', 'service', 'status'],
|
|
236
|
+
rows: [
|
|
237
|
+
{
|
|
238
|
+
_id: 'doc-1',
|
|
239
|
+
_index: 'logs-2026',
|
|
240
|
+
source: {
|
|
241
|
+
'@timestamp': '2026-11-30T01:00:00Z',
|
|
242
|
+
service: 'gateway',
|
|
243
|
+
status: 503,
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
series: [],
|
|
248
|
+
histogram: [],
|
|
249
|
+
metricValue: null,
|
|
250
|
+
metricLabel: 'Count',
|
|
251
|
+
compiledDsl: { query: { match_all: {} } },
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
return { data: { data: [] } };
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
render(<ElasticReportBlock reportId={10} showToolbar={true} />);
|
|
261
|
+
|
|
262
|
+
await waitFor(() => {
|
|
263
|
+
expect(screen.getByText('gateway')).toBeTruthy();
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
const searchInput = screen.getByRole('textbox', { name: 'KQL / Search Query' }) as HTMLInputElement;
|
|
267
|
+
expect(searchInput.value).toBe('status >= 400');
|
|
268
|
+
|
|
269
|
+
await user.clear(searchInput);
|
|
270
|
+
await user.type(searchInput, 'status >= 500');
|
|
271
|
+
await user.click(screen.getByRole('button', { name: /Search/i }));
|
|
272
|
+
|
|
273
|
+
await waitFor(() => {
|
|
274
|
+
expect(mocks.request).toHaveBeenCalledWith(
|
|
275
|
+
expect.objectContaining({
|
|
276
|
+
url: 'esReportService:runReport',
|
|
277
|
+
data: expect.objectContaining({
|
|
278
|
+
reportId: 10,
|
|
279
|
+
overrides: expect.objectContaining({
|
|
280
|
+
query: 'status >= 500',
|
|
281
|
+
}),
|
|
282
|
+
}),
|
|
283
|
+
}),
|
|
284
|
+
);
|
|
285
|
+
});
|
|
286
|
+
expect(searchInput.value).toBe('status >= 500');
|
|
287
|
+
|
|
288
|
+
// Click existing filter pill to edit its value in place
|
|
289
|
+
await user.click(screen.getByRole('button', { name: 'Edit Filter: service' }));
|
|
290
|
+
const valueInput = screen.getByDisplayValue('checkout-api');
|
|
291
|
+
await user.clear(valueInput);
|
|
292
|
+
await user.type(valueInput, 'auth-service');
|
|
293
|
+
await user.click(screen.getByRole('button', { name: 'Apply' }));
|
|
294
|
+
|
|
295
|
+
await waitFor(() => {
|
|
296
|
+
expect(mocks.request).toHaveBeenCalledWith(
|
|
297
|
+
expect.objectContaining({
|
|
298
|
+
url: 'esReportService:runReport',
|
|
299
|
+
data: expect.objectContaining({
|
|
300
|
+
reportId: 10,
|
|
301
|
+
overrides: expect.objectContaining({
|
|
302
|
+
query: 'status >= 500',
|
|
303
|
+
filters: [expect.objectContaining({ field: 'service', operator: 'eq', value: 'auth-service' })],
|
|
304
|
+
}),
|
|
305
|
+
}),
|
|
306
|
+
}),
|
|
307
|
+
);
|
|
308
|
+
});
|
|
309
|
+
expect(screen.getByText(/service eq auth-service/)).toBeTruthy();
|
|
310
|
+
});
|
|
311
|
+
});
|