@finos/legend-application-query 7.0.0 → 8.0.0
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/application/LegendQuery.d.ts.map +1 -1
- package/lib/application/LegendQuery.js +1 -1
- package/lib/application/LegendQuery.js.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.d.ts +6 -7
- package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.js +9 -4
- package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
- package/lib/components/LegendQueryApplication.d.ts +0 -2
- package/lib/components/LegendQueryApplication.d.ts.map +1 -1
- package/lib/components/LegendQueryApplication.js +2 -3
- package/lib/components/LegendQueryApplication.js.map +1 -1
- package/lib/components/LegendQueryBaseStoreProvider.d.ts +1 -3
- package/lib/components/LegendQueryBaseStoreProvider.d.ts.map +1 -1
- package/lib/components/LegendQueryBaseStoreProvider.js +2 -2
- package/lib/components/LegendQueryBaseStoreProvider.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +29 -25
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/QueryEditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/QueryEditorComponentTestUtils.js +2 -2
- package/lib/components/QueryEditorComponentTestUtils.js.map +1 -1
- package/lib/components/QueryEditorStoreProvider.d.ts.map +1 -1
- package/lib/components/QueryEditorStoreProvider.js +6 -8
- package/lib/components/QueryEditorStoreProvider.js.map +1 -1
- package/lib/components/QuerySetup.d.ts +6 -0
- package/lib/components/QuerySetup.d.ts.map +1 -1
- package/lib/components/QuerySetup.js +99 -23
- package/lib/components/QuerySetup.js.map +1 -1
- package/lib/components/QuerySetupStoreProvider.d.ts.map +1 -1
- package/lib/components/QuerySetupStoreProvider.js +2 -3
- package/lib/components/QuerySetupStoreProvider.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +4 -4
- package/lib/stores/LegendQueryBaseStore.d.ts +2 -3
- package/lib/stores/LegendQueryBaseStore.d.ts.map +1 -1
- package/lib/stores/LegendQueryBaseStore.js +2 -2
- package/lib/stores/LegendQueryBaseStore.js.map +1 -1
- package/lib/stores/LegendQueryRouter.d.ts +12 -1
- package/lib/stores/LegendQueryRouter.d.ts.map +1 -1
- package/lib/stores/LegendQueryRouter.js +13 -2
- package/lib/stores/LegendQueryRouter.js.map +1 -1
- package/lib/stores/QueryEditorStore.d.ts +10 -7
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +18 -11
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/QueryEditorStoreTestUtils.d.ts.map +1 -1
- package/lib/stores/QueryEditorStoreTestUtils.js +1 -0
- package/lib/stores/QueryEditorStoreTestUtils.js.map +1 -1
- package/lib/stores/QuerySetupStore.d.ts +17 -3
- package/lib/stores/QuerySetupStore.d.ts.map +1 -1
- package/lib/stores/QuerySetupStore.js +102 -11
- package/lib/stores/QuerySetupStore.js.map +1 -1
- package/package.json +12 -12
- package/src/application/LegendQuery.tsx +1 -4
- package/src/application/LegendQueryApplicationConfig.ts +30 -10
- package/src/components/LegendQueryApplication.tsx +3 -9
- package/src/components/LegendQueryBaseStoreProvider.tsx +4 -14
- package/src/components/QueryEditor.tsx +57 -51
- package/src/components/QueryEditorComponentTestUtils.tsx +1 -6
- package/src/components/QueryEditorStoreProvider.tsx +3 -14
- package/src/components/QuerySetup.tsx +232 -35
- package/src/components/QuerySetupStoreProvider.tsx +2 -11
- package/src/stores/LegendQueryBaseStore.ts +2 -4
- package/src/stores/LegendQueryRouter.ts +28 -2
- package/src/stores/QueryEditorStore.ts +18 -16
- package/src/stores/QueryEditorStoreTestUtils.ts +1 -0
- package/src/stores/QuerySetupStore.ts +149 -9
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@finos/legend-application-query",
|
3
|
-
"version": "
|
3
|
+
"version": "8.0.0",
|
4
4
|
"description": "Legend Query application core",
|
5
5
|
"keywords": [
|
6
6
|
"legend",
|
@@ -43,15 +43,15 @@
|
|
43
43
|
"test:watch": "jest --watch"
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
|
-
"@finos/legend-application": "
|
47
|
-
"@finos/legend-art": "3.2.
|
48
|
-
"@finos/legend-graph": "
|
49
|
-
"@finos/legend-query-builder": "0.0
|
50
|
-
"@finos/legend-server-depot": "
|
51
|
-
"@finos/legend-shared": "6.1.
|
52
|
-
"@finos/legend-storage": "3.0.
|
46
|
+
"@finos/legend-application": "8.0.0",
|
47
|
+
"@finos/legend-art": "3.2.2",
|
48
|
+
"@finos/legend-graph": "16.0.0",
|
49
|
+
"@finos/legend-query-builder": "0.1.0",
|
50
|
+
"@finos/legend-server-depot": "4.0.0",
|
51
|
+
"@finos/legend-shared": "6.1.2",
|
52
|
+
"@finos/legend-storage": "3.0.11",
|
53
53
|
"@testing-library/react": "13.4.0",
|
54
|
-
"@types/react": "18.0.
|
54
|
+
"@types/react": "18.0.21",
|
55
55
|
"@types/react-dom": "18.0.6",
|
56
56
|
"@types/react-router-dom": "5.3.3",
|
57
57
|
"history": "5.3.0",
|
@@ -65,14 +65,14 @@
|
|
65
65
|
"serializr": "2.0.5"
|
66
66
|
},
|
67
67
|
"devDependencies": {
|
68
|
-
"@finos/legend-dev-utils": "2.0.
|
68
|
+
"@finos/legend-dev-utils": "2.0.17",
|
69
69
|
"@jest/globals": "29.0.3",
|
70
70
|
"cross-env": "7.0.3",
|
71
|
-
"eslint": "8.
|
71
|
+
"eslint": "8.24.0",
|
72
72
|
"jest": "29.0.3",
|
73
73
|
"npm-run-all": "4.1.5",
|
74
74
|
"rimraf": "3.0.2",
|
75
|
-
"sass": "1.
|
75
|
+
"sass": "1.55.0",
|
76
76
|
"typescript": "4.8.3"
|
77
77
|
},
|
78
78
|
"peerDependencies": {
|
@@ -79,10 +79,7 @@ export class LegendQuery extends LegendApplication {
|
|
79
79
|
config={this.config}
|
80
80
|
pluginManager={this.pluginManager}
|
81
81
|
>
|
82
|
-
<LegendQueryApplication
|
83
|
-
config={this.config}
|
84
|
-
pluginManager={this.pluginManager}
|
85
|
-
/>
|
82
|
+
<LegendQueryApplication config={this.config} />
|
86
83
|
</ApplicationStoreProvider>
|
87
84
|
</WebApplicationNavigatorProvider>
|
88
85
|
</BrowserRouter>,
|
@@ -17,6 +17,7 @@
|
|
17
17
|
import {
|
18
18
|
assertNonNullable,
|
19
19
|
guaranteeNonEmptyString,
|
20
|
+
guaranteeNonNullable,
|
20
21
|
SerializationFactory,
|
21
22
|
type PlainObject,
|
22
23
|
} from '@finos/legend-shared';
|
@@ -52,21 +53,23 @@ class LegendQueryApplicationCoreOptions {
|
|
52
53
|
}
|
53
54
|
}
|
54
55
|
|
56
|
+
type LegendStudioApplicationInstanceConfigurationData = {
|
57
|
+
sdlcProjectIDPrefix: string;
|
58
|
+
url: string;
|
59
|
+
};
|
60
|
+
|
55
61
|
export interface LegendQueryApplicationConfigurationData
|
56
62
|
extends LegendApplicationConfigurationData {
|
57
63
|
appName: string;
|
58
64
|
env: string;
|
59
65
|
depot: {
|
60
66
|
url: string;
|
61
|
-
/**
|
62
|
-
* This is needed since some of our legacy infrastructure does not yet support
|
63
|
-
* the new API calls, we need to update them to use the latest version of
|
64
|
-
* finos/legend-depot though
|
65
|
-
*/
|
66
|
-
TEMPORARY__useLegacyDepotServerAPIRoutes?: boolean;
|
67
67
|
};
|
68
68
|
engine: { url: string; queryUrl?: string };
|
69
|
-
studio: {
|
69
|
+
studio: {
|
70
|
+
url: string;
|
71
|
+
instances: LegendStudioApplicationInstanceConfigurationData[];
|
72
|
+
};
|
70
73
|
}
|
71
74
|
|
72
75
|
export class LegendQueryApplicationConfig extends LegendApplicationConfig {
|
@@ -76,13 +79,15 @@ export class LegendQueryApplicationConfig extends LegendApplicationConfig {
|
|
76
79
|
readonly engineQueryServerUrl?: string | undefined;
|
77
80
|
readonly depotServerUrl: string;
|
78
81
|
readonly studioUrl: string;
|
79
|
-
readonly
|
82
|
+
readonly studioInstances: LegendStudioApplicationInstanceConfigurationData[] =
|
83
|
+
[];
|
80
84
|
|
81
85
|
constructor(
|
82
86
|
input: LegendApplicationConfigurationInput<LegendQueryApplicationConfigurationData>,
|
83
87
|
) {
|
84
88
|
super(input);
|
85
89
|
|
90
|
+
// engine
|
86
91
|
assertNonNullable(
|
87
92
|
input.configData.engine,
|
88
93
|
`Can't configure application: 'engine' field is missing`,
|
@@ -92,17 +97,32 @@ export class LegendQueryApplicationConfig extends LegendApplicationConfig {
|
|
92
97
|
`Can't configure application: 'engine.url' field is missing or empty`,
|
93
98
|
);
|
94
99
|
this.engineQueryServerUrl = input.configData.engine.queryUrl;
|
100
|
+
|
101
|
+
// depot
|
102
|
+
assertNonNullable(
|
103
|
+
input.configData.depot,
|
104
|
+
`Can't configure application: 'depot' field is missing`,
|
105
|
+
);
|
95
106
|
this.depotServerUrl = guaranteeNonEmptyString(
|
96
107
|
input.configData.depot.url,
|
97
108
|
`Can't configure application: 'depot.url' field is missing or empty`,
|
98
109
|
);
|
110
|
+
|
111
|
+
// studio
|
112
|
+
assertNonNullable(
|
113
|
+
input.configData.studio,
|
114
|
+
`Can't configure application: 'studio' field is missing`,
|
115
|
+
);
|
99
116
|
this.studioUrl = guaranteeNonEmptyString(
|
100
117
|
input.configData.studio.url,
|
101
118
|
`Can't configure application: 'studio.url' field is missing or empty`,
|
102
119
|
);
|
103
|
-
this.
|
104
|
-
input.configData.
|
120
|
+
this.studioInstances = guaranteeNonNullable(
|
121
|
+
input.configData.studio.instances,
|
122
|
+
`Can't configure application: 'studio.instances' field is missing`,
|
123
|
+
);
|
105
124
|
|
125
|
+
// options
|
106
126
|
this.options = LegendQueryApplicationCoreOptions.create(
|
107
127
|
(input.configData.extensions?.core ??
|
108
128
|
{}) as PlainObject<LegendQueryApplicationCoreOptions>,
|
@@ -28,7 +28,6 @@ import {
|
|
28
28
|
generateExtensionUrlPattern,
|
29
29
|
LegendApplicationComponentFrameworkProvider,
|
30
30
|
} from '@finos/legend-application';
|
31
|
-
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
32
31
|
import type { LegendQueryApplicationConfig } from '../application/LegendQueryApplicationConfig.js';
|
33
32
|
import {
|
34
33
|
LegendQueryBaseStoreProvider,
|
@@ -79,21 +78,16 @@ const LegendQueryApplicationRoot = observer(() => {
|
|
79
78
|
});
|
80
79
|
|
81
80
|
export const LegendQueryApplication = observer(
|
82
|
-
(props: {
|
83
|
-
config
|
84
|
-
pluginManager: LegendQueryPluginManager;
|
85
|
-
}) => {
|
86
|
-
const { config, pluginManager } = props;
|
81
|
+
(props: { config: LegendQueryApplicationConfig }) => {
|
82
|
+
const { config } = props;
|
87
83
|
|
88
84
|
return (
|
89
85
|
<DepotServerClientProvider
|
90
86
|
config={{
|
91
87
|
serverUrl: config.depotServerUrl,
|
92
|
-
TEMPORARY__useLegacyDepotServerAPIRoutes:
|
93
|
-
config.TEMPORARY__useLegacyDepotServerAPIRoutes,
|
94
88
|
}}
|
95
89
|
>
|
96
|
-
<LegendQueryBaseStoreProvider
|
90
|
+
<LegendQueryBaseStoreProvider>
|
97
91
|
<LegendApplicationComponentFrameworkProvider>
|
98
92
|
<LegendQueryApplicationRoot />
|
99
93
|
</LegendApplicationComponentFrameworkProvider>
|
@@ -21,7 +21,6 @@ import { guaranteeNonNullable } from '@finos/legend-shared';
|
|
21
21
|
import { useDepotServerClient } from '@finos/legend-server-depot';
|
22
22
|
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
23
23
|
import type { LegendQueryApplicationConfig } from '../application/LegendQueryApplicationConfig.js';
|
24
|
-
import type { LegendQueryApplicationPlugin } from '../stores/LegendQueryApplicationPlugin.js';
|
25
24
|
import {
|
26
25
|
type ApplicationStore,
|
27
26
|
useApplicationStore,
|
@@ -29,12 +28,9 @@ import {
|
|
29
28
|
|
30
29
|
export const useLegendQueryApplicationStore = (): ApplicationStore<
|
31
30
|
LegendQueryApplicationConfig,
|
32
|
-
|
31
|
+
LegendQueryPluginManager
|
33
32
|
> =>
|
34
|
-
useApplicationStore<
|
35
|
-
LegendQueryApplicationConfig,
|
36
|
-
LegendQueryApplicationPlugin
|
37
|
-
>();
|
33
|
+
useApplicationStore<LegendQueryApplicationConfig, LegendQueryPluginManager>();
|
38
34
|
|
39
35
|
const LegendQueryBaseStoreContext = createContext<
|
40
36
|
LegendQueryBaseStore | undefined
|
@@ -42,17 +38,11 @@ const LegendQueryBaseStoreContext = createContext<
|
|
42
38
|
|
43
39
|
export const LegendQueryBaseStoreProvider: React.FC<{
|
44
40
|
children: React.ReactNode;
|
45
|
-
|
46
|
-
}> = ({ children, pluginManager }) => {
|
41
|
+
}> = ({ children }) => {
|
47
42
|
const applicationStore = useLegendQueryApplicationStore();
|
48
43
|
const depotServerClient = useDepotServerClient();
|
49
44
|
const store = useLocalObservable(
|
50
|
-
() =>
|
51
|
-
new LegendQueryBaseStore(
|
52
|
-
applicationStore,
|
53
|
-
depotServerClient,
|
54
|
-
pluginManager,
|
55
|
-
),
|
45
|
+
() => new LegendQueryBaseStore(applicationStore, depotServerClient),
|
56
46
|
);
|
57
47
|
return (
|
58
48
|
<LegendQueryBaseStoreContext.Provider value={store}>
|
@@ -30,6 +30,7 @@ import {
|
|
30
30
|
TimesIcon,
|
31
31
|
CheckSquareIcon,
|
32
32
|
SquareIcon,
|
33
|
+
ManageSearchIcon,
|
33
34
|
} from '@finos/legend-art';
|
34
35
|
import { debounce, getQueryParameters } from '@finos/legend-shared';
|
35
36
|
import { observer } from 'mobx-react-lite';
|
@@ -43,7 +44,7 @@ import {
|
|
43
44
|
LEGEND_QUERY_ROUTE_PATTERN,
|
44
45
|
LEGEND_QUERY_QUERY_PARAM_TOKEN,
|
45
46
|
LEGEND_QUERY_PATH_PARAM_TOKEN,
|
46
|
-
|
47
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl,
|
47
48
|
generateExistingQueryEditorRoute,
|
48
49
|
} from '../stores/LegendQueryRouter.js';
|
49
50
|
import {
|
@@ -70,11 +71,11 @@ import {
|
|
70
71
|
import { flowResult } from 'mobx';
|
71
72
|
import { useLegendQueryApplicationStore } from './LegendQueryBaseStoreProvider.js';
|
72
73
|
import type { LegendQueryApplicationConfig } from '../application/LegendQueryApplicationConfig.js';
|
73
|
-
import type { LegendQueryApplicationPlugin } from '../stores/LegendQueryApplicationPlugin.js';
|
74
74
|
import {
|
75
75
|
QueryBuilder,
|
76
76
|
type QueryBuilderState,
|
77
77
|
} from '@finos/legend-query-builder';
|
78
|
+
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
78
79
|
|
79
80
|
const QueryExportDialogContent = observer(
|
80
81
|
(props: { exportState: QueryExportState }) => {
|
@@ -206,7 +207,7 @@ const QueryLoader = observer(
|
|
206
207
|
editorStore: QueryEditorStore;
|
207
208
|
applicationStore: ApplicationStore<
|
208
209
|
LegendQueryApplicationConfig,
|
209
|
-
|
210
|
+
LegendQueryPluginManager
|
210
211
|
>;
|
211
212
|
}) => {
|
212
213
|
const { editorStore, applicationStore } = props;
|
@@ -215,22 +216,7 @@ const QueryLoader = observer(
|
|
215
216
|
const [selectedQueryID, setSelectedQueryID] = useState('');
|
216
217
|
const [isMineOnly, setIsMineOnly] = useState(false);
|
217
218
|
const [searchText, setSearchText] = useState('');
|
218
|
-
|
219
|
-
editorStore.queryLoaderState.setIsQueryLoaderOpen(false);
|
220
|
-
};
|
221
|
-
const handleEnterQueryImporter = (): void =>
|
222
|
-
queryFinderRef.current?.focus();
|
223
|
-
const toggleIsMineOnly = (): void => {
|
224
|
-
setIsMineOnly(!isMineOnly);
|
225
|
-
};
|
226
|
-
const loadSelectedQuery = (): void => {
|
227
|
-
if (selectedQueryID) {
|
228
|
-
editorStore.queryLoaderState.setIsQueryLoaderOpen(false);
|
229
|
-
applicationStore.navigator.jumpTo(
|
230
|
-
generateExistingQueryEditorRoute(selectedQueryID),
|
231
|
-
);
|
232
|
-
}
|
233
|
-
};
|
219
|
+
|
234
220
|
// search text
|
235
221
|
const debouncedLoadQueries = useMemo(
|
236
222
|
() =>
|
@@ -255,6 +241,14 @@ const QueryLoader = observer(
|
|
255
241
|
debouncedLoadQueries.cancel();
|
256
242
|
debouncedLoadQueries('');
|
257
243
|
};
|
244
|
+
const toggleShowCurrentUserQueriesOnly = (): void => {
|
245
|
+
editorStore.queryLoaderState.setShowCurrentUserQueriesOnly(
|
246
|
+
!editorStore.queryLoaderState.showCurrentUserQueriesOnly,
|
247
|
+
);
|
248
|
+
setIsMineOnly(!isMineOnly);
|
249
|
+
debouncedLoadQueries.cancel();
|
250
|
+
debouncedLoadQueries(searchText);
|
251
|
+
};
|
258
252
|
|
259
253
|
useEffect(() => {
|
260
254
|
flowResult(editorStore.queryLoaderState.loadQueries('')).catch(
|
@@ -262,12 +256,30 @@ const QueryLoader = observer(
|
|
262
256
|
);
|
263
257
|
}, [applicationStore, editorStore.queryLoaderState]);
|
264
258
|
|
259
|
+
// actions
|
260
|
+
const loadQuery = (): void => {
|
261
|
+
if (selectedQueryID) {
|
262
|
+
editorStore.queryLoaderState.setIsQueryLoaderOpen(false);
|
263
|
+
applicationStore.navigator.jumpTo(
|
264
|
+
applicationStore.navigator.generateLocation(
|
265
|
+
generateExistingQueryEditorRoute(selectedQueryID),
|
266
|
+
),
|
267
|
+
);
|
268
|
+
}
|
269
|
+
};
|
270
|
+
|
271
|
+
// life-cycle
|
272
|
+
const close = (): void => {
|
273
|
+
editorStore.queryLoaderState.setIsQueryLoaderOpen(false);
|
274
|
+
};
|
275
|
+
const onEnter = (): void => queryFinderRef.current?.focus();
|
276
|
+
|
265
277
|
return (
|
266
278
|
<Dialog
|
267
279
|
open={editorStore.queryLoaderState.isQueryLoaderOpen}
|
268
|
-
onClose={
|
280
|
+
onClose={close}
|
269
281
|
TransitionProps={{
|
270
|
-
onEnter
|
282
|
+
onEnter,
|
271
283
|
}}
|
272
284
|
classes={{ container: 'search-modal__container' }}
|
273
285
|
PaperProps={{ classes: { root: 'search-modal__inner-container' } }}
|
@@ -284,14 +296,14 @@ const QueryLoader = observer(
|
|
284
296
|
isMineOnly,
|
285
297
|
},
|
286
298
|
)}
|
287
|
-
onClick={
|
299
|
+
onClick={toggleShowCurrentUserQueriesOnly}
|
288
300
|
tabIndex={-1}
|
289
301
|
>
|
290
302
|
{isMineOnly ? <CheckSquareIcon /> : <SquareIcon />}
|
291
303
|
</button>
|
292
304
|
<div
|
293
305
|
className="query-editor__query-loader__filter-section__section__toggler__prompt"
|
294
|
-
onClick={
|
306
|
+
onClick={toggleShowCurrentUserQueriesOnly}
|
295
307
|
>
|
296
308
|
Mine Only
|
297
309
|
</div>
|
@@ -344,12 +356,7 @@ const QueryLoader = observer(
|
|
344
356
|
</tr>
|
345
357
|
</thead>
|
346
358
|
<tbody>
|
347
|
-
{(
|
348
|
-
? editorStore.queryLoaderState.queries.filter(
|
349
|
-
(q) => q.isCurrentUserQuery,
|
350
|
-
)
|
351
|
-
: editorStore.queryLoaderState.queries
|
352
|
-
).map((query) => (
|
359
|
+
{editorStore.queryLoaderState.queries.map((query) => (
|
353
360
|
<tr
|
354
361
|
key={query.id}
|
355
362
|
className={clsx(
|
@@ -393,12 +400,12 @@ const QueryLoader = observer(
|
|
393
400
|
<div className="search-modal__actions">
|
394
401
|
<button
|
395
402
|
className="btn btn--dark"
|
396
|
-
onClick={
|
403
|
+
onClick={loadQuery}
|
397
404
|
disabled={selectedQueryID === ''}
|
398
405
|
>
|
399
406
|
Load Query
|
400
407
|
</button>
|
401
|
-
<button className="btn btn--dark" onClick={
|
408
|
+
<button className="btn btn--dark" onClick={close}>
|
402
409
|
Close
|
403
410
|
</button>
|
404
411
|
</div>
|
@@ -413,13 +420,15 @@ const QueryEditorHeaderContent = observer(
|
|
413
420
|
const { queryBuilderState } = props;
|
414
421
|
const editorStore = useQueryEditorStore();
|
415
422
|
const applicationStore = useLegendQueryApplicationStore();
|
423
|
+
|
424
|
+
// actions
|
416
425
|
const openQueryLoader = (): void => {
|
417
426
|
editorStore.queryLoaderState.setIsQueryLoaderOpen(true);
|
418
427
|
};
|
419
428
|
const viewQueryProject = (): void => {
|
420
429
|
const { groupId, artifactId, versionId } = editorStore.getProjectInfo();
|
421
430
|
applicationStore.navigator.openNewWindow(
|
422
|
-
|
431
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl(
|
423
432
|
applicationStore.config.studioUrl,
|
424
433
|
groupId,
|
425
434
|
artifactId,
|
@@ -428,7 +437,7 @@ const QueryEditorHeaderContent = observer(
|
|
428
437
|
),
|
429
438
|
);
|
430
439
|
};
|
431
|
-
const
|
440
|
+
const toggleLightDarkMode = (): void =>
|
432
441
|
applicationStore.TEMPORARY__setIsLightThemeEnabled(
|
433
442
|
!applicationStore.TEMPORARY__isLightThemeEnabled,
|
434
443
|
);
|
@@ -457,13 +466,18 @@ const QueryEditorHeaderContent = observer(
|
|
457
466
|
className="query-editor__header__action btn--dark"
|
458
467
|
tabIndex={-1}
|
459
468
|
onClick={openQueryLoader}
|
469
|
+
title="Load query"
|
460
470
|
>
|
461
|
-
<
|
462
|
-
Load Query
|
463
|
-
</div>
|
471
|
+
<ManageSearchIcon className="query-editor__header__action__icon--loader" />
|
464
472
|
</button>
|
473
|
+
{editorStore.queryLoaderState.isQueryLoaderOpen && (
|
474
|
+
<QueryLoader
|
475
|
+
editorStore={editorStore}
|
476
|
+
applicationStore={applicationStore}
|
477
|
+
/>
|
478
|
+
)}
|
465
479
|
<button
|
466
|
-
className="query-editor__header__action
|
480
|
+
className="query-editor__header__action btn--dark"
|
467
481
|
tabIndex={-1}
|
468
482
|
title="View project"
|
469
483
|
onClick={viewQueryProject}
|
@@ -472,10 +486,10 @@ const QueryEditorHeaderContent = observer(
|
|
472
486
|
</button>
|
473
487
|
{applicationStore.config.options.TEMPORARY__enableThemeSwitcher && (
|
474
488
|
<button
|
475
|
-
className="query-editor__header__action
|
489
|
+
className="query-editor__header__action btn--dark"
|
476
490
|
tabIndex={-1}
|
477
|
-
title="Toggle
|
478
|
-
onClick={
|
491
|
+
title="Toggle light/dark mode"
|
492
|
+
onClick={toggleLightDarkMode}
|
479
493
|
>
|
480
494
|
{applicationStore.TEMPORARY__isLightThemeEnabled ? (
|
481
495
|
<EmptyLightBulbIcon />
|
@@ -484,23 +498,15 @@ const QueryEditorHeaderContent = observer(
|
|
484
498
|
)}
|
485
499
|
</button>
|
486
500
|
)}
|
487
|
-
{editorStore.queryLoaderState.isQueryLoaderOpen && (
|
488
|
-
<QueryLoader
|
489
|
-
editorStore={editorStore}
|
490
|
-
applicationStore={applicationStore}
|
491
|
-
/>
|
492
|
-
)}
|
493
501
|
<button
|
494
502
|
className="query-editor__header__action btn--dark"
|
495
503
|
tabIndex={-1}
|
496
504
|
onClick={saveQuery}
|
505
|
+
title="Save query"
|
497
506
|
>
|
498
|
-
<
|
499
|
-
<SaveIcon />
|
500
|
-
<QueryExport />
|
501
|
-
</div>
|
502
|
-
<div className="query-editor__header__action__label">Save</div>
|
507
|
+
<SaveIcon />
|
503
508
|
</button>
|
509
|
+
{editorStore.exportState && <QueryExport />}
|
504
510
|
</div>
|
505
511
|
</div>
|
506
512
|
);
|
@@ -57,11 +57,7 @@ import {
|
|
57
57
|
export const TEST__LegendQueryBaseStoreProvider: React.FC<{
|
58
58
|
children: React.ReactNode;
|
59
59
|
}> = ({ children }) => (
|
60
|
-
<LegendQueryBaseStoreProvider
|
61
|
-
pluginManager={LegendQueryPluginManager.create()}
|
62
|
-
>
|
63
|
-
{children}
|
64
|
-
</LegendQueryBaseStoreProvider>
|
60
|
+
<LegendQueryBaseStoreProvider>{children}</LegendQueryBaseStoreProvider>
|
65
61
|
);
|
66
62
|
|
67
63
|
const TEST_QUERY_ID = 'test-query-id';
|
@@ -84,7 +80,6 @@ export const TEST__provideMockedQueryEditorStore = (customization?: {
|
|
84
80
|
pluginManager,
|
85
81
|
),
|
86
82
|
customization?.depotServerClient ?? TEST__getTestDepotServerClient(),
|
87
|
-
pluginManager,
|
88
83
|
TEST_QUERY_ID,
|
89
84
|
);
|
90
85
|
const MOCK__QueryEditorStoreProvider = require('./QueryEditorStoreProvider.js'); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
@@ -23,14 +23,9 @@ import {
|
|
23
23
|
ExistingQueryEditorStore,
|
24
24
|
ServiceQueryCreatorStore,
|
25
25
|
} from '../stores/QueryEditorStore.js';
|
26
|
-
import {
|
27
|
-
|
28
|
-
|
29
|
-
} from '@finos/legend-server-depot';
|
30
|
-
import {
|
31
|
-
useLegendQueryApplicationStore,
|
32
|
-
useLegendQueryBaseStore,
|
33
|
-
} from './LegendQueryBaseStoreProvider.js';
|
26
|
+
import { useDepotServerClient } from '@finos/legend-server-depot';
|
27
|
+
import { useLegendQueryApplicationStore } from './LegendQueryBaseStoreProvider.js';
|
28
|
+
import { parseGAVCoordinates } from '@finos/legend-storage';
|
34
29
|
|
35
30
|
export const QueryEditorStoreContext = createContext<
|
36
31
|
QueryEditorStore | undefined
|
@@ -42,13 +37,11 @@ export const ExistingQueryEditorStoreProvider: React.FC<{
|
|
42
37
|
}> = ({ children, queryId }) => {
|
43
38
|
const applicationStore = useLegendQueryApplicationStore();
|
44
39
|
const depotServerClient = useDepotServerClient();
|
45
|
-
const baseStore = useLegendQueryBaseStore();
|
46
40
|
const store = useLocalObservable(
|
47
41
|
() =>
|
48
42
|
new ExistingQueryEditorStore(
|
49
43
|
applicationStore,
|
50
44
|
depotServerClient,
|
51
|
-
baseStore.pluginManager,
|
52
45
|
queryId,
|
53
46
|
),
|
54
47
|
);
|
@@ -68,13 +61,11 @@ export const MappingQueryCreatorStoreProvider: React.FC<{
|
|
68
61
|
const { groupId, artifactId, versionId } = parseGAVCoordinates(gav);
|
69
62
|
const applicationStore = useLegendQueryApplicationStore();
|
70
63
|
const depotServerClient = useDepotServerClient();
|
71
|
-
const baseStore = useLegendQueryBaseStore();
|
72
64
|
const store = useLocalObservable(
|
73
65
|
() =>
|
74
66
|
new MappingQueryCreatorStore(
|
75
67
|
applicationStore,
|
76
68
|
depotServerClient,
|
77
|
-
baseStore.pluginManager,
|
78
69
|
groupId,
|
79
70
|
artifactId,
|
80
71
|
versionId,
|
@@ -98,13 +89,11 @@ export const ServiceQueryCreatorStoreProvider: React.FC<{
|
|
98
89
|
const { groupId, artifactId, versionId } = parseGAVCoordinates(gav);
|
99
90
|
const applicationStore = useLegendQueryApplicationStore();
|
100
91
|
const depotServerClient = useDepotServerClient();
|
101
|
-
const baseStore = useLegendQueryBaseStore();
|
102
92
|
const store = useLocalObservable(
|
103
93
|
() =>
|
104
94
|
new ServiceQueryCreatorStore(
|
105
95
|
applicationStore,
|
106
96
|
depotServerClient,
|
107
|
-
baseStore.pluginManager,
|
108
97
|
groupId,
|
109
98
|
artifactId,
|
110
99
|
versionId,
|