@finos/legend-extension-dsl-data-space 10.0.11 → 10.0.13
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/__lib__/DSL_DataSpace_LegendApplicationCommand.d.ts +28 -0
- package/lib/__lib__/DSL_DataSpace_LegendApplicationCommand.d.ts.map +1 -0
- package/lib/__lib__/DSL_DataSpace_LegendApplicationCommand.js +70 -0
- package/lib/__lib__/DSL_DataSpace_LegendApplicationCommand.js.map +1 -0
- package/lib/__lib__/DSL_DataSpace_LegendApplicationNavigation.d.ts +20 -0
- package/lib/__lib__/DSL_DataSpace_LegendApplicationNavigation.d.ts.map +1 -0
- package/lib/__lib__/DSL_DataSpace_LegendApplicationNavigation.js +21 -0
- package/lib/__lib__/DSL_DataSpace_LegendApplicationNavigation.js.map +1 -0
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts +3 -1
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts.map +1 -1
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js +13 -1
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js.map +1 -1
- package/lib/components/DataSpaceDataAccess.d.ts.map +1 -1
- package/lib/components/DataSpaceDataAccess.js +5 -76
- package/lib/components/DataSpaceDataAccess.js.map +1 -1
- package/lib/components/DataSpaceDescription.d.ts.map +1 -1
- package/lib/components/DataSpaceDescription.js +2 -1
- package/lib/components/DataSpaceDescription.js.map +1 -1
- package/lib/components/DataSpaceDiagramViewer.d.ts.map +1 -1
- package/lib/components/DataSpaceDiagramViewer.js +110 -39
- package/lib/components/DataSpaceDiagramViewer.js.map +1 -1
- package/lib/components/DataSpaceExecutionContextViewer.d.ts.map +1 -1
- package/lib/components/DataSpaceExecutionContextViewer.js +3 -3
- package/lib/components/DataSpaceExecutionContextViewer.js.map +1 -1
- package/lib/components/DataSpaceInfoPanel.d.ts.map +1 -1
- package/lib/components/DataSpaceInfoPanel.js +6 -6
- package/lib/components/DataSpaceInfoPanel.js.map +1 -1
- package/lib/components/DataSpaceModelsDocumentation.d.ts.map +1 -1
- package/lib/components/DataSpaceModelsDocumentation.js +18 -8
- package/lib/components/DataSpaceModelsDocumentation.js.map +1 -1
- package/lib/components/DataSpacePlaceholder.d.ts +4 -0
- package/lib/components/DataSpacePlaceholder.d.ts.map +1 -1
- package/lib/components/DataSpacePlaceholder.js +6 -1
- package/lib/components/DataSpacePlaceholder.js.map +1 -1
- package/lib/components/DataSpaceQuickStart.d.ts.map +1 -1
- package/lib/components/DataSpaceQuickStart.js +24 -11
- package/lib/components/DataSpaceQuickStart.js.map +1 -1
- package/lib/components/DataSpaceSupportPanel.d.ts.map +1 -1
- package/lib/components/DataSpaceSupportPanel.js +17 -8
- package/lib/components/DataSpaceSupportPanel.js.map +1 -1
- package/lib/components/DataSpaceViewer.d.ts.map +1 -1
- package/lib/components/DataSpaceViewer.js +34 -13
- package/lib/components/DataSpaceViewer.js.map +1 -1
- package/lib/components/DataSpaceViewerActivityBar.d.ts.map +1 -1
- package/lib/components/DataSpaceViewerActivityBar.js +15 -12
- package/lib/components/DataSpaceViewerActivityBar.js.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +1 -0
- package/lib/components/index.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +2 -2
- package/lib/stores/DataSpaceLayoutState.d.ts +46 -0
- package/lib/stores/DataSpaceLayoutState.d.ts.map +1 -1
- package/lib/stores/DataSpaceLayoutState.js +184 -1
- package/lib/stores/DataSpaceLayoutState.js.map +1 -1
- package/lib/stores/DataSpaceModelsDocumentationState.d.ts +11 -2
- package/lib/stores/DataSpaceModelsDocumentationState.d.ts.map +1 -1
- package/lib/stores/DataSpaceModelsDocumentationState.js +41 -0
- package/lib/stores/DataSpaceModelsDocumentationState.js.map +1 -1
- package/lib/stores/DataSpaceQuickStartState.d.ts +24 -0
- package/lib/stores/DataSpaceQuickStartState.d.ts.map +1 -0
- package/lib/stores/DataSpaceQuickStartState.js +48 -0
- package/lib/stores/DataSpaceQuickStartState.js.map +1 -0
- package/lib/stores/DataSpaceViewerDiagramViewerState.d.ts +44 -0
- package/lib/stores/DataSpaceViewerDiagramViewerState.d.ts.map +1 -0
- package/lib/stores/DataSpaceViewerDiagramViewerState.js +194 -0
- package/lib/stores/DataSpaceViewerDiagramViewerState.js.map +1 -0
- package/lib/stores/DataSpaceViewerNavigation.d.ts +36 -0
- package/lib/stores/DataSpaceViewerNavigation.d.ts.map +1 -0
- package/lib/stores/DataSpaceViewerNavigation.js +47 -0
- package/lib/stores/DataSpaceViewerNavigation.js.map +1 -0
- package/lib/stores/DataSpaceViewerState.d.ts +22 -74
- package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
- package/lib/stores/DataSpaceViewerState.js +34 -259
- package/lib/stores/DataSpaceViewerState.js.map +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.js +8 -5
- package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -1
- package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts +8 -8
- package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/query/DataSpaceQueryCreatorStore.js +1 -1
- package/lib/stores/query/DataSpaceQueryCreatorStore.js.map +1 -1
- package/lib/stores/query/DataSpaceQuerySetupStore.d.ts +1 -1
- package/lib/stores/query/DataSpaceQuerySetupStore.d.ts.map +1 -1
- package/lib/stores/query/DataSpaceQuerySetupStore.js +1 -1
- package/lib/stores/query/DataSpaceQuerySetupStore.js.map +1 -1
- package/lib/stores/studio/DataSpacePreviewState.d.ts.map +1 -1
- package/lib/stores/studio/DataSpacePreviewState.js +15 -3
- package/lib/stores/studio/DataSpacePreviewState.js.map +1 -1
- package/package.json +14 -14
- package/src/__lib__/DSL_DataSpace_LegendApplicationCommand.ts +74 -0
- package/src/__lib__/DSL_DataSpace_LegendApplicationNavigation.ts +33 -0
- package/src/components/DSL_DataSpace_LegendApplicationPlugin.tsx +20 -1
- package/src/components/DataSpaceDataAccess.tsx +9 -122
- package/src/components/DataSpaceDescription.tsx +5 -5
- package/src/components/DataSpaceDiagramViewer.tsx +449 -69
- package/src/components/DataSpaceExecutionContextViewer.tsx +47 -40
- package/src/components/DataSpaceInfoPanel.tsx +107 -117
- package/src/components/DataSpaceModelsDocumentation.tsx +31 -12
- package/src/components/DataSpacePlaceholder.tsx +22 -0
- package/src/components/DataSpaceQuickStart.tsx +95 -15
- package/src/components/DataSpaceSupportPanel.tsx +146 -14
- package/src/components/DataSpaceViewer.tsx +153 -23
- package/src/components/DataSpaceViewerActivityBar.tsx +40 -20
- package/src/components/index.ts +1 -0
- package/src/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.ts +1 -1
- package/src/stores/DataSpaceLayoutState.ts +272 -0
- package/src/stores/DataSpaceModelsDocumentationState.ts +61 -2
- package/src/stores/DataSpaceQuickStartState.ts +91 -0
- package/src/stores/DataSpaceViewerDiagramViewerState.ts +245 -0
- package/src/stores/DataSpaceViewerNavigation.ts +64 -0
- package/src/stores/DataSpaceViewerState.ts +88 -401
- package/src/stores/query/DataSpaceAdvancedSearchState.ts +30 -6
- package/src/stores/query/DataSpaceQueryCreatorStore.ts +8 -8
- package/src/stores/query/DataSpaceQuerySetupStore.ts +1 -1
- package/src/stores/studio/DataSpacePreviewState.ts +27 -5
- package/tsconfig.json +5 -1
- package/lib/stores/DataSpaceViewerDataAccessState.d.ts +0 -35
- package/lib/stores/DataSpaceViewerDataAccessState.d.ts.map +0 -1
- package/lib/stores/DataSpaceViewerDataAccessState.js +0 -98
- package/lib/stores/DataSpaceViewerDataAccessState.js.map +0 -1
- package/src/stores/DataSpaceViewerDataAccessState.ts +0 -143
|
@@ -34,12 +34,14 @@ import {
|
|
|
34
34
|
MenuIcon,
|
|
35
35
|
DropdownMenu,
|
|
36
36
|
DataReadyIcon,
|
|
37
|
+
SparkleIcon,
|
|
37
38
|
} from '@finos/legend-art';
|
|
39
|
+
import { type DataSpaceViewerState } from '../stores/DataSpaceViewerState.js';
|
|
40
|
+
import { type ActivityBarItemConfig } from '@finos/legend-lego/application';
|
|
38
41
|
import {
|
|
39
|
-
type DataSpaceViewerState,
|
|
40
42
|
DATA_SPACE_VIEWER_ACTIVITY_MODE,
|
|
41
43
|
generateAnchorForActivity,
|
|
42
|
-
} from '../stores/
|
|
44
|
+
} from '../stores/DataSpaceViewerNavigation.js';
|
|
43
45
|
|
|
44
46
|
const ActivityBarMenu = observer(
|
|
45
47
|
(props: { dataSpaceViewerState: DataSpaceViewerState }) => {
|
|
@@ -78,17 +80,20 @@ const ActivityBarMenu = observer(
|
|
|
78
80
|
},
|
|
79
81
|
);
|
|
80
82
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
const DataSpaceViewerActivityBarItemExperimentalBadge: React.FC = () => (
|
|
84
|
+
<div
|
|
85
|
+
className="data-space__viewer__activity-bar__item__experimental-badge"
|
|
86
|
+
title="This is work in progess"
|
|
87
|
+
>
|
|
88
|
+
<SparkleIcon />
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
86
91
|
|
|
87
92
|
export const DataSpaceViewerActivityBar = observer(
|
|
88
93
|
(props: { dataSpaceViewerState: DataSpaceViewerState }) => {
|
|
89
94
|
const { dataSpaceViewerState } = props;
|
|
90
95
|
const changeActivity =
|
|
91
|
-
(activity:
|
|
96
|
+
(activity: string): (() => void) =>
|
|
92
97
|
(): void => {
|
|
93
98
|
dataSpaceViewerState.changeZone(
|
|
94
99
|
generateAnchorForActivity(activity),
|
|
@@ -96,7 +101,7 @@ export const DataSpaceViewerActivityBar = observer(
|
|
|
96
101
|
);
|
|
97
102
|
};
|
|
98
103
|
|
|
99
|
-
const wikiActivities:
|
|
104
|
+
const wikiActivities: ActivityBarItemConfig[] = [
|
|
100
105
|
{
|
|
101
106
|
mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.DESCRIPTION,
|
|
102
107
|
title: 'Description',
|
|
@@ -130,7 +135,7 @@ export const DataSpaceViewerActivityBar = observer(
|
|
|
130
135
|
},
|
|
131
136
|
];
|
|
132
137
|
|
|
133
|
-
const activities:
|
|
138
|
+
const activities: ActivityBarItemConfig[] = [
|
|
134
139
|
{
|
|
135
140
|
mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.EXECUTION_CONTEXT,
|
|
136
141
|
title: 'Execution Context',
|
|
@@ -138,37 +143,52 @@ export const DataSpaceViewerActivityBar = observer(
|
|
|
138
143
|
},
|
|
139
144
|
{
|
|
140
145
|
mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_STORES,
|
|
141
|
-
title: 'Data Stores',
|
|
146
|
+
title: 'Data Stores (Work In Progress)',
|
|
142
147
|
icon: (
|
|
143
|
-
|
|
148
|
+
<>
|
|
149
|
+
<DatasetIcon className="data-space__viewer__activity-bar__icon--dataset" />
|
|
150
|
+
<DataSpaceViewerActivityBarItemExperimentalBadge />
|
|
151
|
+
</>
|
|
144
152
|
),
|
|
145
153
|
},
|
|
146
154
|
{
|
|
147
155
|
mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_AVAILABILITY,
|
|
148
|
-
title: 'Data Availability',
|
|
156
|
+
title: 'Data Availability (Work In Progress)',
|
|
149
157
|
icon: (
|
|
150
|
-
|
|
158
|
+
<>
|
|
159
|
+
<AvailabilityIcon className="data-space__viewer__activity-bar__icon--availability" />
|
|
160
|
+
<DataSpaceViewerActivityBarItemExperimentalBadge />
|
|
161
|
+
</>
|
|
151
162
|
),
|
|
152
163
|
},
|
|
153
164
|
{
|
|
154
165
|
mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_READINESS,
|
|
155
|
-
title: 'Data Readiness',
|
|
166
|
+
title: 'Data Readiness (Work In Progress)',
|
|
156
167
|
icon: (
|
|
157
|
-
|
|
168
|
+
<>
|
|
169
|
+
<DataReadyIcon className="data-space__viewer__activity-bar__icon--readiness" />
|
|
170
|
+
<DataSpaceViewerActivityBarItemExperimentalBadge />
|
|
171
|
+
</>
|
|
158
172
|
),
|
|
159
173
|
},
|
|
160
174
|
{
|
|
161
175
|
mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_COST,
|
|
162
|
-
title: 'Data Cost',
|
|
176
|
+
title: 'Data Cost (Work In Progress)',
|
|
163
177
|
icon: (
|
|
164
|
-
|
|
178
|
+
<>
|
|
179
|
+
<CostCircleIcon className="data-space__viewer__activity-bar__icon--cost" />
|
|
180
|
+
<DataSpaceViewerActivityBarItemExperimentalBadge />
|
|
181
|
+
</>
|
|
165
182
|
),
|
|
166
183
|
},
|
|
167
184
|
{
|
|
168
185
|
mode: DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_GOVERNANCE,
|
|
169
|
-
title: 'Governance',
|
|
186
|
+
title: 'Data Governance (Work In Progress)',
|
|
170
187
|
icon: (
|
|
171
|
-
|
|
188
|
+
<>
|
|
189
|
+
<GovernanceIcon className="data-space__viewer__activity-bar__icon--governance" />
|
|
190
|
+
<DataSpaceViewerActivityBarItemExperimentalBadge />
|
|
191
|
+
</>
|
|
172
192
|
),
|
|
173
193
|
},
|
|
174
194
|
{
|
package/src/components/index.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
export * from '../__lib__/DSL_DataSpace_LegendApplicationNavigation.js';
|
|
17
18
|
export { DSL_DataSpace_LegendApplicationPlugin } from './DSL_DataSpace_LegendApplicationPlugin.js';
|
|
18
19
|
export { DataSpaceViewer } from './DataSpaceViewer.js';
|
|
19
20
|
export * from '../stores/DSL_DataSpace_LegendApplicationPlugin_Extension.js';
|
|
@@ -164,7 +164,7 @@ export class V1_DSL_DataSpace_PureGraphManagerExtension extends DSL_DataSpace_Pu
|
|
|
164
164
|
result.taggedValues = analysisResult.taggedValues.map((taggedValue) => {
|
|
165
165
|
const info = new DataSpaceTaggedValueInfo();
|
|
166
166
|
info.profile = taggedValue.profile;
|
|
167
|
-
info.tag = taggedValue.
|
|
167
|
+
info.tag = taggedValue.tag;
|
|
168
168
|
info.value = taggedValue.value;
|
|
169
169
|
return info;
|
|
170
170
|
});
|
|
@@ -0,0 +1,272 @@
|
|
|
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 { NAVIGATION_ZONE_SEPARATOR } from '@finos/legend-application';
|
|
18
|
+
import { action, computed, makeObservable, observable } from 'mobx';
|
|
19
|
+
import { type DataSpaceViewerState } from './DataSpaceViewerState.js';
|
|
20
|
+
import {
|
|
21
|
+
getNonNullableEntry,
|
|
22
|
+
getNullableFirstEntry,
|
|
23
|
+
guaranteeNonNullable,
|
|
24
|
+
isNonNullable,
|
|
25
|
+
} from '@finos/legend-shared';
|
|
26
|
+
import {
|
|
27
|
+
DATA_SPACE_VIEWER_ACTIVITY_MODE,
|
|
28
|
+
extractActivityFromAnchor,
|
|
29
|
+
generateAnchorForActivity,
|
|
30
|
+
generateAnchorForDiagram,
|
|
31
|
+
} from './DataSpaceViewerNavigation.js';
|
|
32
|
+
|
|
33
|
+
export const DATA_SPACE_WIKI_PAGE_SECTIONS = [
|
|
34
|
+
DATA_SPACE_VIEWER_ACTIVITY_MODE.DESCRIPTION,
|
|
35
|
+
DATA_SPACE_VIEWER_ACTIVITY_MODE.DIAGRAM_VIEWER,
|
|
36
|
+
DATA_SPACE_VIEWER_ACTIVITY_MODE.MODELS_DOCUMENTATION,
|
|
37
|
+
DATA_SPACE_VIEWER_ACTIVITY_MODE.QUICK_START,
|
|
38
|
+
DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_ACCESS,
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
const DATA_SPACE_WIKI_PAGE_ANCHORS = DATA_SPACE_WIKI_PAGE_SECTIONS.map(
|
|
42
|
+
(activity) => generateAnchorForActivity(activity),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
type DataSpacePageNavigationCommand = {
|
|
46
|
+
anchor: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export class DataSpaceLayoutState {
|
|
50
|
+
readonly dataSpaceViewerState: DataSpaceViewerState;
|
|
51
|
+
|
|
52
|
+
currentNavigationZone = '';
|
|
53
|
+
isExpandedModeEnabled = false;
|
|
54
|
+
|
|
55
|
+
frame?: HTMLElement | undefined;
|
|
56
|
+
header?: HTMLElement | undefined;
|
|
57
|
+
isTopScrollerVisible = false;
|
|
58
|
+
|
|
59
|
+
private wikiPageAnchorIndex = new Map<string, HTMLElement>();
|
|
60
|
+
wikiPageNavigationCommand?: DataSpacePageNavigationCommand | undefined;
|
|
61
|
+
private wikiPageVisibleAnchors: string[] = [];
|
|
62
|
+
private wikiPageScrollIntersectionObserver?: IntersectionObserver | undefined;
|
|
63
|
+
|
|
64
|
+
constructor(dataSpaceViewerState: DataSpaceViewerState) {
|
|
65
|
+
makeObservable<
|
|
66
|
+
DataSpaceLayoutState,
|
|
67
|
+
| 'wikiPageAnchorIndex'
|
|
68
|
+
| 'wikiPageVisibleAnchors'
|
|
69
|
+
| 'updatePageVisibleAnchors'
|
|
70
|
+
>(this, {
|
|
71
|
+
currentNavigationZone: observable,
|
|
72
|
+
isExpandedModeEnabled: observable,
|
|
73
|
+
isTopScrollerVisible: observable,
|
|
74
|
+
wikiPageAnchorIndex: observable,
|
|
75
|
+
wikiPageVisibleAnchors: observable,
|
|
76
|
+
frame: observable.ref,
|
|
77
|
+
wikiPageNavigationCommand: observable.ref,
|
|
78
|
+
isWikiPageFullyRendered: computed,
|
|
79
|
+
registerWikiPageScrollObserver: action,
|
|
80
|
+
setCurrentNavigationZone: action,
|
|
81
|
+
enableExpandedMode: action,
|
|
82
|
+
setFrame: action,
|
|
83
|
+
setTopScrollerVisible: action,
|
|
84
|
+
setWikiPageAnchor: action,
|
|
85
|
+
unsetWikiPageAnchor: action,
|
|
86
|
+
setWikiPageAnchorToNavigate: action,
|
|
87
|
+
updatePageVisibleAnchors: action,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
this.dataSpaceViewerState = dataSpaceViewerState;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
setCurrentNavigationZone(val: string): void {
|
|
94
|
+
this.currentNavigationZone = val;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
get isWikiPageFullyRendered(): boolean {
|
|
98
|
+
return (
|
|
99
|
+
Boolean(this.frame) &&
|
|
100
|
+
DATA_SPACE_WIKI_PAGE_SECTIONS.includes(
|
|
101
|
+
this.dataSpaceViewerState.currentActivity,
|
|
102
|
+
) &&
|
|
103
|
+
DATA_SPACE_WIKI_PAGE_ANCHORS.every((anchor) =>
|
|
104
|
+
this.wikiPageAnchorIndex.has(anchor),
|
|
105
|
+
) &&
|
|
106
|
+
Array.from(this.wikiPageAnchorIndex.values()).every(isNonNullable)
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
registerWikiPageScrollObserver(): void {
|
|
111
|
+
if (this.frame && this.isWikiPageFullyRendered) {
|
|
112
|
+
const wikiPageIntersectionObserver = new IntersectionObserver(
|
|
113
|
+
(entries, observer) => {
|
|
114
|
+
const anchorsWithVisibilityChanged = entries
|
|
115
|
+
.map((entry) => {
|
|
116
|
+
for (const [key, element] of this.wikiPageAnchorIndex.entries()) {
|
|
117
|
+
if (element === entry.target) {
|
|
118
|
+
return { key, isIntersecting: entry.isIntersecting };
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
})
|
|
123
|
+
.filter(isNonNullable);
|
|
124
|
+
anchorsWithVisibilityChanged.forEach((entry) => {
|
|
125
|
+
this.updatePageVisibleAnchors(entry.key, entry.isIntersecting);
|
|
126
|
+
});
|
|
127
|
+
// NOTE: sync scroll with menu/address is quite a delicate piece of work
|
|
128
|
+
// as it interferes with programatic scroll operations we do elsewhere.
|
|
129
|
+
// This is particularly bad when we do a programatic `smooth` scroll, which
|
|
130
|
+
// mimic user scrolling behavior and would tangle up with this observer
|
|
131
|
+
// Since currently, there's no good mechanism to detect scroll end event, and as such,
|
|
132
|
+
// there is no good way to temporarily disable this logic while doing the programmatic
|
|
133
|
+
// smooth scroll as such, we avoid supporting programatic smooth scrolling for now
|
|
134
|
+
// See https://github.com/w3c/csswg-drafts/issues/3744
|
|
135
|
+
// See https://developer.mozilla.org/en-US/docs/Web/API/Document/scrollend_event
|
|
136
|
+
if (
|
|
137
|
+
// if current navigation zone is not set, do not update zone
|
|
138
|
+
this.currentNavigationZone === '' ||
|
|
139
|
+
// if there is no visible anchors, do not update zone
|
|
140
|
+
!this.wikiPageVisibleAnchors.length ||
|
|
141
|
+
// if some of the current visible anchors match or is parent section of the current
|
|
142
|
+
// navigation zone, do not update zone
|
|
143
|
+
this.wikiPageVisibleAnchors.some(
|
|
144
|
+
(visibleAnchor) =>
|
|
145
|
+
this.currentNavigationZone === visibleAnchor ||
|
|
146
|
+
this.currentNavigationZone.startsWith(
|
|
147
|
+
`${visibleAnchor}${NAVIGATION_ZONE_SEPARATOR}`,
|
|
148
|
+
),
|
|
149
|
+
)
|
|
150
|
+
) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const anchor = getNonNullableEntry(this.wikiPageVisibleAnchors, 0);
|
|
154
|
+
this.dataSpaceViewerState.syncZoneWithNavigation(anchor);
|
|
155
|
+
const anchorChunks = anchor.split(NAVIGATION_ZONE_SEPARATOR);
|
|
156
|
+
const activity = getNullableFirstEntry(anchorChunks);
|
|
157
|
+
if (activity) {
|
|
158
|
+
this.dataSpaceViewerState.setCurrentActivity(
|
|
159
|
+
extractActivityFromAnchor(
|
|
160
|
+
activity,
|
|
161
|
+
) as DATA_SPACE_VIEWER_ACTIVITY_MODE,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
root: this.frame,
|
|
167
|
+
threshold: 0.5,
|
|
168
|
+
},
|
|
169
|
+
);
|
|
170
|
+
Array.from(this.wikiPageAnchorIndex.values()).forEach((el) =>
|
|
171
|
+
wikiPageIntersectionObserver.observe(el),
|
|
172
|
+
);
|
|
173
|
+
this.wikiPageScrollIntersectionObserver = wikiPageIntersectionObserver;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
unregisterWikiPageScrollObserver(): void {
|
|
178
|
+
this.wikiPageScrollIntersectionObserver?.disconnect();
|
|
179
|
+
this.wikiPageScrollIntersectionObserver = undefined;
|
|
180
|
+
this.wikiPageVisibleAnchors = [];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
private updatePageVisibleAnchors(
|
|
184
|
+
changedAnchor: string,
|
|
185
|
+
isIntersecting: boolean,
|
|
186
|
+
): void {
|
|
187
|
+
if (isIntersecting) {
|
|
188
|
+
const anchors = this.wikiPageVisibleAnchors.filter(
|
|
189
|
+
(anchor) => changedAnchor !== anchor,
|
|
190
|
+
);
|
|
191
|
+
// NOTE: the newly visible anchors should be the furthest one in
|
|
192
|
+
// the direction of scroll
|
|
193
|
+
anchors.push(changedAnchor);
|
|
194
|
+
this.wikiPageVisibleAnchors = anchors;
|
|
195
|
+
} else {
|
|
196
|
+
this.wikiPageVisibleAnchors = this.wikiPageVisibleAnchors.filter(
|
|
197
|
+
(anchor) => changedAnchor !== anchor,
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
enableExpandedMode(val: boolean): void {
|
|
203
|
+
this.isExpandedModeEnabled = val;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
setFrame(val: HTMLElement | undefined): void {
|
|
207
|
+
this.frame = val;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
setTopScrollerVisible(val: boolean): void {
|
|
211
|
+
this.isTopScrollerVisible = val;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
setWikiPageAnchor(anchorKey: string, element: HTMLElement): void {
|
|
215
|
+
// do not allow overriding existing anchor
|
|
216
|
+
if (!this.wikiPageAnchorIndex.has(anchorKey)) {
|
|
217
|
+
this.wikiPageAnchorIndex.set(anchorKey, element);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
unsetWikiPageAnchor(anchorKey: string): void {
|
|
222
|
+
this.wikiPageAnchorIndex.delete(anchorKey);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
setWikiPageAnchorToNavigate(
|
|
226
|
+
val: DataSpacePageNavigationCommand | undefined,
|
|
227
|
+
): void {
|
|
228
|
+
this.wikiPageNavigationCommand = val;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
navigateWikiPageAnchor(): void {
|
|
232
|
+
if (
|
|
233
|
+
this.frame &&
|
|
234
|
+
this.wikiPageNavigationCommand &&
|
|
235
|
+
this.isWikiPageFullyRendered
|
|
236
|
+
) {
|
|
237
|
+
const anchor = this.wikiPageNavigationCommand.anchor;
|
|
238
|
+
const matchingWikiPageSection = this.wikiPageAnchorIndex.get(anchor);
|
|
239
|
+
const anchorChunks = anchor.split(NAVIGATION_ZONE_SEPARATOR);
|
|
240
|
+
if (matchingWikiPageSection) {
|
|
241
|
+
this.frame.scrollTop =
|
|
242
|
+
matchingWikiPageSection.offsetTop -
|
|
243
|
+
(this.header?.getBoundingClientRect().height ?? 0);
|
|
244
|
+
} else if (
|
|
245
|
+
getNullableFirstEntry(anchorChunks) ===
|
|
246
|
+
generateAnchorForActivity(
|
|
247
|
+
DATA_SPACE_VIEWER_ACTIVITY_MODE.DIAGRAM_VIEWER,
|
|
248
|
+
)
|
|
249
|
+
) {
|
|
250
|
+
this.frame.scrollTop =
|
|
251
|
+
guaranteeNonNullable(
|
|
252
|
+
this.wikiPageAnchorIndex.get(
|
|
253
|
+
generateAnchorForActivity(
|
|
254
|
+
DATA_SPACE_VIEWER_ACTIVITY_MODE.DIAGRAM_VIEWER,
|
|
255
|
+
),
|
|
256
|
+
),
|
|
257
|
+
).offsetTop - (this.header?.getBoundingClientRect().height ?? 0);
|
|
258
|
+
const matchingDiagram =
|
|
259
|
+
this.dataSpaceViewerState.dataSpaceAnalysisResult.diagrams.find(
|
|
260
|
+
(diagram) => generateAnchorForDiagram(diagram) === anchor,
|
|
261
|
+
);
|
|
262
|
+
if (matchingDiagram) {
|
|
263
|
+
this.dataSpaceViewerState.diagramViewerState.setCurrentDiagram(
|
|
264
|
+
matchingDiagram,
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
this.setWikiPageAnchorToNavigate(undefined);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
18
|
-
import type
|
|
18
|
+
import { type DataSpaceViewerState } from './DataSpaceViewerState.js';
|
|
19
19
|
import { type TreeData, type TreeNodeData } from '@finos/legend-art';
|
|
20
20
|
import {
|
|
21
21
|
ActionState,
|
|
@@ -32,6 +32,9 @@ import {
|
|
|
32
32
|
type NormalizedDataSpaceDocumentationEntry,
|
|
33
33
|
} from '../graph-manager/action/analytics/DataSpaceAnalysis.js';
|
|
34
34
|
import { CORE_PURE_PATH, ELEMENT_PATH_DELIMITER } from '@finos/legend-graph';
|
|
35
|
+
import type { CommandRegistrar } from '@finos/legend-application';
|
|
36
|
+
import { DSL_DATA_SPACE_LEGEND_APPLICATION_COMMAND_KEY } from '../__lib__/DSL_DataSpace_LegendApplicationCommand.js';
|
|
37
|
+
import { DATA_SPACE_VIEWER_ACTIVITY_MODE } from './DataSpaceViewerNavigation.js';
|
|
35
38
|
|
|
36
39
|
export enum ModelsDocumentationFilterTreeNodeCheckType {
|
|
37
40
|
CHECKED,
|
|
@@ -331,12 +334,15 @@ const buildPackageFilterTreeData = (
|
|
|
331
334
|
};
|
|
332
335
|
};
|
|
333
336
|
|
|
334
|
-
export class DataSpaceViewerModelsDocumentationState
|
|
337
|
+
export class DataSpaceViewerModelsDocumentationState
|
|
338
|
+
implements CommandRegistrar
|
|
339
|
+
{
|
|
335
340
|
readonly dataSpaceViewerState: DataSpaceViewerState;
|
|
336
341
|
|
|
337
342
|
showHumanizedForm = true;
|
|
338
343
|
|
|
339
344
|
// search text
|
|
345
|
+
private searchInput?: HTMLInputElement | undefined;
|
|
340
346
|
private readonly searchEngine: FuzzySearchEngine<NormalizedDataSpaceDocumentationEntry>;
|
|
341
347
|
searchConfigurationState: FuzzySearchAdvancedConfigState;
|
|
342
348
|
readonly searchState = ActionState.create();
|
|
@@ -585,4 +591,57 @@ export class DataSpaceViewerModelsDocumentationState {
|
|
|
585
591
|
this.resetTypeFilter();
|
|
586
592
|
this.resetPackageFilter();
|
|
587
593
|
}
|
|
594
|
+
|
|
595
|
+
hasClassDocumentation(classPath: string): boolean {
|
|
596
|
+
return this.dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs.some(
|
|
597
|
+
(entry) => entry.elementEntry.path === classPath,
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
viewClassDocumentation(classPath: string): void {
|
|
602
|
+
if (this.hasClassDocumentation(classPath)) {
|
|
603
|
+
const classNode = this.packageFilterTreeData.nodes.get(classPath);
|
|
604
|
+
if (classNode) {
|
|
605
|
+
uncheckAllFilterTree(this.packageFilterTreeData);
|
|
606
|
+
classNode.setCheckType(
|
|
607
|
+
ModelsDocumentationFilterTreeNodeCheckType.CHECKED,
|
|
608
|
+
);
|
|
609
|
+
this.resetSearch();
|
|
610
|
+
this.updatePackageFilter();
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
setSearchInput(el: HTMLInputElement | undefined): void {
|
|
616
|
+
this.searchInput = el;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
focusSearchInput(): void {
|
|
620
|
+
this.searchInput?.focus();
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
selectSearchInput(): void {
|
|
624
|
+
this.searchInput?.select();
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
registerCommands(): void {
|
|
628
|
+
const DEFAULT_TRIGGER = (): boolean =>
|
|
629
|
+
this.dataSpaceViewerState.currentActivity ===
|
|
630
|
+
DATA_SPACE_VIEWER_ACTIVITY_MODE.MODELS_DOCUMENTATION;
|
|
631
|
+
this.dataSpaceViewerState.applicationStore.commandService.registerCommand({
|
|
632
|
+
key: DSL_DATA_SPACE_LEGEND_APPLICATION_COMMAND_KEY.SEARCH_DOCUMENTATION,
|
|
633
|
+
trigger: DEFAULT_TRIGGER,
|
|
634
|
+
action: () => this.focusSearchInput(),
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
deregisterCommands(): void {
|
|
639
|
+
[
|
|
640
|
+
DSL_DATA_SPACE_LEGEND_APPLICATION_COMMAND_KEY.SEARCH_DOCUMENTATION,
|
|
641
|
+
].forEach((commandKey) =>
|
|
642
|
+
this.dataSpaceViewerState.applicationStore.commandService.deregisterCommand(
|
|
643
|
+
commandKey,
|
|
644
|
+
),
|
|
645
|
+
);
|
|
646
|
+
}
|
|
588
647
|
}
|
|
@@ -0,0 +1,91 @@
|
|
|
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 { makeObservable, observable } from 'mobx';
|
|
18
|
+
import { type DataSpaceViewerState } from './DataSpaceViewerState.js';
|
|
19
|
+
import { DataAccessState } from '@finos/legend-query-builder';
|
|
20
|
+
import {
|
|
21
|
+
type DataSpaceExecutableAnalysisResult,
|
|
22
|
+
DataSpaceServiceExecutableInfo,
|
|
23
|
+
} from '../graph-manager/index.js';
|
|
24
|
+
import type {
|
|
25
|
+
DatasetEntitlementReport,
|
|
26
|
+
DatasetSpecification,
|
|
27
|
+
} from '@finos/legend-graph';
|
|
28
|
+
|
|
29
|
+
export class DataSpaceQuickStartState {
|
|
30
|
+
readonly dataSpaceViewerState: DataSpaceViewerState;
|
|
31
|
+
|
|
32
|
+
dataAccessStateIndex = new Map<
|
|
33
|
+
DataSpaceExecutableAnalysisResult,
|
|
34
|
+
DataAccessState
|
|
35
|
+
>();
|
|
36
|
+
|
|
37
|
+
constructor(dataSpaceViewerState: DataSpaceViewerState) {
|
|
38
|
+
makeObservable(this, {
|
|
39
|
+
dataAccessStateIndex: observable,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
this.dataSpaceViewerState = dataSpaceViewerState;
|
|
43
|
+
dataSpaceViewerState.dataSpaceAnalysisResult.executables.forEach(
|
|
44
|
+
(executable) => {
|
|
45
|
+
let dataAccessState: DataAccessState | undefined;
|
|
46
|
+
|
|
47
|
+
if (
|
|
48
|
+
executable.info instanceof DataSpaceServiceExecutableInfo &&
|
|
49
|
+
executable.info.mapping &&
|
|
50
|
+
executable.info.runtime
|
|
51
|
+
) {
|
|
52
|
+
const query = executable.info.query;
|
|
53
|
+
const mapping = executable.info.mapping;
|
|
54
|
+
const runtime = executable.info.runtime;
|
|
55
|
+
dataAccessState = new DataAccessState(
|
|
56
|
+
this.dataSpaceViewerState.applicationStore,
|
|
57
|
+
this.dataSpaceViewerState.graphManagerState,
|
|
58
|
+
{
|
|
59
|
+
initialDatasets: executable.datasets,
|
|
60
|
+
surveyDatasets: async (): Promise<DatasetSpecification[]> =>
|
|
61
|
+
this.dataSpaceViewerState.graphManagerState.graphManager.surveyDatasets(
|
|
62
|
+
mapping,
|
|
63
|
+
runtime,
|
|
64
|
+
await this.dataSpaceViewerState.graphManagerState.graphManager.pureCodeToLambda(
|
|
65
|
+
query,
|
|
66
|
+
),
|
|
67
|
+
this.dataSpaceViewerState.retrieveGraphData(),
|
|
68
|
+
),
|
|
69
|
+
checkDatasetEntitlements: async (
|
|
70
|
+
datasets: DatasetSpecification[],
|
|
71
|
+
): Promise<DatasetEntitlementReport[]> =>
|
|
72
|
+
this.dataSpaceViewerState.graphManagerState.graphManager.checkDatasetEntitlements(
|
|
73
|
+
datasets,
|
|
74
|
+
mapping,
|
|
75
|
+
runtime,
|
|
76
|
+
await this.dataSpaceViewerState.graphManagerState.graphManager.pureCodeToLambda(
|
|
77
|
+
query,
|
|
78
|
+
),
|
|
79
|
+
this.dataSpaceViewerState.retrieveGraphData(),
|
|
80
|
+
),
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (dataAccessState) {
|
|
86
|
+
this.dataAccessStateIndex.set(executable, dataAccessState);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|