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,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: elastic-report-builder
|
|
3
|
+
title: Elasticsearch Kibana Report Builder
|
|
4
|
+
description: Discover Elasticsearch data views, inspect field capabilities, preview KQL/filter/sort/aggregation queries, and create Saved Elasticsearch Reports for NocoBase blocks.
|
|
5
|
+
tools:
|
|
6
|
+
- elastic-report-es_list_connections
|
|
7
|
+
- elastic-report-es_list_data_views
|
|
8
|
+
- elastic-report-es_upsert_data_view
|
|
9
|
+
- elastic-report-es_inspect_fields
|
|
10
|
+
- elastic-report-es_preview_report
|
|
11
|
+
- elastic-report-es_save_report
|
|
12
|
+
- elastic-report-es_list_reports
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Elasticsearch Report Builder Guide
|
|
16
|
+
|
|
17
|
+
Use these tools (or their `mcp-elastic-report-*` equivalents) whenever a user asks to explore Elasticsearch logs/metrics/documents or build a Kibana-style Table or Chart report in NocoBase.
|
|
18
|
+
|
|
19
|
+
## Mandatory 4-Step Workflow
|
|
20
|
+
|
|
21
|
+
1. **Locate or Create a Data View**:
|
|
22
|
+
- Call `es_list_data_views` first.
|
|
23
|
+
- If no matching Data View exists yet, call `es_list_connections` to check available Elasticsearch connections and index names, then call `es_upsert_data_view` with `dataSourceKey` and `indexPattern` (for example `logs-*`).
|
|
24
|
+
2. **Inspect Field Capabilities (`_field_caps`)**:
|
|
25
|
+
- Always call `es_inspect_fields` for the chosen `dataViewId` before writing filters, sorts, or chart buckets.
|
|
26
|
+
- Never guess field names. When sorting or grouping (`terms` bucket) on a `text` field, prefer its `keywordSubfield` (for example `service.keyword`) or a field marked `aggregatable: true`.
|
|
27
|
+
3. **Preview Before Saving**:
|
|
28
|
+
- Call `es_preview_report` with your proposed `spec` (`visualization`: `'table' | 'bar' | 'line' | 'area' | 'pie' | 'metric'`, `query` in KQL, `filters`, `sort`, `timeRange`, `columns` or `chart`).
|
|
29
|
+
- Verify `total` hits and sample rows/series look accurate; adjust filters or field names if `total` is unexpectedly 0 or an error occurs.
|
|
30
|
+
4. **Save the Report**:
|
|
31
|
+
- Call `es_save_report` with `published: true` and a clear `title`.
|
|
32
|
+
- Tell the user the saved report title so they can click **Add Block -> Elastic Report** on any `/v/` page and select it immediately.
|
package/client-v2.d.ts
ADDED
package/client-v2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client-v2/index.js');
|
package/client.d.ts
ADDED
package/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client/index.js');
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("plugin-elastic-report",["@nocobase/client-v2","react","antd","@nocobase/client","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["plugin-elastic-report"]=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["plugin-elastic-report"]=t(e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/client"],e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,a){return function(){"use strict";var l={375:function(e){e.exports=o},342:function(e){e.exports=r},485:function(t){t.exports=e},694:function(e){e.exports=a},59:function(e){e.exports=n},155:function(e){e.exports=t}},i={};function c(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return l[e](n,n.exports,c),n.exports}c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,{a:t}),t},c.d=function(e,t){for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.g.importScripts&&(u=c.g.location+"");var u,s=c.g.document;if(!u&&s&&(s.currentScript&&"SCRIPT"===s.currentScript.tagName.toUpperCase()&&(u=s.currentScript.src),!u)){var f=s.getElementsByTagName("script");if(f.length)for(var p=f.length-1;p>-1&&(!u||!/^http(s?):/.test(u));)u=f[p--].src}if(!u)throw Error("Automatic publicPath is not supported in this browser");c.p=u.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var d={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/plugin-elastic-report/dist/client/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-elastic-report/dist/client/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",a="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var l=window.location.pathname||"/",i=l.indexOf(a);e=i>=0?l.slice(0,i+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-elastic-report/dist/client/"}c.p=e}(),!function(){c.r(d),c.d(d,{PluginElasticReportLegacyClient:function(){return ec},default:function(){return eu}});var e=c(342),t=c(485),n=c(155),r=c.n(n),o=c(59),a="esReportService",l="__ES_HL_START__",i="__ES_HL_END__";function u(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){u(a,r,o,l,i,"next",e)}function i(e){u(a,r,o,l,i,"throw",e)}l(void 0)})}}function f(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function p(e){return(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&null!==e&&!Array.isArray(e)}function y(e){if(!p(e))return e;var t=e.data;return p(t)&&"data"in t?t.data:null!=t?t:e}function m(e,t,n){return s(function(){return f(this,function(r){switch(r.label){case 0:return[4,e.request({url:"".concat(a,":runReport"),method:"post",data:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({reportId:t},n?{overrides:n}:{})})];case 1:return[2,y(r.sent())]}})})()}var b=c(694),v="plugin-elastic-report";function h(){var e=(0,b.useFlowEngine)();return function(t,n){return e.context.t(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[v,"client"]},n))}}function g(e){return(0,b.tExpr)(e,{ns:[v,"client"]})}var S=c(375);function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function E(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||x(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e,t){if(e){if("string"==typeof e)return w(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w(e,t)}}var O=o.Typography.Text,k=["#1677ff","#13c2c2","#52c41a","#fa8c16","#722ed1","#eb2f96","#2f54eb","#faad14"];function j(e){return Number.isFinite(e)?Math.abs(e)>=1e6?"".concat((e/1e6).toFixed(2),"M"):Math.abs(e)>=1e3?"".concat((e/1e3).toFixed(1),"k"):Number.isInteger(e)?String(e):e.toFixed(2):"0"}function P(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:18;return e.length<=t?e:"".concat(e.slice(0,t-1),"…")}var _=function(e){var t,a,l,i=e.buckets,c=h(),u=o.theme.useToken().token,s=(0,n.useId)();if(!i.length)return null;var f=(t=Math).max.apply(t,[1].concat(E(i.map(function(e){return e.count})))),p=Math.max(4,(720-2*i.length)/i.length);return r().createElement("figure",{style:{margin:"0 0 12px 0"}},r().createElement("svg",{role:"img","aria-labelledby":s,viewBox:"0 0 ".concat(720," ").concat(68),style:{width:"100%",height:68,display:"block"}},r().createElement("title",{id:s},c("Date Histogram")),i.map(function(e,t){var n=Math.max(e.count>0?3:1,Math.round(e.count/f*54));return r().createElement(o.Tooltip,{key:"".concat(e.key,"-").concat(t),title:"".concat(e.key,": ").concat(e.count)},r().createElement("rect",{x:t*(p+2),y:68-n-2,width:p,height:n,rx:2,fill:e.count>0?u.colorPrimary:u.colorFillSecondary,opacity:.85}))})),r().createElement("figcaption",{style:{display:"flex",justifyContent:"space-between",fontSize:11,color:u.colorTextSecondary}},r().createElement("span",null,null==(a=i[0])?void 0:a.key),r().createElement("span",null,null==(l=i[i.length-1])?void 0:l.key)))},A=function(e){var t,a,l,i,c=e.title,u=e.visualization,s=e.series,f=e.metricValue,p=e.metricLabel,d=e.totalHits,y=e.onSelectBucket,m=h(),b=o.theme.useToken().token,v=(0,n.useId)(),g=function(e){if(Array.isArray(e))return e}(t=(0,n.useState)(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,l=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||x(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),S=g[0],w=g[1];if("metric"===u)return r().createElement(o.Card,{bordered:!1,style:{textAlign:"center",padding:"16px 8px"}},r().createElement(o.Statistic,{title:p||c,value:null!=f?f:0,valueStyle:{fontSize:36,fontWeight:600,color:b.colorPrimary}}),r().createElement(O,{type:"secondary",style:{fontSize:12}},m("Hits"),": ",d.toLocaleString()));if(!s.length)return r().createElement(o.Empty,{description:m("No matching documents")});var _=(i=Math).max.apply(i,[1].concat(E(s.map(function(e){return Math.abs(e.value)}))));return r().createElement("figure",{style:{margin:0}},r().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8}},r().createElement("figcaption",{style:{fontSize:12,color:b.colorTextSecondary}},p," \xb7 ",m("Hits"),": ",d.toLocaleString()),r().createElement(o.Button,{size:"small",type:"link",onClick:function(){return w(function(e){return!e})}},S?m("Show chart"):m("Show data table"))),S?r().createElement(o.Table,{size:"small",rowKey:"key",pagination:!1,dataSource:s,columns:[{title:m("Bucket Field"),dataIndex:"label",key:"label"},{title:p||m("Value"),dataIndex:"value",key:"value"},{title:m("Hits"),dataIndex:"count",key:"count"}]}):"pie"===u?(a=Math.max(1,s.reduce(function(e,t){return e+Math.max(0,t.value)},0)),l=-Math.PI/2,r().createElement("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:24}},r().createElement("svg",{role:"img","aria-labelledby":v,viewBox:"0 0 260 240",style:{width:240,height:220,flexShrink:0}},r().createElement("title",{id:v},"".concat(c," - ").concat(p)),s.map(function(e,t){var n=Math.max(0,e.value),i=n/a*Math.PI*2,c=l,u=l+i;if(l=u,1===s.length||i>=2*Math.PI-.001)return r().createElement(o.Tooltip,{key:e.key,title:"".concat(e.label,": ").concat(e.value.toLocaleString()," (100%)")},r().createElement("circle",{cx:130,cy:120,r:92,fill:k[0]}));var f=130+92*Math.cos(c),p=120+92*Math.sin(c),d=130+92*Math.cos(u),m=120+92*Math.sin(u),v=+(i>Math.PI),h="M ".concat(130," ").concat(120," L ").concat(f.toFixed(2)," ").concat(p.toFixed(2)," A ").concat(92," ").concat(92," 0 ").concat(v," 1 ").concat(d.toFixed(2)," ").concat(m.toFixed(2)," Z"),g=(n/a*100).toFixed(1);return r().createElement(o.Tooltip,{key:"".concat(e.key,"-").concat(t),title:"".concat(e.label,": ").concat(e.value.toLocaleString()," (").concat(g,"%)")},r().createElement("path",{d:h,fill:k[t%k.length],stroke:b.colorBgContainer,strokeWidth:1.5,style:{cursor:y?"pointer":"default"},onClick:function(){return null==y?void 0:y(e.key)}}))})),r().createElement("div",{style:{flex:1,minWidth:200}},r().createElement(o.Space,{direction:"vertical",size:6,style:{width:"100%"}},s.map(function(e,t){var n=(Math.max(0,e.value)/a*100).toFixed(1);return r().createElement("div",{key:"legend-".concat(e.key,"-").concat(t),style:{display:"flex",justifyContent:"space-between",gap:12,fontSize:13}},r().createElement(o.Space,{size:8},r().createElement("span",{"aria-hidden":"true",style:{display:"inline-block",width:10,height:10,borderRadius:2,backgroundColor:k[t%k.length]}}),r().createElement(O,{ellipsis:!0,style:{maxWidth:220}},e.label)),r().createElement(O,{strong:!0},e.value.toLocaleString()," (",n,"%)"))}))))):function(){var e=[0,.25,.5,.75,1];if("bar"===u){var t=Math.min(16,Math.max(4,Math.floor(680/(4*s.length)))),n=Math.max(8,(680-t*(s.length+1))/s.length);return r().createElement("svg",{role:"img","aria-labelledby":v,viewBox:"0 0 ".concat(760," ").concat(260),style:{width:"100%",height:260,display:"block"}},r().createElement("title",{id:v},"".concat(c," - ").concat(p)),e.map(function(e){var t=214-194*e;return r().createElement("g",{key:"grid-".concat(e)},r().createElement("line",{x1:56,y1:t,x2:736,y2:t,stroke:b.colorSplit,strokeDasharray:"3 3"}),r().createElement("text",{x:48,y:t+4,textAnchor:"end",fontSize:11,fill:b.colorTextSecondary},j(e*_)))}),s.map(function(e,a){var l=Math.max(2,Math.max(0,e.value)/_*194),i=56+t+a*(n+t),c=s.length<=12||a%Math.ceil(s.length/8)==0;return r().createElement("g",{key:"".concat(e.key,"-").concat(a)},r().createElement(o.Tooltip,{title:"".concat(e.label,": ").concat(e.value.toLocaleString()," (").concat(m("Hits"),": ").concat(e.count,")")},r().createElement("rect",{x:i,y:214-l,width:n,height:l,rx:3,fill:k[a%k.length],style:{cursor:y?"pointer":"default"},onClick:function(){return null==y?void 0:y(e.key)}})),c&&r().createElement("text",{x:i+n/2,y:232,textAnchor:"middle",fontSize:11,fill:b.colorTextSecondary},P(e.label,12)))}))}var a=s.length>1?680/(s.length-1):340,l=s.map(function(e,t){return{x:s.length>1?56+t*a:396,y:214-Math.max(0,e.value)/_*194,item:e,idx:t}}),i=l.map(function(e,t){return"".concat(0===t?"M":"L"," ").concat(e.x.toFixed(1)," ").concat(e.y.toFixed(1))}).join(" "),f=l.length>0?"".concat(i," L ").concat(l[l.length-1].x.toFixed(1)," ").concat("214.0"," L ").concat(l[0].x.toFixed(1)," ").concat("214.0"," Z"):"";return r().createElement("svg",{role:"img","aria-labelledby":v,viewBox:"0 0 ".concat(760," ").concat(260),style:{width:"100%",height:260,display:"block"}},r().createElement("title",{id:v},"".concat(c," - ").concat(p)),e.map(function(e){var t=214-194*e;return r().createElement("g",{key:"grid-".concat(e)},r().createElement("line",{x1:56,y1:t,x2:736,y2:t,stroke:b.colorSplit,strokeDasharray:"3 3"}),r().createElement("text",{x:48,y:t+4,textAnchor:"end",fontSize:11,fill:b.colorTextSecondary},j(e*_)))}),"area"===u&&f&&r().createElement("path",{d:f,fill:b.colorPrimary,fillOpacity:.18}),i&&r().createElement("path",{d:i,fill:"none",stroke:b.colorPrimary,strokeWidth:2.5}),l.map(function(e){var t=e.x,n=e.y,a=e.item,l=e.idx,i=s.length<=10||l%Math.ceil(s.length/7)==0;return r().createElement("g",{key:"".concat(a.key,"-").concat(l)},r().createElement(o.Tooltip,{title:"".concat(a.label,": ").concat(a.value.toLocaleString())},r().createElement("circle",{cx:t,cy:n,r:4,fill:b.colorBgContainer,stroke:b.colorPrimary,strokeWidth:2,style:{cursor:y?"pointer":"default"},onClick:function(){return null==y?void 0:y(a.key)}})),i&&r().createElement("text",{x:t,y:232,textAnchor:"middle",fontSize:11,fill:b.colorTextSecondary},P(a.label,12)))}))}())},I=function(e){var t=e.text;if(!t||!t.includes(l))return r().createElement(r().Fragment,null,t);for(var n=[],o=0,a=0;o<t.length;){var c=t.indexOf(l,o);if(-1===c){n.push(t.slice(o));break}c>o&&n.push(t.slice(o,c));var u=c+l.length,s=t.indexOf(i,u);if(-1===s){n.push(t.slice(u));break}n.push(r().createElement("mark",{key:"hl-".concat(a++)},t.slice(u,s))),o=s+i.length}return r().createElement(r().Fragment,null,n)};function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function M(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw r}}return a}}(e,t)||F(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(e){return function(e){if(Array.isArray(e))return T(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||F(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){if(e){if("string"==typeof e)return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T(e,t)}}var B=o.Typography.Text,D={position:"absolute",clipPath:"inset(50%)",overflow:"hidden",width:1,height:1,margin:-1,padding:0,border:0,whiteSpace:"nowrap"},q=[{label:"is (=)",value:"eq",needsValue:!0},{label:"is not (!=)",value:"ne",needsValue:!0},{label:"contains",value:"contains",needsValue:!0},{label:"is one of (in)",value:"in",needsValue:!0},{label:"is not one of",value:"not_in",needsValue:!0},{label:">",value:"gt",needsValue:!0},{label:">=",value:"gte",needsValue:!0},{label:"<",value:"lt",needsValue:!0},{label:"<=",value:"lte",needsValue:!0},{label:"between",value:"between",needsValue:!0,needsRange:!0},{label:"exists",value:"exists",needsValue:!1},{label:"does not exist",value:"not_exists",needsValue:!1}];function L(e){if(null==e)return"—";if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return String(e);try{return JSON.stringify(e)}catch(t){return String(e)}}var V=function(e){var t,a,l,i,c,u,s,f,p=e.title,d=e.spec,y=e.dataView,m=e.fields,b=void 0===m?[]:m,v=e.result,g=e.loading,w=void 0!==g&&g,E=e.error,x=void 0===E?null:E,O=e.showToolbar,k=void 0===O||O,j=e.compact,P=void 0!==j&&j,T=e.onExecute,F=h(),V=(0,n.useId)(),H=R((0,n.useState)(null!=(t=d.query)?t:""),2),N=H[0],$=H[1],W=R((0,n.useState)(null!=(a=d.filters)?a:[]),2),K=W[0],U=W[1],J=R((0,n.useState)(null!=(l=d.sort)?l:[]),2),G=J[0],Q=J[1],Z=R((0,n.useState)(null!=(i=null==(s=d.timeRange)?void 0:s.preset)?i:"last_24h"),2),X=Z[0],Y=Z[1],ee=R((0,n.useState)(1),2),et=ee[0],en=ee[1],er=R((0,n.useState)([]),2),eo=er[0],ea=er[1],el=R((0,n.useState)(!1),2),ei=el[0],ec=el[1],eu=R((0,n.useState)(null),2),es=eu[0],ef=eu[1],ep=R((0,n.useState)(""),2),ed=ep[0],ey=ep[1],em=R((0,n.useState)("eq"),2),eb=em[0],ev=em[1],eh=R((0,n.useState)(""),2),eg=eh[0],eS=eh[1],ew=R((0,n.useState)(""),2),eE=ew[0],ex=ew[1],eO=R((0,n.useState)(!1),2),ek=eO[0],ej=eO[1],eP=R((0,n.useState)(null),2),e_=eP[0],eA=eP[1],eI=(0,n.useMemo)(function(){return JSON.stringify(d)},[d]),eT=(0,n.useRef)(eI);(0,n.useEffect)(function(){var e,t,n,r,o;eT.current!==eI&&(eT.current=eI,$(null!=(e=d.query)?e:""),U(null!=(t=d.filters)?t:[]),Q(null!=(n=d.sort)?n:[]),Y(null!=(r=null==(o=d.timeRange)?void 0:o.preset)?r:"last_24h"),en(1),ea([]))},[eI,d]);var eC=(0,n.useMemo)(function(){return b.filter(function(e){return e.aggregatable||!!e.keywordSubfield})},[b]),eM=(0,n.useMemo)(function(){return[{label:F("Last 15 minutes"),value:"last_15m"},{label:F("Last 1 hour"),value:"last_1h"},{label:F("Last 24 hours"),value:"last_24h"},{label:F("Last 7 days"),value:"last_7d"},{label:F("Last 30 days"),value:"last_30d"},{label:F("Last 90 days"),value:"last_90d"},{label:F("All time"),value:"all"}]},[F]),eR=function(e){var t,n;T(C({query:(null==e?void 0:e.query)!==void 0?e.query:N,filters:(null==e?void 0:e.filters)!==void 0?e.filters:K,sort:(null==e?void 0:e.sort)!==void 0?e.sort:G,timeRange:(null==e?void 0:e.timeRange)!==void 0?e.timeRange:{preset:X},page:null!=(t=null==e?void 0:e.page)?t:1,pageSize:null!=(n=d.pageSize)?n:20},(null==e?void 0:e.searchAfter)?{searchAfter:e.searchAfter}:{}))},ez=function(e){var t=K[e];t&&(ef(e),ey(t.field),ev(t.operator),eS(Array.isArray(t.value)?t.value.join(", "):void 0!==t.value?String(t.value):""),ex(void 0!==t.valueTo?String(t.valueTo):""),ec(!0))},eF=function(e){var t=K.filter(function(t,n){return n!==e});U(t),en(1),ea([]),eR({filters:t,page:1})},eB=(0,n.useMemo)(function(){var e,t;return null!=(e=null!=(t=null==v?void 0:v.columns)?t:d.columns)?e:[]},[null==v?void 0:v.columns,d.columns]),eD=(0,n.useMemo)(function(){return eB.map(function(e){var t=G.find(function(t){return t.field===e||t.field==="".concat(e,".keyword")}),n=eC.some(function(t){return t.name===e||t.name==="".concat(e,".keyword")});return M(C({title:e,key:e,ellipsis:!0},n?{sorter:!0,sortOrder:t?"asc"===t.order?"ascend":"descend":null}:{}),{render:function(t,n){var o,a,l=null==(a=n.highlights)||null==(o=a[e])?void 0:o[0];if(l)return r().createElement(I,{text:l});var i="_id"===e?n._id:"_index"===e?n._index:function(e,t){if(t in e)return e[t];var n=t.split("."),r=e,o=!0,a=!1,l=void 0;try{for(var i,c=n[Symbol.iterator]();!(o=(i=c.next()).done);o=!0){var u,s=i.value;if(!r||(void 0===r?"undefined":(u=r)&&"u">typeof Symbol&&u.constructor===Symbol?"symbol":typeof u)!="object"||Array.isArray(r)||!(s in r))return;r=r[s]}}catch(e){a=!0,l=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw l}}return r}(n.source,e);return r().createElement("span",null,L(i))}})})},[eB,eC,G]),eq=k&&!1!==d.allowInteractiveControls,eL=q.find(function(e){return e.value===eb});return r().createElement("div",null,r().createElement("div",{role:"status","aria-live":"polite",style:D},!w&&v?"".concat(p,": ").concat(v.total," ").concat(F("Hits")):""),eq&&r().createElement("div",{style:{marginBottom:12}},r().createElement(o.Space,{wrap:!0,style:{width:"100%",justifyContent:"space-between"}},r().createElement(o.Space,{wrap:!0},r().createElement(o.Input,{allowClear:!0,"aria-label":F("KQL / Search Query"),placeholder:F('Search KQL, e.g. status >= 500 AND service: "api"'),prefix:r().createElement(S.SearchOutlined,{"aria-hidden":"true"}),value:N,style:{minWidth:P?220:320},onChange:function(e){var t=e.target.value;$(t),""===t&&"click"===e.type&&(en(1),ea([]),eR({query:"",page:1}))},onPressEnter:function(){en(1),ea([]),eR({query:N,page:1})}}),(null==y?void 0:y.timeField)&&r().createElement(o.Select,{"aria-label":F("Time Field"),value:X,options:eM,style:{minWidth:150},onChange:function(e){Y(e),en(1),ea([]),eR({timeRange:{preset:e},page:1})}}),r().createElement(o.Popover,{trigger:"click",title:null!==es?F("Edit Filter"):F("Add Filter"),open:ei,onOpenChange:function(e){ec(e),e||ef(null)},content:r().createElement("div",{style:{width:280}},r().createElement(o.Form,{layout:"vertical",size:"small"},r().createElement(o.Form.Item,{label:F("Field"),style:{marginBottom:8}},r().createElement(o.Select,{showSearch:!0,value:ed||void 0,placeholder:F("Field"),options:b.map(function(e){return{label:"".concat(e.name," (").concat(e.type,")"),value:e.name}}),onChange:function(e){return ey(e)}})),r().createElement(o.Form.Item,{label:F("Operator"),style:{marginBottom:8}},r().createElement(o.Select,{value:eb,options:q.map(function(e){return{label:e.label,value:e.value}}),onChange:function(e){return ev(e)}})),(null==eL?void 0:eL.needsValue)&&r().createElement(o.Form.Item,{label:F("Value"),style:{marginBottom:8}},r().createElement(o.Input,{value:eg,onChange:function(e){return eS(e.target.value)}})),(null==eL?void 0:eL.needsRange)&&r().createElement(o.Form.Item,{label:F("To Value"),style:{marginBottom:8}},r().createElement(o.Input,{value:eE,onChange:function(e){return ex(e.target.value)}})),r().createElement(o.Space,{style:{justifyContent:"flex-end",width:"100%"}},r().createElement(o.Button,{size:"small",onClick:function(){ec(!1),ef(null)}},F("Cancel")),r().createElement(o.Button,{size:"small",type:"primary",onClick:function(){if(ed){var e,t,n=q.find(function(e){return e.value===eb}),r="in"===eb||"not_in"===eb?eg.split(",").map(function(e){return e.trim()}).filter(Boolean):eg,o=M(C({id:null!==es&&null!=(e=null==(t=K[es])?void 0:t.id)?e:"".concat(Date.now()),field:ed,operator:eb},(null==n?void 0:n.needsValue)?{value:r}:{},(null==n?void 0:n.needsRange)&&eE?{valueTo:eE}:{}),{enabled:!0}),a=null!==es?K.map(function(e,t){return t===es?o:e}):z(K).concat([o]);U(a),en(1),ea([]),ec(!1),ef(null),eS(""),ex(""),eR({filters:a,page:1})}}},F("Apply")))))},r().createElement(o.Button,{icon:r().createElement(S.FilterOutlined,null),onClick:function(){ef(null),ev("eq"),eS(""),ex(""),ec(!0)}},F("Add Filter"))),"table"===d.visualization&&eC.length>0&&r().createElement(o.Select,{allowClear:!0,"aria-label":F("Sort"),placeholder:F("Sort"),style:{minWidth:170},value:G[0]?"".concat(G[0].field,":").concat(G[0].order):void 0,options:eC.slice(0,40).flatMap(function(e){return[{label:"".concat(e.name," ↓"),value:"".concat(e.name,":desc")},{label:"".concat(e.name," ↑"),value:"".concat(e.name,":asc")}]}),onChange:function(e){if(!e){Q([]),en(1),ea([]),eR({sort:[],page:1});return}var t=e.lastIndexOf(":"),n=[{field:e.slice(0,t),order:"asc"===e.slice(t+1)?"asc":"desc"}];Q(n),en(1),ea([]),eR({sort:n,page:1})}})),r().createElement(o.Space,null,r().createElement(o.Button,{type:"primary",icon:r().createElement(S.SearchOutlined,null),onClick:function(){en(1),ea([]),eR({page:1})}},F("Search")),r().createElement(o.Button,{icon:r().createElement(S.ReloadOutlined,null),"aria-label":F("Refresh"),onClick:function(){return eR({page:et})}}),r().createElement(o.Button,{icon:r().createElement(S.RollbackOutlined,null),onClick:function(){var e,t,n,r,o,a,l,i=null!=(e=d.query)?e:"",c=null!=(t=d.filters)?t:[],u=null!=(n=d.sort)?n:[],s=null!=(r=null==(l=d.timeRange)?void 0:l.preset)?r:"last_24h";$(i),U(c),Q(u),Y(s),en(1),ea([]),T({query:i,filters:c,sort:u,timeRange:null!=(o=d.timeRange)?o:{preset:s},page:1,pageSize:null!=(a=d.pageSize)?a:20})}},F("Reset")),(null==v?void 0:v.compiledDsl)&&r().createElement(o.Button,{icon:r().createElement(S.CodeOutlined,null),onClick:function(){return ej(!0)}},F("Inspect DSL")))),K.length>0&&r().createElement("div",{style:{marginTop:8,display:"flex",flexWrap:"wrap",gap:6}},K.map(function(e,t){return r().createElement(o.Tag,{key:e.id||"".concat(e.field,"-").concat(t),closable:!0,color:"processing",onClose:function(e){e.preventDefault(),e.stopPropagation(),eF(t)}},r().createElement("span",{role:"button",tabIndex:0,"aria-label":"".concat(F("Edit Filter"),": ").concat(e.field),style:{cursor:"pointer"},onClick:function(){return ez(t)},onKeyDown:function(e){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),ez(t))}},e.field," ",e.operator,void 0!==e.value?" ".concat(Array.isArray(e.value)?e.value.join(", "):String(e.value)):"",void 0!==e.valueTo?" .. ".concat(String(e.valueTo)):""))}))),x&&r().createElement(o.Alert,{type:"error",showIcon:!0,message:x,style:{marginBottom:12}}),r().createElement(o.Spin,{spinning:w},v?"table"===d.visualization?r().createElement("div",null,v.histogram.length>0&&(null==(f=d.chart)?void 0:f.showHistogram)!==!1&&r().createElement(_,{buckets:v.histogram}),r().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8,fontSize:12}},r().createElement(B,{id:V,strong:!0},p," \xb7 ",F("Hits"),": ",v.total.toLocaleString(),"gte"===v.totalRelation?"+":""," (",v.tookMs," ms)"),v.nextSearchAfter&&eo.length>0&&r().createElement(o.Button,{size:"small",onClick:function(){en(1),ea([]),eR({page:1})}},F("First page"))),r().createElement("div",{role:"region","aria-labelledby":V,tabIndex:0,style:{overflowX:"auto",maxInlineSize:"100%",containerType:"inline-size"}},r().createElement(o.Table,{size:P?"small":"middle",rowKey:function(e){return"".concat(e._index,":").concat(e._id)},columns:eD,dataSource:v.rows,onRow:function(e){return{onClick:function(){return eA(e)},style:{cursor:"pointer"}}},onChange:function(e,t,n){var r,o,a=Array.isArray(n)?n[0]:n;if(a&&a.columnKey&&a.order){var l=[{field:String(a.columnKey),order:"ascend"===a.order?"asc":"desc"}];Q(l),en(1),ea([]),eR({sort:l,page:1});return}var i=null!=(r=e.current)?r:1;if(i*(null!=(o=d.pageSize)?o:20)>1e4&&v.nextSearchAfter){ea(z(eo).concat([v.nextSearchAfter])),en(i),eR({page:i,searchAfter:v.nextSearchAfter});return}en(i),eR({page:i})},pagination:{current:et,pageSize:null!=(c=d.pageSize)?c:20,total:Math.min(v.total,1e4),showSizeChanger:!1}})),v.total>=1e4&&v.nextSearchAfter&&r().createElement("div",{style:{marginTop:8,textAlign:"right"}},r().createElement(o.Button,{size:"small",onClick:function(){v.nextSearchAfter&&(ea(z(eo).concat([v.nextSearchAfter])),en(function(e){return e+1}),eR({searchAfter:v.nextSearchAfter}))}},F("Next cursor page")))):r().createElement(A,{title:p,visualization:d.visualization,series:v.series,metricValue:v.metricValue,metricLabel:v.metricLabel,totalHits:v.total,onSelectBucket:function(e){if(k&&!1!==d.allowInteractiveControls){var t,n,r=(null==(t=d.chart)?void 0:t.bucketField)||(null==y?void 0:y.timeField);if(r&&(null==(n=d.chart)?void 0:n.bucketType)!=="date_histogram"){var o=z(K).concat([{id:"".concat(Date.now()),field:r,operator:"eq",value:e,enabled:!0}]);U(o),eR({filters:o,page:1})}}}}):r().createElement(o.Empty,{description:F("No matching documents")})),r().createElement(o.Modal,{title:F("Elasticsearch Query DSL"),open:ek,footer:null,onCancel:function(){return ej(!1)},width:680},r().createElement("pre",{style:{maxHeight:420,overflow:"auto",fontSize:12}},JSON.stringify(null!=(u=null==v?void 0:v.compiledDsl)?u:{},null,2))),r().createElement(o.Drawer,{title:F("Document Details"),open:!!e_,onClose:function(){return eA(null)},width:640},e_&&r().createElement(o.Tabs,{items:[{key:"table",label:F("Table View"),children:r().createElement(o.Descriptions,{bordered:!0,column:1,size:"small"},r().createElement(o.Descriptions.Item,{label:"_index"},e_._index),r().createElement(o.Descriptions.Item,{label:"_id"},e_._id),Object.entries(e_.source).map(function(e){var t=R(e,2),n=t[0],a=t[1];return r().createElement(o.Descriptions.Item,{key:n,label:n},L(a))}))},{key:"json",label:F("JSON View"),children:r().createElement("pre",{style:{maxHeight:520,overflow:"auto",fontSize:12}},JSON.stringify(e_,null,2))}]})))};function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function N(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function $(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){N(a,r,o,l,i,"next",e)}function i(e){N(a,r,o,l,i,"throw",e)}l(void 0)})}}function W(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function K(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return H(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return H(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var J=function(e){var l=e.reportId,i=e.showToolbar,c=e.compact,u=void 0!==c&&c,p=h(),d=(0,t.useApp)().apiClient,b=(0,n.useRef)(d);b.current=d;var v=K((0,n.useState)(null),2),g=v[0],S=v[1],w=K((0,n.useState)(null),2),E=w[0],x=w[1],O=K((0,n.useState)([]),2),k=O[0],j=O[1],P=K((0,n.useState)(null),2),_=P[0],A=P[1],I=K((0,n.useState)(!1),2),T=I[0],C=I[1],M=K((0,n.useState)(null),2),R=M[0],z=M[1],F=(0,n.useRef)(0),B=(0,n.useCallback)(function(e){return $(function(){var t,n,r;return U(this,function(o){switch(o.label){case 0:if(null==l||""===String(l).trim())return[2];t=++F.current,C(!0),z(null),o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,m(b.current,l,e)];case 2:if(n=o.sent(),t!==F.current)return[2];return A(n.result),[3,5];case 3:if(r=o.sent(),t!==F.current)return[2];return z(W(r,Error)?r.message:String(r)),[3,5];case 4:return t===F.current&&C(!1),[7];case 5:return[2]}})})()},[l]);return((0,n.useEffect)(function(){if(null==l||""===String(l).trim()){S(null),x(null),j([]),A(null),z(null);return}var e=!1;return $(function(){var t,n,r,o,i,c,u;return U(this,function(p){switch(p.label){case 0:C(!0),z(null),p.label=1;case 1:var d;return p.trys.push([1,3,4,5]),[4,Promise.all([(d=b.current,s(function(){return f(this,function(e){switch(e.label){case 0:return[4,d.request({url:"".concat(a,":getReportMeta"),method:"get",params:{reportId:l}})];case 1:return[2,y(e.sent())]}})})()),m(b.current,l)])];case 2:if(i=(o=K.apply(void 0,[p.sent(),2]))[0],c=o[1],e)return[2];return S(null!=(t=c.report)?t:i.report),x(null!=(n=c.dataView)?n:i.dataView),j(null!=(r=i.fields)?r:[]),A(c.result),[3,5];case 3:return u=p.sent(),e||z(W(u,Error)?u.message:String(u)),[3,5];case 4:return e||C(!1),[7];case 5:return[2]}})})(),function(){e=!0}},[l]),null==l||""===String(l).trim())?r().createElement(o.Card,{size:u?"small":"default"},r().createElement(o.Empty,{description:p("Select a saved Elastic Report in block settings to display data")})):r().createElement(o.Card,{size:u?"small":"default",title:null==g?void 0:g.title,extra:(null==E?void 0:E.indexPattern)?r().createElement("span",{style:{fontSize:12,opacity:.7}},E.indexPattern):void 0},g?r().createElement(V,{title:g.title,spec:g.spec,dataView:E,fields:k,result:_,loading:T,error:R,showToolbar:void 0===i||i,compact:u,onExecute:function(e){B(e)}}):r().createElement(V,{title:p("Elastic Report"),spec:{visualization:"table"},result:null,loading:T,error:R,showToolbar:!1,compact:u,onExecute:function(){}}))};function G(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Q(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function Z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return G(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(e){return(X=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Y(e,t){return(Y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ee=function(){return!!e})()}var et=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=X(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,ee()?Reflect.construct(e,t||[],X(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&Y(n,e),t=[{key:"renderComponent",value:function(){return r().createElement(J,{reportId:this.props.reportId,showToolbar:!1!==this.props.showToolbar,compact:!0===this.props.compact})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(t.BlockModel);function en(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function er(e,t,n){return(er=ei()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&ea(o,n.prototype),o}).apply(null,arguments)}et.define({label:g("Elastic Report"),createModelOptions:{use:"ElasticReportBlockModel"}}),et.registerFlow({key:"elasticReportBlockSettings",title:g("Elastic report settings"),on:"beforeRender",steps:{editReport:{title:g("Select report"),uiSchema:{reportId:{title:g("Report"),type:"string","x-decorator":"FormItem","x-component":function(e){var l,i,c=h(),u=(0,t.useApp)().apiClient,p=Z((0,n.useState)([]),2),d=p[0],m=p[1],b=Z((0,n.useState)(!1),2),v=b[0],g=b[1],S=(0,n.useCallback)(function(e){var t;return(t=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:g(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,s(function(){var t;return f(this,function(n){switch(n.label){case 0:return[4,u.request({url:"".concat(a,":listPublishedReports"),method:"get",params:e?{search:e}:void 0})];case 1:return[2,Array.isArray(t=y(n.sent()))?t:[]]}})})()];case 2:return m(t.sent()),[3,5];case 3:return t.sent(),m([]),[3,5];case 4:return g(!1),[7];case 5:return[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function l(e){Q(a,r,o,l,i,"next",e)}function i(e){Q(a,r,o,l,i,"throw",e)}l(void 0)})})()},[u]);return(0,n.useEffect)(function(){S()},[S]),r().createElement(o.Select,(l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),i=i={loading:v,showSearch:!0,allowClear:!0,placeholder:c("Select report"),optionFilterProp:"label",options:d.map(function(e){return{value:e.id,label:"".concat(e.title," (").concat(e.visualization.toUpperCase(),")"),report:e}}),optionRender:function(e){var t=e.data.report;return t?r().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8}},r().createElement("span",null,t.title),r().createElement("span",null,r().createElement(o.Tag,{color:"blue",style:{marginInlineEnd:0}},t.visualization.toUpperCase()))):e.label}},Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(i)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(i)).forEach(function(e){Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(i,e))}),l))},required:!0},showToolbar:{title:g("Show interactive toolbar"),type:"boolean","x-decorator":"FormItem","x-component":"Switch"},compact:{title:g("Compact layout"),type:"boolean","x-decorator":"FormItem","x-component":"Switch"}},defaultParams:{showToolbar:!0,compact:!1},handler:function(e,t){e.model.setProps({reportId:t.reportId,showToolbar:!1!==t.showToolbar,compact:!0===t.compact})}}}});function eo(e){return(eo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ea(e,t){return(ea=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function el(e){var t="function"==typeof Map?new Map:void 0;return(el=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return er(e,arguments,eo(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ea(n,e)})(e)}function ei(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ei=function(){return!!e})()}var ec=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=eo(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,ei()?Reflect.construct(e,t||[],eo(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&ea(n,e),t=[{key:"load",value:function(){var e;return(e=function(){var e,t;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(n){return null==(t=this.flowEngine)||null==(e=t.registerModels)||e.call(t,{ElasticReportBlockModel:et}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){en(a,r,o,l,i,"next",e)}function i(e){en(a,r,o,l,i,"throw",e)}l(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(el(e.Plugin)),eu=ec}(),d}()});
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
"use strict";(self.webpackChunkplugin_elastic_report_client_v2=self.webpackChunkplugin_elastic_report_client_v2||[]).push([["851"],{614:function(e,t,l){l.r(t),l.d(t,{ElasticReportManager:function(){return I}});var n=l(375),a=l(485),r=l(59),i=l(155),o=l.n(i),c=l(297),u=l(221),s=l(515);function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var l=0,n=Array(t);l<t;l++)n[l]=e[l];return n}function d(e,t,l,n,a,r,i){try{var o=e[r](i),c=o.value}catch(e){l(e);return}o.done?t(c):Promise.resolve(c).then(n,a)}function p(e){return function(){var t=this,l=arguments;return new Promise(function(n,a){var r=e.apply(t,l);function i(e){d(r,n,a,i,o,"next",e)}function o(e){d(r,n,a,i,o,"throw",e)}i(void 0)})}}function f(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function b(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{},n=Object.keys(l);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(l).filter(function(e){return Object.getOwnPropertyDescriptor(l,e).enumerable}))),n.forEach(function(t){var n;n=l[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function v(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t.push.apply(t,l)}return t})(Object(t)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(t,l))}),e}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var l,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var r=[],i=!0,o=!1;try{for(a=a.call(e);!(i=(l=a.next()).done)&&(r.push(l.value),!t||r.length!==t);i=!0);}catch(e){o=!0,n=e}finally{try{i||null==a.return||a.return()}finally{if(o)throw n}}return r}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var l=Object.prototype.toString.call(e).slice(8,-1);if("Object"===l&&e.constructor&&(l=e.constructor.name),"Map"===l||"Set"===l)return Array.from(l);if("Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return m(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){var l,n,a,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),o=Object.defineProperty;return o(i,"next",{value:c(0)}),o(i,"throw",{value:c(1)}),o(i,"return",{value:c(2)}),"function"==typeof Symbol&&o(i,Symbol.iterator,{value:function(){return this}}),i;function c(o){return function(c){var u=[o,c];if(l)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(r=0)),r;)try{if(l=1,n&&(a=2&u[0]?n.return:u[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;switch(n=0,a&&(u=[2&u[0],a.value]),u[0]){case 0:case 1:a=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,n=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(!(a=(a=r.trys).length>0&&a[a.length-1])&&(6===u[0]||2===u[0])){r=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]<a[3])){r.label=u[1];break}if(6===u[0]&&r.label<a[1]){r.label=a[1],a=u;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(u);break}a[2]&&r.ops.pop(),r.trys.pop();continue}u=t.call(e,r)}catch(e){u=[6,e],n=0}finally{l=a=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var h=r.Typography.Paragraph,w=r.Typography.Text,g=[{label:"is (=)",value:"eq"},{label:"is not (!=)",value:"ne"},{label:"contains",value:"contains"},{label:"in (comma-separated)",value:"in"},{label:"not in",value:"not_in"},{label:">",value:"gt"},{label:">=",value:"gte"},{label:"<",value:"lt"},{label:"<=",value:"lte"},{label:"between",value:"between"},{label:"exists",value:"exists"},{label:"does not exist",value:"not_exists"}];function S(e){var t,l,n,a,r,i=(null!=(t=e.filters)?t:[]).filter(function(e){return!!(null==e?void 0:e.field)}).map(function(e,t){return v(b({id:"flt-".concat(t),field:e.field,operator:e.operator||"eq"},void 0!==e.value&&""!==e.value?{value:e.value}:{},void 0!==e.valueTo&&""!==e.valueTo?{valueTo:e.valueTo}:{}),{enabled:!0})}),o=(null!=(l=e.sort)?l:[]).filter(function(e){return!!(null==e?void 0:e.field)}).map(function(e){return{field:e.field,order:"asc"===e.order?"asc":"desc"}});return{visualization:e.visualization||"table",query:null!=(n=null==(r=e.query)?void 0:r.trim())?n:"",queryMode:"kql",filters:i,sort:o,timeRange:{preset:e.timePreset||"last_24h"},columns:null!=(a=e.columns)?a:[],pageSize:e.pageSize||20,allowInteractiveControls:!1!==e.allowInteractiveControls,chart:v(b(v(b({bucketType:e.bucketType||"date_histogram"},e.bucketField?{bucketField:e.bucketField}:{}),{calendarInterval:e.calendarInterval||"auto",topN:e.topN||10,metricType:e.metricType||"count"}),e.metricField?{metricField:e.metricField}:{},e.metricLabel?{metricLabel:e.metricLabel}:{}),{showHistogram:!1!==e.showHistogram})}}var I=function(){var e,t,l,m,d=(0,s.kj)(),I=(0,a.useApp)().apiClient,F=r.App.useApp().message,k=y((0,i.useState)([]),2),C=k[0],x=k[1],P=y((0,i.useState)([]),2),T=P[0],O=P[1],z=y((0,i.useState)([]),2),D=z[0],V=z[1],B=y((0,i.useState)(null),2),A=B[0],_=B[1],L=y((0,i.useState)(!1),2),j=L[0],q=L[1],M=y((0,i.useState)(!1),2),N=M[0],R=M[1],K=y((0,i.useState)(null),2),W=K[0],H=K[1],U=y((0,i.useState)(!1),2),Q=U[0],G=U[1],$=y((0,i.useState)([]),2),J=$[0],X=$[1],Y=y((0,i.useState)(!1),2),Z=Y[0],ee=Y[1],et=y(r.Form.useForm(),1)[0],el=y((0,i.useState)(!1),2),en=el[0],ea=el[1],er=y((0,i.useState)(null),2),ei=er[0],eo=er[1],ec=y((0,i.useState)([]),2),eu=ec[0],es=ec[1],em=y((0,i.useState)({visualization:"table"}),2),ed=em[0],ep=em[1],ef=y((0,i.useState)(null),2),eb=ef[0],ev=ef[1],ey=y((0,i.useState)(!1),2),eE=ey[0],eh=ey[1],ew=y((0,i.useState)(null),2),eg=ew[0],eS=ew[1],eI=y((0,i.useState)(!1),2),eF=eI[0],ek=eI[1],eC=y(r.Form.useForm(),1)[0],ex=null!=(e=r.Form.useWatch("visualization",eC))?e:"table",eP=r.Form.useWatch("dataViewId",eC),eT=null!=(t=r.Form.useWatch("bucketType",eC))?t:"date_histogram",eO=null!=(l=r.Form.useWatch("metricType",eC))?l:"count",ez=(0,i.useCallback)(function(){return p(function(){var e,t,l,n,a;return E(this,function(r){switch(r.label){case 0:q(!0),r.label=1;case 1:return r.trys.push([1,,3,4]),[4,Promise.all([(0,c.us)(I).catch(function(){return[]}),(0,c.pX)(I).catch(function(){return[]}),(0,c.L$)(I).catch(function(){return[]}),(0,c.Fs)(I).catch(function(){return null})])];case 2:return t=(e=y.apply(void 0,[r.sent(),4]))[0],l=e[1],n=e[2],a=e[3],x(t),O(l),V(n),_(a),[3,4];case 3:return q(!1),[7];case 4:return[2]}})})()},[I]);(0,i.useEffect)(function(){ez()},[ez]),(0,i.useEffect)(function(){if(!en||null==eP)return void es([]);var e=!1;return(0,c.tD)(I,eP,!1).then(function(t){var l;e||es(null!=(l=t.fields)?l:[])}).catch(function(){e||es([])}),function(){e=!0}},[I,en,eP]);var eD=(0,i.useMemo)(function(){var e;return null!=(e=T.find(function(e){return String(e.id)===String(eP)}))?e:null},[T,eP]),eV=(0,i.useMemo)(function(){return eu.filter(function(e){return e.aggregatable||!!e.keywordSubfield})},[eu]),eB=(0,i.useMemo)(function(){return eu.filter(function(e){return["long","integer","short","byte","double","float","half_float","scaled_float"].includes(e.type)})},[eu]),eA=function(e){var t,l;H(e),X([]),et.setFieldsValue({title:e.title,dataSourceKey:e.dataSourceKey,indexPattern:e.indexPattern,timeField:null!=(t=e.timeField)?t:"",description:null!=(l=e.description)?l:""}),R(!0)},e_=function(e){eo(e),ev(null),eS(null);var t,l,n,a,r,i,o,c,u,s,m,d,p,f,b,v,y,E,h,w,g,S=e.spec;ep(S),eC.setFieldsValue({title:e.title,description:null!=(t=e.description)?t:"",dataViewId:e.dataViewId,published:!1!==e.published,visualization:null!=(l=S.visualization)?l:"table",query:null!=(n=S.query)?n:"",timePreset:null!=(a=null==(p=S.timeRange)?void 0:p.preset)?a:"last_24h",filters:(null!=(r=S.filters)?r:[]).map(function(e){return{field:e.field,operator:e.operator,value:Array.isArray(e.value)?e.value.join(", "):void 0!==e.value?String(e.value):"",valueTo:void 0!==e.valueTo?String(e.valueTo):""}}),sort:null!=(i=S.sort)?i:[],columns:null!=(o=S.columns)?o:[],pageSize:null!=(c=S.pageSize)?c:20,showHistogram:(null==(f=S.chart)?void 0:f.showHistogram)!==!1,allowInteractiveControls:!1!==S.allowInteractiveControls,bucketType:null!=(u=null==(b=S.chart)?void 0:b.bucketType)?u:"date_histogram",bucketField:null==(v=S.chart)?void 0:v.bucketField,calendarInterval:null!=(s=null==(y=S.chart)?void 0:y.calendarInterval)?s:"auto",topN:null!=(m=null==(E=S.chart)?void 0:E.topN)?m:10,metricType:null!=(d=null==(h=S.chart)?void 0:h.metricType)?d:"count",metricField:null==(w=S.chart)?void 0:w.metricField,metricLabel:null==(g=S.chart)?void 0:g.metricLabel}),ea(!0)},eL=function(e){return p(function(){var t,l,n;return E(this,function(a){switch(a.label){case 0:if(void 0===(t=eC.getFieldsValue(!0)).dataViewId||null===t.dataViewId)return[2];eh(!0),eS(null),a.label=1;case 1:return a.trys.push([1,3,4,5]),l=S(t),e||ep(l),[4,(0,c.wE)(I,t.dataViewId,l,e)];case 2:return ev(a.sent().result),[3,5];case 3:return eS(f(n=a.sent(),Error)?n.message:String(n)),[3,5];case 4:return eh(!1),[7];case 5:return[2]}})})()},ej=[{title:d("Title"),dataIndex:"title",key:"title",render:function(e,t){return o().createElement(r.Space,{direction:"vertical",size:0},o().createElement(w,{strong:!0},e),t.description&&o().createElement(w,{type:"secondary",style:{fontSize:12}},t.description))}},{title:d("Visualization"),dataIndex:"visualization",key:"visualization",width:140,render:function(e){return o().createElement(r.Tag,{color:"blue"},String(e).toUpperCase())}},{title:d("Data View"),key:"dataView",render:function(e,t){return t.dataView?"".concat(t.dataView.title," (").concat(t.dataView.indexPattern,")"):String(t.dataViewId)}},{title:d("Published"),dataIndex:"published",key:"published",width:120,render:function(e){return o().createElement(r.Tag,{color:e?"success":"default"},e?d("Published"):d("Draft"))}},{title:"",key:"actions",width:180,render:function(e,t){return o().createElement(r.Space,null,o().createElement(r.Button,{size:"small",icon:o().createElement(n.EditOutlined,null),onClick:function(){return e_(t)}},d("Edit")),o().createElement(r.Popconfirm,{title:d("Confirm delete?"),onConfirm:function(){return p(function(){return E(this,function(e){switch(e.label){case 0:return[4,(0,c.Jr)(I,t.id)];case 1:return e.sent(),F.success(d("Deleted successfully")),[4,ez()];case 2:return e.sent(),[2]}})})()}},o().createElement(r.Button,{size:"small",danger:!0,icon:o().createElement(n.DeleteOutlined,null)},d("Delete"))))}}],eq=[{title:d("Title"),dataIndex:"title",key:"title"},{title:d("Data Source (Elasticsearch)"),dataIndex:"dataSourceKey",key:"dataSourceKey"},{title:d("Index Pattern"),dataIndex:"indexPattern",key:"indexPattern",render:function(e){return o().createElement(r.Tag,null,e)}},{title:d("Time Field"),dataIndex:"timeField",key:"timeField",render:function(e){return e||"—"}},{title:d("Fields"),key:"fieldCount",width:110,render:function(e,t){var l,n;return null!=(l=null==(n=t.cachedFields)?void 0:n.length)?l:0}},{title:"",key:"actions",width:260,render:function(e,t){return o().createElement(r.Space,null,o().createElement(r.Button,{size:"small",icon:o().createElement(n.ReloadOutlined,null),onClick:function(){return p(function(){return E(this,function(e){switch(e.label){case 0:return[4,(0,c.tD)(I,t.id,!0)];case 1:return e.sent(),F.success(d("Saved successfully")),[4,ez()];case 2:return e.sent(),[2]}})})()}},d("Refresh Fields")),o().createElement(r.Button,{size:"small",icon:o().createElement(n.EditOutlined,null),onClick:function(){return eA(t)}},d("Edit")),o().createElement(r.Popconfirm,{title:d("Confirm delete?"),onConfirm:function(){return p(function(){return E(this,function(e){switch(e.label){case 0:return[4,(0,c.WW)(I,t.id)];case 1:return e.sent(),F.success(d("Deleted successfully")),[4,ez()];case 2:return e.sent(),[2]}})})()}},o().createElement(r.Button,{size:"small",danger:!0,icon:o().createElement(n.DeleteOutlined,null),"aria-label":d("Delete")})))}}];return o().createElement(r.Card,{bordered:!1},o().createElement(r.Tabs,{items:[{key:"reports",label:d("Reports"),children:o().createElement("div",null,o().createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:16}},o().createElement(r.Space,null,o().createElement(r.Button,{type:"primary",icon:o().createElement(n.PlusOutlined,null),onClick:function(){var e;eo(null),ev(null),eS(null),eC.resetFields(),eC.setFieldsValue({title:"",dataViewId:null==(e=T[0])?void 0:e.id,published:!0,visualization:"table",query:"",timePreset:"last_24h",filters:[],sort:[],columns:[],pageSize:20,showHistogram:!0,allowInteractiveControls:!0,bucketType:"date_histogram",calendarInterval:"auto",topN:10,metricType:"count"}),ep({visualization:"table",query:"",queryMode:"kql",filters:[],sort:[],timeRange:{preset:"last_24h"},columns:[],pageSize:20,allowInteractiveControls:!0,chart:{bucketType:"date_histogram",calendarInterval:"auto",topN:10,metricType:"count",showHistogram:!0}}),ea(!0)}},d("New Report")),o().createElement(r.Button,{icon:o().createElement(n.ReloadOutlined,null),onClick:ez},d("Refresh")))),o().createElement(r.Table,{rowKey:"id",loading:j,columns:ej,dataSource:D}))},{key:"dataViews",label:d("Data Views"),children:o().createElement("div",null,o().createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:16}},o().createElement(r.Space,null,o().createElement(r.Button,{type:"primary",icon:o().createElement(n.PlusOutlined,null),onClick:function(){var e;H(null),X([]),et.resetFields(),et.setFieldsValue({dataSourceKey:null==(e=C[0])?void 0:e.key,indexPattern:"*",timeField:"@timestamp"}),R(!0)}},d("New Data View")),o().createElement(r.Button,{icon:o().createElement(n.ReloadOutlined,null),onClick:ez},d("Refresh")))),o().createElement(r.Table,{rowKey:"id",loading:j,columns:eq,dataSource:T}))},{key:"mcp",label:d("MCP & AI Employee"),children:o().createElement(r.Space,{direction:"vertical",size:16,style:{width:"100%"}},o().createElement(r.Alert,{type:"info",showIcon:!0,message:d("AI Employee Usage"),description:d("This plugin automatically registers the elastic-report MCP server (with user context) and AI Employee tools so AI agents can inspect fields, preview Elasticsearch queries, and publish Saved Reports ready to select in blocks.")}),A&&o().createElement(r.Descriptions,{bordered:!0,column:1,size:"small"},o().createElement(r.Descriptions.Item,{label:d("MCP Server Name")},o().createElement(r.Tag,{color:"purple"},A.serverName)),o().createElement(r.Descriptions.Item,{label:d("Dedicated MCP Endpoint")},o().createElement(r.Space,null,o().createElement("code",null,A.endpointPath),o().createElement(r.Button,{size:"small",icon:o().createElement(n.CopyOutlined,null),onClick:function(){var e;null==(e=navigator.clipboard)||e.writeText(window.location.origin+A.endpointPath),F.success(d("Copied to clipboard"))}},d("Copy"))))),o().createElement(r.Card,{size:"small",title:d("Exposed MCP Tools")},o().createElement(r.Table,{size:"small",rowKey:"name",pagination:!1,dataSource:null!=(m=null==A?void 0:A.tools)?m:[],columns:[{title:"Tool",dataIndex:"name",key:"name",width:220,render:function(e){return o().createElement("code",null,e)}},{title:d("Description"),dataIndex:"description",key:"description"}]})))}]}),o().createElement(r.Modal,{title:W?d("Edit Data View"):d("New Data View"),open:N,confirmLoading:Q,onCancel:function(){return R(!1)},onOk:function(){return p(function(){var e,t;return E(this,function(l){switch(l.label){case 0:return l.trys.push([0,4,5,6]),[4,et.validateFields()];case 1:return e=l.sent(),G(!0),[4,(0,c.L9)(I,v(b({},W?{id:W.id}:{}),{title:e.title,dataSourceKey:e.dataSourceKey,indexPattern:e.indexPattern,timeField:e.timeField||null,description:e.description||null}))];case 2:return l.sent(),F.success(d("Saved successfully")),R(!1),[4,ez()];case 3:return l.sent(),[3,6];case 4:return f(t=l.sent(),Error)&&"message"in t&&F.error(t.message),[3,6];case 5:return G(!1),[7];case 6:return[2]}})})()},width:600},o().createElement(r.Form,{form:et,layout:"vertical"},o().createElement(r.Form.Item,{name:"title",label:d("Title"),rules:[{required:!0}]},o().createElement(r.Input,{placeholder:"Application Logs"})),o().createElement(r.Form.Item,{name:"dataSourceKey",label:d("Data Source (Elasticsearch)"),rules:[{required:!0}]},o().createElement(r.Select,{options:C.map(function(e){return{label:"".concat(e.displayName," (").concat(e.key,")"),value:e.key}})})),o().createElement(r.Form.Item,{name:"indexPattern",label:d("Index Pattern"),rules:[{required:!0}]},o().createElement(r.Space.Compact,{style:{width:"100%"}},o().createElement(r.Input,{placeholder:"logs-*"}),o().createElement(r.Button,{loading:Z,icon:o().createElement(n.EyeOutlined,null),onClick:function(){return p(function(){var e,t,l;return E(this,function(n){switch(n.label){case 0:if(e=et.getFieldValue("dataSourceKey"),t=et.getFieldValue("indexPattern")||"*",!e)return[2];ee(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,(0,c.aG)(I,e,t)];case 2:return X(n.sent()),[3,5];case 3:return l=n.sent(),F.error(f(l,Error)?l.message:String(l)),[3,5];case 4:return ee(!1),[7];case 5:return[2]}})})()}},d("Browse Indices")))),J.length>0&&o().createElement(h,{style:{fontSize:12}},o().createElement(w,{strong:!0},d("Matching Indices"),": "),J.slice(0,20).map(function(e){return o().createElement(r.Tag,{key:e,style:{marginBottom:4}},e)})),o().createElement(r.Form.Item,{name:"timeField",label:d("Time Field")},o().createElement(r.Input,{placeholder:"@timestamp"})),o().createElement(r.Form.Item,{name:"description",label:d("Description")},o().createElement(r.Input.TextArea,{rows:2})))),o().createElement(r.Drawer,{title:ei?d("Edit Report"):d("New Report"),open:en,onClose:function(){return ea(!1)},width:1080,extra:o().createElement(r.Space,null,o().createElement(r.Button,{icon:o().createElement(n.PlayCircleOutlined,null),loading:eE,onClick:function(){return eL()}},d("Run Preview")),o().createElement(r.Button,{type:"primary",loading:eF,onClick:function(){return p(function(){var e,t,l;return E(this,function(n){switch(n.label){case 0:return n.trys.push([0,4,5,6]),[4,eC.validateFields()];case 1:return e=n.sent(),ek(!0),t=S(e),[4,(0,c.V8)(I,v(b({},ei?{id:ei.id}:{}),{title:e.title,description:e.description||null,dataViewId:e.dataViewId,published:!1!==e.published,spec:t}))];case 2:return n.sent(),F.success(d("Saved successfully")),ea(!1),[4,ez()];case 3:return n.sent(),[3,6];case 4:return f(l=n.sent(),Error)&&"message"in l&&F.error(l.message),[3,6];case 5:return ek(!1),[7];case 6:return[2]}})})()}},d("Save")))},o().createElement(r.Form,{form:eC,layout:"vertical"},o().createElement(r.Row,{gutter:16},o().createElement(r.Col,{xs:24,md:10},o().createElement(r.Form.Item,{name:"title",label:d("Title"),rules:[{required:!0}]},o().createElement(r.Input,{placeholder:"HTTP 5xx Error Logs"}))),o().createElement(r.Col,{xs:24,md:7},o().createElement(r.Form.Item,{name:"dataViewId",label:d("Data View"),rules:[{required:!0}]},o().createElement(r.Select,{options:T.map(function(e){return{label:"".concat(e.title," (").concat(e.indexPattern,")"),value:e.id}})}))),o().createElement(r.Col,{xs:24,md:7},o().createElement(r.Form.Item,{name:"visualization",label:d("Visualization"),rules:[{required:!0}]},o().createElement(r.Select,{options:[{label:d("Table (Discover)"),value:"table"},{label:d("Bar Chart"),value:"bar"},{label:d("Line Chart"),value:"line"},{label:d("Area Chart"),value:"area"},{label:d("Pie Chart"),value:"pie"},{label:d("Metric KPI"),value:"metric"}]})))),o().createElement(r.Row,{gutter:16},o().createElement(r.Col,{xs:24,md:14},o().createElement(r.Form.Item,{name:"query",label:d("KQL / Search Query")},o().createElement(r.Input,{placeholder:d('Search KQL, e.g. status >= 500 AND service: "api"')}))),o().createElement(r.Col,{xs:12,md:5},o().createElement(r.Form.Item,{name:"timePreset",label:d("Time Field")},o().createElement(r.Select,{options:[{label:d("Last 15 minutes"),value:"last_15m"},{label:d("Last 1 hour"),value:"last_1h"},{label:d("Last 24 hours"),value:"last_24h"},{label:d("Last 7 days"),value:"last_7d"},{label:d("Last 30 days"),value:"last_30d"},{label:d("Last 90 days"),value:"last_90d"},{label:d("All time"),value:"all"}]}))),o().createElement(r.Col,{xs:12,md:5},o().createElement(r.Form.Item,{name:"published",label:d("Published"),valuePropName:"checked"},o().createElement(r.Switch,null)))),o().createElement(r.Card,{size:"small",title:d("Add Filter"),style:{marginBottom:12}},o().createElement(r.Form.List,{name:"filters"},function(e,t){var l=t.add,a=t.remove;return o().createElement(r.Space,{direction:"vertical",style:{width:"100%"}},e.map(function(e){var t=e.key,l=e.name;return o().createElement(r.Space,{key:t,wrap:!0,align:"baseline"},o().createElement(r.Form.Item,{name:[l,"field"],style:{marginBottom:0,minWidth:190}},o().createElement(r.Select,{showSearch:!0,placeholder:d("Field"),options:eu.map(function(e){return{label:"".concat(e.name," (").concat(e.type,")"),value:e.name}})})),o().createElement(r.Form.Item,{name:[l,"operator"],style:{marginBottom:0,minWidth:160}},o().createElement(r.Select,{options:g})),o().createElement(r.Form.Item,{name:[l,"value"],style:{marginBottom:0}},o().createElement(r.Input,{placeholder:d("Value")})),o().createElement(r.Form.Item,{name:[l,"valueTo"],style:{marginBottom:0}},o().createElement(r.Input,{placeholder:d("To Value"),style:{width:120}})),o().createElement(r.Button,{size:"small",danger:!0,icon:o().createElement(n.DeleteOutlined,null),onClick:function(){return a(l)}}))}),o().createElement(r.Button,{size:"small",type:"dashed",icon:o().createElement(n.PlusOutlined,null),onClick:function(){return l({operator:"eq"})}},d("Add Filter")))})),"table"===ex?o().createElement(r.Row,{gutter:16},o().createElement(r.Col,{xs:24,md:12},o().createElement(r.Form.Item,{name:"columns",label:d("Columns")},o().createElement(r.Select,{mode:"multiple",allowClear:!0,placeholder:d("Auto-detect columns from documents"),options:eu.filter(function(e){return!e.isSubfield}).map(function(e){return{label:e.name,value:e.name}})})),o().createElement(r.Card,{size:"small",title:d("Sort"),style:{marginBottom:12}},o().createElement(r.Form.List,{name:"sort"},function(e,t){var l=t.add,a=t.remove;return o().createElement(r.Space,{direction:"vertical",style:{width:"100%"}},e.map(function(e){var t=e.key,l=e.name;return o().createElement(r.Space,{key:t,align:"baseline"},o().createElement(r.Form.Item,{name:[l,"field"],style:{marginBottom:0,minWidth:200}},o().createElement(r.Select,{showSearch:!0,placeholder:d("Field"),options:eV.map(function(e){return{label:e.keywordSubfield?"".concat(e.name," (").concat(e.keywordSubfield,")"):e.name,value:e.keywordSubfield||e.name}})})),o().createElement(r.Form.Item,{name:[l,"order"],style:{marginBottom:0,minWidth:130}},o().createElement(r.Select,{options:[{label:d("Descending"),value:"desc"},{label:d("Ascending"),value:"asc"}]})),o().createElement(r.Button,{size:"small",danger:!0,icon:o().createElement(n.DeleteOutlined,null),onClick:function(){return a(l)}}))}),o().createElement(r.Button,{size:"small",type:"dashed",icon:o().createElement(n.PlusOutlined,null),onClick:function(){return l({order:"desc"})}},d("Add Sort")))}))),o().createElement(r.Col,{xs:24,md:12},o().createElement(r.Row,{gutter:12},o().createElement(r.Col,{span:8},o().createElement(r.Form.Item,{name:"pageSize",label:d("Page Size")},o().createElement(r.InputNumber,{min:5,max:200,style:{width:"100%"}}))),o().createElement(r.Col,{span:8},o().createElement(r.Form.Item,{name:"showHistogram",label:d("Show time histogram above table"),valuePropName:"checked"},o().createElement(r.Switch,null))),o().createElement(r.Col,{span:8},o().createElement(r.Form.Item,{name:"allowInteractiveControls",label:d("Allow interactive search/filter on block"),valuePropName:"checked"},o().createElement(r.Switch,null)))),o().createElement(r.Form.Item,{name:"description",label:d("Description")},o().createElement(r.Input.TextArea,{rows:2})))):o().createElement(r.Card,{size:"small",style:{marginBottom:12}},o().createElement(r.Row,{gutter:16},"metric"!==ex&&o().createElement(o().Fragment,null,o().createElement(r.Col,{xs:12,md:6},o().createElement(r.Form.Item,{name:"bucketType",label:d("Bucket Type")},o().createElement(r.Select,{options:[{label:d("Date Histogram"),value:"date_histogram"},{label:d("Top Terms"),value:"terms"}]}))),o().createElement(r.Col,{xs:12,md:6},o().createElement(r.Form.Item,{name:"bucketField",label:d("Bucket Field")},o().createElement(r.Select,{showSearch:!0,allowClear:!0,options:eV.map(function(e){return{label:e.keywordSubfield?"".concat(e.name," → ").concat(e.keywordSubfield):e.name,value:e.keywordSubfield||e.name}})}))),"date_histogram"===eT?o().createElement(r.Col,{xs:12,md:4},o().createElement(r.Form.Item,{name:"calendarInterval",label:d("Interval")},o().createElement(r.Select,{options:[{label:"Auto",value:"auto"},{label:"1m",value:"1m"},{label:"5m",value:"5m"},{label:"15m",value:"15m"},{label:"1h",value:"1h"},{label:"1d",value:"1d"},{label:"1w",value:"1w"},{label:"1M",value:"1M"}]}))):o().createElement(r.Col,{xs:12,md:4},o().createElement(r.Form.Item,{name:"topN",label:d("Top N")},o().createElement(r.InputNumber,{min:1,max:50,style:{width:"100%"}})))),o().createElement(r.Col,{xs:12,md:4},o().createElement(r.Form.Item,{name:"metricType",label:d("Metric")},o().createElement(r.Select,{options:[{label:"Count",value:"count"},{label:"Sum",value:"sum"},{label:"Average",value:"avg"},{label:"Min",value:"min"},{label:"Max",value:"max"},{label:"Unique (Cardinality)",value:"cardinality"}]}))),"count"!==eO&&o().createElement(r.Col,{xs:12,md:4},o().createElement(r.Form.Item,{name:"metricField",label:d("Metric Field")},o().createElement(r.Select,{showSearch:!0,options:("cardinality"===eO?eV:eB.length>0?eB:eV).map(function(e){return{label:e.name,value:e.keywordSubfield||e.name}})}))),o().createElement(r.Col,{xs:12,md:6},o().createElement(r.Form.Item,{name:"metricLabel",label:d("Metric Label")},o().createElement(r.Input,{placeholder:"Requests / Latency (ms)"}))),o().createElement(r.Col,{xs:12,md:6},o().createElement(r.Form.Item,{name:"allowInteractiveControls",label:d("Allow interactive search/filter on block"),valuePropName:"checked"},o().createElement(r.Switch,null)))))),o().createElement(r.Divider,{orientation:"left"},d("Preview")),o().createElement(u.L,{title:eC.getFieldValue("title")||d("Preview"),spec:ed,dataView:eD,fields:eu,result:eb,loading:eE,error:eg,showToolbar:!0,onExecute:function(e){eL(e)}})))};t.default=I}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("plugin-elastic-report/client-v2",["@nocobase/client-v2","react","antd","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["plugin-elastic-report/client-v2"]=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["plugin-elastic-report/client-v2"]=t(e["@nocobase/client-v2"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o){return function(){"use strict";var a,l,i,c={364:function(e,t,n){n.d(t,{v:function(){return h}});var r=n(485),o=n(59),a=n(155),l=n.n(a),i=n(297),c=n(515),u=n(221);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){f(a,r,o,l,i,"next",e)}function i(e){f(a,r,o,l,i,"throw",e)}l(void 0)})}}function d(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var h=function(e){var t=e.reportId,n=e.showToolbar,s=e.compact,f=void 0!==s&&s,h=(0,c.kj)(),v=(0,r.useApp)().apiClient,b=(0,a.useRef)(v);b.current=v;var g=y((0,a.useState)(null),2),S=g[0],w=g[1],E=y((0,a.useState)(null),2),x=E[0],k=E[1],O=y((0,a.useState)([]),2),j=O[0],A=O[1],P=y((0,a.useState)(null),2),_=P[0],I=P[1],M=y((0,a.useState)(!1),2),T=M[0],C=M[1],R=y((0,a.useState)(null),2),F=R[0],z=R[1],B=(0,a.useRef)(0),q=(0,a.useCallback)(function(e){return p(function(){var n,r,o;return m(this,function(a){switch(a.label){case 0:if(null==t||""===String(t).trim())return[2];n=++B.current,C(!0),z(null),a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,(0,i.Xz)(b.current,t,e)];case 2:if(r=a.sent(),n!==B.current)return[2];return I(r.result),[3,5];case 3:if(o=a.sent(),n!==B.current)return[2];return z(d(o,Error)?o.message:String(o)),[3,5];case 4:return n===B.current&&C(!1),[7];case 5:return[2]}})})()},[t]);return((0,a.useEffect)(function(){if(null==t||""===String(t).trim()){w(null),k(null),A([]),I(null),z(null);return}var e=!1;return p(function(){var n,r,o,a,l,c,u;return m(this,function(s){switch(s.label){case 0:C(!0),z(null),s.label=1;case 1:return s.trys.push([1,3,4,5]),[4,Promise.all([(0,i.kP)(b.current,t),(0,i.Xz)(b.current,t)])];case 2:if(l=(a=y.apply(void 0,[s.sent(),2]))[0],c=a[1],e)return[2];return w(null!=(n=c.report)?n:l.report),k(null!=(r=c.dataView)?r:l.dataView),A(null!=(o=l.fields)?o:[]),I(c.result),[3,5];case 3:return u=s.sent(),e||z(d(u,Error)?u.message:String(u)),[3,5];case 4:return e||C(!1),[7];case 5:return[2]}})})(),function(){e=!0}},[t]),null==t||""===String(t).trim())?l().createElement(o.Card,{size:f?"small":"default"},l().createElement(o.Empty,{description:h("Select a saved Elastic Report in block settings to display data")})):l().createElement(o.Card,{size:f?"small":"default",title:null==S?void 0:S.title,extra:(null==x?void 0:x.indexPattern)?l().createElement("span",{style:{fontSize:12,opacity:.7}},x.indexPattern):void 0},S?l().createElement(u.L,{title:S.title,spec:S.spec,dataView:x,fields:j,result:_,loading:T,error:F,showToolbar:void 0===n||n,compact:f,onExecute:function(e){q(e)}}):l().createElement(u.L,{title:h("Elastic Report"),spec:{visualization:"table"},result:null,loading:T,error:F,showToolbar:!1,compact:f,onExecute:function(){}}))}},221:function(e,t,n){n.d(t,{L:function(){return _}});var r=n(375),o=n(59),a=n(155),l=n.n(a),i=n(515);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}}var f=o.Typography.Text,p=["#1677ff","#13c2c2","#52c41a","#fa8c16","#722ed1","#eb2f96","#2f54eb","#faad14"];function d(e){return Number.isFinite(e)?Math.abs(e)>=1e6?"".concat((e/1e6).toFixed(2),"M"):Math.abs(e)>=1e3?"".concat((e/1e3).toFixed(1),"k"):Number.isInteger(e)?String(e):e.toFixed(2):"0"}function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:18;return e.length<=t?e:"".concat(e.slice(0,t-1),"…")}var m=function(e){var t,n,r,c=e.buckets,s=(0,i.kj)(),f=o.theme.useToken().token,p=(0,a.useId)();if(!c.length)return null;var d=(t=Math).max.apply(t,[1].concat(u(c.map(function(e){return e.count})))),y=Math.max(4,(720-2*c.length)/c.length);return l().createElement("figure",{style:{margin:"0 0 12px 0"}},l().createElement("svg",{role:"img","aria-labelledby":p,viewBox:"0 0 ".concat(720," ").concat(68),style:{width:"100%",height:68,display:"block"}},l().createElement("title",{id:p},s("Date Histogram")),c.map(function(e,t){var n=Math.max(e.count>0?3:1,Math.round(e.count/d*54));return l().createElement(o.Tooltip,{key:"".concat(e.key,"-").concat(t),title:"".concat(e.key,": ").concat(e.count)},l().createElement("rect",{x:t*(y+2),y:68-n-2,width:y,height:n,rx:2,fill:e.count>0?f.colorPrimary:f.colorFillSecondary,opacity:.85}))})),l().createElement("figcaption",{style:{display:"flex",justifyContent:"space-between",fontSize:11,color:f.colorTextSecondary}},l().createElement("span",null,null==(n=c[0])?void 0:n.key),l().createElement("span",null,null==(r=c[c.length-1])?void 0:r.key)))},h=function(e){var t,n,r,c,m=e.title,h=e.visualization,v=e.series,b=e.metricValue,g=e.metricLabel,S=e.totalHits,w=e.onSelectBucket,E=(0,i.kj)(),x=o.theme.useToken().token,k=(0,a.useId)(),O=function(e){if(Array.isArray(e))return e}(t=(0,a.useState)(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,l=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||s(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),j=O[0],A=O[1];if("metric"===h)return l().createElement(o.Card,{bordered:!1,style:{textAlign:"center",padding:"16px 8px"}},l().createElement(o.Statistic,{title:g||m,value:null!=b?b:0,valueStyle:{fontSize:36,fontWeight:600,color:x.colorPrimary}}),l().createElement(f,{type:"secondary",style:{fontSize:12}},E("Hits"),": ",S.toLocaleString()));if(!v.length)return l().createElement(o.Empty,{description:E("No matching documents")});var P=(c=Math).max.apply(c,[1].concat(u(v.map(function(e){return Math.abs(e.value)}))));return l().createElement("figure",{style:{margin:0}},l().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8}},l().createElement("figcaption",{style:{fontSize:12,color:x.colorTextSecondary}},g," \xb7 ",E("Hits"),": ",S.toLocaleString()),l().createElement(o.Button,{size:"small",type:"link",onClick:function(){return A(function(e){return!e})}},j?E("Show chart"):E("Show data table"))),j?l().createElement(o.Table,{size:"small",rowKey:"key",pagination:!1,dataSource:v,columns:[{title:E("Bucket Field"),dataIndex:"label",key:"label"},{title:g||E("Value"),dataIndex:"value",key:"value"},{title:E("Hits"),dataIndex:"count",key:"count"}]}):"pie"===h?(n=Math.max(1,v.reduce(function(e,t){return e+Math.max(0,t.value)},0)),r=-Math.PI/2,l().createElement("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:24}},l().createElement("svg",{role:"img","aria-labelledby":k,viewBox:"0 0 260 240",style:{width:240,height:220,flexShrink:0}},l().createElement("title",{id:k},"".concat(m," - ").concat(g)),v.map(function(e,t){var a=Math.max(0,e.value),i=a/n*Math.PI*2,c=r,u=r+i;if(r=u,1===v.length||i>=2*Math.PI-.001)return l().createElement(o.Tooltip,{key:e.key,title:"".concat(e.label,": ").concat(e.value.toLocaleString()," (100%)")},l().createElement("circle",{cx:130,cy:120,r:92,fill:p[0]}));var s=130+92*Math.cos(c),f=120+92*Math.sin(c),d=130+92*Math.cos(u),y=120+92*Math.sin(u),m=+(i>Math.PI),h="M ".concat(130," ").concat(120," L ").concat(s.toFixed(2)," ").concat(f.toFixed(2)," A ").concat(92," ").concat(92," 0 ").concat(m," 1 ").concat(d.toFixed(2)," ").concat(y.toFixed(2)," Z"),b=(a/n*100).toFixed(1);return l().createElement(o.Tooltip,{key:"".concat(e.key,"-").concat(t),title:"".concat(e.label,": ").concat(e.value.toLocaleString()," (").concat(b,"%)")},l().createElement("path",{d:h,fill:p[t%p.length],stroke:x.colorBgContainer,strokeWidth:1.5,style:{cursor:w?"pointer":"default"},onClick:function(){return null==w?void 0:w(e.key)}}))})),l().createElement("div",{style:{flex:1,minWidth:200}},l().createElement(o.Space,{direction:"vertical",size:6,style:{width:"100%"}},v.map(function(e,t){var r=(Math.max(0,e.value)/n*100).toFixed(1);return l().createElement("div",{key:"legend-".concat(e.key,"-").concat(t),style:{display:"flex",justifyContent:"space-between",gap:12,fontSize:13}},l().createElement(o.Space,{size:8},l().createElement("span",{"aria-hidden":"true",style:{display:"inline-block",width:10,height:10,borderRadius:2,backgroundColor:p[t%p.length]}}),l().createElement(f,{ellipsis:!0,style:{maxWidth:220}},e.label)),l().createElement(f,{strong:!0},e.value.toLocaleString()," (",r,"%)"))}))))):function(){var e=[0,.25,.5,.75,1];if("bar"===h){var t=Math.min(16,Math.max(4,Math.floor(680/(4*v.length)))),n=Math.max(8,(680-t*(v.length+1))/v.length);return l().createElement("svg",{role:"img","aria-labelledby":k,viewBox:"0 0 ".concat(760," ").concat(260),style:{width:"100%",height:260,display:"block"}},l().createElement("title",{id:k},"".concat(m," - ").concat(g)),e.map(function(e){var t=214-194*e;return l().createElement("g",{key:"grid-".concat(e)},l().createElement("line",{x1:56,y1:t,x2:736,y2:t,stroke:x.colorSplit,strokeDasharray:"3 3"}),l().createElement("text",{x:48,y:t+4,textAnchor:"end",fontSize:11,fill:x.colorTextSecondary},d(e*P)))}),v.map(function(e,r){var a=Math.max(2,Math.max(0,e.value)/P*194),i=56+t+r*(n+t),c=v.length<=12||r%Math.ceil(v.length/8)==0;return l().createElement("g",{key:"".concat(e.key,"-").concat(r)},l().createElement(o.Tooltip,{title:"".concat(e.label,": ").concat(e.value.toLocaleString()," (").concat(E("Hits"),": ").concat(e.count,")")},l().createElement("rect",{x:i,y:214-a,width:n,height:a,rx:3,fill:p[r%p.length],style:{cursor:w?"pointer":"default"},onClick:function(){return null==w?void 0:w(e.key)}})),c&&l().createElement("text",{x:i+n/2,y:232,textAnchor:"middle",fontSize:11,fill:x.colorTextSecondary},y(e.label,12)))}))}var r=v.length>1?680/(v.length-1):340,a=v.map(function(e,t){return{x:v.length>1?56+t*r:396,y:214-Math.max(0,e.value)/P*194,item:e,idx:t}}),i=a.map(function(e,t){return"".concat(0===t?"M":"L"," ").concat(e.x.toFixed(1)," ").concat(e.y.toFixed(1))}).join(" "),c=a.length>0?"".concat(i," L ").concat(a[a.length-1].x.toFixed(1)," ").concat("214.0"," L ").concat(a[0].x.toFixed(1)," ").concat("214.0"," Z"):"";return l().createElement("svg",{role:"img","aria-labelledby":k,viewBox:"0 0 ".concat(760," ").concat(260),style:{width:"100%",height:260,display:"block"}},l().createElement("title",{id:k},"".concat(m," - ").concat(g)),e.map(function(e){var t=214-194*e;return l().createElement("g",{key:"grid-".concat(e)},l().createElement("line",{x1:56,y1:t,x2:736,y2:t,stroke:x.colorSplit,strokeDasharray:"3 3"}),l().createElement("text",{x:48,y:t+4,textAnchor:"end",fontSize:11,fill:x.colorTextSecondary},d(e*P)))}),"area"===h&&c&&l().createElement("path",{d:c,fill:x.colorPrimary,fillOpacity:.18}),i&&l().createElement("path",{d:i,fill:"none",stroke:x.colorPrimary,strokeWidth:2.5}),a.map(function(e){var t=e.x,n=e.y,r=e.item,a=e.idx,i=v.length<=10||a%Math.ceil(v.length/7)==0;return l().createElement("g",{key:"".concat(r.key,"-").concat(a)},l().createElement(o.Tooltip,{title:"".concat(r.label,": ").concat(r.value.toLocaleString())},l().createElement("circle",{cx:t,cy:n,r:4,fill:x.colorBgContainer,stroke:x.colorPrimary,strokeWidth:2,style:{cursor:w?"pointer":"default"},onClick:function(){return null==w?void 0:w(r.key)}})),i&&l().createElement("text",{x:t,y:232,textAnchor:"middle",fontSize:11,fill:x.colorTextSecondary},y(r.label,12)))}))}())},v=n(249),b=function(e){var t=e.text;if(!t||!t.includes(v.ES))return l().createElement(l().Fragment,null,t);for(var n=[],r=0,o=0;r<t.length;){var a=t.indexOf(v.ES,r);if(-1===a){n.push(t.slice(r));break}a>r&&n.push(t.slice(r,a));var i=a+v.ES.length,c=t.indexOf(v.F8,i);if(-1===c){n.push(t.slice(i));break}n.push(l().createElement("mark",{key:"hl-".concat(o++)},t.slice(i,c))),r=c+v.F8.length}return l().createElement(l().Fragment,null,n)};function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function w(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw r}}return a}}(e,t)||k(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||k(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(e,t)}}var O=o.Typography.Text,j={position:"absolute",clipPath:"inset(50%)",overflow:"hidden",width:1,height:1,margin:-1,padding:0,border:0,whiteSpace:"nowrap"},A=[{label:"is (=)",value:"eq",needsValue:!0},{label:"is not (!=)",value:"ne",needsValue:!0},{label:"contains",value:"contains",needsValue:!0},{label:"is one of (in)",value:"in",needsValue:!0},{label:"is not one of",value:"not_in",needsValue:!0},{label:">",value:"gt",needsValue:!0},{label:">=",value:"gte",needsValue:!0},{label:"<",value:"lt",needsValue:!0},{label:"<=",value:"lte",needsValue:!0},{label:"between",value:"between",needsValue:!0,needsRange:!0},{label:"exists",value:"exists",needsValue:!1},{label:"does not exist",value:"not_exists",needsValue:!1}];function P(e){if(null==e)return"—";if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return String(e);try{return JSON.stringify(e)}catch(t){return String(e)}}var _=function(e){var t,n,c,u,s,f,p,d,y=e.title,v=e.spec,g=e.dataView,k=e.fields,_=void 0===k?[]:k,I=e.result,M=e.loading,T=void 0!==M&&M,C=e.error,R=void 0===C?null:C,F=e.showToolbar,z=void 0===F||F,B=e.compact,q=void 0!==B&&B,L=e.onExecute,D=(0,i.kj)(),V=(0,a.useId)(),$=E((0,a.useState)(null!=(t=v.query)?t:""),2),N=$[0],H=$[1],W=E((0,a.useState)(null!=(n=v.filters)?n:[]),2),K=W[0],Q=W[1],Z=E((0,a.useState)(null!=(c=v.sort)?c:[]),2),U=Z[0],J=Z[1],G=E((0,a.useState)(null!=(u=null==(p=v.timeRange)?void 0:p.preset)?u:"last_24h"),2),X=G[0],Y=G[1],ee=E((0,a.useState)(1),2),et=ee[0],en=ee[1],er=E((0,a.useState)([]),2),eo=er[0],ea=er[1],el=E((0,a.useState)(!1),2),ei=el[0],ec=el[1],eu=E((0,a.useState)(null),2),es=eu[0],ef=eu[1],ep=E((0,a.useState)(""),2),ed=ep[0],ey=ep[1],em=E((0,a.useState)("eq"),2),eh=em[0],ev=em[1],eb=E((0,a.useState)(""),2),eg=eb[0],eS=eb[1],ew=E((0,a.useState)(""),2),eE=ew[0],ex=ew[1],ek=E((0,a.useState)(!1),2),eO=ek[0],ej=ek[1],eA=E((0,a.useState)(null),2),eP=eA[0],e_=eA[1],eI=(0,a.useMemo)(function(){return JSON.stringify(v)},[v]),eM=(0,a.useRef)(eI);(0,a.useEffect)(function(){var e,t,n,r,o;eM.current!==eI&&(eM.current=eI,H(null!=(e=v.query)?e:""),Q(null!=(t=v.filters)?t:[]),J(null!=(n=v.sort)?n:[]),Y(null!=(r=null==(o=v.timeRange)?void 0:o.preset)?r:"last_24h"),en(1),ea([]))},[eI,v]);var eT=(0,a.useMemo)(function(){return _.filter(function(e){return e.aggregatable||!!e.keywordSubfield})},[_]),eC=(0,a.useMemo)(function(){return[{label:D("Last 15 minutes"),value:"last_15m"},{label:D("Last 1 hour"),value:"last_1h"},{label:D("Last 24 hours"),value:"last_24h"},{label:D("Last 7 days"),value:"last_7d"},{label:D("Last 30 days"),value:"last_30d"},{label:D("Last 90 days"),value:"last_90d"},{label:D("All time"),value:"all"}]},[D]),eR=function(e){var t,n;L(S({query:(null==e?void 0:e.query)!==void 0?e.query:N,filters:(null==e?void 0:e.filters)!==void 0?e.filters:K,sort:(null==e?void 0:e.sort)!==void 0?e.sort:U,timeRange:(null==e?void 0:e.timeRange)!==void 0?e.timeRange:{preset:X},page:null!=(t=null==e?void 0:e.page)?t:1,pageSize:null!=(n=v.pageSize)?n:20},(null==e?void 0:e.searchAfter)?{searchAfter:e.searchAfter}:{}))},eF=function(e){var t=K[e];t&&(ef(e),ey(t.field),ev(t.operator),eS(Array.isArray(t.value)?t.value.join(", "):void 0!==t.value?String(t.value):""),ex(void 0!==t.valueTo?String(t.valueTo):""),ec(!0))},ez=function(e){var t=K.filter(function(t,n){return n!==e});Q(t),en(1),ea([]),eR({filters:t,page:1})},eB=(0,a.useMemo)(function(){var e,t;return null!=(e=null!=(t=null==I?void 0:I.columns)?t:v.columns)?e:[]},[null==I?void 0:I.columns,v.columns]),eq=(0,a.useMemo)(function(){return eB.map(function(e){var t=U.find(function(t){return t.field===e||t.field==="".concat(e,".keyword")}),n=eT.some(function(t){return t.name===e||t.name==="".concat(e,".keyword")});return w(S({title:e,key:e,ellipsis:!0},n?{sorter:!0,sortOrder:t?"asc"===t.order?"ascend":"descend":null}:{}),{render:function(t,n){var r,o,a=null==(o=n.highlights)||null==(r=o[e])?void 0:r[0];if(a)return l().createElement(b,{text:a});var i="_id"===e?n._id:"_index"===e?n._index:function(e,t){if(t in e)return e[t];var n=t.split("."),r=e,o=!0,a=!1,l=void 0;try{for(var i,c=n[Symbol.iterator]();!(o=(i=c.next()).done);o=!0){var u,s=i.value;if(!r||(void 0===r?"undefined":(u=r)&&"u">typeof Symbol&&u.constructor===Symbol?"symbol":typeof u)!="object"||Array.isArray(r)||!(s in r))return;r=r[s]}}catch(e){a=!0,l=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw l}}return r}(n.source,e);return l().createElement("span",null,P(i))}})})},[eB,eT,U]),eL=z&&!1!==v.allowInteractiveControls,eD=A.find(function(e){return e.value===eh});return l().createElement("div",null,l().createElement("div",{role:"status","aria-live":"polite",style:j},!T&&I?"".concat(y,": ").concat(I.total," ").concat(D("Hits")):""),eL&&l().createElement("div",{style:{marginBottom:12}},l().createElement(o.Space,{wrap:!0,style:{width:"100%",justifyContent:"space-between"}},l().createElement(o.Space,{wrap:!0},l().createElement(o.Input,{allowClear:!0,"aria-label":D("KQL / Search Query"),placeholder:D('Search KQL, e.g. status >= 500 AND service: "api"'),prefix:l().createElement(r.SearchOutlined,{"aria-hidden":"true"}),value:N,style:{minWidth:q?220:320},onChange:function(e){var t=e.target.value;H(t),""===t&&"click"===e.type&&(en(1),ea([]),eR({query:"",page:1}))},onPressEnter:function(){en(1),ea([]),eR({query:N,page:1})}}),(null==g?void 0:g.timeField)&&l().createElement(o.Select,{"aria-label":D("Time Field"),value:X,options:eC,style:{minWidth:150},onChange:function(e){Y(e),en(1),ea([]),eR({timeRange:{preset:e},page:1})}}),l().createElement(o.Popover,{trigger:"click",title:null!==es?D("Edit Filter"):D("Add Filter"),open:ei,onOpenChange:function(e){ec(e),e||ef(null)},content:l().createElement("div",{style:{width:280}},l().createElement(o.Form,{layout:"vertical",size:"small"},l().createElement(o.Form.Item,{label:D("Field"),style:{marginBottom:8}},l().createElement(o.Select,{showSearch:!0,value:ed||void 0,placeholder:D("Field"),options:_.map(function(e){return{label:"".concat(e.name," (").concat(e.type,")"),value:e.name}}),onChange:function(e){return ey(e)}})),l().createElement(o.Form.Item,{label:D("Operator"),style:{marginBottom:8}},l().createElement(o.Select,{value:eh,options:A.map(function(e){return{label:e.label,value:e.value}}),onChange:function(e){return ev(e)}})),(null==eD?void 0:eD.needsValue)&&l().createElement(o.Form.Item,{label:D("Value"),style:{marginBottom:8}},l().createElement(o.Input,{value:eg,onChange:function(e){return eS(e.target.value)}})),(null==eD?void 0:eD.needsRange)&&l().createElement(o.Form.Item,{label:D("To Value"),style:{marginBottom:8}},l().createElement(o.Input,{value:eE,onChange:function(e){return ex(e.target.value)}})),l().createElement(o.Space,{style:{justifyContent:"flex-end",width:"100%"}},l().createElement(o.Button,{size:"small",onClick:function(){ec(!1),ef(null)}},D("Cancel")),l().createElement(o.Button,{size:"small",type:"primary",onClick:function(){if(ed){var e,t,n=A.find(function(e){return e.value===eh}),r="in"===eh||"not_in"===eh?eg.split(",").map(function(e){return e.trim()}).filter(Boolean):eg,o=w(S({id:null!==es&&null!=(e=null==(t=K[es])?void 0:t.id)?e:"".concat(Date.now()),field:ed,operator:eh},(null==n?void 0:n.needsValue)?{value:r}:{},(null==n?void 0:n.needsRange)&&eE?{valueTo:eE}:{}),{enabled:!0}),a=null!==es?K.map(function(e,t){return t===es?o:e}):x(K).concat([o]);Q(a),en(1),ea([]),ec(!1),ef(null),eS(""),ex(""),eR({filters:a,page:1})}}},D("Apply")))))},l().createElement(o.Button,{icon:l().createElement(r.FilterOutlined,null),onClick:function(){ef(null),ev("eq"),eS(""),ex(""),ec(!0)}},D("Add Filter"))),"table"===v.visualization&&eT.length>0&&l().createElement(o.Select,{allowClear:!0,"aria-label":D("Sort"),placeholder:D("Sort"),style:{minWidth:170},value:U[0]?"".concat(U[0].field,":").concat(U[0].order):void 0,options:eT.slice(0,40).flatMap(function(e){return[{label:"".concat(e.name," ↓"),value:"".concat(e.name,":desc")},{label:"".concat(e.name," ↑"),value:"".concat(e.name,":asc")}]}),onChange:function(e){if(!e){J([]),en(1),ea([]),eR({sort:[],page:1});return}var t=e.lastIndexOf(":"),n=[{field:e.slice(0,t),order:"asc"===e.slice(t+1)?"asc":"desc"}];J(n),en(1),ea([]),eR({sort:n,page:1})}})),l().createElement(o.Space,null,l().createElement(o.Button,{type:"primary",icon:l().createElement(r.SearchOutlined,null),onClick:function(){en(1),ea([]),eR({page:1})}},D("Search")),l().createElement(o.Button,{icon:l().createElement(r.ReloadOutlined,null),"aria-label":D("Refresh"),onClick:function(){return eR({page:et})}}),l().createElement(o.Button,{icon:l().createElement(r.RollbackOutlined,null),onClick:function(){var e,t,n,r,o,a,l,i=null!=(e=v.query)?e:"",c=null!=(t=v.filters)?t:[],u=null!=(n=v.sort)?n:[],s=null!=(r=null==(l=v.timeRange)?void 0:l.preset)?r:"last_24h";H(i),Q(c),J(u),Y(s),en(1),ea([]),L({query:i,filters:c,sort:u,timeRange:null!=(o=v.timeRange)?o:{preset:s},page:1,pageSize:null!=(a=v.pageSize)?a:20})}},D("Reset")),(null==I?void 0:I.compiledDsl)&&l().createElement(o.Button,{icon:l().createElement(r.CodeOutlined,null),onClick:function(){return ej(!0)}},D("Inspect DSL")))),K.length>0&&l().createElement("div",{style:{marginTop:8,display:"flex",flexWrap:"wrap",gap:6}},K.map(function(e,t){return l().createElement(o.Tag,{key:e.id||"".concat(e.field,"-").concat(t),closable:!0,color:"processing",onClose:function(e){e.preventDefault(),e.stopPropagation(),ez(t)}},l().createElement("span",{role:"button",tabIndex:0,"aria-label":"".concat(D("Edit Filter"),": ").concat(e.field),style:{cursor:"pointer"},onClick:function(){return eF(t)},onKeyDown:function(e){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),eF(t))}},e.field," ",e.operator,void 0!==e.value?" ".concat(Array.isArray(e.value)?e.value.join(", "):String(e.value)):"",void 0!==e.valueTo?" .. ".concat(String(e.valueTo)):""))}))),R&&l().createElement(o.Alert,{type:"error",showIcon:!0,message:R,style:{marginBottom:12}}),l().createElement(o.Spin,{spinning:T},I?"table"===v.visualization?l().createElement("div",null,I.histogram.length>0&&(null==(d=v.chart)?void 0:d.showHistogram)!==!1&&l().createElement(m,{buckets:I.histogram}),l().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8,fontSize:12}},l().createElement(O,{id:V,strong:!0},y," \xb7 ",D("Hits"),": ",I.total.toLocaleString(),"gte"===I.totalRelation?"+":""," (",I.tookMs," ms)"),I.nextSearchAfter&&eo.length>0&&l().createElement(o.Button,{size:"small",onClick:function(){en(1),ea([]),eR({page:1})}},D("First page"))),l().createElement("div",{role:"region","aria-labelledby":V,tabIndex:0,style:{overflowX:"auto",maxInlineSize:"100%",containerType:"inline-size"}},l().createElement(o.Table,{size:q?"small":"middle",rowKey:function(e){return"".concat(e._index,":").concat(e._id)},columns:eq,dataSource:I.rows,onRow:function(e){return{onClick:function(){return e_(e)},style:{cursor:"pointer"}}},onChange:function(e,t,n){var r,o,a=Array.isArray(n)?n[0]:n;if(a&&a.columnKey&&a.order){var l=[{field:String(a.columnKey),order:"ascend"===a.order?"asc":"desc"}];J(l),en(1),ea([]),eR({sort:l,page:1});return}var i=null!=(r=e.current)?r:1;if(i*(null!=(o=v.pageSize)?o:20)>1e4&&I.nextSearchAfter){ea(x(eo).concat([I.nextSearchAfter])),en(i),eR({page:i,searchAfter:I.nextSearchAfter});return}en(i),eR({page:i})},pagination:{current:et,pageSize:null!=(s=v.pageSize)?s:20,total:Math.min(I.total,1e4),showSizeChanger:!1}})),I.total>=1e4&&I.nextSearchAfter&&l().createElement("div",{style:{marginTop:8,textAlign:"right"}},l().createElement(o.Button,{size:"small",onClick:function(){I.nextSearchAfter&&(ea(x(eo).concat([I.nextSearchAfter])),en(function(e){return e+1}),eR({searchAfter:I.nextSearchAfter}))}},D("Next cursor page")))):l().createElement(h,{title:y,visualization:v.visualization,series:I.series,metricValue:I.metricValue,metricLabel:I.metricLabel,totalHits:I.total,onSelectBucket:function(e){if(z&&!1!==v.allowInteractiveControls){var t,n,r=(null==(t=v.chart)?void 0:t.bucketField)||(null==g?void 0:g.timeField);if(r&&(null==(n=v.chart)?void 0:n.bucketType)!=="date_histogram"){var o=x(K).concat([{id:"".concat(Date.now()),field:r,operator:"eq",value:e,enabled:!0}]);Q(o),eR({filters:o,page:1})}}}}):l().createElement(o.Empty,{description:D("No matching documents")})),l().createElement(o.Modal,{title:D("Elasticsearch Query DSL"),open:eO,footer:null,onCancel:function(){return ej(!1)},width:680},l().createElement("pre",{style:{maxHeight:420,overflow:"auto",fontSize:12}},JSON.stringify(null!=(f=null==I?void 0:I.compiledDsl)?f:{},null,2))),l().createElement(o.Drawer,{title:D("Document Details"),open:!!eP,onClose:function(){return e_(null)},width:640},eP&&l().createElement(o.Tabs,{items:[{key:"table",label:D("Table View"),children:l().createElement(o.Descriptions,{bordered:!0,column:1,size:"small"},l().createElement(o.Descriptions.Item,{label:"_index"},eP._index),l().createElement(o.Descriptions.Item,{label:"_id"},eP._id),Object.entries(eP.source).map(function(e){var t=E(e,2),n=t[0],r=t[1];return l().createElement(o.Descriptions.Item,{key:n,label:n},P(r))}))},{key:"json",label:D("JSON View"),children:l().createElement("pre",{style:{maxHeight:520,overflow:"auto",fontSize:12}},JSON.stringify(eP,null,2))}]})))}},640:function(e,t,n){n.d(t,{h:function(){return p}});var r=n(485),o=n(59),a=n(155),l=n.n(a),i=n(297),c=n(515);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var p=function(e){var t,n,u=(0,c.kj)(),p=(0,r.useApp)().apiClient,d=f((0,a.useState)([]),2),y=d[0],m=d[1],h=f((0,a.useState)(!1),2),v=h[0],b=h[1],g=(0,a.useCallback)(function(e){var t;return(t=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:b(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,(0,i.oO)(p,e)];case 2:return m(t.sent()),[3,5];case 3:return t.sent(),m([]),[3,5];case 4:return b(!1),[7];case 5:return[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function l(e){s(a,r,o,l,i,"next",e)}function i(e){s(a,r,o,l,i,"throw",e)}l(void 0)})})()},[p]);return(0,a.useEffect)(function(){g()},[g]),l().createElement(o.Select,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),n=n={loading:v,showSearch:!0,allowClear:!0,placeholder:u("Select report"),optionFilterProp:"label",options:y.map(function(e){return{value:e.id,label:"".concat(e.title," (").concat(e.visualization.toUpperCase(),")"),report:e}}),optionRender:function(e){var t=e.data.report;return t?l().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8}},l().createElement("span",null,t.title),l().createElement("span",null,l().createElement(o.Tag,{color:"blue",style:{marginInlineEnd:0}},t.visualization.toUpperCase()))):e.label}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}},615:function(e,t,n){n.r(t),n.d(t,{ElasticReportBlockModel:function(){return p}});var r=n(485),o=n(155),a=n.n(o),l=n(364),i=n(640),c=n(515);function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}var p=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=u(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,f()?Reflect.construct(e,t||[],u(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&s(n,e),t=[{key:"renderComponent",value:function(){return a().createElement(l.v,{reportId:this.props.reportId,showToolbar:!1!==this.props.showToolbar,compact:!0===this.props.compact})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(r.BlockModel);p.define({label:(0,c.MZ)("Elastic Report"),createModelOptions:{use:"ElasticReportBlockModel"}}),p.registerFlow({key:"elasticReportBlockSettings",title:(0,c.MZ)("Elastic report settings"),on:"beforeRender",steps:{editReport:{title:(0,c.MZ)("Select report"),uiSchema:{reportId:{title:(0,c.MZ)("Report"),type:"string","x-decorator":"FormItem","x-component":i.h,required:!0},showToolbar:{title:(0,c.MZ)("Show interactive toolbar"),type:"boolean","x-decorator":"FormItem","x-component":"Switch"},compact:{title:(0,c.MZ)("Compact layout"),type:"boolean","x-decorator":"FormItem","x-component":"Switch"}},defaultParams:{showToolbar:!0,compact:!1},handler:function(e,t){e.model.setProps({reportId:t.reportId,showToolbar:!1!==t.showToolbar,compact:!0===t.compact})}}}}),t.default=p},297:function(e,t,n){n.d(t,{Fs:function(){return x},Jr:function(){return g},L$:function(){return h},L9:function(){return d},V8:function(){return b},WW:function(){return y},Xz:function(){return E},aG:function(){return f},kP:function(){return w},oO:function(){return v},pX:function(){return p},tD:function(){return m},us:function(){return s},wE:function(){return S}});var r=n(249);function o(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function a(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var l=e.apply(t,n);function i(e){o(l,r,a,i,c,"next",e)}function c(e){o(l,r,a,i,c,"throw",e)}i(void 0)})}}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function i(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function c(e){return(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&null!==e&&!Array.isArray(e)}function u(e){if(!c(e))return e;var t=e.data;return c(t)&&"data"in t?t.data:null!=t?t:e}function s(e){return a(function(){var t;return i(this,function(n){switch(n.label){case 0:return[4,e.request({url:"".concat(r.$v,":listConnections"),method:"get"})];case 1:return[2,Array.isArray(t=u(n.sent()))?t:[]]}})})()}function f(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"*";return a(function(){var o;return i(this,function(a){switch(a.label){case 0:return[4,e.request({url:"".concat(r.$v,":listIndices"),method:"post",data:{dataSourceKey:t,indexPattern:n}})];case 1:return[2,Array.isArray(o=u(a.sent()))?o.filter(function(e){return"string"==typeof e}):[]]}})})()}function p(e){return a(function(){var t;return i(this,function(n){switch(n.label){case 0:return[4,e.request({url:"".concat(r.vN,":list"),method:"get",params:{pageSize:200,sort:["-id"]}})];case 1:return[2,Array.isArray(t=u(n.sent()))?t:[]]}})})()}function d(e,t){return a(function(){return i(this,function(n){switch(n.label){case 0:return[4,e.request({url:"".concat(r.$v,":upsertDataView"),method:"post",data:t})];case 1:return[2,u(n.sent())]}})})()}function y(e,t){return a(function(){return i(this,function(n){switch(n.label){case 0:return[4,e.request({url:"".concat(r.vN,":destroy"),method:"post",params:{filterByTk:t}})];case 1:return n.sent(),[2]}})})()}function m(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return a(function(){return i(this,function(o){switch(o.label){case 0:return[4,e.request({url:"".concat(r.$v,":inspectFields"),method:"post",data:{dataViewId:t,refresh:n}})];case 1:return[2,u(o.sent())]}})})()}function h(e){return a(function(){var t;return i(this,function(n){switch(n.label){case 0:return[4,e.request({url:"".concat(r.ty,":list"),method:"get",params:{pageSize:200,appends:["dataView"],sort:["-updatedAt","-id"]}})];case 1:return[2,Array.isArray(t=u(n.sent()))?t:[]]}})})()}function v(e,t){return a(function(){var n;return i(this,function(o){switch(o.label){case 0:return[4,e.request({url:"".concat(r.$v,":listPublishedReports"),method:"get",params:t?{search:t}:void 0})];case 1:return[2,Array.isArray(n=u(o.sent()))?n:[]]}})})()}function b(e,t){return a(function(){return i(this,function(n){switch(n.label){case 0:return[4,e.request({url:"".concat(r.$v,":saveReport"),method:"post",data:t})];case 1:return[2,u(n.sent())]}})})()}function g(e,t){return a(function(){return i(this,function(n){switch(n.label){case 0:return[4,e.request({url:"".concat(r.ty,":destroy"),method:"post",params:{filterByTk:t}})];case 1:return n.sent(),[2]}})})()}function S(e,t,n,o){return a(function(){return i(this,function(a){switch(a.label){case 0:return[4,e.request({url:"".concat(r.$v,":previewReport"),method:"post",data:l({dataViewId:t,spec:n},o?{overrides:o}:{})})];case 1:return[2,u(a.sent())]}})})()}function w(e,t){return a(function(){return i(this,function(n){switch(n.label){case 0:return[4,e.request({url:"".concat(r.$v,":getReportMeta"),method:"get",params:{reportId:t}})];case 1:return[2,u(n.sent())]}})})()}function E(e,t,n){return a(function(){return i(this,function(o){switch(o.label){case 0:return[4,e.request({url:"".concat(r.$v,":runReport"),method:"post",data:l({reportId:t},n?{overrides:n}:{})})];case 1:return[2,u(o.sent())]}})})()}function x(e){return a(function(){return i(this,function(t){switch(t.label){case 0:return[4,e.request({url:"".concat(r.$v,":getMcpInfo"),method:"get"})];case 1:return[2,u(t.sent())]}})})()}},515:function(e,t,n){n.d(t,{MZ:function(){return l},kj:function(){return a}});var r=n(694),o=n(249).AF;function a(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[o,"client"]},n))}}function l(e){return(0,r.tExpr)(e,{ns:[o,"client"]})}},249:function(e,t,n){n.d(t,{$v:function(){return c},AF:function(){return r},ES:function(){return u},F8:function(){return s},FI:function(){return a},QS:function(){return o},ty:function(){return i},vN:function(){return l}});var r="plugin-elastic-report",o="elastic-report",a="pm.elastic-report",l="esReportDataViews",i="esReports",c="esReportService",u="__ES_HL_START__",s="__ES_HL_END__"},375:function(e){e.exports=r},485:function(t){t.exports=e},694:function(e){e.exports=o},59:function(e){e.exports=n},155:function(e){e.exports=t}},u={};function s(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return c[e](n,n.exports,s),n.exports}s.m=c,s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce(function(t,n){return s.f[n](e,t),t},[]))},s.u=function(e){return""+e+".488fdbf5bc5b6a36.js"},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f={},s.l=function(e,t,n,r){if(f[e])return void f[e].push(t);if(void 0!==n)for(var o,a,l=document.getElementsByTagName("script"),i=0;i<l.length;i++){var c=l[i];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="plugin-elastic-report/client-v2:"+n){o=c;break}}o||(a=!0,(o=document.createElement("script")).timeout=120,s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-rspack","plugin-elastic-report/client-v2:"+n),o.src=e),f[e]=[t];var u=function(t,n){o.onerror=o.onload=null,clearTimeout(p);var r=f[e];if(delete f[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),a&&document.head.appendChild(o)},s.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(p=s.g.location+"");var f,p,d=s.g.document;if(!p&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(p=d.currentScript.src),!p)){var y=d.getElementsByTagName("script");if(y.length)for(var m=y.length-1;m>-1&&(!p||!/^http(s?):/.test(p));)p=y[m--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");s.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a={889:0},s.f.j=function(e,t){var n=s.o(a,e)?a[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=a[e]=[t,r]});t.push(n[2]=r);var o=s.p+s.u(e),l=Error();s.l(o,function(t){if(s.o(a,e)&&(0!==(n=a[e])&&(a[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",l.name="ChunkLoadError",l.type=r,l.request=o,n[1](l)}},"chunk-"+e,e)}},l=function(e,t){var n,r,o=t[0],l=t[1],i=t[2],c=0;if(o.some(function(e){return 0!==a[e]})){for(n in l)s.o(l,n)&&(s.m[n]=l[n]);i&&i(s)}for(e&&e(t);c<o.length;c++)r=o[c],s.o(a,r)&&a[r]&&a[r][0](),a[r]=0},(i=self.webpackChunkplugin_elastic_report_client_v2=self.webpackChunkplugin_elastic_report_client_v2||[]).forEach(l.bind(null,0)),i.push=l.bind(null,i.push.bind(i));var h={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/plugin-elastic-report/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-elastic-report/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",a="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var l=window.location.pathname||"/",i=l.indexOf(a);e=i>=0?l.slice(0,i+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-elastic-report/dist/client-v2/"}s.p=e}(),!function(){s.r(h),s.d(h,{ElasticReportRenderer:function(){return d.L},default:function(){return u},ElasticReportBlockModel:function(){return f.ElasticReportBlockModel},PluginElasticReportClient:function(){return c},ReportSelect:function(){return y.h},ElasticReportBlock:function(){return p.v}});var e=s(485),t=s(249);function n(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function r(e,t,n){return(r=i()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&a(o,n.prototype),o}).apply(null,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return r(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)})(e)}function i(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(i=function(){return!!e})()}var c=function(e){var r;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function l(){var e,t;if(!(this instanceof l))throw TypeError("Cannot call a class as a function");return e=l,t=arguments,e=o(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,i()?Reflect.construct(e,t||[],o(this).constructor):e.apply(this,t))}return l.prototype=Object.create(e&&e.prototype,{constructor:{value:l,writable:!0,configurable:!0}}),e&&a(l,e),r=[{key:"load",value:function(){var e;return(e=function(){var e,n,r,o,a,l,i,c,u,f;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:c(0)}),i(l,"throw",{value:c(1)}),i(l,"return",{value:c(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(p){if(this.flowEngine.registerModelLoaders({ElasticReportBlockModel:{extends:"BlockModel",loader:function(){return Promise.resolve().then(s.bind(s,615))}}}),e=this.t("Elastic Report"),this.pluginSettingsManager.addMenuItem({key:t.QS,title:e,icon:"BarChartOutlined",aclSnippet:t.FI}),this.pluginSettingsManager.addPageTabItem({menuKey:t.QS,key:"index",title:e,aclSnippet:t.FI,componentLoader:function(){return s.e("851").then(s.bind(s,614))}}),"function"==typeof this.pluginSettingsManager.setPluginSettingsLink){o=new Set([t.AF,t.QS,null==(n=this.options)?void 0:n.name,null==(r=this.options)?void 0:r.packageName].filter(function(e){return"string"==typeof e&&e.trim().length>0})),a=!0,l=!1,i=void 0;try{for(c=o[Symbol.iterator]();!(a=(u=c.next()).done);a=!0)f=u.value,this.pluginSettingsManager.setPluginSettingsLink(f,t.QS)}catch(e){l=!0,i=e}finally{try{a||null==c.return||c.return()}finally{if(l)throw i}}}return[2]})},function(){var t=this,r=arguments;return new Promise(function(o,a){var l=e.apply(t,r);function i(e){n(l,o,a,i,c,"next",e)}function c(e){n(l,o,a,i,c,"throw",e)}i(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(l.prototype,r),l}(l(e.Plugin)),u=c,f=s(615),p=s(364),d=s(221),y=s(640)}(),h}()});
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
module.exports = {
|
|
11
|
+
"@nocobase/client": "2.2.52",
|
|
12
|
+
"@nocobase/flow-engine": "2.2.52",
|
|
13
|
+
"@nocobase/client-v2": "2.2.52",
|
|
14
|
+
"@nocobase/actions": "2.2.52",
|
|
15
|
+
"@nocobase/server": "2.2.52",
|
|
16
|
+
"antd": "5.24.2",
|
|
17
|
+
"react": "18.2.0",
|
|
18
|
+
"@ant-design/icons": "5.6.1",
|
|
19
|
+
"@nocobase/database": "2.2.52"
|
|
20
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
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 __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var src_exports = {};
|
|
39
|
+
__export(src_exports, {
|
|
40
|
+
default: () => import_server.default
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(src_exports);
|
|
43
|
+
var import_server = __toESM(require("./server"));
|
|
44
|
+
__reExport(src_exports, require("./server"), module.exports);
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
...require("./server")
|
|
48
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Elastic Report": "Elastic Report",
|
|
3
|
+
"Elastic report settings": "Elastic report settings",
|
|
4
|
+
"Select report": "Select report",
|
|
5
|
+
"Report": "Report",
|
|
6
|
+
"Show interactive toolbar": "Show interactive toolbar",
|
|
7
|
+
"Compact layout": "Compact layout",
|
|
8
|
+
"Reports": "Reports",
|
|
9
|
+
"Data Views": "Data Views",
|
|
10
|
+
"MCP & AI Employee": "MCP & AI Employee",
|
|
11
|
+
"New Report": "New Report",
|
|
12
|
+
"Edit Report": "Edit Report",
|
|
13
|
+
"New Data View": "New Data View",
|
|
14
|
+
"Edit Data View": "Edit Data View",
|
|
15
|
+
"Title": "Title",
|
|
16
|
+
"Description": "Description",
|
|
17
|
+
"Data Source (Elasticsearch)": "Data Source (Elasticsearch)",
|
|
18
|
+
"Index Pattern": "Index Pattern",
|
|
19
|
+
"Time Field": "Time Field",
|
|
20
|
+
"Browse Indices": "Browse Indices",
|
|
21
|
+
"Matching Indices": "Matching Indices",
|
|
22
|
+
"Fields": "Fields",
|
|
23
|
+
"Refresh Fields": "Refresh Fields",
|
|
24
|
+
"Visualization": "Visualization",
|
|
25
|
+
"Table (Discover)": "Table (Discover)",
|
|
26
|
+
"Bar Chart": "Bar Chart",
|
|
27
|
+
"Line Chart": "Line Chart",
|
|
28
|
+
"Area Chart": "Area Chart",
|
|
29
|
+
"Pie Chart": "Pie Chart",
|
|
30
|
+
"Metric KPI": "Metric KPI",
|
|
31
|
+
"Data View": "Data View",
|
|
32
|
+
"Published": "Published",
|
|
33
|
+
"Draft": "Draft",
|
|
34
|
+
"Allow interactive search/filter on block": "Allow interactive search/filter on block",
|
|
35
|
+
"Show time histogram above table": "Show time histogram above table",
|
|
36
|
+
"KQL / Search Query": "KQL / Search Query",
|
|
37
|
+
"Search KQL, e.g. status >= 500 AND service: \"api\"": "Search KQL, e.g. status >= 500 AND service: \"api\"",
|
|
38
|
+
"Search": "Search",
|
|
39
|
+
"Reset": "Reset",
|
|
40
|
+
"Refresh": "Refresh",
|
|
41
|
+
"Inspect DSL": "Inspect DSL",
|
|
42
|
+
"Elasticsearch Query DSL": "Elasticsearch Query DSL",
|
|
43
|
+
"Add Filter": "Add Filter",
|
|
44
|
+
"Edit Filter": "Edit Filter",
|
|
45
|
+
"Field": "Field",
|
|
46
|
+
"Operator": "Operator",
|
|
47
|
+
"Value": "Value",
|
|
48
|
+
"To Value": "To Value",
|
|
49
|
+
"Apply": "Apply",
|
|
50
|
+
"Cancel": "Cancel",
|
|
51
|
+
"Save": "Save",
|
|
52
|
+
"Delete": "Delete",
|
|
53
|
+
"Edit": "Edit",
|
|
54
|
+
"Preview": "Preview",
|
|
55
|
+
"Run Preview": "Run Preview",
|
|
56
|
+
"Sort": "Sort",
|
|
57
|
+
"Add Sort": "Add Sort",
|
|
58
|
+
"Ascending": "Ascending",
|
|
59
|
+
"Descending": "Descending",
|
|
60
|
+
"Columns": "Columns",
|
|
61
|
+
"Auto-detect columns from documents": "Auto-detect columns from documents",
|
|
62
|
+
"Page Size": "Page Size",
|
|
63
|
+
"Bucket Type": "Bucket Type",
|
|
64
|
+
"Date Histogram": "Date Histogram",
|
|
65
|
+
"Top Terms": "Top Terms",
|
|
66
|
+
"Bucket Field": "Bucket Field",
|
|
67
|
+
"Interval": "Interval",
|
|
68
|
+
"Top N": "Top N",
|
|
69
|
+
"Metric": "Metric",
|
|
70
|
+
"Metric Field": "Metric Field",
|
|
71
|
+
"Metric Label": "Metric Label",
|
|
72
|
+
"Last 15 minutes": "Last 15 minutes",
|
|
73
|
+
"Last 1 hour": "Last 1 hour",
|
|
74
|
+
"Last 24 hours": "Last 24 hours",
|
|
75
|
+
"Last 7 days": "Last 7 days",
|
|
76
|
+
"Last 30 days": "Last 30 days",
|
|
77
|
+
"Last 90 days": "Last 90 days",
|
|
78
|
+
"All time": "All time",
|
|
79
|
+
"Document Details": "Document Details",
|
|
80
|
+
"Table View": "Table View",
|
|
81
|
+
"JSON View": "JSON View",
|
|
82
|
+
"Show data table": "Show data table",
|
|
83
|
+
"Show chart": "Show chart",
|
|
84
|
+
"Select a saved Elastic Report in block settings to display data": "Select a saved Elastic Report in block settings to display data",
|
|
85
|
+
"No matching documents": "No matching documents",
|
|
86
|
+
"Saved successfully": "Saved successfully",
|
|
87
|
+
"Deleted successfully": "Deleted successfully",
|
|
88
|
+
"Copied to clipboard": "Copied to clipboard",
|
|
89
|
+
"Copy": "Copy",
|
|
90
|
+
"Confirm delete?": "Confirm delete?",
|
|
91
|
+
"Hits": "Hits",
|
|
92
|
+
"Next cursor page": "Next cursor page",
|
|
93
|
+
"First page": "First page",
|
|
94
|
+
"Dedicated MCP Endpoint": "Dedicated MCP Endpoint",
|
|
95
|
+
"MCP Server Name": "MCP Server Name",
|
|
96
|
+
"Exposed MCP Tools": "Exposed MCP Tools",
|
|
97
|
+
"AI Employee Usage": "AI Employee Usage",
|
|
98
|
+
"This plugin automatically registers the elastic-report MCP server (with user context) and AI Employee tools so AI agents can inspect fields, preview Elasticsearch queries, and publish Saved Reports ready to select in blocks.": "This plugin automatically registers the elastic-report MCP server (with user context) and AI Employee tools so AI agents can inspect fields, preview Elasticsearch queries, and publish Saved Reports ready to select in blocks."
|
|
99
|
+
}
|