@finos/legend-application-query 13.8.39 → 13.8.41

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 (54) hide show
  1. package/lib/__lib__/LegendQueryEvent.d.ts +0 -1
  2. package/lib/__lib__/LegendQueryEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendQueryEvent.js +0 -1
  4. package/lib/__lib__/LegendQueryEvent.js.map +1 -1
  5. package/lib/__lib__/LegendQueryNavigation.d.ts +6 -2
  6. package/lib/__lib__/LegendQueryNavigation.d.ts.map +1 -1
  7. package/lib/__lib__/LegendQueryNavigation.js +24 -3
  8. package/lib/__lib__/LegendQueryNavigation.js.map +1 -1
  9. package/lib/__lib__/LegendQueryTelemetryHelper.d.ts +0 -1
  10. package/lib/__lib__/LegendQueryTelemetryHelper.d.ts.map +1 -1
  11. package/lib/__lib__/LegendQueryTelemetryHelper.js +0 -3
  12. package/lib/__lib__/LegendQueryTelemetryHelper.js.map +1 -1
  13. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
  14. package/lib/components/Core_LegendQueryApplicationPlugin.js +24 -1
  15. package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
  16. package/lib/components/QueryEditor.d.ts.map +1 -1
  17. package/lib/components/QueryEditor.js +12 -22
  18. package/lib/components/QueryEditor.js.map +1 -1
  19. package/lib/components/QueryEditorStoreProvider.d.ts +1 -0
  20. package/lib/components/QueryEditorStoreProvider.d.ts.map +1 -1
  21. package/lib/components/QueryEditorStoreProvider.js +2 -2
  22. package/lib/components/QueryEditorStoreProvider.js.map +1 -1
  23. package/lib/components/data-space/DataSpaceQuerySetup.d.ts.map +1 -1
  24. package/lib/components/data-space/DataSpaceQuerySetup.js +0 -1
  25. package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
  26. package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.d.ts.map +1 -1
  27. package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.js +0 -2
  28. package/lib/components/data-space/LegendQueryDataSpaceQueryBuilder.js.map +1 -1
  29. package/lib/components/utils/QueryParameterUtils.d.ts +6 -0
  30. package/lib/components/utils/QueryParameterUtils.d.ts.map +1 -1
  31. package/lib/components/utils/QueryParameterUtils.js +11 -0
  32. package/lib/components/utils/QueryParameterUtils.js.map +1 -1
  33. package/lib/index.css +1 -1
  34. package/lib/light-mode.css +1 -1
  35. package/lib/package.json +1 -1
  36. package/lib/stores/EditExistingQuerySetupStore.d.ts.map +1 -1
  37. package/lib/stores/EditExistingQuerySetupStore.js +2 -2
  38. package/lib/stores/EditExistingQuerySetupStore.js.map +1 -1
  39. package/lib/stores/QueryEditorStore.d.ts +12 -1
  40. package/lib/stores/QueryEditorStore.d.ts.map +1 -1
  41. package/lib/stores/QueryEditorStore.js +45 -7
  42. package/lib/stores/QueryEditorStore.js.map +1 -1
  43. package/package.json +10 -10
  44. package/src/__lib__/LegendQueryEvent.ts +0 -1
  45. package/src/__lib__/LegendQueryNavigation.ts +29 -2
  46. package/src/__lib__/LegendQueryTelemetryHelper.ts +0 -4
  47. package/src/components/Core_LegendQueryApplicationPlugin.tsx +31 -0
  48. package/src/components/QueryEditor.tsx +24 -38
  49. package/src/components/QueryEditorStoreProvider.tsx +3 -1
  50. package/src/components/data-space/DataSpaceQuerySetup.tsx +0 -1
  51. package/src/components/data-space/LegendQueryDataSpaceQueryBuilder.tsx +0 -2
  52. package/src/components/utils/QueryParameterUtils.ts +17 -0
  53. package/src/stores/EditExistingQuerySetupStore.ts +5 -2
  54. package/src/stores/QueryEditorStore.ts +65 -3
@@ -165,7 +165,10 @@ import {
165
165
  LakehouseContractServerClient,
166
166
  LakehouseEnvironmentType,
167
167
  } from '@finos/legend-server-lakehouse';
168
- import { processQueryParameters } from '../components/utils/QueryParameterUtils.js';
168
+ import {
169
+ buildQueryParamsFromParameterValues,
170
+ processQueryParameters,
171
+ } from '../components/utils/QueryParameterUtils.js';
169
172
 
170
173
  export interface QueryPersistConfiguration {
171
174
  defaultName?: string | undefined;
@@ -376,12 +379,24 @@ export abstract class QueryEditorStore {
376
379
  applicationStore,
377
380
  this.graphManagerState.graphManager,
378
381
  {
379
- loadQuery: (query: LightQuery): void => {
382
+ loadQuery: (
383
+ query: LightQuery,
384
+ revisionId?: string | undefined,
385
+ ): void => {
386
+ // carry any active parameter-value overrides across the navigation so
387
+ // a revert/load-revision keeps the values the user currently has set
388
+ const extraQueryParams = buildQueryParamsFromParameterValues(
389
+ this.getPreservedParameterOverrides(),
390
+ );
380
391
  this.queryBuilderState?.changeDetectionState.alertUnsavedChanges(
381
392
  () => {
382
393
  this.queryLoaderState.setQueryLoaderDialogOpen(false);
383
394
  applicationStore.navigationService.navigator.goToLocation(
384
- generateExistingQueryEditorRoute(query.id),
395
+ generateExistingQueryEditorRoute(
396
+ query.id,
397
+ revisionId,
398
+ extraQueryParams,
399
+ ),
385
400
  { ignoreBlocking: true },
386
401
  );
387
402
  },
@@ -447,6 +462,16 @@ export abstract class QueryEditorStore {
447
462
  return true;
448
463
  }
449
464
 
465
+ /**
466
+ * Parameter-value overrides (raw `p:` values, keyed by parameter name) that
467
+ * should be carried across a revert/load-revision navigation so the values
468
+ * the user currently has set are preserved. Only existing-query editors have
469
+ * these; other editor kinds return `undefined`.
470
+ */
471
+ getPreservedParameterOverrides(): Record<string, string> | undefined {
472
+ return undefined;
473
+ }
474
+
450
475
  setExistingQueryName(val: string | undefined): void {
451
476
  this.existingQueryName = val;
452
477
  }
@@ -1800,6 +1825,11 @@ export class ExistingQueryUpdateState {
1800
1825
  }
1801
1826
  }
1802
1827
 
1828
+ /**
1829
+ * Manages the query's version history: fetching the list of revisions and
1830
+ * navigating to a chosen revision. A revision is keyed by its `version`
1831
+ * identifier, which is passed as the `revisionId` route param.
1832
+ */
1803
1833
  const resolveExecutionContext = (
1804
1834
  dataSpace: DataSpace,
1805
1835
  ex: string | undefined,
@@ -1837,6 +1867,9 @@ const resolveExecutionContext = (
1837
1867
 
1838
1868
  export class ExistingQueryEditorStore extends QueryEditorStore {
1839
1869
  private queryId: string;
1870
+ // A specific revision from the query's version history to load, keyed by the
1871
+ // revision's `version` identifier. When undefined, the latest is loaded.
1872
+ readonly revisionId: string | undefined;
1840
1873
  private _lightQuery?: LightQuery | undefined;
1841
1874
  query: Query | undefined;
1842
1875
  queryInfo: QueryInfo | undefined;
@@ -1848,6 +1881,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1848
1881
  depotServerClient: DepotServerClient,
1849
1882
  queryId: string,
1850
1883
  urlQueryParamValues: Record<string, string> | undefined,
1884
+ revisionId?: string | undefined,
1851
1885
  ) {
1852
1886
  super(applicationStore, depotServerClient);
1853
1887
 
@@ -1864,10 +1898,29 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1864
1898
  });
1865
1899
 
1866
1900
  this.queryId = queryId;
1901
+ this.revisionId = revisionId;
1867
1902
  this.urlQueryParamValues = urlQueryParamValues;
1868
1903
  this.updateState = new ExistingQueryUpdateState(this);
1869
1904
  }
1870
1905
 
1906
+ get id(): string {
1907
+ return this.queryId;
1908
+ }
1909
+
1910
+ // Open the query version history in the query loader (the same viewer used by
1911
+ // "load query"), loading this query's revisions.
1912
+ showQueryVersionHistory(): void {
1913
+ if (this.query) {
1914
+ this.queryLoaderState.setQueryLoaderDialogOpen(true);
1915
+ // opened directly into history (not drilled in from the query list), so
1916
+ // there is no list to go back to
1917
+ this.queryLoaderState.setHistoryViewerStandalone(true);
1918
+ flowResult(this.queryLoaderState.getQueryHistory(this.lightQuery)).catch(
1919
+ this.applicationStore.alertUnhandledError,
1920
+ );
1921
+ }
1922
+ }
1923
+
1871
1924
  get lightQuery(): LightQuery {
1872
1925
  return guaranteeNonNullable(this._lightQuery, `Query has not been loaded`);
1873
1926
  }
@@ -1876,6 +1929,12 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1876
1929
  return generateExistingQueryEditorRoute(this.queryId);
1877
1930
  }
1878
1931
 
1932
+ override getPreservedParameterOverrides():
1933
+ | Record<string, string>
1934
+ | undefined {
1935
+ return this.urlQueryParamValues;
1936
+ }
1937
+
1879
1938
  override get isPerformingBlockingAction(): boolean {
1880
1939
  return (
1881
1940
  super.isPerformingBlockingAction ||
@@ -2001,6 +2060,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
2001
2060
  override async setUpEditorState(): Promise<void> {
2002
2061
  const queryInfo = await this.graphManagerState.graphManager.getQueryInfo(
2003
2062
  this.queryId,
2063
+ this.revisionId,
2004
2064
  );
2005
2065
  this.setLightQuery(
2006
2066
  await this.graphManagerState.graphManager.getLightQuery(this.queryId),
@@ -2333,6 +2393,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
2333
2393
  if (!queryInfo) {
2334
2394
  queryInfo = await this.graphManagerState.graphManager.getQueryInfo(
2335
2395
  this.queryId,
2396
+ this.revisionId,
2336
2397
  );
2337
2398
  }
2338
2399
  const queryBuilderState =
@@ -2344,6 +2405,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
2344
2405
  const query = await this.graphManagerState.graphManager.getQuery(
2345
2406
  this.queryId,
2346
2407
  this.graphManagerState.graph,
2408
+ this.revisionId,
2347
2409
  );
2348
2410
  this.setQuery(query);
2349
2411
  LegendQueryUserDataHelper.addRecentlyViewedQuery(