@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.
Files changed (68) hide show
  1. package/lib/application/LegendQuery.d.ts.map +1 -1
  2. package/lib/application/LegendQuery.js +1 -1
  3. package/lib/application/LegendQuery.js.map +1 -1
  4. package/lib/application/LegendQueryApplicationConfig.d.ts +6 -7
  5. package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
  6. package/lib/application/LegendQueryApplicationConfig.js +9 -4
  7. package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
  8. package/lib/components/LegendQueryApplication.d.ts +0 -2
  9. package/lib/components/LegendQueryApplication.d.ts.map +1 -1
  10. package/lib/components/LegendQueryApplication.js +2 -3
  11. package/lib/components/LegendQueryApplication.js.map +1 -1
  12. package/lib/components/LegendQueryBaseStoreProvider.d.ts +1 -3
  13. package/lib/components/LegendQueryBaseStoreProvider.d.ts.map +1 -1
  14. package/lib/components/LegendQueryBaseStoreProvider.js +2 -2
  15. package/lib/components/LegendQueryBaseStoreProvider.js.map +1 -1
  16. package/lib/components/QueryEditor.d.ts.map +1 -1
  17. package/lib/components/QueryEditor.js +29 -25
  18. package/lib/components/QueryEditor.js.map +1 -1
  19. package/lib/components/QueryEditorComponentTestUtils.d.ts.map +1 -1
  20. package/lib/components/QueryEditorComponentTestUtils.js +2 -2
  21. package/lib/components/QueryEditorComponentTestUtils.js.map +1 -1
  22. package/lib/components/QueryEditorStoreProvider.d.ts.map +1 -1
  23. package/lib/components/QueryEditorStoreProvider.js +6 -8
  24. package/lib/components/QueryEditorStoreProvider.js.map +1 -1
  25. package/lib/components/QuerySetup.d.ts +6 -0
  26. package/lib/components/QuerySetup.d.ts.map +1 -1
  27. package/lib/components/QuerySetup.js +99 -23
  28. package/lib/components/QuerySetup.js.map +1 -1
  29. package/lib/components/QuerySetupStoreProvider.d.ts.map +1 -1
  30. package/lib/components/QuerySetupStoreProvider.js +2 -3
  31. package/lib/components/QuerySetupStoreProvider.js.map +1 -1
  32. package/lib/index.css +2 -2
  33. package/lib/index.css.map +1 -1
  34. package/lib/package.json +4 -4
  35. package/lib/stores/LegendQueryBaseStore.d.ts +2 -3
  36. package/lib/stores/LegendQueryBaseStore.d.ts.map +1 -1
  37. package/lib/stores/LegendQueryBaseStore.js +2 -2
  38. package/lib/stores/LegendQueryBaseStore.js.map +1 -1
  39. package/lib/stores/LegendQueryRouter.d.ts +12 -1
  40. package/lib/stores/LegendQueryRouter.d.ts.map +1 -1
  41. package/lib/stores/LegendQueryRouter.js +13 -2
  42. package/lib/stores/LegendQueryRouter.js.map +1 -1
  43. package/lib/stores/QueryEditorStore.d.ts +10 -7
  44. package/lib/stores/QueryEditorStore.d.ts.map +1 -1
  45. package/lib/stores/QueryEditorStore.js +18 -11
  46. package/lib/stores/QueryEditorStore.js.map +1 -1
  47. package/lib/stores/QueryEditorStoreTestUtils.d.ts.map +1 -1
  48. package/lib/stores/QueryEditorStoreTestUtils.js +1 -0
  49. package/lib/stores/QueryEditorStoreTestUtils.js.map +1 -1
  50. package/lib/stores/QuerySetupStore.d.ts +17 -3
  51. package/lib/stores/QuerySetupStore.d.ts.map +1 -1
  52. package/lib/stores/QuerySetupStore.js +102 -11
  53. package/lib/stores/QuerySetupStore.js.map +1 -1
  54. package/package.json +12 -12
  55. package/src/application/LegendQuery.tsx +1 -4
  56. package/src/application/LegendQueryApplicationConfig.ts +30 -10
  57. package/src/components/LegendQueryApplication.tsx +3 -9
  58. package/src/components/LegendQueryBaseStoreProvider.tsx +4 -14
  59. package/src/components/QueryEditor.tsx +57 -51
  60. package/src/components/QueryEditorComponentTestUtils.tsx +1 -6
  61. package/src/components/QueryEditorStoreProvider.tsx +3 -14
  62. package/src/components/QuerySetup.tsx +232 -35
  63. package/src/components/QuerySetupStoreProvider.tsx +2 -11
  64. package/src/stores/LegendQueryBaseStore.ts +2 -4
  65. package/src/stores/LegendQueryRouter.ts +28 -2
  66. package/src/stores/QueryEditorStore.ts +18 -16
  67. package/src/stores/QueryEditorStoreTestUtils.ts +1 -0
  68. package/src/stores/QuerySetupStore.ts +149 -9
@@ -22,12 +22,14 @@ import {
22
22
  clsx,
23
23
  CustomSelectorInput,
24
24
  PanelLoadingIndicator,
25
- PencilIcon,
26
25
  PlusIcon,
27
26
  RobotIcon,
28
27
  SearchIcon,
29
28
  UserIcon,
30
29
  QuestionCircleIcon,
30
+ DroidIcon,
31
+ createFilter,
32
+ ManageSearchIcon,
31
33
  } from '@finos/legend-art';
32
34
  import {
33
35
  debounce,
@@ -47,7 +49,9 @@ import {
47
49
  type ServiceExecutionOption,
48
50
  CreateMappingQuerySetupState,
49
51
  EditExistingQuerySetupState,
50
- LoadServiceQuerySetupState,
52
+ CloneServiceQuerySetupState,
53
+ UpdateExistingServiceQuerySetupState,
54
+ LoadProjectServiceQuerySetupState,
51
55
  } from '../stores/QuerySetupStore.js';
52
56
  import {
53
57
  useQuerySetupStore,
@@ -57,8 +61,8 @@ import {
57
61
  type ProjectData,
58
62
  LATEST_VERSION_ALIAS,
59
63
  SNAPSHOT_VERSION_ALIAS,
60
- compareSemVerVersions,
61
64
  } from '@finos/legend-server-depot';
65
+ import { compareSemVerVersions } from '@finos/legend-storage';
62
66
  import type {
63
67
  LightQuery,
64
68
  Mapping,
@@ -69,6 +73,12 @@ import {
69
73
  useApplicationStore,
70
74
  buildElementOption,
71
75
  } from '@finos/legend-application';
76
+ import {
77
+ type ServiceOption,
78
+ buildServiceOption,
79
+ formatServiceOptionLabel,
80
+ } from '@finos/legend-query-builder';
81
+ import { useLegendQueryApplicationStore } from './LegendQueryBaseStoreProvider.js';
72
82
 
73
83
  type QueryOption = { label: string; value: LightQuery };
74
84
  const buildQueryOption = (query: LightQuery): QueryOption => ({
@@ -85,7 +95,6 @@ const EditExistingQuerySetup = observer(
85
95
  const [searchText, setSearchText] = useState('');
86
96
  const back = (): void => {
87
97
  setupStore.setSetupState(undefined);
88
- querySetupState.setCurrentQuery(undefined);
89
98
  };
90
99
  const next = (): void => {
91
100
  if (querySetupState.currentQuery) {
@@ -97,16 +106,6 @@ const EditExistingQuerySetup = observer(
97
106
  };
98
107
  const canProceed = querySetupState.currentQuery;
99
108
 
100
- // show current user queries only
101
- const toggleShowCurrentUserQueriesOnly = (): void => {
102
- querySetupState.setShowCurrentUserQueriesOnly(
103
- !querySetupState.showCurrentUserQueriesOnly,
104
- );
105
- flowResult(querySetupState.loadQueries(searchText)).catch(
106
- applicationStore.alertUnhandledError,
107
- );
108
- };
109
-
110
109
  // query
111
110
  const queryOptions = querySetupState.queries.map(buildQueryOption);
112
111
  const selectedQueryOption = querySetupState.currentQuery
@@ -185,6 +184,15 @@ const EditExistingQuerySetup = observer(
185
184
  }
186
185
  };
187
186
 
187
+ // show current user queries only
188
+ const toggleShowCurrentUserQueriesOnly = (): void => {
189
+ querySetupState.setShowCurrentUserQueriesOnly(
190
+ !querySetupState.showCurrentUserQueriesOnly,
191
+ );
192
+ debouncedLoadQueries.cancel();
193
+ debouncedLoadQueries(searchText);
194
+ };
195
+
188
196
  useEffect(() => {
189
197
  flowResult(querySetupState.loadQueries('')).catch(
190
198
  applicationStore.alertUnhandledError,
@@ -214,7 +222,7 @@ const EditExistingQuerySetup = observer(
214
222
  })}
215
223
  onClick={next}
216
224
  disabled={!canProceed}
217
- title="Proceed"
225
+ title="Edit query"
218
226
  >
219
227
  <ArrowRightIcon />
220
228
  </button>
@@ -261,6 +269,101 @@ const EditExistingQuerySetup = observer(
261
269
  },
262
270
  );
263
271
 
272
+ export const UpdateExistingServiceQuerySetup = observer(
273
+ (props: { querySetupState: UpdateExistingServiceQuerySetupState }) => {
274
+ const { querySetupState } = props;
275
+ const applicationStore = useLegendQueryApplicationStore();
276
+ const setupStore = useQuerySetupStore();
277
+ const serviceSearchRef = useRef<SelectComponent>(null);
278
+ const [searchText, setSearchText] = useState('');
279
+
280
+ const back = (): void => {
281
+ setupStore.setSetupState(undefined);
282
+ };
283
+
284
+ const serviceOptions = querySetupState.services.map(buildServiceOption);
285
+ const onServiceOptionChange = (option: ServiceOption): void => {
286
+ querySetupState
287
+ .loadServiceUpdater(option.value)
288
+ .catch(applicationStore.alertUnhandledError);
289
+ };
290
+ const serviceFilterOption = createFilter({
291
+ ignoreCase: true,
292
+ ignoreAccents: false,
293
+ stringify: (option: ServiceOption): string =>
294
+ // NOTE: account for label, path, and URL pattern
295
+ `${option.label} - ${option.value.urlPattern ?? ''} - ${
296
+ option.value.path
297
+ }`,
298
+ });
299
+
300
+ // search text
301
+ const debouncedLoadServices = useMemo(
302
+ () =>
303
+ debounce((input: string): void => {
304
+ flowResult(querySetupState.loadServices(input)).catch(
305
+ applicationStore.alertUnhandledError,
306
+ );
307
+ }, 500),
308
+ [applicationStore, querySetupState],
309
+ );
310
+ const onSearchTextChange = (value: string): void => {
311
+ if (value !== searchText) {
312
+ setSearchText(value);
313
+ debouncedLoadServices.cancel();
314
+ debouncedLoadServices(value);
315
+ }
316
+ };
317
+
318
+ useEffect(() => {
319
+ flowResult(querySetupState.loadServices('')).catch(
320
+ applicationStore.alertUnhandledError,
321
+ );
322
+ }, [querySetupState, applicationStore]);
323
+
324
+ useEffect(() => {
325
+ serviceSearchRef.current?.focus();
326
+ }, []);
327
+
328
+ return (
329
+ <div className="query-setup__wizard query-setup__existing-service-query">
330
+ <div className="query-setup__wizard__header query-setup__existing-service-query__header">
331
+ <button
332
+ className="query-setup__wizard__header__btn"
333
+ onClick={back}
334
+ title="Back to Main Menu"
335
+ >
336
+ <ArrowLeftIcon />
337
+ </button>
338
+ <div className="query-setup__wizard__header__title">
339
+ Updating an existing service query...
340
+ </div>
341
+ </div>
342
+ <div className="query-setup__wizard__content">
343
+ <div className="query-setup__wizard__group query-setup__wizard__group--inline query-setup__existing-service-query__search-bar">
344
+ <div className="query-setup__wizard__group__title">
345
+ <SearchIcon />
346
+ </div>
347
+ <CustomSelectorInput
348
+ ref={serviceSearchRef}
349
+ className="query-setup__wizard__selector"
350
+ options={serviceOptions}
351
+ isLoading={querySetupState.loadServicesState.isInProgress}
352
+ onInputChange={onSearchTextChange}
353
+ inputValue={searchText}
354
+ onChange={onServiceOptionChange}
355
+ placeholder="Search for service..."
356
+ darkMode={true}
357
+ filterOption={serviceFilterOption}
358
+ formatOptionLabel={formatServiceOptionLabel}
359
+ />
360
+ </div>
361
+ </div>
362
+ </div>
363
+ );
364
+ },
365
+ );
366
+
264
367
  type ProjectOption = { label: string; value: ProjectData };
265
368
  const buildProjectOption = (project: ProjectData): ProjectOption => ({
266
369
  label: `${project.groupId}.${project.artifactId}`,
@@ -273,15 +376,79 @@ const buildVersionOption = (version: string): VersionOption => ({
273
376
  value: version,
274
377
  });
275
378
 
276
- const LoadServiceQuerySetup = observer(
277
- (props: { querySetupState: LoadServiceQuerySetupState }) => {
379
+ const LoadProjectServiceQuerySetup = observer(
380
+ (props: { querySetupState: LoadProjectServiceQuerySetupState }) => {
381
+ const { querySetupState } = props;
382
+ const applicationStore = useApplicationStore();
383
+ const setupStore = useQuerySetupStore();
384
+ const back = (): void => {
385
+ setupStore.setSetupState(undefined);
386
+ };
387
+
388
+ // project
389
+ const projectOptions = querySetupState.projects.map(buildProjectOption);
390
+ const projectSelectorPlaceholder = querySetupState.loadProjectsState
391
+ .isInProgress
392
+ ? 'Loading projects'
393
+ : querySetupState.loadProjectsState.hasFailed
394
+ ? 'Error fetching projects'
395
+ : querySetupState.projects.length
396
+ ? 'Choose a project'
397
+ : 'You have no projects, please create or acquire access for at least one';
398
+ const onProjectOptionChange = (option: ProjectOption): void => {
399
+ querySetupState
400
+ .loadProjectServiceUpdater(option.value)
401
+ .catch(applicationStore.alertUnhandledError);
402
+ };
403
+
404
+ useEffect(() => {
405
+ flowResult(querySetupState.loadProjects()).catch(
406
+ applicationStore.alertUnhandledError,
407
+ );
408
+ }, [querySetupState, applicationStore]);
409
+
410
+ return (
411
+ <div className="query-setup__wizard query-setup__existing-service-query">
412
+ <div className="query-setup__wizard__header query-setup__service-query__header">
413
+ <button
414
+ className="query-setup__wizard__header__btn"
415
+ onClick={back}
416
+ title="Back to Main Menu"
417
+ >
418
+ <ArrowLeftIcon />
419
+ </button>
420
+ <div className="query-setup__wizard__header__title">
421
+ Load service query from a project...
422
+ </div>
423
+ </div>
424
+ <div className="query-setup__wizard__content">
425
+ <div className="query-setup__wizard__group query-setup__wizard__group--inline query-setup__existing-service-query__search-bar">
426
+ <CustomSelectorInput
427
+ className="query-setup__wizard__selector"
428
+ options={projectOptions}
429
+ disabled={
430
+ querySetupState.loadProjectsState.isInProgress ||
431
+ !projectOptions.length
432
+ }
433
+ isLoading={querySetupState.loadProjectsState.isInProgress}
434
+ onChange={onProjectOptionChange}
435
+ placeholder={projectSelectorPlaceholder}
436
+ darkMode={true}
437
+ />
438
+ </div>
439
+ </div>
440
+ </div>
441
+ );
442
+ },
443
+ );
444
+
445
+ const CloneServiceQuerySetup = observer(
446
+ (props: { querySetupState: CloneServiceQuerySetupState }) => {
278
447
  const { querySetupState } = props;
279
448
  const applicationStore = useApplicationStore();
280
449
  const setupStore = useQuerySetupStore();
281
450
  const back = (): void => {
282
451
  setupStore.setSetupState(undefined);
283
- querySetupState.setCurrentVersionId(undefined);
284
- querySetupState.setCurrentProject(undefined);
285
452
  };
286
453
  const next = (): void => {
287
454
  if (
@@ -412,7 +579,7 @@ const LoadServiceQuerySetup = observer(
412
579
  <ArrowLeftIcon />
413
580
  </button>
414
581
  <div className="query-setup__wizard__header__title">
415
- Loading a service query...
582
+ Clone an existing service query...
416
583
  </div>
417
584
  <button
418
585
  className={clsx('query-setup__wizard__header__btn', {
@@ -420,7 +587,7 @@ const LoadServiceQuerySetup = observer(
420
587
  })}
421
588
  onClick={next}
422
589
  disabled={!canProceed}
423
- title="Proceed"
590
+ title="Create a new query"
424
591
  >
425
592
  <ArrowRightIcon />
426
593
  </button>
@@ -517,8 +684,6 @@ const CreateMappingQuerySetup = observer(
517
684
  const setupStore = useQuerySetupStore();
518
685
  const back = (): void => {
519
686
  setupStore.setSetupState(undefined);
520
- querySetupState.setCurrentVersionId(undefined);
521
- querySetupState.setCurrentProject(undefined);
522
687
  };
523
688
  const next = (): void => {
524
689
  if (
@@ -678,7 +843,7 @@ const CreateMappingQuerySetup = observer(
678
843
  })}
679
844
  onClick={next}
680
845
  disabled={!canProceed}
681
- title="Proceed"
846
+ title="Create a new query"
682
847
  >
683
848
  <ArrowRightIcon />
684
849
  </button>
@@ -806,10 +971,16 @@ const QuerySetupLandingPage = observer(() => {
806
971
  ));
807
972
  const editQuery = (): void =>
808
973
  setupStore.setSetupState(new EditExistingQuerySetupState(setupStore));
809
- const loadServiceQuery = (): void =>
810
- setupStore.setSetupState(new LoadServiceQuerySetupState(setupStore));
974
+ const updateServiceQuery = (): void =>
975
+ setupStore.setSetupState(
976
+ new UpdateExistingServiceQuerySetupState(setupStore),
977
+ );
978
+ const cloneServiceQuery = (): void =>
979
+ setupStore.setSetupState(new CloneServiceQuerySetupState(setupStore));
811
980
  const createMappingQuery = (): void =>
812
981
  setupStore.setSetupState(new CreateMappingQuerySetupState(setupStore));
982
+ const loadServiceQueryFromProject = (): void =>
983
+ setupStore.setSetupState(new LoadProjectServiceQuerySetupState(setupStore));
813
984
 
814
985
  useEffect(() => {
815
986
  setupStore.initialize();
@@ -834,33 +1005,55 @@ const QuerySetupLandingPage = observer(() => {
834
1005
  onClick={editQuery}
835
1006
  >
836
1007
  <div className="query-setup__landing-page__option__icon">
837
- <PencilIcon className="query-setup__landing-page__icon--edit" />
1008
+ <ManageSearchIcon className="query-setup__landing-page__icon--search" />
838
1009
  </div>
839
1010
  <div className="query-setup__landing-page__option__label">
840
1011
  Load an existing query
841
1012
  </div>
842
1013
  </button>
843
1014
  {extraQuerySetupOptions}
1015
+ <button
1016
+ className="query-setup__landing-page__option query-setup__landing-page__option--advanced query-setup__landing-page__option--create-query"
1017
+ onClick={createMappingQuery}
1018
+ >
1019
+ <div className="query-setup__landing-page__option__icon">
1020
+ <PlusIcon />
1021
+ </div>
1022
+ <div className="query-setup__landing-page__option__label">
1023
+ Create new query on a mapping
1024
+ </div>
1025
+ </button>
844
1026
  <button
845
1027
  className="query-setup__landing-page__option query-setup__landing-page__option--advanced query-setup__landing-page__option--service-query"
846
- onClick={loadServiceQuery}
1028
+ onClick={cloneServiceQuery}
847
1029
  >
848
1030
  <div className="query-setup__landing-page__option__icon">
849
1031
  <RobotIcon />
850
1032
  </div>
851
1033
  <div className="query-setup__landing-page__option__label">
852
- Load query from a service
1034
+ Clone an existing service query
853
1035
  </div>
854
1036
  </button>
855
1037
  <button
856
- className="query-setup__landing-page__option query-setup__landing-page__option--advanced query-setup__landing-page__option--create-query"
857
- onClick={createMappingQuery}
1038
+ className="query-setup__landing-page__option query-setup__landing-page__option--advanced query-setup__landing-page__option--service-query"
1039
+ onClick={updateServiceQuery}
858
1040
  >
859
1041
  <div className="query-setup__landing-page__option__icon">
860
- <PlusIcon />
1042
+ <DroidIcon />
861
1043
  </div>
862
1044
  <div className="query-setup__landing-page__option__label">
863
- Create new query on a mapping
1045
+ Update an existing service query
1046
+ </div>
1047
+ </button>
1048
+ <button
1049
+ className="query-setup__landing-page__option query-setup__landing-page__option--advanced query-setup__landing-page__option--service-query"
1050
+ onClick={loadServiceQueryFromProject}
1051
+ >
1052
+ <div className="query-setup__landing-page__option__icon">
1053
+ <DroidIcon />
1054
+ </div>
1055
+ <div className="query-setup__landing-page__option__label">
1056
+ Load service query from a project
864
1057
  </div>
865
1058
  </button>
866
1059
  </div>
@@ -880,10 +1073,14 @@ export const QuerySetup = withQuerySetupStore(
880
1073
  ): React.ReactNode => {
881
1074
  if (setupState instanceof EditExistingQuerySetupState) {
882
1075
  return <EditExistingQuerySetup querySetupState={setupState} />;
883
- } else if (setupState instanceof LoadServiceQuerySetupState) {
884
- return <LoadServiceQuerySetup querySetupState={setupState} />;
885
1076
  } else if (setupState instanceof CreateMappingQuerySetupState) {
886
1077
  return <CreateMappingQuerySetup querySetupState={setupState} />;
1078
+ } else if (setupState instanceof CloneServiceQuerySetupState) {
1079
+ return <CloneServiceQuerySetup querySetupState={setupState} />;
1080
+ } else if (setupState instanceof UpdateExistingServiceQuerySetupState) {
1081
+ return <UpdateExistingServiceQuerySetup querySetupState={setupState} />;
1082
+ } else if (setupState instanceof LoadProjectServiceQuerySetupState) {
1083
+ return <LoadProjectServiceQuerySetup querySetupState={setupState} />;
887
1084
  }
888
1085
  const extraQuerySetupRenderers = setupStore.pluginManager
889
1086
  .getApplicationPlugins()
@@ -19,10 +19,7 @@ import { useLocalObservable } from 'mobx-react-lite';
19
19
  import { QuerySetupStore } from '../stores/QuerySetupStore.js';
20
20
  import { guaranteeNonNullable } from '@finos/legend-shared';
21
21
  import { useDepotServerClient } from '@finos/legend-server-depot';
22
- import {
23
- useLegendQueryApplicationStore,
24
- useLegendQueryBaseStore,
25
- } from './LegendQueryBaseStoreProvider.js';
22
+ import { useLegendQueryApplicationStore } from './LegendQueryBaseStoreProvider.js';
26
23
 
27
24
  const QuerySetupStoreContext = createContext<QuerySetupStore | undefined>(
28
25
  undefined,
@@ -33,14 +30,8 @@ export const QuerySetupStoreProvider: React.FC<{
33
30
  }> = ({ children }) => {
34
31
  const applicationStore = useLegendQueryApplicationStore();
35
32
  const depotServerClient = useDepotServerClient();
36
- const baseStore = useLegendQueryBaseStore();
37
33
  const store = useLocalObservable(
38
- () =>
39
- new QuerySetupStore(
40
- applicationStore,
41
- depotServerClient,
42
- baseStore.pluginManager,
43
- ),
34
+ () => new QuerySetupStore(applicationStore, depotServerClient),
44
35
  );
45
36
  return (
46
37
  <QuerySetupStoreContext.Provider value={store}>
@@ -18,11 +18,10 @@ import type { DepotServerClient } from '@finos/legend-server-depot';
18
18
  import type { ApplicationStore } from '@finos/legend-application';
19
19
  import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
20
20
  import type { LegendQueryApplicationConfig } from '../application/LegendQueryApplicationConfig.js';
21
- import type { LegendQueryApplicationPlugin } from './LegendQueryApplicationPlugin.js';
22
21
 
23
22
  export type LegendQueryApplicationStore = ApplicationStore<
24
23
  LegendQueryApplicationConfig,
25
- LegendQueryApplicationPlugin
24
+ LegendQueryPluginManager
26
25
  >;
27
26
 
28
27
  export class LegendQueryBaseStore {
@@ -33,11 +32,10 @@ export class LegendQueryBaseStore {
33
32
  constructor(
34
33
  applicationStore: LegendQueryApplicationStore,
35
34
  depotServerClient: DepotServerClient,
36
- pluginManager: LegendQueryPluginManager,
37
35
  ) {
38
36
  this.applicationStore = applicationStore;
39
37
  this.depotServerClient = depotServerClient;
40
- this.pluginManager = pluginManager;
38
+ this.pluginManager = applicationStore.pluginManager;
41
39
 
42
40
  // Register plugins
43
41
  this.depotServerClient.setTracerService(
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { generateGAVCoordinates } from '@finos/legend-server-depot';
17
+ import { generateGAVCoordinates } from '@finos/legend-storage';
18
18
  import { generatePath } from 'react-router';
19
19
 
20
20
  export enum LEGEND_QUERY_PATH_PARAM_TOKEN {
@@ -95,7 +95,10 @@ export interface ExistingQueryEditorPathParams {
95
95
  [LEGEND_QUERY_PATH_PARAM_TOKEN.QUERY_ID]: string;
96
96
  }
97
97
 
98
- export const generateStudioProjectViewUrl = (
98
+ /**
99
+ * @external_application_navigation This depends on Legend Studio routing and is hardcoded so it's potentially brittle
100
+ */
101
+ export const EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl = (
99
102
  studioUrl: string,
100
103
  groupId: string,
101
104
  artifactId: string,
@@ -107,3 +110,26 @@ export const generateStudioProjectViewUrl = (
107
110
  artifactId,
108
111
  versionId,
109
112
  )}${entityPath ? `/entity/${entityPath}` : ''}`;
113
+
114
+ /**
115
+ * @external_application_navigation This depends on Legend Studio routing and is hardcoded so it's potentially brittle
116
+ */
117
+ export const EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateExistingServiceQueryUrl =
118
+ (
119
+ studioUrl: string,
120
+ groupId: string,
121
+ artifactId: string,
122
+ servicePath: string,
123
+ ): string =>
124
+ `${studioUrl}/extensions/update-service-query/${servicePath}@${generateGAVCoordinates(
125
+ groupId,
126
+ artifactId,
127
+ undefined,
128
+ )}`;
129
+
130
+ /**
131
+ * @external_application_navigation This depends on Legend Studio routing and is hardcoded so it's potentially brittle
132
+ */
133
+ export const EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateProjectServiceQueryUrl =
134
+ (studioUrl: string, projectId: string): string =>
135
+ `${studioUrl}/extensions/update-project-service-query/${projectId}`;
@@ -57,10 +57,9 @@ import {
57
57
  generateServiceQueryCreatorRoute,
58
58
  } from './LegendQueryRouter.js';
59
59
  import { LEGEND_QUERY_APP_EVENT } from '../LegendQueryAppEvent.js';
60
- import type { Entity } from '@finos/legend-storage';
60
+ import type { Entity, ProjectGAVCoordinates } from '@finos/legend-storage';
61
61
  import {
62
62
  type DepotServerClient,
63
- type ProjectGAVCoordinates,
64
63
  ProjectData,
65
64
  } from '@finos/legend-server-depot';
66
65
  import { TAB_SIZE, APPLICATION_EVENT } from '@finos/legend-application';
@@ -204,18 +203,20 @@ export class QueryExportState {
204
203
  }
205
204
 
206
205
  export class QueryLoaderState {
207
- editorStore: QueryEditorStore;
208
- isQueryLoaderOpen = false;
206
+ readonly editorStore: QueryEditorStore;
209
207
  loadQueriesState = ActionState.create();
210
208
  queries: LightQuery[] = [];
209
+ isQueryLoaderOpen = false;
210
+ showCurrentUserQueriesOnly = false;
211
211
 
212
212
  constructor(editorStore: QueryEditorStore) {
213
213
  makeObservable(this, {
214
214
  isQueryLoaderOpen: observable,
215
215
  queries: observable,
216
- loadQueriesState: observable,
216
+ showCurrentUserQueriesOnly: observable,
217
217
  setIsQueryLoaderOpen: action,
218
218
  setQueries: action,
219
+ setShowCurrentUserQueriesOnly: action,
219
220
  loadQueries: flow,
220
221
  });
221
222
  this.editorStore = editorStore;
@@ -229,6 +230,10 @@ export class QueryLoaderState {
229
230
  this.queries = val;
230
231
  }
231
232
 
233
+ setShowCurrentUserQueriesOnly(val: boolean): void {
234
+ this.showCurrentUserQueriesOnly = val;
235
+ }
236
+
232
237
  *loadQueries(searchText: string): GeneratorFn<void> {
233
238
  const isValidSearchString =
234
239
  searchText.length >= QUERY_BUILDER_SEARCH_TEXT_MIN_LENGTH;
@@ -239,6 +244,8 @@ export class QueryLoaderState {
239
244
  ? searchText
240
245
  : undefined;
241
246
  searchSpecification.limit = QUERY_BUILDER_QUERY_LOAD_MAX_AMOUNT;
247
+ searchSpecification.showCurrentUserQueriesOnly =
248
+ this.showCurrentUserQueriesOnly;
242
249
  this.queries =
243
250
  (yield this.editorStore.graphManagerState.graphManager.searchQueries(
244
251
  searchSpecification,
@@ -266,7 +273,6 @@ export abstract class QueryEditorStore {
266
273
  constructor(
267
274
  applicationStore: LegendQueryApplicationStore,
268
275
  depotServerClient: DepotServerClient,
269
- pluginManager: LegendQueryPluginManager,
270
276
  ) {
271
277
  makeObservable(this, {
272
278
  exportState: observable,
@@ -278,10 +284,10 @@ export abstract class QueryEditorStore {
278
284
 
279
285
  this.applicationStore = applicationStore;
280
286
  this.depotServerClient = depotServerClient;
281
- this.pluginManager = pluginManager;
287
+ this.pluginManager = applicationStore.pluginManager;
282
288
  this.graphManagerState = new GraphManagerState(
283
- this.pluginManager,
284
- this.applicationStore.log,
289
+ applicationStore.pluginManager,
290
+ applicationStore.log,
285
291
  );
286
292
  this.queryLoaderState = new QueryLoaderState(this);
287
293
  }
@@ -458,14 +464,13 @@ export class MappingQueryCreatorStore extends QueryEditorStore {
458
464
  constructor(
459
465
  applicationStore: LegendQueryApplicationStore,
460
466
  depotServerClient: DepotServerClient,
461
- pluginManager: LegendQueryPluginManager,
462
467
  groupId: string,
463
468
  artifactId: string,
464
469
  versionId: string,
465
470
  mappingPath: string,
466
471
  runtimePath: string,
467
472
  ) {
468
- super(applicationStore, depotServerClient, pluginManager);
473
+ super(applicationStore, depotServerClient);
469
474
 
470
475
  this.groupId = groupId;
471
476
  this.artifactId = artifactId;
@@ -521,7 +526,6 @@ export class MappingQueryCreatorStore extends QueryEditorStore {
521
526
  ),
522
527
  ),
523
528
  );
524
-
525
529
  return queryBuilderState;
526
530
  }
527
531
 
@@ -547,14 +551,13 @@ export class ServiceQueryCreatorStore extends QueryEditorStore {
547
551
  constructor(
548
552
  applicationStore: LegendQueryApplicationStore,
549
553
  depotServerClient: DepotServerClient,
550
- pluginManager: LegendQueryPluginManager,
551
554
  groupId: string,
552
555
  artifactId: string,
553
556
  versionId: string,
554
557
  servicePath: string,
555
558
  executionKey: string | undefined,
556
559
  ) {
557
- super(applicationStore, depotServerClient, pluginManager);
560
+ super(applicationStore, depotServerClient);
558
561
 
559
562
  this.groupId = groupId;
560
563
  this.artifactId = artifactId;
@@ -625,10 +628,9 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
625
628
  constructor(
626
629
  applicationStore: LegendQueryApplicationStore,
627
630
  depotServerClient: DepotServerClient,
628
- pluginManager: LegendQueryPluginManager,
629
631
  queryId: string,
630
632
  ) {
631
- super(applicationStore, depotServerClient, pluginManager);
633
+ super(applicationStore, depotServerClient);
632
634
 
633
635
  makeObservable<ExistingQueryEditorStore, '_query'>(this, {
634
636
  _query: observable,
@@ -28,6 +28,7 @@ const TEST_DATA__appConfig = {
28
28
  },
29
29
  studio: {
30
30
  url: 'http://testStudioUrl',
31
+ instances: [],
31
32
  },
32
33
  };
33
34