@finos/legend-extension-dsl-data-space 9.2.4 → 9.2.6
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/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts +2 -1
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts.map +1 -1
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js +8 -0
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js.map +1 -1
- package/lib/components/DataSpaceDataAccess.d.ts.map +1 -1
- package/lib/components/DataSpaceDataAccess.js +70 -66
- package/lib/components/DataSpaceDataAccess.js.map +1 -1
- package/lib/components/DataSpaceDiagramViewer.js +1 -1
- package/lib/components/DataSpaceDiagramViewer.js.map +1 -1
- package/lib/components/DataSpaceModelsDocumentation.d.ts.map +1 -1
- package/lib/components/DataSpaceModelsDocumentation.js +337 -34
- package/lib/components/DataSpaceModelsDocumentation.js.map +1 -1
- package/lib/components/DataSpaceQuickStart.d.ts.map +1 -1
- package/lib/components/DataSpaceQuickStart.js +33 -12
- package/lib/components/DataSpaceQuickStart.js.map +1 -1
- package/lib/components/DataSpaceViewer.d.ts.map +1 -1
- package/lib/components/DataSpaceViewer.js +1 -1
- package/lib/components/DataSpaceViewer.js.map +1 -1
- package/lib/components/DataSpaceWiki.d.ts.map +1 -1
- package/lib/components/DataSpaceWiki.js +0 -1
- package/lib/components/DataSpaceWiki.js.map +1 -1
- package/lib/graphManager/action/analytics/DataSpaceAnalysis.d.ts +45 -9
- package/lib/graphManager/action/analytics/DataSpaceAnalysis.d.ts.map +1 -1
- package/lib/graphManager/action/analytics/DataSpaceAnalysis.js +55 -12
- package/lib/graphManager/action/analytics/DataSpaceAnalysis.js.map +1 -1
- package/lib/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.d.ts.map +1 -1
- package/lib/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js +51 -8
- package/lib/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
- package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts +15 -3
- package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts.map +1 -1
- package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js +16 -2
- package/lib/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +7 -10
- package/lib/stores/DataSpaceModelsDocumentationState.d.ts +93 -0
- package/lib/stores/DataSpaceModelsDocumentationState.d.ts.map +1 -0
- package/lib/stores/DataSpaceModelsDocumentationState.js +396 -0
- package/lib/stores/DataSpaceModelsDocumentationState.js.map +1 -0
- package/lib/stores/DataSpaceViewerState.d.ts +5 -0
- package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
- package/lib/stores/DataSpaceViewerState.js +6 -1
- package/lib/stores/DataSpaceViewerState.js.map +1 -1
- package/package.json +18 -21
- package/src/components/DSL_DataSpace_LegendApplicationPlugin.ts +10 -0
- package/src/components/DataSpaceDataAccess.tsx +101 -96
- package/src/components/DataSpaceDiagramViewer.tsx +1 -1
- package/src/components/DataSpaceModelsDocumentation.tsx +1043 -46
- package/src/components/DataSpaceQuickStart.tsx +69 -15
- package/src/components/DataSpaceViewer.tsx +2 -4
- package/src/components/DataSpaceWiki.tsx +0 -2
- package/src/graphManager/action/analytics/DataSpaceAnalysis.ts +71 -19
- package/src/graphManager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.ts +97 -29
- package/src/graphManager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.ts +22 -3
- package/src/stores/DataSpaceModelsDocumentationState.ts +588 -0
- package/src/stores/DataSpaceViewerState.ts +14 -0
- package/tsconfig.json +1 -1
- package/lib/graphManager/action/analytics/HACKY__DataSpaceUsageShowcase.d.ts +0 -57
- package/lib/graphManager/action/analytics/HACKY__DataSpaceUsageShowcase.d.ts.map +0 -1
- package/lib/graphManager/action/analytics/HACKY__DataSpaceUsageShowcase.js +0 -209
- package/lib/graphManager/action/analytics/HACKY__DataSpaceUsageShowcase.js.map +0 -1
- package/src/graphManager/action/analytics/HACKY__DataSpaceUsageShowcase.ts +0 -313
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { action, computed, makeObservable, observable } from 'mobx';
|
|
18
|
+
import type { DataSpaceViewerState } from './DataSpaceViewerState.js';
|
|
19
|
+
import { FuzzySearchAdvancedConfigState } from '@finos/legend-application/components';
|
|
20
|
+
import { type TreeData, type TreeNodeData } from '@finos/legend-art';
|
|
21
|
+
import {
|
|
22
|
+
ActionState,
|
|
23
|
+
filterByType,
|
|
24
|
+
guaranteeNonNullable,
|
|
25
|
+
FuzzySearchEngine,
|
|
26
|
+
} from '@finos/legend-shared';
|
|
27
|
+
import {
|
|
28
|
+
DataSpaceAssociationDocumentationEntry,
|
|
29
|
+
DataSpaceClassDocumentationEntry,
|
|
30
|
+
DataSpaceEnumerationDocumentationEntry,
|
|
31
|
+
DataSpaceModelDocumentationEntry,
|
|
32
|
+
type NormalizedDataSpaceDocumentationEntry,
|
|
33
|
+
} from '../graphManager/action/analytics/DataSpaceAnalysis.js';
|
|
34
|
+
import { CORE_PURE_PATH, ELEMENT_PATH_DELIMITER } from '@finos/legend-graph';
|
|
35
|
+
|
|
36
|
+
export enum ModelsDocumentationFilterTreeNodeCheckType {
|
|
37
|
+
CHECKED,
|
|
38
|
+
UNCHECKED,
|
|
39
|
+
PARTIALLY_CHECKED,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export abstract class ModelsDocumentationFilterTreeNodeData
|
|
43
|
+
implements TreeNodeData
|
|
44
|
+
{
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly label: string;
|
|
47
|
+
readonly parentNode: ModelsDocumentationFilterTreeNodeData | undefined;
|
|
48
|
+
isOpen = false;
|
|
49
|
+
childrenIds: string[] = [];
|
|
50
|
+
childrenNodes: ModelsDocumentationFilterTreeNodeData[] = [];
|
|
51
|
+
// By default all nodes are checked
|
|
52
|
+
checkType = ModelsDocumentationFilterTreeNodeCheckType.CHECKED;
|
|
53
|
+
|
|
54
|
+
constructor(
|
|
55
|
+
id: string,
|
|
56
|
+
label: string,
|
|
57
|
+
parentNode: ModelsDocumentationFilterTreeNodeData | undefined,
|
|
58
|
+
) {
|
|
59
|
+
makeObservable(this, {
|
|
60
|
+
isOpen: observable,
|
|
61
|
+
checkType: observable,
|
|
62
|
+
setIsOpen: action,
|
|
63
|
+
setCheckType: action,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
this.id = id;
|
|
67
|
+
this.label = label;
|
|
68
|
+
this.parentNode = parentNode;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
setIsOpen(val: boolean): void {
|
|
72
|
+
this.isOpen = val;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
setCheckType(val: ModelsDocumentationFilterTreeNodeCheckType): void {
|
|
76
|
+
this.checkType = val;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export class ModelsDocumentationFilterTreeRootNodeData extends ModelsDocumentationFilterTreeNodeData {}
|
|
81
|
+
|
|
82
|
+
export class ModelsDocumentationFilterTreePackageNodeData extends ModelsDocumentationFilterTreeNodeData {
|
|
83
|
+
declare parentNode: ModelsDocumentationFilterTreeNodeData;
|
|
84
|
+
packagePath: string;
|
|
85
|
+
|
|
86
|
+
constructor(
|
|
87
|
+
id: string,
|
|
88
|
+
label: string,
|
|
89
|
+
parentNode: ModelsDocumentationFilterTreeNodeData,
|
|
90
|
+
packagePath: string,
|
|
91
|
+
) {
|
|
92
|
+
super(id, label, parentNode);
|
|
93
|
+
this.packagePath = packagePath;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export class ModelsDocumentationFilterTreeElementNodeData extends ModelsDocumentationFilterTreeNodeData {
|
|
98
|
+
declare parentNode: ModelsDocumentationFilterTreeNodeData;
|
|
99
|
+
elementPath: string;
|
|
100
|
+
typePath: CORE_PURE_PATH | undefined;
|
|
101
|
+
|
|
102
|
+
constructor(
|
|
103
|
+
id: string,
|
|
104
|
+
label: string,
|
|
105
|
+
parentNode: ModelsDocumentationFilterTreeNodeData,
|
|
106
|
+
elementPath: string,
|
|
107
|
+
typePath: CORE_PURE_PATH | undefined,
|
|
108
|
+
) {
|
|
109
|
+
super(id, label, parentNode);
|
|
110
|
+
this.elementPath = elementPath;
|
|
111
|
+
this.typePath = typePath;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export class ModelsDocumentationFilterTreeTypeNodeData extends ModelsDocumentationFilterTreeNodeData {
|
|
116
|
+
declare parentNode: ModelsDocumentationFilterTreeNodeData;
|
|
117
|
+
typePath: CORE_PURE_PATH;
|
|
118
|
+
|
|
119
|
+
constructor(
|
|
120
|
+
id: string,
|
|
121
|
+
label: string,
|
|
122
|
+
parentNode: ModelsDocumentationFilterTreeNodeData,
|
|
123
|
+
typePath: CORE_PURE_PATH,
|
|
124
|
+
) {
|
|
125
|
+
super(id, label, parentNode);
|
|
126
|
+
this.typePath = typePath;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const trickleDownUncheckNodeChildren = (
|
|
131
|
+
node: ModelsDocumentationFilterTreeNodeData,
|
|
132
|
+
): void => {
|
|
133
|
+
node.setCheckType(ModelsDocumentationFilterTreeNodeCheckType.UNCHECKED);
|
|
134
|
+
node.childrenNodes.forEach((childNode) =>
|
|
135
|
+
trickleDownUncheckNodeChildren(childNode),
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const trickleUpUncheckNode = (
|
|
140
|
+
node: ModelsDocumentationFilterTreeNodeData,
|
|
141
|
+
): void => {
|
|
142
|
+
const parentNode = node.parentNode;
|
|
143
|
+
if (!parentNode) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (
|
|
147
|
+
parentNode.childrenNodes.some(
|
|
148
|
+
(childNode) =>
|
|
149
|
+
childNode.checkType ===
|
|
150
|
+
ModelsDocumentationFilterTreeNodeCheckType.CHECKED,
|
|
151
|
+
)
|
|
152
|
+
) {
|
|
153
|
+
parentNode.setCheckType(
|
|
154
|
+
ModelsDocumentationFilterTreeNodeCheckType.PARTIALLY_CHECKED,
|
|
155
|
+
);
|
|
156
|
+
} else {
|
|
157
|
+
parentNode.setCheckType(
|
|
158
|
+
ModelsDocumentationFilterTreeNodeCheckType.UNCHECKED,
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
trickleUpUncheckNode(parentNode);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export const uncheckFilterTreeNode = (
|
|
166
|
+
node: ModelsDocumentationFilterTreeNodeData,
|
|
167
|
+
): void => {
|
|
168
|
+
trickleDownUncheckNodeChildren(node);
|
|
169
|
+
trickleUpUncheckNode(node);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const trickleDownCheckNode = (
|
|
173
|
+
node: ModelsDocumentationFilterTreeNodeData,
|
|
174
|
+
): void => {
|
|
175
|
+
node.setCheckType(ModelsDocumentationFilterTreeNodeCheckType.CHECKED);
|
|
176
|
+
node.childrenNodes.forEach((childNode) => trickleDownCheckNode(childNode));
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const trickleUpCheckNode = (
|
|
180
|
+
node: ModelsDocumentationFilterTreeNodeData,
|
|
181
|
+
): void => {
|
|
182
|
+
const parentNode = node.parentNode;
|
|
183
|
+
if (!parentNode) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (
|
|
187
|
+
parentNode.childrenNodes.every(
|
|
188
|
+
(childNode) =>
|
|
189
|
+
childNode.checkType ===
|
|
190
|
+
ModelsDocumentationFilterTreeNodeCheckType.CHECKED,
|
|
191
|
+
)
|
|
192
|
+
) {
|
|
193
|
+
parentNode.setCheckType(ModelsDocumentationFilterTreeNodeCheckType.CHECKED);
|
|
194
|
+
} else {
|
|
195
|
+
parentNode.setCheckType(
|
|
196
|
+
ModelsDocumentationFilterTreeNodeCheckType.PARTIALLY_CHECKED,
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
trickleUpCheckNode(parentNode);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export const checkFilterTreeNode = (
|
|
204
|
+
node: ModelsDocumentationFilterTreeNodeData,
|
|
205
|
+
): void => {
|
|
206
|
+
trickleDownCheckNode(node);
|
|
207
|
+
trickleUpCheckNode(node);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export const uncheckAllFilterTree = (
|
|
211
|
+
treeData: TreeData<ModelsDocumentationFilterTreeNodeData>,
|
|
212
|
+
): void => {
|
|
213
|
+
treeData.nodes.forEach((node) =>
|
|
214
|
+
node.setCheckType(ModelsDocumentationFilterTreeNodeCheckType.UNCHECKED),
|
|
215
|
+
);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const buildTypeFilterTreeData =
|
|
219
|
+
(): TreeData<ModelsDocumentationFilterTreeNodeData> => {
|
|
220
|
+
const rootIds: string[] = [];
|
|
221
|
+
const nodes = new Map<string, ModelsDocumentationFilterTreeNodeData>();
|
|
222
|
+
|
|
223
|
+
// all node
|
|
224
|
+
const allNode = new ModelsDocumentationFilterTreeRootNodeData(
|
|
225
|
+
'all',
|
|
226
|
+
'All Types',
|
|
227
|
+
undefined,
|
|
228
|
+
);
|
|
229
|
+
rootIds.push(allNode.id);
|
|
230
|
+
allNode.setIsOpen(true); // open the root node by default
|
|
231
|
+
nodes.set(allNode.id, allNode);
|
|
232
|
+
|
|
233
|
+
// type nodes
|
|
234
|
+
const classNode = new ModelsDocumentationFilterTreeTypeNodeData(
|
|
235
|
+
'class',
|
|
236
|
+
'Class',
|
|
237
|
+
allNode,
|
|
238
|
+
CORE_PURE_PATH.CLASS,
|
|
239
|
+
);
|
|
240
|
+
allNode.childrenIds.push(classNode.id);
|
|
241
|
+
nodes.set(classNode.id, classNode);
|
|
242
|
+
|
|
243
|
+
const enumerationNode = new ModelsDocumentationFilterTreeTypeNodeData(
|
|
244
|
+
'enumeration',
|
|
245
|
+
'Enumeration',
|
|
246
|
+
allNode,
|
|
247
|
+
CORE_PURE_PATH.ENUMERATION,
|
|
248
|
+
);
|
|
249
|
+
allNode.childrenIds.push(enumerationNode.id);
|
|
250
|
+
nodes.set(enumerationNode.id, enumerationNode);
|
|
251
|
+
|
|
252
|
+
const associationNode = new ModelsDocumentationFilterTreeTypeNodeData(
|
|
253
|
+
'association',
|
|
254
|
+
'Association',
|
|
255
|
+
allNode,
|
|
256
|
+
CORE_PURE_PATH.ASSOCIATION,
|
|
257
|
+
);
|
|
258
|
+
allNode.childrenIds.push(associationNode.id);
|
|
259
|
+
nodes.set(associationNode.id, associationNode);
|
|
260
|
+
allNode.childrenNodes = [classNode, enumerationNode, associationNode];
|
|
261
|
+
|
|
262
|
+
return {
|
|
263
|
+
rootIds,
|
|
264
|
+
nodes,
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
const buildPackageFilterTreeData = (
|
|
269
|
+
modelDocEntries: DataSpaceModelDocumentationEntry[],
|
|
270
|
+
): TreeData<ModelsDocumentationFilterTreeNodeData> => {
|
|
271
|
+
const rootIds: string[] = [];
|
|
272
|
+
const nodes = new Map<string, ModelsDocumentationFilterTreeNodeData>();
|
|
273
|
+
|
|
274
|
+
// all node
|
|
275
|
+
const allNode = new ModelsDocumentationFilterTreeRootNodeData(
|
|
276
|
+
'all',
|
|
277
|
+
'All Packages',
|
|
278
|
+
undefined,
|
|
279
|
+
);
|
|
280
|
+
rootIds.push(allNode.id);
|
|
281
|
+
allNode.setIsOpen(true); // open the root node by default
|
|
282
|
+
nodes.set(allNode.id, allNode);
|
|
283
|
+
|
|
284
|
+
modelDocEntries.forEach((entry) => {
|
|
285
|
+
const path = entry.path;
|
|
286
|
+
const chunks = path.split(ELEMENT_PATH_DELIMITER);
|
|
287
|
+
let currentParentNode = allNode;
|
|
288
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
289
|
+
const chunk = guaranteeNonNullable(chunks[i]);
|
|
290
|
+
const elementPath = `${
|
|
291
|
+
currentParentNode === allNode
|
|
292
|
+
? ''
|
|
293
|
+
: `${currentParentNode.id}${ELEMENT_PATH_DELIMITER}`
|
|
294
|
+
}${chunk}`;
|
|
295
|
+
const nodeId = elementPath;
|
|
296
|
+
let node = nodes.get(nodeId);
|
|
297
|
+
if (!node) {
|
|
298
|
+
if (i === chunks.length - 1) {
|
|
299
|
+
node = new ModelsDocumentationFilterTreeElementNodeData(
|
|
300
|
+
nodeId,
|
|
301
|
+
chunk,
|
|
302
|
+
currentParentNode,
|
|
303
|
+
elementPath,
|
|
304
|
+
entry instanceof DataSpaceClassDocumentationEntry
|
|
305
|
+
? CORE_PURE_PATH.CLASS
|
|
306
|
+
: entry instanceof DataSpaceEnumerationDocumentationEntry
|
|
307
|
+
? CORE_PURE_PATH.ENUMERATION
|
|
308
|
+
: entry instanceof DataSpaceAssociationDocumentationEntry
|
|
309
|
+
? CORE_PURE_PATH.ASSOCIATION
|
|
310
|
+
: undefined,
|
|
311
|
+
);
|
|
312
|
+
} else {
|
|
313
|
+
node = new ModelsDocumentationFilterTreePackageNodeData(
|
|
314
|
+
nodeId,
|
|
315
|
+
chunk,
|
|
316
|
+
currentParentNode,
|
|
317
|
+
elementPath,
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
nodes.set(nodeId, node);
|
|
321
|
+
currentParentNode.childrenIds.push(nodeId);
|
|
322
|
+
currentParentNode.childrenNodes.push(node);
|
|
323
|
+
}
|
|
324
|
+
currentParentNode = node;
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
return {
|
|
329
|
+
rootIds,
|
|
330
|
+
nodes,
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
export class DataSpaceViewerModelsDocumentationState {
|
|
335
|
+
readonly dataSpaceViewerState: DataSpaceViewerState;
|
|
336
|
+
|
|
337
|
+
showHumanizedForm = true;
|
|
338
|
+
|
|
339
|
+
// search text
|
|
340
|
+
private readonly searchEngine: FuzzySearchEngine<NormalizedDataSpaceDocumentationEntry>;
|
|
341
|
+
searchConfigurationState: FuzzySearchAdvancedConfigState;
|
|
342
|
+
readonly searchState = ActionState.create();
|
|
343
|
+
searchText: string;
|
|
344
|
+
searchResults: NormalizedDataSpaceDocumentationEntry[] = [];
|
|
345
|
+
showSearchConfigurationMenu = false;
|
|
346
|
+
|
|
347
|
+
// filter
|
|
348
|
+
showFilterPanel = false;
|
|
349
|
+
typeFilterTreeData: TreeData<ModelsDocumentationFilterTreeNodeData>;
|
|
350
|
+
packageFilterTreeData: TreeData<ModelsDocumentationFilterTreeNodeData>;
|
|
351
|
+
filterTypes: string[] = [];
|
|
352
|
+
filterPaths: string[] = [];
|
|
353
|
+
|
|
354
|
+
constructor(dataSpaceViewerState: DataSpaceViewerState) {
|
|
355
|
+
makeObservable(this, {
|
|
356
|
+
showHumanizedForm: observable,
|
|
357
|
+
searchText: observable,
|
|
358
|
+
// NOTE: we use `observable.struct` for these to avoid unnecessary re-rendering of the grid
|
|
359
|
+
searchResults: observable.struct,
|
|
360
|
+
filterTypes: observable.struct,
|
|
361
|
+
filterPaths: observable.struct,
|
|
362
|
+
showSearchConfigurationMenu: observable,
|
|
363
|
+
showFilterPanel: observable,
|
|
364
|
+
typeFilterTreeData: observable.ref,
|
|
365
|
+
packageFilterTreeData: observable.ref,
|
|
366
|
+
filteredSearchResults: computed,
|
|
367
|
+
isTypeFilterCustomized: computed,
|
|
368
|
+
isPackageFilterCustomized: computed,
|
|
369
|
+
isFilterCustomized: computed,
|
|
370
|
+
setShowHumanizedForm: action,
|
|
371
|
+
setSearchText: action,
|
|
372
|
+
resetSearch: action,
|
|
373
|
+
search: action,
|
|
374
|
+
setShowSearchConfigurationMenu: action,
|
|
375
|
+
setShowFilterPanel: action,
|
|
376
|
+
resetTypeFilterTreeData: action,
|
|
377
|
+
resetPackageFilterTreeData: action,
|
|
378
|
+
updateTypeFilter: action,
|
|
379
|
+
updatePackageFilter: action,
|
|
380
|
+
resetTypeFilter: action,
|
|
381
|
+
resetPackageFilter: action,
|
|
382
|
+
resetAllFilters: action,
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
this.dataSpaceViewerState = dataSpaceViewerState;
|
|
386
|
+
this.searchEngine = new FuzzySearchEngine(
|
|
387
|
+
this.dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs,
|
|
388
|
+
{
|
|
389
|
+
includeScore: true,
|
|
390
|
+
// NOTE: we must not sort/change the order in the grid since
|
|
391
|
+
// we want to ensure the element row is on top
|
|
392
|
+
shouldSort: false,
|
|
393
|
+
// Ignore location when computing the search score
|
|
394
|
+
// See https://fusejs.io/concepts/scoring-theory.html
|
|
395
|
+
ignoreLocation: true,
|
|
396
|
+
// This specifies the point the search gives up
|
|
397
|
+
// `0.0` means exact match where `1.0` would match anything
|
|
398
|
+
// We set a relatively low threshold to filter out irrelevant results
|
|
399
|
+
threshold: 0.2,
|
|
400
|
+
keys: [
|
|
401
|
+
{
|
|
402
|
+
name: 'text',
|
|
403
|
+
weight: 3,
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
name: 'humanizedText',
|
|
407
|
+
weight: 3,
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
name: 'elementEntry.name',
|
|
411
|
+
weight: 3,
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
name: 'elementEntry.humanizedName',
|
|
415
|
+
weight: 3,
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
name: 'entry.name',
|
|
419
|
+
weight: 2,
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
name: 'entry.humanizedName',
|
|
423
|
+
weight: 2,
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
name: 'documentation',
|
|
427
|
+
weight: 4,
|
|
428
|
+
},
|
|
429
|
+
],
|
|
430
|
+
// extended search allows for exact word match through single quote
|
|
431
|
+
// See https://fusejs.io/examples.html#extended-search
|
|
432
|
+
useExtendedSearch: true,
|
|
433
|
+
},
|
|
434
|
+
);
|
|
435
|
+
this.searchConfigurationState = new FuzzySearchAdvancedConfigState(
|
|
436
|
+
(): void => this.search(),
|
|
437
|
+
);
|
|
438
|
+
this.searchText = '';
|
|
439
|
+
this.searchResults =
|
|
440
|
+
this.dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs;
|
|
441
|
+
|
|
442
|
+
this.typeFilterTreeData = buildTypeFilterTreeData();
|
|
443
|
+
this.packageFilterTreeData = buildPackageFilterTreeData(
|
|
444
|
+
this.dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs
|
|
445
|
+
.map((entry) => entry.entry)
|
|
446
|
+
.filter(filterByType(DataSpaceModelDocumentationEntry)),
|
|
447
|
+
);
|
|
448
|
+
this.updateTypeFilter();
|
|
449
|
+
this.updatePackageFilter();
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
get filteredSearchResults(): NormalizedDataSpaceDocumentationEntry[] {
|
|
453
|
+
return (
|
|
454
|
+
this.searchResults
|
|
455
|
+
// filter by types
|
|
456
|
+
.filter(
|
|
457
|
+
(result) =>
|
|
458
|
+
(this.filterTypes.includes(CORE_PURE_PATH.CLASS) &&
|
|
459
|
+
result.elementEntry instanceof
|
|
460
|
+
DataSpaceClassDocumentationEntry) ||
|
|
461
|
+
(this.filterTypes.includes(CORE_PURE_PATH.ENUMERATION) &&
|
|
462
|
+
result.elementEntry instanceof
|
|
463
|
+
DataSpaceEnumerationDocumentationEntry) ||
|
|
464
|
+
(this.filterTypes.includes(CORE_PURE_PATH.ASSOCIATION) &&
|
|
465
|
+
result.elementEntry instanceof
|
|
466
|
+
DataSpaceAssociationDocumentationEntry),
|
|
467
|
+
)
|
|
468
|
+
// filter by paths
|
|
469
|
+
.filter((result) => this.filterPaths.includes(result.elementEntry.path))
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
get isTypeFilterCustomized(): boolean {
|
|
474
|
+
return Array.from(this.typeFilterTreeData.nodes.values()).some(
|
|
475
|
+
(node) =>
|
|
476
|
+
node.checkType === ModelsDocumentationFilterTreeNodeCheckType.UNCHECKED,
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
get isPackageFilterCustomized(): boolean {
|
|
481
|
+
return Array.from(this.packageFilterTreeData.nodes.values()).some(
|
|
482
|
+
(node) =>
|
|
483
|
+
node.checkType === ModelsDocumentationFilterTreeNodeCheckType.UNCHECKED,
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
get isFilterCustomized(): boolean {
|
|
488
|
+
return this.isTypeFilterCustomized || this.isPackageFilterCustomized;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
setShowHumanizedForm(val: boolean): void {
|
|
492
|
+
this.showHumanizedForm = val;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
setSearchText(val: string): void {
|
|
496
|
+
this.searchText = val;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
resetSearch(): void {
|
|
500
|
+
this.searchText = '';
|
|
501
|
+
this.searchResults =
|
|
502
|
+
this.dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs;
|
|
503
|
+
this.searchState.complete();
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
search(): void {
|
|
507
|
+
if (!this.searchText) {
|
|
508
|
+
this.searchResults =
|
|
509
|
+
this.dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs;
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
this.searchState.inProgress();
|
|
513
|
+
this.searchResults = Array.from(
|
|
514
|
+
this.searchEngine
|
|
515
|
+
.search(
|
|
516
|
+
this.searchConfigurationState.generateSearchText(this.searchText),
|
|
517
|
+
)
|
|
518
|
+
.values(),
|
|
519
|
+
).map((result) => result.item);
|
|
520
|
+
|
|
521
|
+
this.searchState.complete();
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
setShowSearchConfigurationMenu(val: boolean): void {
|
|
525
|
+
this.showSearchConfigurationMenu = val;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
setShowFilterPanel(val: boolean): void {
|
|
529
|
+
this.showFilterPanel = val;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
resetTypeFilterTreeData(): void {
|
|
533
|
+
this.typeFilterTreeData = { ...this.typeFilterTreeData };
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
resetPackageFilterTreeData(): void {
|
|
537
|
+
this.packageFilterTreeData = { ...this.packageFilterTreeData };
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
updateTypeFilter(): void {
|
|
541
|
+
const types: string[] = [];
|
|
542
|
+
this.typeFilterTreeData.nodes.forEach((node) => {
|
|
543
|
+
if (
|
|
544
|
+
node instanceof ModelsDocumentationFilterTreeTypeNodeData &&
|
|
545
|
+
node.checkType === ModelsDocumentationFilterTreeNodeCheckType.CHECKED
|
|
546
|
+
) {
|
|
547
|
+
types.push(node.typePath);
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
// NOTE: sort to avoid unnecessary re-computation of filtered search results
|
|
551
|
+
this.filterTypes = types.sort((a, b) => a.localeCompare(b));
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
updatePackageFilter(): void {
|
|
555
|
+
const elementPaths: string[] = [];
|
|
556
|
+
this.packageFilterTreeData.nodes.forEach((node) => {
|
|
557
|
+
if (
|
|
558
|
+
node instanceof ModelsDocumentationFilterTreeElementNodeData &&
|
|
559
|
+
node.checkType === ModelsDocumentationFilterTreeNodeCheckType.CHECKED
|
|
560
|
+
) {
|
|
561
|
+
elementPaths.push(node.elementPath);
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
// NOTE: sort to avoid unnecessary re-computation of filtered search results
|
|
565
|
+
this.filterPaths = elementPaths.sort((a, b) => a.localeCompare(b));
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
resetTypeFilter(): void {
|
|
569
|
+
this.typeFilterTreeData.nodes.forEach((node) =>
|
|
570
|
+
node.setCheckType(ModelsDocumentationFilterTreeNodeCheckType.CHECKED),
|
|
571
|
+
);
|
|
572
|
+
this.updateTypeFilter();
|
|
573
|
+
this.resetTypeFilterTreeData();
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
resetPackageFilter(): void {
|
|
577
|
+
this.packageFilterTreeData.nodes.forEach((node) =>
|
|
578
|
+
node.setCheckType(ModelsDocumentationFilterTreeNodeCheckType.CHECKED),
|
|
579
|
+
);
|
|
580
|
+
this.updatePackageFilter();
|
|
581
|
+
this.resetPackageFilterTreeData();
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
resetAllFilters(): void {
|
|
585
|
+
this.resetTypeFilter();
|
|
586
|
+
this.resetPackageFilter();
|
|
587
|
+
}
|
|
588
|
+
}
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
PURE_DATA_SPACE_INFO_PROFILE_VERIFIED_STEREOTYPE,
|
|
44
44
|
} from '../graphManager/DSL_DataSpace_PureGraphManagerPlugin.js';
|
|
45
45
|
import { DataSpaceViewerDataAccessState } from './DataSpaceViewerDataAccessState.js';
|
|
46
|
+
import { DataSpaceViewerModelsDocumentationState } from './DataSpaceModelsDocumentationState.js';
|
|
46
47
|
|
|
47
48
|
export enum DATA_SPACE_VIEWER_ACTIVITY_MODE {
|
|
48
49
|
DESCRIPTION = 'description',
|
|
@@ -107,6 +108,7 @@ export class DataSpaceViewerState {
|
|
|
107
108
|
| undefined;
|
|
108
109
|
|
|
109
110
|
readonly dataAccessState: DataSpaceViewerDataAccessState;
|
|
111
|
+
readonly modelsDocumentationState: DataSpaceViewerModelsDocumentationState;
|
|
110
112
|
|
|
111
113
|
_renderer?: DiagramRenderer | undefined;
|
|
112
114
|
currentDiagram?: DataSpaceDiagramAnalysisResult | undefined;
|
|
@@ -114,6 +116,8 @@ export class DataSpaceViewerState {
|
|
|
114
116
|
currentExecutionContext: DataSpaceExecutionContextAnalysisResult;
|
|
115
117
|
currentRuntime: PackageableRuntime;
|
|
116
118
|
|
|
119
|
+
TEMPORARY__enableExperimentalFeatures = false;
|
|
120
|
+
|
|
117
121
|
constructor(
|
|
118
122
|
applicationStore: GenericLegendApplicationStore,
|
|
119
123
|
graphManagerState: BasicGraphManagerState,
|
|
@@ -137,6 +141,9 @@ export class DataSpaceViewerState {
|
|
|
137
141
|
onDiagramClassDoubleClick: (classView: ClassView) => void;
|
|
138
142
|
onZoneChange?: ((zone: NavigationZone | undefined) => void) | undefined;
|
|
139
143
|
},
|
|
144
|
+
options?: {
|
|
145
|
+
TEMPORARY__enableExperimentalFeatures?: boolean | undefined;
|
|
146
|
+
},
|
|
140
147
|
) {
|
|
141
148
|
makeObservable(this, {
|
|
142
149
|
_renderer: observable,
|
|
@@ -174,6 +181,13 @@ export class DataSpaceViewerState {
|
|
|
174
181
|
this.onZoneChange = actions.onZoneChange;
|
|
175
182
|
|
|
176
183
|
this.dataAccessState = new DataSpaceViewerDataAccessState(this);
|
|
184
|
+
this.modelsDocumentationState = new DataSpaceViewerModelsDocumentationState(
|
|
185
|
+
this,
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
this.TEMPORARY__enableExperimentalFeatures = Boolean(
|
|
189
|
+
options?.TEMPORARY__enableExperimentalFeatures,
|
|
190
|
+
);
|
|
177
191
|
}
|
|
178
192
|
|
|
179
193
|
get diagramRenderer(): DiagramRenderer {
|
package/tsconfig.json
CHANGED
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"./src/graphManager/DSL_DataSpace_PureGraphManagerPlugin.ts",
|
|
47
47
|
"./src/graphManager/action/analytics/DataSpaceAnalysis.ts",
|
|
48
48
|
"./src/graphManager/action/analytics/DataSpaceAnalysisHelper.ts",
|
|
49
|
-
"./src/graphManager/action/analytics/HACKY__DataSpaceUsageShowcase.ts",
|
|
50
49
|
"./src/graphManager/action/changeDetection/DSL_DataSpace_ObserverHelper.ts",
|
|
51
50
|
"./src/graphManager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.ts",
|
|
52
51
|
"./src/graphManager/protocol/pure/DSL_DataSpace_PureGraphManagerExtensionBuilder.ts",
|
|
@@ -57,6 +56,7 @@
|
|
|
57
56
|
"./src/graphManager/protocol/pure/v1/transformation/pureGraph/V1_DSL_DataSpace_GraphBuilderHelper.ts",
|
|
58
57
|
"./src/graphManager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.ts",
|
|
59
58
|
"./src/stores/DSL_DataSpace_LegendApplicationPlugin_Extension.ts",
|
|
59
|
+
"./src/stores/DataSpaceModelsDocumentationState.ts",
|
|
60
60
|
"./src/stores/DataSpaceViewerDataAccessState.ts",
|
|
61
61
|
"./src/stores/DataSpaceViewerState.ts",
|
|
62
62
|
"./src/stores/query/DataSpaceAdvancedSearchState.ts",
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
export declare abstract class HACKY__DataSpaceUsageShowcaseSampleOutput {
|
|
17
|
-
}
|
|
18
|
-
export declare abstract class HACKY__DataSpaceUsageShowcaseOutputDescription {
|
|
19
|
-
readonly sampleOutput: HACKY__DataSpaceUsageShowcaseSampleOutput;
|
|
20
|
-
constructor(sampleOutput: HACKY__DataSpaceUsageShowcaseSampleOutput);
|
|
21
|
-
}
|
|
22
|
-
type SampleData = boolean | string | number | undefined;
|
|
23
|
-
export declare class HACKY__DataSpaceUsageShowcaseTDSSampleOutput extends HACKY__DataSpaceUsageShowcaseSampleOutput {
|
|
24
|
-
readonly headers: string[];
|
|
25
|
-
readonly rows: SampleData[][];
|
|
26
|
-
constructor(headers: string[], rows: SampleData[][]);
|
|
27
|
-
}
|
|
28
|
-
declare class HACKY__DataSpaceUsageShowcaseTDSColumnInfo {
|
|
29
|
-
readonly uuid: string;
|
|
30
|
-
readonly name: string;
|
|
31
|
-
readonly description?: string | undefined;
|
|
32
|
-
readonly sampleValues: SampleData[];
|
|
33
|
-
constructor(name: string, description: string | undefined, sampleValues: SampleData[]);
|
|
34
|
-
}
|
|
35
|
-
export declare class HACKY__DataSpaceUsageShowcaseTDSOutputDescription extends HACKY__DataSpaceUsageShowcaseOutputDescription {
|
|
36
|
-
readonly columns: HACKY__DataSpaceUsageShowcaseTDSColumnInfo[];
|
|
37
|
-
constructor(columns: HACKY__DataSpaceUsageShowcaseTDSColumnInfo[]);
|
|
38
|
-
}
|
|
39
|
-
export declare class HACKY__DataSpaceUsageShowcase {
|
|
40
|
-
readonly uuid: string;
|
|
41
|
-
readonly title: string;
|
|
42
|
-
readonly description?: string | undefined;
|
|
43
|
-
readonly query: string;
|
|
44
|
-
readonly outputDescription: HACKY__DataSpaceUsageShowcaseOutputDescription;
|
|
45
|
-
showQuery: boolean;
|
|
46
|
-
showOutputDescription: boolean;
|
|
47
|
-
showSampleOutput: boolean;
|
|
48
|
-
constructor(title: string, description: string | undefined, query: string, outputDescription: HACKY__DataSpaceUsageShowcaseOutputDescription);
|
|
49
|
-
setShowQuery(val: boolean): void;
|
|
50
|
-
setShowOutputDescription(val: boolean): void;
|
|
51
|
-
setShowSampleOutput(val: boolean): void;
|
|
52
|
-
}
|
|
53
|
-
export declare const HACKY__SHOWCASE1: HACKY__DataSpaceUsageShowcase;
|
|
54
|
-
export declare const HACKY__SHOWCASE2: HACKY__DataSpaceUsageShowcase;
|
|
55
|
-
export declare const HACKY__SHOWCASE3: HACKY__DataSpaceUsageShowcase;
|
|
56
|
-
export {};
|
|
57
|
-
//# sourceMappingURL=HACKY__DataSpaceUsageShowcase.d.ts.map
|