@finos/legend-application-query 13.4.12 → 13.4.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +3 -0
  2. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
  3. package/lib/components/Core_LegendQueryApplicationPlugin.js +250 -5
  4. package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
  5. package/lib/components/QueryEditor.d.ts +8 -0
  6. package/lib/components/QueryEditor.d.ts.map +1 -1
  7. package/lib/components/QueryEditor.js +15 -136
  8. package/lib/components/QueryEditor.js.map +1 -1
  9. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
  10. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +2 -0
  11. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js.map +1 -1
  12. package/lib/components/data-space/DataSpaceQuerySetup.d.ts.map +1 -1
  13. package/lib/components/data-space/DataSpaceQuerySetup.js +7 -6
  14. package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
  15. package/lib/index.css +2 -2
  16. package/lib/index.css.map +1 -1
  17. package/lib/index.d.ts +1 -1
  18. package/lib/index.d.ts.map +1 -1
  19. package/lib/index.js +1 -1
  20. package/lib/index.js.map +1 -1
  21. package/lib/package.json +1 -1
  22. package/lib/stores/LegendQueryApplicationPlugin.d.ts +4 -4
  23. package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
  24. package/lib/stores/LegendQueryApplicationPlugin.js +1 -0
  25. package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
  26. package/lib/stores/QueryEditorStore.d.ts +5 -1
  27. package/lib/stores/QueryEditorStore.d.ts.map +1 -1
  28. package/lib/stores/QueryEditorStore.js +12 -4
  29. package/lib/stores/QueryEditorStore.js.map +1 -1
  30. package/lib/stores/__test-utils__/LegendQueryApplicationTestUtils.js +1 -1
  31. package/lib/stores/__test-utils__/LegendQueryApplicationTestUtils.js.map +1 -1
  32. package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts.map +1 -1
  33. package/lib/stores/data-space/DataSpaceQueryCreatorStore.js +2 -2
  34. package/lib/stores/data-space/DataSpaceQueryCreatorStore.js.map +1 -1
  35. package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts +2 -1
  36. package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts.map +1 -1
  37. package/lib/stores/data-space/DataSpaceQuerySetupState.js +6 -3
  38. package/lib/stores/data-space/DataSpaceQuerySetupState.js.map +1 -1
  39. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
  40. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +2 -2
  41. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
  42. package/package.json +6 -6
  43. package/src/components/Core_LegendQueryApplicationPlugin.tsx +593 -1
  44. package/src/components/QueryEditor.tsx +30 -468
  45. package/src/components/__test-utils__/QueryEditorComponentTestUtils.tsx +2 -0
  46. package/src/components/data-space/DataSpaceQuerySetup.tsx +52 -53
  47. package/src/index.ts +2 -1
  48. package/src/stores/{LegendQueryApplicationPlugin.ts → LegendQueryApplicationPlugin.tsx} +11 -6
  49. package/src/stores/QueryEditorStore.ts +16 -0
  50. package/src/stores/__test-utils__/LegendQueryApplicationTestUtils.ts +1 -1
  51. package/src/stores/data-space/DataSpaceQueryCreatorStore.ts +2 -0
  52. package/src/stores/data-space/DataSpaceQuerySetupState.ts +8 -0
  53. package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +2 -0
  54. package/tsconfig.json +2 -2
@@ -21,10 +21,10 @@ import { flowResult } from 'mobx';
21
21
  import { QueryBuilderClassSelector } from '@finos/legend-query-builder';
22
22
  import {
23
23
  CustomSelectorInput,
24
+ PanelHeader,
24
25
  SearchIcon,
25
26
  type SelectComponent,
26
27
  } from '@finos/legend-art';
27
- import { DataSpaceIcon } from '@finos/legend-extension-dsl-data-space/application';
28
28
  import {
29
29
  useLegendQueryApplicationStore,
30
30
  useLegendQueryBaseStore,
@@ -82,8 +82,9 @@ const DataSpaceQuerySetupSetupPanelContent = observer(
82
82
  const applicationStore = useApplicationStore();
83
83
  const dataSpaceSearchRef = useRef<SelectComponent>(null);
84
84
  // data space
85
- const dataSpaceOptions =
86
- queryBuilderState.dataSpaces.map(buildDataSpaceOption);
85
+ const dataSpaceOptions = queryBuilderState.dataSpaces
86
+ .map(buildDataSpaceOption)
87
+ .sort((a, b) => a.label.localeCompare(b.label));
87
88
  const selectedDataSpaceOption = null;
88
89
  const onDataSpaceOptionChange = (option: DataSpaceOption): void => {
89
90
  queryBuilderState.onDataSpaceChange(option.value);
@@ -101,59 +102,57 @@ const DataSpaceQuerySetupSetupPanelContent = observer(
101
102
  useEffect(() => dataSpaceSearchRef.current?.focus());
102
103
 
103
104
  return (
104
- <>
105
- <div className="query-builder__setup__config-group">
106
- <div className="query-builder__setup__config-group__header">
107
- <div className="query-builder__setup__config-group__header__title">
108
- data space execution context
109
- </div>
110
- </div>
111
- <div className="query-builder__setup__config-group__content">
112
- <div className="query-builder__setup__config-group__item">
113
- <div
114
- className="btn--sm query-builder__setup__config-group__item__label"
115
- title="data space"
116
- >
117
- <DataSpaceIcon />
118
- </div>
119
- <CustomSelectorInput
120
- ref={dataSpaceSearchRef}
121
- className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
122
- options={dataSpaceOptions}
123
- isLoading={queryBuilderState.loadDataSpacesState.isInProgress}
124
- onChange={onDataSpaceOptionChange}
125
- value={selectedDataSpaceOption}
126
- placeholder="Search for data space..."
127
- escapeClearsValue={true}
128
- darkMode={
129
- !applicationStore.layoutService
130
- .TEMPORARY__isLightColorThemeEnabled
131
- }
132
- formatOptionLabel={formatDataSpaceOptionLabel}
105
+ <div className="query-builder__setup__config-group">
106
+ <PanelHeader title="properties" />
107
+ <div className="query-builder__setup__config-group__content">
108
+ <div className="query-builder__setup__config-group__item">
109
+ <label
110
+ className="btn--sm query-builder__setup__config-group__item__label"
111
+ title="data space"
112
+ htmlFor="query-builder__setup__data-space-selector"
113
+ >
114
+ Data Space
115
+ </label>
116
+ <CustomSelectorInput
117
+ inputId="query-builder__setup__data-space-selector"
118
+ ref={dataSpaceSearchRef}
119
+ className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
120
+ options={dataSpaceOptions}
121
+ isLoading={queryBuilderState.loadDataSpacesState.isInProgress}
122
+ onChange={onDataSpaceOptionChange}
123
+ value={selectedDataSpaceOption}
124
+ placeholder="Search for data space..."
125
+ escapeClearsValue={true}
126
+ darkMode={
127
+ !applicationStore.layoutService
128
+ .TEMPORARY__isLightColorThemeEnabled
129
+ }
130
+ formatOptionLabel={formatDataSpaceOptionLabel}
131
+ />
132
+ <button
133
+ tabIndex={-1}
134
+ className="query-builder__setup__data-space-searcher__btn btn--dark"
135
+ onClick={openDataSpaceAdvancedSearch}
136
+ title="Open advanced search for data space..."
137
+ >
138
+ <SearchIcon />
139
+ </button>
140
+ {queryBuilderState.advancedSearchState && (
141
+ <DataSpaceAdvancedSearchModal
142
+ searchState={queryBuilderState.advancedSearchState}
143
+ onClose={() => queryBuilderState.hideAdvancedSearchPanel()}
133
144
  />
134
- <button
135
- tabIndex={-1}
136
- className="query-builder__setup__data-space-searcher__btn btn--dark"
137
- onClick={openDataSpaceAdvancedSearch}
138
- title="Open advanced search for data space..."
139
- >
140
- <SearchIcon />
141
- </button>
142
- {queryBuilderState.advancedSearchState && (
143
- <DataSpaceAdvancedSearchModal
144
- searchState={queryBuilderState.advancedSearchState}
145
- onClose={() => queryBuilderState.hideAdvancedSearchPanel()}
146
- />
147
- )}
148
- </div>
145
+ )}
146
+ </div>
147
+ <div className="query-builder__setup__config-group__item">
148
+ <QueryBuilderClassSelector
149
+ queryBuilderState={queryBuilderState}
150
+ classes={[]}
151
+ noMatchMessage="No compatible entity found"
152
+ />
149
153
  </div>
150
154
  </div>
151
- <QueryBuilderClassSelector
152
- queryBuilderState={queryBuilderState}
153
- classes={[]}
154
- noMatchMessage="No compatible class found"
155
- />
156
- </>
155
+ </div>
157
156
  );
158
157
  },
159
158
  );
package/src/index.ts CHANGED
@@ -36,11 +36,12 @@ export type { LegendQueryApplicationStore } from './stores/LegendQueryBaseStore.
36
36
  export * from './stores/LegendQueryApplicationPlugin.js';
37
37
  export { BaseQuerySetupStore } from './stores/QuerySetupStore.js';
38
38
  export {
39
+ type QueryPersistConfiguration,
39
40
  createViewProjectHandler,
40
41
  createViewSDLCProjectHandler,
41
42
  QueryEditorStore,
42
43
  ExistingQueryEditorStore,
43
- type QueryPersistConfiguration,
44
+ QueryBuilderActionConfig_QueryApplication,
44
45
  } from './stores/QueryEditorStore.js';
45
46
  export { QUERY_EDITOR_TEST_ID } from './__lib__/LegendQueryTesting.js';
46
47
  // components
@@ -16,12 +16,14 @@
16
16
 
17
17
  import { LegendApplicationPlugin } from '@finos/legend-application';
18
18
  import type { Query } from '@finos/legend-graph';
19
- import type { QueryBuilderState } from '@finos/legend-query-builder';
20
- import type React from 'react';
21
- import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
22
19
  import type {
23
- ExistingQueryEditorStore,
24
- QueryEditorStore,
20
+ QueryBuilderState,
21
+ QueryBuilder_LegendApplicationPlugin_Extension,
22
+ } from '@finos/legend-query-builder';
23
+ import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
24
+ import {
25
+ type ExistingQueryEditorStore,
26
+ type QueryEditorStore,
25
27
  } from './QueryEditorStore.js';
26
28
  import type { QuerySetupLandingPageStore } from './QuerySetupStore.js';
27
29
 
@@ -77,7 +79,10 @@ export type QueryEditorHelpMenuActionConfiguration = {
77
79
  icon?: React.ReactNode;
78
80
  };
79
81
 
80
- export abstract class LegendQueryApplicationPlugin extends LegendApplicationPlugin {
82
+ export class LegendQueryApplicationPlugin
83
+ extends LegendApplicationPlugin
84
+ implements QueryBuilder_LegendApplicationPlugin_Extension
85
+ {
81
86
  /**
82
87
  * This helps to better type-check for this empty abtract type
83
88
  * See https://github.com/finos/legend-studio/blob/master/docs/technical/typescript-usage.md#understand-typescript-structual-type-system
@@ -106,6 +106,7 @@ import {
106
106
  ServiceQueryBuilderState,
107
107
  QueryLoaderState,
108
108
  QueryBuilderDataBrowserWorkflow,
109
+ QueryBuilderActionConfig,
109
110
  } from '@finos/legend-query-builder';
110
111
  import { LegendQueryUserDataHelper } from '../__lib__/LegendQueryUserDataHelper.js';
111
112
  import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
@@ -654,6 +655,15 @@ export abstract class QueryEditorStore {
654
655
  }
655
656
  }
656
657
 
658
+ export class QueryBuilderActionConfig_QueryApplication extends QueryBuilderActionConfig {
659
+ editorStore: QueryEditorStore;
660
+
661
+ constructor(editorStore: QueryEditorStore) {
662
+ super();
663
+ this.editorStore = editorStore;
664
+ }
665
+ }
666
+
657
667
  export class MappingQueryCreatorStore extends QueryEditorStore {
658
668
  readonly groupId: string;
659
669
  readonly artifactId: string;
@@ -698,6 +708,7 @@ export class MappingQueryCreatorStore extends QueryEditorStore {
698
708
  this.applicationStore,
699
709
  this.graphManagerState,
700
710
  QueryBuilderDataBrowserWorkflow.INSTANCE,
711
+ new QueryBuilderActionConfig_QueryApplication(this),
701
712
  (val: Mapping) => {
702
713
  this.applicationStore.navigationService.navigator.updateCurrentLocation(
703
714
  generateMappingQueryCreatorRoute(
@@ -807,6 +818,7 @@ export class ServiceQueryCreatorStore extends QueryEditorStore {
807
818
  this.applicationStore,
808
819
  this.graphManagerState,
809
820
  QueryBuilderDataBrowserWorkflow.INSTANCE,
821
+ new QueryBuilderActionConfig_QueryApplication(this),
810
822
  service,
811
823
  this.graphManagerState.usableServices,
812
824
  this.executionKey,
@@ -1220,6 +1232,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1220
1232
  this.graphManagerState,
1221
1233
  this.depotServerClient,
1222
1234
  QueryBuilderDataBrowserWorkflow.INSTANCE,
1235
+ new QueryBuilderActionConfig_QueryApplication(this),
1223
1236
  dataSpace,
1224
1237
  matchingExecutionContext,
1225
1238
  (dataSpaceInfo: DataSpaceInfo) => {
@@ -1332,6 +1345,9 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1332
1345
  this.applicationStore.config.options.queryBuilderConfig,
1333
1346
  sourceInfo,
1334
1347
  );
1348
+ classQueryBuilderState.workflowState.updateActionConfig(
1349
+ new QueryBuilderActionConfig_QueryApplication(this),
1350
+ );
1335
1351
  classQueryBuilderState.executionContextState.setMapping(
1336
1352
  exec.mapping.value,
1337
1353
  );
@@ -18,7 +18,7 @@ import { TEST__getApplicationVersionData } from '@finos/legend-application/test'
18
18
  import { LegendQueryApplicationConfig } from '../../application/LegendQueryApplicationConfig.js';
19
19
 
20
20
  const TEST_DATA__appConfig = {
21
- appName: 'test-query-app',
21
+ appName: 'query',
22
22
  env: 'test-env',
23
23
  engine: {
24
24
  url: 'https://testEngineUrl',
@@ -45,6 +45,7 @@ import {
45
45
  retrieveAnalyticsResultCache,
46
46
  } from '@finos/legend-extension-dsl-data-space/graph';
47
47
  import {
48
+ QueryBuilderActionConfig_QueryApplication,
48
49
  QueryEditorStore,
49
50
  createViewProjectHandler,
50
51
  createViewSDLCProjectHandler,
@@ -148,6 +149,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
148
149
  this.graphManagerState,
149
150
  this.depotServerClient,
150
151
  QueryBuilderDataBrowserWorkflow.INSTANCE,
152
+ new QueryBuilderActionConfig_QueryApplication(this),
151
153
  dataSpace,
152
154
  executionContext,
153
155
  (dataSpaceInfo: DataSpaceInfo) => {
@@ -42,6 +42,7 @@ import {
42
42
  } from '@finos/legend-extension-dsl-data-space/application';
43
43
  import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '@finos/legend-extension-dsl-data-space/graph';
44
44
  import {
45
+ QueryBuilderActionConfig_QueryApplication,
45
46
  QueryEditorStore,
46
47
  createViewProjectHandler,
47
48
  createViewSDLCProjectHandler,
@@ -52,6 +53,7 @@ import { renderDataSpaceQuerySetupSetupPanelContent } from '../../components/dat
52
53
  import { DataSpaceAdvancedSearchState } from '@finos/legend-extension-dsl-data-space/application-query';
53
54
 
54
55
  export class DataSpaceQuerySetupState extends QueryBuilderState {
56
+ editorStore: QueryEditorStore;
55
57
  readonly depotServerClient: DepotServerClient;
56
58
  readonly loadDataSpacesState = ActionState.create();
57
59
  readonly onDataSpaceChange: (val: DataSpaceInfo) => void;
@@ -75,6 +77,7 @@ export class DataSpaceQuerySetupState extends QueryBuilderState {
75
77
  advancedSearchState?: DataSpaceAdvancedSearchState | undefined;
76
78
 
77
79
  constructor(
80
+ editorStore: QueryEditorStore,
78
81
  applicationStore: GenericLegendApplicationStore,
79
82
  graphManagerState: GraphManagerState,
80
83
  depotServerClient: DepotServerClient,
@@ -107,6 +110,10 @@ export class DataSpaceQuerySetupState extends QueryBuilderState {
107
110
  loadDataSpaces: flow,
108
111
  });
109
112
 
113
+ this.editorStore = editorStore;
114
+ this.workflowState.updateActionConfig(
115
+ new QueryBuilderActionConfig_QueryApplication(editorStore),
116
+ );
110
117
  this.depotServerClient = depotServerClient;
111
118
  this.onDataSpaceChange = onDataSpaceChange;
112
119
  this.viewProject = viewProject;
@@ -175,6 +182,7 @@ export class DataSpaceQuerySetupStore extends QueryEditorStore {
175
182
 
176
183
  async initializeQueryBuilderState(): Promise<QueryBuilderState> {
177
184
  const queryBuilderState = new DataSpaceQuerySetupState(
185
+ this,
178
186
  this.applicationStore,
179
187
  this.graphManagerState,
180
188
  this.depotServerClient,
@@ -30,6 +30,7 @@ import {
30
30
  } from '@finos/legend-query-builder';
31
31
  import type { ProjectGAVCoordinates } from '@finos/legend-storage';
32
32
  import {
33
+ QueryBuilderActionConfig_QueryApplication,
33
34
  QueryEditorStore,
34
35
  createViewProjectHandler,
35
36
  createViewSDLCProjectHandler,
@@ -142,6 +143,7 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
142
143
  this.graphManagerState,
143
144
  this.depotServerClient,
144
145
  QueryBuilderDataBrowserWorkflow.INSTANCE,
146
+ new QueryBuilderActionConfig_QueryApplication(this),
145
147
  dataSpace,
146
148
  executionContext,
147
149
  (dataSpaceInfo: DataSpaceInfo) => {
package/tsconfig.json CHANGED
@@ -66,7 +66,6 @@
66
66
  "./src/stores/CloneServiceQuerySetupStore.ts",
67
67
  "./src/stores/CreateMappingQuerySetupStore.ts",
68
68
  "./src/stores/EditExistingQuerySetupStore.ts",
69
- "./src/stores/LegendQueryApplicationPlugin.ts",
70
69
  "./src/stores/LegendQueryBaseStore.ts",
71
70
  "./src/stores/LoadProjectServiceQuerySetupStore.ts",
72
71
  "./src/stores/QueryEditorStore.ts",
@@ -94,7 +93,8 @@
94
93
  "./src/components/__test-utils__/QueryEditorComponentTestUtils.tsx",
95
94
  "./src/components/data-space/DataSpaceQueryCreator.tsx",
96
95
  "./src/components/data-space/DataSpaceQuerySetup.tsx",
97
- "./src/components/data-space/DataSpaceTemplateQueryCreator.tsx"
96
+ "./src/components/data-space/DataSpaceTemplateQueryCreator.tsx",
97
+ "./src/stores/LegendQueryApplicationPlugin.tsx"
98
98
  ],
99
99
  "include": [
100
100
  "src/**/*.ts",