plugin-elastic-report 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-v2.d.ts +2 -2
- package/client-v2.js +1 -1
- package/client.d.ts +2 -2
- package/client.js +1 -1
- package/{ai → dist/ai}/skills/elastic-report/SKILLS.md +52 -34
- package/dist/client-v2/851.35e416bfb3fb565f.js +10 -0
- package/dist/client-v2/877.81b10beb7b7f4bd7.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +2 -1
- package/dist/locale/en-US.json +213 -198
- package/dist/locale/vi-VN.json +213 -198
- package/dist/locale/zh-CN.json +213 -198
- package/dist/node_modules/@elastic/elasticsearch/package.json +1 -1
- package/dist/server/mcp/ElasticReportToolCatalog.js +6 -4
- package/dist/server/plugin.js +4 -4
- package/dist/server/report-block-tools.js +340 -0
- package/dist/server/services/ElasticReportService.js +12 -6
- package/dist/shared/constants.js +9 -0
- package/package.json +2 -3
- package/server.d.ts +2 -2
- package/server.js +1 -1
- package/src/ai/skills/elastic-report/SKILLS.md +52 -0
- package/src/client/index.tsx +34 -34
- package/src/client/workflow-instructions.tsx +44 -44
- package/src/client-v2/__tests__/elastic-report.test.tsx +879 -791
- package/src/client-v2/__tests__/kql-autocomplete.test.ts +178 -178
- package/src/client-v2/api.ts +320 -320
- package/src/client-v2/bus/DashboardFilterBus.ts +212 -212
- package/src/client-v2/components/ElasticBasicCharts.tsx +652 -652
- package/src/client-v2/components/ElasticFilterBar.tsx +372 -372
- package/src/client-v2/components/ElasticKqlInput.tsx +421 -421
- package/src/client-v2/components/ElasticReportBlock.tsx +306 -306
- package/src/client-v2/components/ElasticReportRenderer.tsx +1257 -1257
- package/src/client-v2/components/HighlightText.tsx +50 -50
- package/src/client-v2/components/ReportSelect.tsx +85 -85
- package/src/client-v2/index.tsx +14 -14
- package/src/client-v2/locale.ts +23 -23
- package/src/client-v2/models/ElasticFilterBarBlockModel.tsx +115 -115
- package/src/client-v2/models/ElasticReportBlockModel.tsx +118 -118
- package/src/client-v2/pages/ElasticReportManager.tsx +1453 -1453
- package/src/client-v2/plugin.tsx +107 -72
- package/src/client-v2/report-destination.tsx +126 -0
- package/src/client-v2/utils/kqlAutocomplete.ts +861 -861
- package/src/client-v2/workflow/instructions.tsx +149 -149
- package/src/index.ts +11 -11
- package/src/locale/en-US.json +213 -198
- package/src/locale/vi-VN.json +213 -198
- package/src/locale/zh-CN.json +213 -198
- package/src/server/__tests__/ai-blocks.integration.test.ts +292 -0
- package/src/server/__tests__/query-compiler.test.ts +620 -620
- package/src/server/__tests__/report-mcp-acl.integration.test.ts +645 -645
- package/src/server/acl-guard.ts +194 -194
- package/src/server/collections/es-report-data-views.ts +64 -64
- package/src/server/collections/es-reports.ts +80 -80
- package/src/server/index.ts +15 -15
- package/src/server/mcp/ElasticReportMcpServer.ts +391 -391
- package/src/server/mcp/ElasticReportToolCatalog.ts +667 -663
- package/src/server/plugin.ts +599 -599
- package/src/server/report-block-tools.ts +400 -0
- package/src/server/services/ElasticReportService.ts +494 -486
- package/src/server/services/ElasticsearchConnectionService.ts +728 -728
- package/src/server/services/ReportExportService.ts +282 -282
- package/src/server/services/ReportQueryCompiler.ts +1552 -1552
- package/src/server/workflow/ElasticReportQueryInstruction.ts +124 -124
- package/src/shared/constants.ts +39 -36
- package/src/shared/types.ts +272 -272
- package/dist/client-v2/851.142c93fc6d666b28.js +0 -10
- package/dist/client-v2/877.f4095a3dbcadf98f.js +0 -10
- package/dist/node_modules/@elastic/elasticsearch/node_modules/.bin/arrow2csv +0 -15
- package/dist/node_modules/@elastic/elasticsearch/node_modules/.bin/arrow2csv.cmd +0 -7
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { BlockModel } from '@nocobase/client-v2';
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import type { ID } from '../../shared/types';
|
|
13
|
-
import { resolveFlowRootScopeId } from '../bus/DashboardFilterBus';
|
|
14
|
-
import { ElasticReportBlock } from '../components/ElasticReportBlock';
|
|
15
|
-
import { tExpr } from '../locale';
|
|
16
|
-
|
|
17
|
-
export interface ElasticReportBlockModelProps {
|
|
18
|
-
reportId?: ID;
|
|
19
|
-
showToolbar?: boolean;
|
|
20
|
-
compact?: boolean;
|
|
21
|
-
subscribeDashboardFilters?: boolean;
|
|
22
|
-
syncGroup?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class ElasticReportBlockModel extends BlockModel {
|
|
26
|
-
declare props: ElasticReportBlockModelProps;
|
|
27
|
-
|
|
28
|
-
renderComponent() {
|
|
29
|
-
const scopeKey = resolveFlowRootScopeId(
|
|
30
|
-
this as unknown as { uid?: string; parent?: unknown },
|
|
31
|
-
this.props.syncGroup,
|
|
32
|
-
);
|
|
33
|
-
const contextRecord = (this as unknown as { context?: { record?: unknown } }).context?.record;
|
|
34
|
-
return (
|
|
35
|
-
<ElasticReportBlock
|
|
36
|
-
reportId={this.props.reportId}
|
|
37
|
-
showToolbar={this.props.showToolbar !== false}
|
|
38
|
-
compact={this.props.compact === true}
|
|
39
|
-
scopeKey={scopeKey}
|
|
40
|
-
subscribeDashboardFilters={this.props.subscribeDashboardFilters !== false}
|
|
41
|
-
contextRecord={contextRecord}
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
ElasticReportBlockModel.define({
|
|
48
|
-
label: tExpr('Elastic Report'),
|
|
49
|
-
createModelOptions: { use: 'ElasticReportBlockModel' },
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
ElasticReportBlockModel.registerFlow({
|
|
53
|
-
key: 'elasticReportBlockSettings',
|
|
54
|
-
title: tExpr('Elastic report settings'),
|
|
55
|
-
on: 'beforeRender',
|
|
56
|
-
steps: {
|
|
57
|
-
editReport: {
|
|
58
|
-
title: tExpr('Select report'),
|
|
59
|
-
uiMode: {
|
|
60
|
-
type: 'dialog',
|
|
61
|
-
props: {
|
|
62
|
-
width: 520,
|
|
63
|
-
style: { maxWidth: 'calc(100vw - 32px)' },
|
|
64
|
-
centered: true,
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
uiSchema: {
|
|
68
|
-
reportId: {
|
|
69
|
-
title: tExpr('Report'),
|
|
70
|
-
'x-decorator': 'FormItem',
|
|
71
|
-
'x-component': 'ElasticReportSelect',
|
|
72
|
-
required: true,
|
|
73
|
-
},
|
|
74
|
-
showToolbar: {
|
|
75
|
-
title: tExpr('Show interactive toolbar'),
|
|
76
|
-
type: 'boolean',
|
|
77
|
-
'x-decorator': 'FormItem',
|
|
78
|
-
'x-component': 'Switch',
|
|
79
|
-
},
|
|
80
|
-
compact: {
|
|
81
|
-
title: tExpr('Compact layout'),
|
|
82
|
-
type: 'boolean',
|
|
83
|
-
'x-decorator': 'FormItem',
|
|
84
|
-
'x-component': 'Switch',
|
|
85
|
-
},
|
|
86
|
-
subscribeDashboardFilters: {
|
|
87
|
-
title: tExpr('Subscribe to dashboard filter bar'),
|
|
88
|
-
type: 'boolean',
|
|
89
|
-
'x-decorator': 'FormItem',
|
|
90
|
-
'x-component': 'Switch',
|
|
91
|
-
},
|
|
92
|
-
syncGroup: {
|
|
93
|
-
title: tExpr('Sync Group'),
|
|
94
|
-
type: 'string',
|
|
95
|
-
'x-decorator': 'FormItem',
|
|
96
|
-
'x-component': 'Input',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
defaultParams: {
|
|
100
|
-
showToolbar: true,
|
|
101
|
-
compact: false,
|
|
102
|
-
subscribeDashboardFilters: true,
|
|
103
|
-
syncGroup: '',
|
|
104
|
-
},
|
|
105
|
-
handler(ctx, params) {
|
|
106
|
-
ctx.model.setProps({
|
|
107
|
-
reportId: params.reportId,
|
|
108
|
-
showToolbar: params.showToolbar !== false,
|
|
109
|
-
compact: params.compact === true,
|
|
110
|
-
subscribeDashboardFilters: params.subscribeDashboardFilters !== false,
|
|
111
|
-
syncGroup: typeof params.syncGroup === 'string' ? params.syncGroup : '',
|
|
112
|
-
});
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
export default ElasticReportBlockModel;
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { BlockModel } from '@nocobase/client-v2';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import type { ID } from '../../shared/types';
|
|
13
|
+
import { resolveFlowRootScopeId } from '../bus/DashboardFilterBus';
|
|
14
|
+
import { ElasticReportBlock } from '../components/ElasticReportBlock';
|
|
15
|
+
import { tExpr } from '../locale';
|
|
16
|
+
|
|
17
|
+
export interface ElasticReportBlockModelProps {
|
|
18
|
+
reportId?: ID;
|
|
19
|
+
showToolbar?: boolean;
|
|
20
|
+
compact?: boolean;
|
|
21
|
+
subscribeDashboardFilters?: boolean;
|
|
22
|
+
syncGroup?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class ElasticReportBlockModel extends BlockModel {
|
|
26
|
+
declare props: ElasticReportBlockModelProps;
|
|
27
|
+
|
|
28
|
+
renderComponent() {
|
|
29
|
+
const scopeKey = resolveFlowRootScopeId(
|
|
30
|
+
this as unknown as { uid?: string; parent?: unknown },
|
|
31
|
+
this.props.syncGroup,
|
|
32
|
+
);
|
|
33
|
+
const contextRecord = (this as unknown as { context?: { record?: unknown } }).context?.record;
|
|
34
|
+
return (
|
|
35
|
+
<ElasticReportBlock
|
|
36
|
+
reportId={this.props.reportId}
|
|
37
|
+
showToolbar={this.props.showToolbar !== false}
|
|
38
|
+
compact={this.props.compact === true}
|
|
39
|
+
scopeKey={scopeKey}
|
|
40
|
+
subscribeDashboardFilters={this.props.subscribeDashboardFilters !== false}
|
|
41
|
+
contextRecord={contextRecord}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
ElasticReportBlockModel.define({
|
|
48
|
+
label: tExpr('Elastic Report'),
|
|
49
|
+
createModelOptions: { use: 'ElasticReportBlockModel' },
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
ElasticReportBlockModel.registerFlow({
|
|
53
|
+
key: 'elasticReportBlockSettings',
|
|
54
|
+
title: tExpr('Elastic report settings'),
|
|
55
|
+
on: 'beforeRender',
|
|
56
|
+
steps: {
|
|
57
|
+
editReport: {
|
|
58
|
+
title: tExpr('Select report'),
|
|
59
|
+
uiMode: {
|
|
60
|
+
type: 'dialog',
|
|
61
|
+
props: {
|
|
62
|
+
width: 520,
|
|
63
|
+
style: { maxWidth: 'calc(100vw - 32px)' },
|
|
64
|
+
centered: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
uiSchema: {
|
|
68
|
+
reportId: {
|
|
69
|
+
title: tExpr('Report'),
|
|
70
|
+
'x-decorator': 'FormItem',
|
|
71
|
+
'x-component': 'ElasticReportSelect',
|
|
72
|
+
required: true,
|
|
73
|
+
},
|
|
74
|
+
showToolbar: {
|
|
75
|
+
title: tExpr('Show interactive toolbar'),
|
|
76
|
+
type: 'boolean',
|
|
77
|
+
'x-decorator': 'FormItem',
|
|
78
|
+
'x-component': 'Switch',
|
|
79
|
+
},
|
|
80
|
+
compact: {
|
|
81
|
+
title: tExpr('Compact layout'),
|
|
82
|
+
type: 'boolean',
|
|
83
|
+
'x-decorator': 'FormItem',
|
|
84
|
+
'x-component': 'Switch',
|
|
85
|
+
},
|
|
86
|
+
subscribeDashboardFilters: {
|
|
87
|
+
title: tExpr('Subscribe to dashboard filter bar'),
|
|
88
|
+
type: 'boolean',
|
|
89
|
+
'x-decorator': 'FormItem',
|
|
90
|
+
'x-component': 'Switch',
|
|
91
|
+
},
|
|
92
|
+
syncGroup: {
|
|
93
|
+
title: tExpr('Sync Group'),
|
|
94
|
+
type: 'string',
|
|
95
|
+
'x-decorator': 'FormItem',
|
|
96
|
+
'x-component': 'Input',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
defaultParams: {
|
|
100
|
+
showToolbar: true,
|
|
101
|
+
compact: false,
|
|
102
|
+
subscribeDashboardFilters: true,
|
|
103
|
+
syncGroup: '',
|
|
104
|
+
},
|
|
105
|
+
handler(ctx, params) {
|
|
106
|
+
ctx.model.setProps({
|
|
107
|
+
reportId: params.reportId,
|
|
108
|
+
showToolbar: params.showToolbar !== false,
|
|
109
|
+
compact: params.compact === true,
|
|
110
|
+
subscribeDashboardFilters: params.subscribeDashboardFilters !== false,
|
|
111
|
+
syncGroup: typeof params.syncGroup === 'string' ? params.syncGroup : '',
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export default ElasticReportBlockModel;
|