@finos/legend-extension-dsl-data-space 10.1.93 → 10.1.94

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.d.ts +1 -1
  2. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.d.ts.map +1 -1
  3. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.js +1 -1
  4. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.js.map +1 -1
  5. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts +2 -1
  6. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts.map +1 -1
  7. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js +11 -0
  8. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js.map +1 -1
  9. package/lib/components/DataSpaceDiagramViewer.d.ts.map +1 -1
  10. package/lib/components/DataSpaceDiagramViewer.js +3 -1
  11. package/lib/components/DataSpaceDiagramViewer.js.map +1 -1
  12. package/lib/components/DataSpaceModelsDocumentation.d.ts.map +1 -1
  13. package/lib/components/DataSpaceModelsDocumentation.js +5 -1
  14. package/lib/components/DataSpaceModelsDocumentation.js.map +1 -1
  15. package/lib/components/DataSpaceQuickStart.d.ts.map +1 -1
  16. package/lib/components/DataSpaceQuickStart.js +5 -1
  17. package/lib/components/DataSpaceQuickStart.js.map +1 -1
  18. package/lib/components/query/DataSpaceAdvancedSearchModal.d.ts.map +1 -1
  19. package/lib/components/query/DataSpaceAdvancedSearchModal.js +2 -1
  20. package/lib/components/query/DataSpaceAdvancedSearchModal.js.map +1 -1
  21. package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.d.ts +18 -0
  22. package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.d.ts.map +1 -0
  23. package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.js +94 -0
  24. package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.js.map +1 -0
  25. package/lib/components/studio/DataSpacePreviewAction.d.ts.map +1 -1
  26. package/lib/components/studio/DataSpacePreviewAction.js +2 -1
  27. package/lib/components/studio/DataSpacePreviewAction.js.map +1 -1
  28. package/lib/index.css +2 -2
  29. package/lib/index.css.map +1 -1
  30. package/lib/package.json +1 -1
  31. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts +2 -0
  32. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts.map +1 -1
  33. package/lib/stores/query/DataSpaceQueryBuilderState.js +6 -0
  34. package/lib/stores/query/DataSpaceQueryBuilderState.js.map +1 -1
  35. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js +3 -3
  36. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
  37. package/package.json +12 -12
  38. package/src/__lib__/query/DSL_DataSpace_LegendQueryNavigation.ts +1 -1
  39. package/src/components/DSL_DataSpace_LegendApplicationPlugin.tsx +16 -0
  40. package/src/components/DataSpaceDiagramViewer.tsx +5 -1
  41. package/src/components/DataSpaceModelsDocumentation.tsx +7 -1
  42. package/src/components/DataSpaceQuickStart.tsx +12 -1
  43. package/src/components/query/DataSpaceAdvancedSearchModal.tsx +7 -2
  44. package/src/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.tsx +224 -0
  45. package/src/components/studio/DataSpacePreviewAction.tsx +4 -1
  46. package/src/stores/query/DataSpaceQueryBuilderState.ts +7 -0
  47. package/src/stores/query/DataSpaceTemplateQueryCreatorStore.ts +3 -3
  48. package/tsconfig.json +1 -0
@@ -149,6 +149,8 @@ const DataSpaceExecutableTDSResultView = observer(
149
149
  extractTDSExecutableActionConfigurations.find(
150
150
  (config) => config.key === selectedTab,
151
151
  );
152
+ const darkMode =
153
+ !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled;
152
154
 
153
155
  return (
154
156
  <div className="data-space__viewer__quickstart__item__content">
@@ -277,7 +279,16 @@ const DataSpaceExecutableTDSResultView = observer(
277
279
  </div>
278
280
  <div className="data-space__viewer__quickstart__item__content__tab__content">
279
281
  {selectedTab === TDS_EXECUTABLE_ACTION_TAB.COLUMN_SPECS && (
280
- <div className="data-space__viewer__quickstart__tds__column-specs data-space__viewer__grid ag-theme-balham-dark">
282
+ <div
283
+ className={clsx(
284
+ 'data-space__viewer__quickstart__tds__column-specs',
285
+ 'data-space__viewer__grid',
286
+ {
287
+ 'ag-theme-balham': !darkMode,
288
+ 'ag-theme-balham-dark': darkMode,
289
+ },
290
+ )}
291
+ >
281
292
  <DataGrid
282
293
  rowData={columnSpecifications}
283
294
  gridOptions={{
@@ -153,7 +153,9 @@ export const DataSpaceAdvancedSearchModal = observer(
153
153
  }}
154
154
  >
155
155
  <Modal
156
- darkMode={true}
156
+ darkMode={
157
+ !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
158
+ }
157
159
  className="editor-modal data-space-advanced-search__dialog"
158
160
  >
159
161
  <ModalHeader className="data-space-advanced-search__dialog__header">
@@ -185,7 +187,10 @@ export const DataSpaceAdvancedSearchModal = observer(
185
187
  placeholder="Search for data space by name..."
186
188
  isClearable={true}
187
189
  escapeClearsValue={true}
188
- darkMode={true}
190
+ darkMode={
191
+ !applicationStore.layoutService
192
+ .TEMPORARY__isLightColorThemeEnabled
193
+ }
189
194
  formatOptionLabel={formatDataSpaceOptionLabel}
190
195
  />
191
196
  <button
@@ -0,0 +1,224 @@
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 {
18
+ PanelHeader,
19
+ FilterIcon,
20
+ BasePopover,
21
+ ClickAwayListener,
22
+ ShareIcon,
23
+ TagIcon,
24
+ } from '@finos/legend-art';
25
+ import { observer } from 'mobx-react-lite';
26
+ import { useRef } from 'react';
27
+ import { DataSpaceExecutableTemplate } from '../../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
28
+ import type { DataSpaceQueryBuilderState } from '../../stores/query/DataSpaceQueryBuilderState.js';
29
+ import {
30
+ ActionAlertActionType,
31
+ ActionAlertType,
32
+ useApplicationStore,
33
+ } from '@finos/legend-application';
34
+ import { generateDataSpaceTemplateQueryCreatorRoute } from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
35
+
36
+ const DataSpaceTemplateQueryDialog = observer(
37
+ (props: {
38
+ triggerElement: HTMLElement | null;
39
+ queryBuilderState: DataSpaceQueryBuilderState;
40
+ templateQueries: DataSpaceExecutableTemplate[];
41
+ }) => {
42
+ const { triggerElement, queryBuilderState, templateQueries } = props;
43
+ const applicationStore = useApplicationStore();
44
+ const handleClose = (): void => {
45
+ queryBuilderState.setTemplateQueryDialogOpen(false);
46
+ };
47
+
48
+ const loadTemplateQuery = (template: DataSpaceExecutableTemplate): void => {
49
+ const executionContext =
50
+ queryBuilderState.dataSpace.executionContexts.find(
51
+ (c) => c.name === template.executionContextKey,
52
+ );
53
+ if (
54
+ executionContext &&
55
+ executionContext.hashCode !==
56
+ queryBuilderState.executionContext.hashCode
57
+ ) {
58
+ queryBuilderState.setExecutionContext(executionContext);
59
+ queryBuilderState.propagateExecutionContextChange(executionContext);
60
+ queryBuilderState.initializeWithQuery(template.query);
61
+ queryBuilderState.onExecutionContextChange?.(executionContext);
62
+ } else {
63
+ queryBuilderState.initializeWithQuery(template.query);
64
+ }
65
+ handleClose();
66
+ };
67
+
68
+ const loadQuery = (template: DataSpaceExecutableTemplate): void => {
69
+ if (queryBuilderState.changeDetectionState.hasChanged) {
70
+ applicationStore.alertService.setActionAlertInfo({
71
+ message:
72
+ 'Unsaved changes will be lost if you continue. Do you still want to proceed?',
73
+ type: ActionAlertType.CAUTION,
74
+ actions: [
75
+ {
76
+ label: 'Proceed',
77
+ type: ActionAlertActionType.PROCEED_WITH_CAUTION,
78
+ handler: (): void => loadTemplateQuery(template),
79
+ },
80
+ {
81
+ label: 'Abort',
82
+ type: ActionAlertActionType.PROCEED,
83
+ default: true,
84
+ },
85
+ ],
86
+ });
87
+ } else {
88
+ loadTemplateQuery(template);
89
+ }
90
+ };
91
+
92
+ const visitTemplateQuery = (
93
+ template: DataSpaceExecutableTemplate,
94
+ ): void => {
95
+ if (queryBuilderState.projectInfo?.groupId) {
96
+ applicationStore.navigationService.navigator.visitAddress(
97
+ applicationStore.navigationService.navigator.generateAddress(
98
+ generateDataSpaceTemplateQueryCreatorRoute(
99
+ queryBuilderState.projectInfo.groupId,
100
+ queryBuilderState.projectInfo.artifactId,
101
+ queryBuilderState.projectInfo.versionId,
102
+ queryBuilderState.dataSpace.path,
103
+ template.title,
104
+ ),
105
+ ),
106
+ );
107
+ }
108
+ };
109
+
110
+ return (
111
+ <ClickAwayListener onClickAway={handleClose}>
112
+ <div>
113
+ <BasePopover
114
+ open={queryBuilderState.isTemplateQueryDialogOpen}
115
+ PaperProps={{
116
+ classes: {
117
+ root: '"query-builder__data-space__template-query-panel__container__root',
118
+ },
119
+ }}
120
+ className="query-builder__data-space__template-query-panel__container"
121
+ onClose={handleClose}
122
+ anchorEl={triggerElement}
123
+ anchorOrigin={{
124
+ vertical: 'bottom',
125
+ horizontal: 'left',
126
+ }}
127
+ transformOrigin={{
128
+ vertical: 'top',
129
+ horizontal: 'center',
130
+ }}
131
+ >
132
+ <div className="query-builder__data-space__template-query-panel">
133
+ <div className="query-builder__data-space__template-query-panel__header">
134
+ Curated Template Queries
135
+ </div>
136
+ {templateQueries.map((query) => (
137
+ <div
138
+ key={query.title}
139
+ className="query-builder__data-space__template-query-panel__query"
140
+ >
141
+ <TagIcon className="query-builder__data-space__template-query-panel__query__icon" />
142
+ <button
143
+ className="query-builder__data-space__template-query-panel__query__entry"
144
+ title="click to load template query"
145
+ onClick={() => loadQuery(query)}
146
+ >
147
+ <div className="query-builder__data-space__template-query-panel__query__entry__content">
148
+ <div className="query-builder__data-space__template-query-panel__query__entry__content__title">
149
+ {query.title}
150
+ </div>
151
+ {query.description && (
152
+ <div className="query-builder__data-space__template-query-panel__query__entry__content__description">
153
+ {query.description}
154
+ </div>
155
+ )}
156
+ </div>
157
+ </button>
158
+ <button
159
+ className="query-builder__data-space__template-query-panel__query__share"
160
+ title="Visit..."
161
+ onClick={() => visitTemplateQuery(query)}
162
+ >
163
+ <ShareIcon />
164
+ <div className="query-builder__data-space__template-query-panel__query__share__label">
165
+ Visit
166
+ </div>
167
+ </button>
168
+ </div>
169
+ ))}
170
+ </div>
171
+ </BasePopover>
172
+ </div>
173
+ </ClickAwayListener>
174
+ );
175
+ },
176
+ );
177
+
178
+ const DataSpaceQueryBuilderTemplateQueryPanel = observer(
179
+ (props: { queryBuilderState: DataSpaceQueryBuilderState }) => {
180
+ const { queryBuilderState } = props;
181
+ const templateQueryButtonRef = useRef<HTMLButtonElement>(null);
182
+ const templateQueries = queryBuilderState.dataSpace.executables?.filter(
183
+ (e) => e instanceof DataSpaceExecutableTemplate,
184
+ ) as DataSpaceExecutableTemplate[] | undefined;
185
+
186
+ const showTemplateQueries = (): void => {
187
+ queryBuilderState.setTemplateQueryDialogOpen(true);
188
+ };
189
+
190
+ return (
191
+ <>
192
+ {templateQueries && templateQueries.length > 0 && (
193
+ <PanelHeader className="query-builder__data-space__template-query">
194
+ <div className="query-builder__data-space__template-query__title">
195
+ <FilterIcon />
196
+ </div>
197
+ <button
198
+ className="query-builder__data-space__template-query__btn"
199
+ ref={templateQueryButtonRef}
200
+ onClick={showTemplateQueries}
201
+ >
202
+ Template ( {templateQueries.length} )
203
+ </button>
204
+ {queryBuilderState.isTemplateQueryDialogOpen && (
205
+ <DataSpaceTemplateQueryDialog
206
+ triggerElement={templateQueryButtonRef.current}
207
+ queryBuilderState={queryBuilderState}
208
+ templateQueries={templateQueries}
209
+ />
210
+ )}
211
+ </PanelHeader>
212
+ )}
213
+ </>
214
+ );
215
+ },
216
+ );
217
+
218
+ export const renderDataSpaceQueryBuilderTemplateQueryPanelContent = (
219
+ queryBuilderState: DataSpaceQueryBuilderState,
220
+ ): React.ReactNode => (
221
+ <DataSpaceQueryBuilderTemplateQueryPanel
222
+ queryBuilderState={queryBuilderState}
223
+ />
224
+ );
@@ -59,6 +59,7 @@ export const DataSpacePreviewAction = observer(
59
59
 
60
60
  export const DataSpacePreviewDialog = observer(() => {
61
61
  const editorStore = useEditorStore();
62
+ const applicationStore = editorStore.applicationStore;
62
63
  const dataSpacePreviewState =
63
64
  DataSpacePreviewState.retrieveNullableState(editorStore);
64
65
  if (!dataSpacePreviewState) {
@@ -81,7 +82,9 @@ export const DataSpacePreviewDialog = observer(() => {
81
82
  }}
82
83
  >
83
84
  <Modal
84
- darkMode={true}
85
+ darkMode={
86
+ !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
87
+ }
85
88
  className="editor-modal data-space-preview__dialog"
86
89
  >
87
90
  <ModalHeader className="data-space-preview__dialog__header">
@@ -146,6 +146,7 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
146
146
  dataSpaces: DataSpaceInfo[] = [];
147
147
  showRuntimeSelector = false;
148
148
  advancedSearchState?: DataSpaceAdvancedSearchState | undefined;
149
+ isTemplateQueryDialogOpen = false;
149
150
 
150
151
  constructor(
151
152
  applicationStore: GenericLegendApplicationStore,
@@ -172,10 +173,12 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
172
173
  executionContext: observable,
173
174
  showRuntimeSelector: observable,
174
175
  advancedSearchState: observable,
176
+ isTemplateQueryDialogOpen: observable,
175
177
  showAdvancedSearchPanel: action,
176
178
  hideAdvancedSearchPanel: action,
177
179
  setExecutionContext: action,
178
180
  setShowRuntimeSelector: action,
181
+ setTemplateQueryDialogOpen: action,
179
182
  loadDataSpaces: flow,
180
183
  });
181
184
 
@@ -197,6 +200,10 @@ export class DataSpaceQueryBuilderState extends QueryBuilderState {
197
200
  : 'query-builder__setup__data-space';
198
201
  }
199
202
 
203
+ setTemplateQueryDialogOpen(val: boolean): void {
204
+ this.isTemplateQueryDialogOpen = val;
205
+ }
206
+
200
207
  showAdvancedSearchPanel(): void {
201
208
  if (this.projectInfo && this.isAdvancedDataSpaceSearchEnabled) {
202
209
  this.advancedSearchState = new DataSpaceAdvancedSearchState(
@@ -39,7 +39,7 @@ import {
39
39
  DataSpaceProjectInfo,
40
40
  } from './DataSpaceQueryBuilderState.js';
41
41
  import type { DataSpaceInfo } from './DataSpaceInfo.js';
42
- import { generateDataSpaceTemplateQueryViewerRoute } from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
42
+ import { generateDataSpaceTemplateQueryCreatorRoute } from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
43
43
  import {
44
44
  DataSpaceExecutableTemplate,
45
45
  type DataSpaceExecutionContext,
@@ -149,7 +149,7 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
149
149
  (dataSpaceInfo: DataSpaceInfo) => {
150
150
  if (dataSpaceInfo.defaultExecutionContext) {
151
151
  this.applicationStore.navigationService.navigator.goToLocation(
152
- generateDataSpaceTemplateQueryViewerRoute(
152
+ generateDataSpaceTemplateQueryCreatorRoute(
153
153
  guaranteeNonNullable(dataSpaceInfo.groupId),
154
154
  guaranteeNonNullable(dataSpaceInfo.artifactId),
155
155
  LATEST_VERSION_ALIAS, //always default to latest
@@ -167,7 +167,7 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
167
167
  dataSpaceAnalysisResult,
168
168
  (ec: DataSpaceExecutionContext) => {
169
169
  this.applicationStore.navigationService.navigator.updateCurrentLocation(
170
- generateDataSpaceTemplateQueryViewerRoute(
170
+ generateDataSpaceTemplateQueryCreatorRoute(
171
171
  this.groupId,
172
172
  this.artifactId,
173
173
  this.versionId,
package/tsconfig.json CHANGED
@@ -93,6 +93,7 @@
93
93
  "./src/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.tsx",
94
94
  "./src/components/query/DataSpaceAdvancedSearchModal.tsx",
95
95
  "./src/components/query/DataSpaceQueryBuilder.tsx",
96
+ "./src/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.tsx",
96
97
  "./src/components/query/DataSpaceQueryCreator.tsx",
97
98
  "./src/components/query/DataSpaceQuerySetup.tsx",
98
99
  "./src/components/query/DataSpaceTemplateQueryCreator.tsx",