@finos/legend-extension-dsl-data-space 10.2.0 → 10.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.d.ts +18 -6
  2. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.d.ts.map +1 -1
  3. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.js +18 -6
  4. package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.js.map +1 -1
  5. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.d.ts.map +1 -1
  6. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js +1 -0
  7. package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js.map +1 -1
  8. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts +4 -1
  9. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts.map +1 -1
  10. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js +55 -5
  11. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js.map +1 -1
  12. package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.js +1 -1
  13. package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.js.map +1 -1
  14. package/lib/components/query/DataSpaceTemplateQueryCreator.js +4 -4
  15. package/lib/components/query/DataSpaceTemplateQueryCreator.js.map +1 -1
  16. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts +2 -0
  17. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.d.ts.map +1 -1
  18. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.js +13 -0
  19. package/lib/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.js.map +1 -1
  20. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.d.ts +19 -0
  21. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.d.ts.map +1 -0
  22. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.js +79 -0
  23. package/lib/components/studio/DataSpaceTemplateQueryPromoteReview.js.map +1 -0
  24. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.d.ts +1 -0
  25. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.d.ts.map +1 -1
  26. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js +2 -0
  27. package/lib/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js.map +1 -1
  28. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.d.ts +1 -0
  29. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.d.ts.map +1 -1
  30. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.js +1 -0
  31. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.js.map +1 -1
  32. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.d.ts +10 -1
  33. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.d.ts.map +1 -1
  34. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
  35. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.d.ts.map +1 -1
  36. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js +2 -0
  37. package/lib/graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js.map +1 -1
  38. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.d.ts +12 -1
  39. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.d.ts.map +1 -1
  40. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js +28 -3
  41. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
  42. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts +1 -0
  43. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts.map +1 -1
  44. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js +2 -0
  45. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js.map +1 -1
  46. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.d.ts +1 -0
  47. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.d.ts.map +1 -1
  48. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.js +2 -0
  49. package/lib/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.js.map +1 -1
  50. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.d.ts.map +1 -1
  51. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.js +1 -0
  52. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.js.map +1 -1
  53. package/lib/index.css +2 -2
  54. package/lib/index.css.map +1 -1
  55. package/lib/package.json +2 -1
  56. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.d.ts +3 -2
  57. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
  58. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js +9 -13
  59. package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
  60. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.d.ts +61 -0
  61. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.d.ts.map +1 -0
  62. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.js +407 -0
  63. package/lib/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.js.map +1 -0
  64. package/package.json +8 -7
  65. package/src/__lib__/query/DSL_DataSpace_LegendQueryNavigation.ts +43 -9
  66. package/src/components/DSL_DataSpace_LegendApplicationPlugin.tsx +1 -0
  67. package/src/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.tsx +117 -3
  68. package/src/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.tsx +1 -1
  69. package/src/components/query/DataSpaceTemplateQueryCreator.tsx +6 -6
  70. package/src/components/studio/DSL_DataSpace_LegendStudioApplicationPlugin.tsx +18 -1
  71. package/src/components/studio/DataSpaceTemplateQueryPromoteReview.tsx +285 -0
  72. package/src/graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.ts +2 -0
  73. package/src/graph-manager/action/analytics/DataSpaceAnalysis.ts +1 -0
  74. package/src/graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.ts +15 -0
  75. package/src/graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.ts +2 -0
  76. package/src/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.ts +66 -2
  77. package/src/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.ts +2 -0
  78. package/src/graph-manager/protocol/pure/v1/model/packageableElements/dataSpace/V1_DSL_DataSpace_DataSpace.ts +2 -0
  79. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataSpace_ProtocolHelper.ts +1 -0
  80. package/src/stores/query/DataSpaceTemplateQueryCreatorStore.ts +12 -24
  81. package/src/stores/query/DataSpaceTemplateQueryPromotionReviewerStore.ts +636 -0
  82. package/tsconfig.json +2 -0
@@ -16,15 +16,17 @@
16
16
 
17
17
  import packageJson from '../../../package.json' assert { type: 'json' };
18
18
  import {
19
- type QuerySetupActionConfiguration,
20
19
  type ExistingQueryEditorStateBuilder,
21
- type ExistingQueryEditorStore,
20
+ type QueryEditorStore,
21
+ type QuerySetupActionConfiguration,
22
+ ExistingQueryEditorStore,
22
23
  LegendQueryApplicationPlugin,
23
24
  LEGEND_QUERY_APP_EVENT,
24
25
  createViewProjectHandler,
25
26
  createViewSDLCProjectHandler,
27
+ type QueryEditorActionConfiguration,
26
28
  } from '@finos/legend-application-query';
27
- import { SquareIcon } from '@finos/legend-art';
29
+ import { ArrowCircleUpIcon, SquareIcon } from '@finos/legend-art';
28
30
  import {
29
31
  ActionAlertActionType,
30
32
  ActionAlertType,
@@ -34,6 +36,7 @@ import {
34
36
  DATA_SPACE_QUERY_ROUTE_PATTERN,
35
37
  generateDataSpaceQueryCreatorRoute,
36
38
  generateDataSpaceQuerySetupRoute,
39
+ generateDataSpaceTemplateQueryPromotionRoute,
37
40
  } from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
38
41
  import { DataSpaceQueryCreator } from './DataSpaceQueryCreator.js';
39
42
  import {
@@ -54,6 +57,7 @@ import type { DataSpaceInfo } from '../../stores/query/DataSpaceInfo.js';
54
57
  import { getOwnDataSpace } from '../../graph-manager/DSL_DataSpace_GraphManagerHelper.js';
55
58
  import {
56
59
  assertErrorThrown,
60
+ buildUrl,
57
61
  guaranteeNonNullable,
58
62
  LogEvent,
59
63
  } from '@finos/legend-shared';
@@ -71,6 +75,8 @@ import type {
71
75
  DataSpaceExecutionContext,
72
76
  } from '../../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
73
77
  import { DataSpaceTemplateQueryCreator } from './DataSpaceTemplateQueryCreator.js';
78
+ import { DataSpaceTemplateQueryCreatorStore } from '../../stores/query/DataSpaceTemplateQueryCreatorStore.js';
79
+ import { parseProjectIdentifier } from '@finos/legend-storage';
74
80
 
75
81
  const resolveExecutionContext = (
76
82
  dataSpace: DataSpace,
@@ -305,4 +311,112 @@ export class DSL_DataSpace_LegendQueryApplicationPlugin extends LegendQueryAppli
305
311
  },
306
312
  ];
307
313
  }
314
+
315
+ override getExtraQueryHeaders(): ((
316
+ editorStore: QueryEditorStore,
317
+ ) => React.ReactNode | undefined)[] {
318
+ return [
319
+ (editorStore: QueryEditorStore): React.ReactNode | undefined => {
320
+ if (editorStore instanceof DataSpaceTemplateQueryCreatorStore) {
321
+ return (
322
+ <div className="query-editor__dataspace__header">
323
+ <div className="query-editor__header__content__main query-editor__header__content__title__text query-editor__dataspace__header__title__text">
324
+ {editorStore.templateQueryTitle}
325
+ </div>
326
+ <div className="query-editor__dataspace__header__title__tag">
327
+ template
328
+ </div>
329
+ </div>
330
+ );
331
+ }
332
+ return undefined;
333
+ },
334
+ ];
335
+ }
336
+
337
+ override getExtraQueryEditorActionConfigurations(): QueryEditorActionConfiguration[] {
338
+ return [
339
+ {
340
+ key: 'promote-as-curated-template-query',
341
+ renderer: (editorStore, queryBuilderState) => {
342
+ const proceedCuratedTemplateQueryPromotion =
343
+ async (): Promise<void> => {
344
+ if (
345
+ !(
346
+ editorStore instanceof ExistingQueryEditorStore &&
347
+ queryBuilderState instanceof DataSpaceQueryBuilderState
348
+ )
349
+ ) {
350
+ return;
351
+ }
352
+ // fetch project data
353
+ const project = StoreProjectData.serialization.fromJson(
354
+ await editorStore.depotServerClient.getProject(
355
+ editorStore.lightQuery.groupId,
356
+ editorStore.lightQuery.artifactId,
357
+ ),
358
+ );
359
+
360
+ // find the matching SDLC instance
361
+ const projectIDPrefix = parseProjectIdentifier(
362
+ project.projectId,
363
+ ).prefix;
364
+ const matchingSDLCEntry =
365
+ editorStore.applicationStore.config.studioInstances.find(
366
+ (entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
367
+ );
368
+ if (matchingSDLCEntry) {
369
+ editorStore.applicationStore.navigationService.navigator.visitAddress(
370
+ buildUrl([
371
+ editorStore.applicationStore.config.studioApplicationUrl,
372
+ generateDataSpaceTemplateQueryPromotionRoute(
373
+ editorStore.lightQuery.groupId,
374
+ editorStore.lightQuery.artifactId,
375
+ editorStore.lightQuery.versionId,
376
+ queryBuilderState.dataSpace.path,
377
+ editorStore.lightQuery.id,
378
+ ),
379
+ ]),
380
+ );
381
+ } else {
382
+ editorStore.applicationStore.notificationService.notifyWarning(
383
+ `Can't find the corresponding SDLC instance to productionize the query`,
384
+ );
385
+ }
386
+ };
387
+
388
+ const proceed = (): void => {
389
+ queryBuilderState.changeDetectionState.alertUnsavedChanges(() => {
390
+ proceedCuratedTemplateQueryPromotion().catch(
391
+ editorStore.applicationStore.alertUnhandledError,
392
+ );
393
+ });
394
+ };
395
+
396
+ return (
397
+ <>
398
+ {editorStore instanceof ExistingQueryEditorStore &&
399
+ queryBuilderState instanceof DataSpaceQueryBuilderState && (
400
+ <button
401
+ className="query-editor__header__action btn--dark"
402
+ tabIndex={-1}
403
+ onClick={proceed}
404
+ title={
405
+ !(editorStore instanceof ExistingQueryEditorStore)
406
+ ? 'Please save your query first before promoting'
407
+ : 'Promote Curated Template query...'
408
+ }
409
+ >
410
+ <ArrowCircleUpIcon className="query-editor__header__action__icon--productionize" />
411
+ <div className="query-editor__header__action__label">
412
+ Promote as Template Query
413
+ </div>
414
+ </button>
415
+ )}
416
+ </>
417
+ );
418
+ },
419
+ },
420
+ ];
421
+ }
308
422
  }
@@ -100,7 +100,7 @@ const DataSpaceTemplateQueryDialog = observer(
100
100
  queryBuilderState.projectInfo.artifactId,
101
101
  queryBuilderState.projectInfo.versionId,
102
102
  queryBuilderState.dataSpace.path,
103
- template.title,
103
+ template.id,
104
104
  ),
105
105
  ),
106
106
  );
@@ -33,8 +33,8 @@ const DataSpaceTemplateQueryCreatorStoreProvider: React.FC<{
33
33
  children: React.ReactNode;
34
34
  gav: string;
35
35
  dataSpacePath: string;
36
- templateQueryTitle: string;
37
- }> = ({ children, gav, dataSpacePath, templateQueryTitle }) => {
36
+ templateQueryId: string;
37
+ }> = ({ children, gav, dataSpacePath, templateQueryId }) => {
38
38
  const { groupId, artifactId, versionId } = parseGAVCoordinates(gav);
39
39
  const applicationStore = useLegendQueryApplicationStore();
40
40
  const baseStore = useLegendQueryBaseStore();
@@ -47,7 +47,7 @@ const DataSpaceTemplateQueryCreatorStoreProvider: React.FC<{
47
47
  artifactId,
48
48
  versionId,
49
49
  dataSpacePath,
50
- templateQueryTitle,
50
+ templateQueryId,
51
51
  ),
52
52
  );
53
53
  return (
@@ -65,16 +65,16 @@ export const DataSpaceTemplateQueryCreator = observer(() => {
65
65
  parameters[
66
66
  DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH
67
67
  ];
68
- const templateQueryTitle =
68
+ const templateQueryId =
69
69
  parameters[
70
- DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.TEMPLATE_QUERY_TITLE
70
+ DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.TEMPLATE_QUERY_ID
71
71
  ];
72
72
 
73
73
  return (
74
74
  <DataSpaceTemplateQueryCreatorStoreProvider
75
75
  gav={gav}
76
76
  dataSpacePath={dataSpacePath}
77
- templateQueryTitle={templateQueryTitle}
77
+ templateQueryId={templateQueryId}
78
78
  >
79
79
  <QueryEditor />
80
80
  </DataSpaceTemplateQueryCreatorStoreProvider>
@@ -48,7 +48,10 @@ import {
48
48
  } from '../../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
49
49
  import { DSL_DATA_SPACE_LEGEND_STUDIO_DOCUMENTATION_KEY } from '../../__lib__/studio/DSL_DataSpace_LegendStudioDocumentation.js';
50
50
  import { SIMPLE_DATA_SPACE_SNIPPET } from '../../__lib__/studio/DSL_DataSpace_LegendStudioCodeSnippet.js';
51
- import type { DocumentationEntry } from '@finos/legend-application';
51
+ import type {
52
+ ApplicationPageEntry,
53
+ DocumentationEntry,
54
+ } from '@finos/legend-application';
52
55
  import { DataSpaceIcon } from '../DSL_DataSpace_Icon.js';
53
56
  import { DataSpacePreviewState } from '../../stores/studio/DataSpacePreviewState.js';
54
57
  import {
@@ -57,6 +60,8 @@ import {
57
60
  } from './DataSpacePreviewAction.js';
58
61
  import type { PureGrammarTextSuggestion } from '@finos/legend-lego/code-editor';
59
62
  import { DataSpaceQueryAction } from './DataSpaceQueryAction.js';
63
+ import { DataSpaceTemplateQueryPromotionReviewer } from './DataSpaceTemplateQueryPromoteReview.js';
64
+ import { DATA_SPACE_QUERY_ROUTE_PATTERN } from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
60
65
 
61
66
  const DATA_SPACE_ELEMENT_TYPE = 'DATA SPACE';
62
67
  const DATA_SPACE_ELEMENT_PROJECT_EXPLORER_DND_TYPE =
@@ -80,6 +85,18 @@ export class DSL_DataSpace_LegendStudioApplicationPlugin
80
85
  ];
81
86
  }
82
87
 
88
+ override getExtraApplicationPageEntries(): ApplicationPageEntry[] {
89
+ return [
90
+ {
91
+ key: 'promote-as-curated-template-query-page',
92
+ addressPatterns: [
93
+ DATA_SPACE_QUERY_ROUTE_PATTERN.PROMOTE_TEMPLATE_QUERY,
94
+ ],
95
+ renderer: DataSpaceTemplateQueryPromotionReviewer,
96
+ },
97
+ ];
98
+ }
99
+
83
100
  override getExtraExplorerContextMenuItemRendererConfigurations(): ExplorerContextMenuItemRendererConfiguration[] {
84
101
  return [
85
102
  {
@@ -0,0 +1,285 @@
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 { BlankPanelContent, GitBranchIcon, clsx } from '@finos/legend-art';
18
+ import { observer, useLocalObservable } from 'mobx-react-lite';
19
+ import { useApplicationStore } from '@finos/legend-application';
20
+ import { DataSpaceTemplateQueryPromotionReviewerStore } from '../../stores/query/DataSpaceTemplateQueryPromotionReviewerStore.js';
21
+ import {
22
+ DATA_SPACE_TEMPLATE_QUERY_PROMOTION_ROUTE_PATTERN_TOKEN,
23
+ type DataSpaceTemplateQueryPromotionReviewerPathParams,
24
+ } from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
25
+ import { useParams } from '@finos/legend-application/browser';
26
+ import {
27
+ ActivityBarMenu,
28
+ LEGEND_STUDIO_TEST_ID,
29
+ useLegendStudioApplicationStore,
30
+ useLegendStudioBaseStore,
31
+ } from '@finos/legend-application-studio';
32
+ import { createContext, useContext } from 'react';
33
+ import { guaranteeNonNullable } from '@finos/legend-shared';
34
+ import { flowResult } from 'mobx';
35
+
36
+ const TemplateQueryPromotionReviewerStoreContext = createContext<
37
+ DataSpaceTemplateQueryPromotionReviewerStore | undefined
38
+ >(undefined);
39
+
40
+ const DataSpaceTemplateQueryPromotionReviewerStoreProvider: React.FC<{
41
+ children: React.ReactNode;
42
+ dataSpacePath: string;
43
+ queryId: string;
44
+ }> = ({ children, dataSpacePath, queryId }) => {
45
+ const applicationStore = useLegendStudioApplicationStore();
46
+ const baseStore = useLegendStudioBaseStore();
47
+ const store = useLocalObservable(
48
+ () =>
49
+ new DataSpaceTemplateQueryPromotionReviewerStore(
50
+ applicationStore,
51
+ baseStore.sdlcServerClient,
52
+ baseStore.depotServerClient,
53
+ ),
54
+ );
55
+ store.initialize(queryId, dataSpacePath);
56
+ return (
57
+ <TemplateQueryPromotionReviewerStoreContext.Provider value={store}>
58
+ {children}
59
+ </TemplateQueryPromotionReviewerStoreContext.Provider>
60
+ );
61
+ };
62
+
63
+ const useTemplateQueryPromotionReviewerStore =
64
+ (): DataSpaceTemplateQueryPromotionReviewerStore =>
65
+ guaranteeNonNullable(
66
+ useContext(TemplateQueryPromotionReviewerStoreContext),
67
+ `Can't find query productionizer store in context`,
68
+ );
69
+
70
+ const TemplateQueryPromotionReviewerContent = observer(() => {
71
+ const applicationStore = useApplicationStore();
72
+ const queryPromotionReviewerStore = useTemplateQueryPromotionReviewerStore();
73
+ const isLoadingEditor = !queryPromotionReviewerStore.initState.hasCompleted;
74
+
75
+ // workspace name
76
+ const changeWorkspaceName: React.ChangeEventHandler<HTMLInputElement> = (
77
+ event,
78
+ ) => queryPromotionReviewerStore.setWorkspaceName(event.target.value);
79
+
80
+ // template query
81
+ const onChangeTemplateQueryId: React.ChangeEventHandler<HTMLInputElement> = (
82
+ event,
83
+ ) => queryPromotionReviewerStore.setTemplateQueryId(event.target.value);
84
+
85
+ const onChangeTemplateQueryTitle: React.ChangeEventHandler<
86
+ HTMLInputElement
87
+ > = (event) =>
88
+ queryPromotionReviewerStore.setTemplateQueryTitle(event.target.value);
89
+
90
+ const onChangeTemplateQueryDescription: React.ChangeEventHandler<
91
+ HTMLInputElement
92
+ > = (event) =>
93
+ queryPromotionReviewerStore.setTemplateQueryDescription(event.target.value);
94
+
95
+ // actions
96
+ const promoteTemplateQuery = (): void => {
97
+ flowResult(queryPromotionReviewerStore.promoteAsTemplateQuery()).catch(
98
+ applicationStore.alertUnhandledError,
99
+ );
100
+ };
101
+
102
+ return (
103
+ <div className="app__page">
104
+ {isLoadingEditor && (
105
+ <BlankPanelContent>
106
+ {queryPromotionReviewerStore.initState.message ??
107
+ queryPromotionReviewerStore.graphManagerState.systemBuildState
108
+ .message ??
109
+ queryPromotionReviewerStore.graphManagerState.dependenciesBuildState
110
+ .message ??
111
+ queryPromotionReviewerStore.graphManagerState.generationsBuildState
112
+ .message ??
113
+ queryPromotionReviewerStore.graphManagerState.graphBuildState
114
+ .message}
115
+ </BlankPanelContent>
116
+ )}
117
+ <div className="template-query-promotor">
118
+ <div className="template-query-promotor__body">
119
+ <div className="activity-bar">
120
+ <ActivityBarMenu />
121
+ </div>
122
+ <div
123
+ className="template-query-promotor__content"
124
+ data-testid={LEGEND_STUDIO_TEST_ID.SETUP__CONTENT}
125
+ >
126
+ <div className="template-query-promotor__content__main">
127
+ <div className="template-query-promotor__title">
128
+ Promote as Curated Template Query
129
+ </div>
130
+ <div className="template-query-promotor__title__prompt">
131
+ We will promote this query as a curated template query in
132
+ dataspace. This automated process will generate a code review
133
+ and workspace. Please get the generated code review reviewed and
134
+ approved.
135
+ </div>
136
+ <div className="template-query-promotor__group template-query-promotor__group--workspace">
137
+ <div className="template-query-promotor__group__header">
138
+ workspace
139
+ </div>
140
+ <div className="template-query-promotor__group__content">
141
+ <div className="template-query-promotor__input">
142
+ <div
143
+ className="template-query-promotor__input__icon"
144
+ title="workspace"
145
+ >
146
+ <GitBranchIcon className="template-query-promotor__input__icon--workspce" />
147
+ </div>
148
+ <div className="input-group template-query-promotor__input__input">
149
+ <input
150
+ className={clsx(
151
+ 'input input--dark input-group__input',
152
+ {
153
+ 'input-group__input--error':
154
+ !queryPromotionReviewerStore.isWorkspaceNameValid,
155
+ },
156
+ )}
157
+ spellCheck={false}
158
+ value={queryPromotionReviewerStore.workspaceName}
159
+ placeholder="Enter a name for your workspace"
160
+ onChange={changeWorkspaceName}
161
+ />
162
+ {!queryPromotionReviewerStore.isWorkspaceNameValid && (
163
+ <div className="input-group__error-message">
164
+ Workspace already existed
165
+ </div>
166
+ )}
167
+ </div>
168
+ </div>
169
+ </div>
170
+ </div>
171
+ <div className="template-query-promotor__group template-query-promotor__group--template">
172
+ <div className="template-query-promotor__group__header">
173
+ template query
174
+ </div>
175
+ <div className="template-query-promotor__group__content">
176
+ <div className="template-query-promotor__input">
177
+ <div className="template-query-promotor__input__label">
178
+ id
179
+ </div>
180
+ <div className="input-group template-query-promotor__input__input">
181
+ <input
182
+ className={clsx(
183
+ 'input input--dark input-group__input',
184
+ {
185
+ 'input-group__input--error':
186
+ !queryPromotionReviewerStore.isTemplateQueryIdValid,
187
+ },
188
+ )}
189
+ spellCheck={false}
190
+ placeholder="Create an id for your template query"
191
+ value={queryPromotionReviewerStore.templateQueryId}
192
+ onChange={onChangeTemplateQueryId}
193
+ />
194
+ {!queryPromotionReviewerStore.isTemplateQueryIdValid && (
195
+ <div className="input-group__error-message">
196
+ Invalid template query id
197
+ </div>
198
+ )}
199
+ </div>
200
+ </div>
201
+ <div className="template-query-promotor__input">
202
+ <div className="template-query-promotor__input__label">
203
+ title
204
+ </div>
205
+ <div className="input-group template-query-promotor__input__input">
206
+ <input
207
+ className="input input--dark input-group__input"
208
+ spellCheck={false}
209
+ placeholder="Create a title for your template query"
210
+ value={queryPromotionReviewerStore.templateQueryTitle}
211
+ onChange={onChangeTemplateQueryTitle}
212
+ />
213
+ </div>
214
+ </div>
215
+ <div className="template-query-promotor__input">
216
+ <div className="template-query-promotor__input__label">
217
+ description
218
+ </div>
219
+ <div className="input-group template-query-promotor__input__input">
220
+ <input
221
+ className="input input--dark input-group__input"
222
+ spellCheck={false}
223
+ placeholder="Add some descriptions for your template query"
224
+ value={
225
+ queryPromotionReviewerStore.templateQueryDescription
226
+ }
227
+ onChange={onChangeTemplateQueryDescription}
228
+ />
229
+ </div>
230
+ </div>
231
+ </div>
232
+ </div>
233
+ <div className="template-query-promotor__actions">
234
+ <button
235
+ className="template-query-promotor__next-btn btn--dark"
236
+ onClick={promoteTemplateQuery}
237
+ disabled={
238
+ queryPromotionReviewerStore.promoteState.isInProgress ||
239
+ !queryPromotionReviewerStore.currentQuery ||
240
+ !queryPromotionReviewerStore.currentQueryInfo ||
241
+ !queryPromotionReviewerStore.currentProject ||
242
+ !queryPromotionReviewerStore
243
+ .currentProjectConfigurationStatus?.isConfigured ||
244
+ !queryPromotionReviewerStore.workspaceName ||
245
+ !queryPromotionReviewerStore.templateQueryTitle ||
246
+ !queryPromotionReviewerStore.isWorkspaceNameValid ||
247
+ !queryPromotionReviewerStore.isTemplateQueryIdValid
248
+ }
249
+ >
250
+ Promote Query
251
+ </button>
252
+ </div>
253
+ </div>
254
+ </div>
255
+ </div>
256
+ <div
257
+ data-testid={LEGEND_STUDIO_TEST_ID.STATUS_BAR}
258
+ className="editor__status-bar"
259
+ />
260
+ </div>
261
+ </div>
262
+ );
263
+ });
264
+
265
+ export const DataSpaceTemplateQueryPromotionReviewer = observer(() => {
266
+ const parameters =
267
+ useParams<DataSpaceTemplateQueryPromotionReviewerPathParams>();
268
+ const dataSpacePath =
269
+ parameters[
270
+ DATA_SPACE_TEMPLATE_QUERY_PROMOTION_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH
271
+ ];
272
+ const queryId =
273
+ parameters[
274
+ DATA_SPACE_TEMPLATE_QUERY_PROMOTION_ROUTE_PATTERN_TOKEN.QUERY_ID
275
+ ];
276
+
277
+ return (
278
+ <DataSpaceTemplateQueryPromotionReviewerStoreProvider
279
+ dataSpacePath={dataSpacePath}
280
+ queryId={queryId}
281
+ >
282
+ <TemplateQueryPromotionReviewerContent />
283
+ </DataSpaceTemplateQueryPromotionReviewerStoreProvider>
284
+ );
285
+ });
@@ -100,12 +100,14 @@ export class DataSpaceExecutableTemplate
100
100
  extends DataSpaceExecutable
101
101
  implements Hashable
102
102
  {
103
+ id!: string;
103
104
  query!: RawLambda;
104
105
  executionContextKey?: string;
105
106
 
106
107
  override get hashCode(): string {
107
108
  return hashArray([
108
109
  DATA_SPACE_HASH_STRUCTURE.DATA_SPACE_TEMPLATE_EXECUTABLE,
110
+ this.id,
109
111
  this.title,
110
112
  this.description ?? '',
111
113
  this.query,
@@ -130,6 +130,7 @@ export abstract class DataSpaceExecutableInfo {
130
130
  }
131
131
 
132
132
  export class DataSpaceTemplateExecutableInfo extends DataSpaceExecutableInfo {
133
+ id!: string;
133
134
  executionContextKey!: string;
134
135
  }
135
136
 
@@ -16,6 +16,7 @@
16
16
 
17
17
  import {
18
18
  type AbstractPureGraphManager,
19
+ type RawLambda,
19
20
  AbstractPureGraphManagerExtension,
20
21
  } from '@finos/legend-graph';
21
22
  import type { Entity } from '@finos/legend-storage';
@@ -38,6 +39,20 @@ export abstract class DSL_DataSpace_PureGraphManagerExtension extends AbstractPu
38
39
  cacheRetriever: () => Promise<PlainObject<DataSpaceAnalysisResult>>,
39
40
  actionState?: ActionState,
40
41
  ): Promise<DataSpaceAnalysisResult | undefined>;
42
+
43
+ abstract addNewExecutableToDataSpaceEntity(
44
+ dataSpaceEntity: Entity,
45
+ executable: {
46
+ id: string;
47
+ title: string;
48
+ mapping: string;
49
+ runtime: string;
50
+ query: RawLambda;
51
+ description?: string;
52
+ },
53
+ ): Promise<Entity>;
54
+
55
+ abstract IsTemplateQueryIdValid(dataSpaceEntity: Entity, id: string): boolean;
41
56
  }
42
57
 
43
58
  export const DSL_DataSpace_getGraphManagerExtension = (
@@ -229,6 +229,7 @@ export class DSL_DataSpace_PureProtocolProcessorPlugin
229
229
  executableProtocol instanceof V1_DataSpaceTemplateExecutable
230
230
  ) {
231
231
  const executable = new DataSpaceExecutableTemplate();
232
+ executable.id = executableProtocol.id;
232
233
  executable.title = executableProtocol.title;
233
234
  executable.description = executableProtocol.description;
234
235
  executable.query = V1_buildRawLambdaWithResolvedPaths(
@@ -418,6 +419,7 @@ export class DSL_DataSpace_PureProtocolProcessorPlugin
418
419
  protocol.executables = metamodel.executables?.map((executable) => {
419
420
  if (executable instanceof DataSpaceExecutableTemplate) {
420
421
  const executableProtocol = new V1_DataSpaceTemplateExecutable();
422
+ executableProtocol.id = executable.id;
421
423
  executableProtocol.title = executable.title;
422
424
  executableProtocol.description = executable.description;
423
425
  if (executable.executionContextKey) {