@finos/legend-application-marketplace 0.1.56 → 0.1.58

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 (56) hide show
  1. package/lib/__lib__/LegendMarketplaceAppEvent.d.ts +3 -1
  2. package/lib/__lib__/LegendMarketplaceAppEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendMarketplaceAppEvent.js +2 -0
  4. package/lib/__lib__/LegendMarketplaceAppEvent.js.map +1 -1
  5. package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts +13 -7
  6. package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts.map +1 -1
  7. package/lib/__lib__/LegendMarketplaceTelemetryHelper.js +61 -19
  8. package/lib/__lib__/LegendMarketplaceTelemetryHelper.js.map +1 -1
  9. package/lib/components/Header/LegendMarketplaceIconToolbar.d.ts.map +1 -1
  10. package/lib/components/Header/LegendMarketplaceIconToolbar.js +34 -5
  11. package/lib/components/Header/LegendMarketplaceIconToolbar.js.map +1 -1
  12. package/lib/components/SearchBar/LegendMarketplaceSearchBar.js +1 -1
  13. package/lib/index.css +2 -2
  14. package/lib/index.css.map +1 -1
  15. package/lib/package.json +1 -1
  16. package/lib/pages/Lakehouse/MarketplaceLakehouseHome.d.ts.map +1 -1
  17. package/lib/pages/Lakehouse/MarketplaceLakehouseHome.js +10 -21
  18. package/lib/pages/Lakehouse/MarketplaceLakehouseHome.js.map +1 -1
  19. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.d.ts.map +1 -1
  20. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js +23 -127
  21. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js.map +1 -1
  22. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.d.ts.map +1 -1
  23. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js +34 -158
  24. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js.map +1 -1
  25. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.d.ts.map +1 -1
  26. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js +58 -38
  27. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js.map +1 -1
  28. package/lib/stores/lakehouse/LegendMarketplaceSearchResultsStore.d.ts.map +1 -1
  29. package/lib/stores/lakehouse/LegendMarketplaceSearchResultsStore.js +7 -1
  30. package/lib/stores/lakehouse/LegendMarketplaceSearchResultsStore.js.map +1 -1
  31. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts +22 -11
  32. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts.map +1 -1
  33. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js +145 -74
  34. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js.map +1 -1
  35. package/lib/stores/orders/OrderHelpers.d.ts +1 -1
  36. package/lib/stores/orders/OrderHelpers.d.ts.map +1 -1
  37. package/lib/stores/orders/OrderHelpers.js +7 -6
  38. package/lib/stores/orders/OrderHelpers.js.map +1 -1
  39. package/lib/utils/EntitlementsUtils.d.ts +20 -0
  40. package/lib/utils/EntitlementsUtils.d.ts.map +1 -0
  41. package/lib/utils/EntitlementsUtils.js +107 -0
  42. package/lib/utils/EntitlementsUtils.js.map +1 -0
  43. package/package.json +10 -10
  44. package/src/__lib__/LegendMarketplaceAppEvent.ts +2 -0
  45. package/src/__lib__/LegendMarketplaceTelemetryHelper.ts +75 -21
  46. package/src/components/Header/LegendMarketplaceIconToolbar.tsx +94 -5
  47. package/src/components/SearchBar/LegendMarketplaceSearchBar.tsx +1 -1
  48. package/src/pages/Lakehouse/MarketplaceLakehouseHome.tsx +12 -58
  49. package/src/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.tsx +68 -235
  50. package/src/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.tsx +88 -295
  51. package/src/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.tsx +84 -49
  52. package/src/stores/lakehouse/LegendMarketplaceSearchResultsStore.ts +13 -3
  53. package/src/stores/lakehouse/entitlements/EntitlementsDashboardState.ts +234 -109
  54. package/src/stores/orders/OrderHelpers.ts +8 -7
  55. package/src/utils/EntitlementsUtils.tsx +207 -0
  56. package/tsconfig.json +1 -0
@@ -76,6 +76,7 @@ import {
76
76
  CONTRACT_ACTION,
77
77
  LegendMarketplaceTelemetryHelper,
78
78
  } from '../../../__lib__/LegendMarketplaceTelemetryHelper.js';
79
+ import { formatOrderDate } from '../../../stores/orders/OrderHelpers.js';
79
80
 
80
81
  const EntitlementsDashboardActionModal = (props: {
81
82
  open: boolean;
@@ -83,7 +84,7 @@ const EntitlementsDashboardActionModal = (props: {
83
84
  dashboardState: EntitlementsDashboardState;
84
85
  onClose: () => void;
85
86
  action: 'approve' | 'deny' | undefined;
86
- allContracts: V1_LiteDataContract[];
87
+ pendingTaskContracts: V1_LiteDataContract[];
87
88
  marketplaceBaseStore: LegendMarketplaceBaseStore;
88
89
  }) => {
89
90
  const {
@@ -92,7 +93,7 @@ const EntitlementsDashboardActionModal = (props: {
92
93
  dashboardState,
93
94
  onClose,
94
95
  action,
95
- allContracts,
96
+ pendingTaskContracts,
96
97
  marketplaceBaseStore,
97
98
  } = props;
98
99
 
@@ -136,7 +137,7 @@ const EntitlementsDashboardActionModal = (props: {
136
137
  dashboardState.lakehouseEntitlementsStore.applicationStore
137
138
  .telemetryService,
138
139
  selectedTasks,
139
- allContracts,
140
+ pendingTaskContracts,
140
141
  action === 'approve'
141
142
  ? CONTRACT_ACTION.APPROVED
142
143
  : CONTRACT_ACTION.DENIED,
@@ -151,7 +152,7 @@ const EntitlementsDashboardActionModal = (props: {
151
152
  dashboardState.lakehouseEntitlementsStore.applicationStore
152
153
  .telemetryService,
153
154
  selectedTasks,
154
- allContracts,
155
+ pendingTaskContracts,
155
156
  action === 'approve'
156
157
  ? CONTRACT_ACTION.APPROVED
157
158
  : CONTRACT_ACTION.DENIED,
@@ -194,8 +195,8 @@ const EntitlementsDashboardActionModal = (props: {
194
195
  )}
195
196
  {errorMessages.map(([task, errorMessage]) => {
196
197
  const contractId = task.dataContractId;
197
- const contract = allContracts.find(
198
- (_contract) => _contract.guid === contractId,
198
+ const contract = pendingTaskContracts.find(
199
+ (c) => c.guid === contractId,
199
200
  );
200
201
  return (
201
202
  <Box
@@ -257,33 +258,33 @@ export const EntitlementsPendingTasksDashboard = observer(
257
258
  (props: { dashboardState: EntitlementsDashboardState }): React.ReactNode => {
258
259
  // State and props
259
260
  const { dashboardState } = props;
260
- const tasks = dashboardState.pendingTasks;
261
- const allContracts = dashboardState.allContracts;
261
+ const pendingTasks = dashboardState.pendingTasks;
262
+ const pendingTaskContracts = dashboardState.pendingTaskContracts;
262
263
  const privilegeManagerTasks = useMemo(
263
264
  () =>
264
- tasks?.filter(
265
+ pendingTasks?.filter(
265
266
  (task) =>
266
267
  task.type === V1_ApprovalType.CONSUMER_PRIVILEGE_MANAGER_APPROVAL,
267
268
  ) ?? [],
268
- [tasks],
269
+ [pendingTasks],
269
270
  );
270
271
  const dataOwnerTasks = useMemo(
271
272
  () =>
272
- tasks?.filter(
273
+ pendingTasks?.filter(
273
274
  (task) => task.type === V1_ApprovalType.DATA_OWNER_APPROVAL,
274
275
  ) ?? [],
275
- [tasks],
276
+ [pendingTasks],
276
277
  );
277
278
  const otherTasks = useMemo(
278
279
  () =>
279
- tasks?.filter(
280
+ pendingTasks?.filter(
280
281
  (task) =>
281
282
  !privilegeManagerTasks.includes(task) &&
282
283
  !dataOwnerTasks.includes(task),
283
284
  ) ?? [],
284
- [dataOwnerTasks, privilegeManagerTasks, tasks],
285
+ [dataOwnerTasks, privilegeManagerTasks, pendingTasks],
285
286
  );
286
- const loading = dashboardState.initializationState.isInProgress;
287
+ const loading = dashboardState.fetchingPendingTasksState.isInProgress;
287
288
 
288
289
  const marketplaceBaseStore = useLegendMarketplaceBaseStore();
289
290
  const [searchParams, setSearchParams] = useSearchParams();
@@ -304,17 +305,17 @@ export const EntitlementsPendingTasksDashboard = observer(
304
305
  // Effects
305
306
 
306
307
  useEffect(() => {
307
- if (dashboardState.initializationState.hasCompleted) {
308
+ if (dashboardState.fetchingPendingTasksState.hasCompleted) {
308
309
  setSelectedTaskIdsSet((prev) => {
309
310
  const selectedArray = Array.from(prev.values());
310
311
  return new Set<string>(
311
312
  selectedArray.filter((taskId) =>
312
- tasks?.map((task) => task.taskId).includes(taskId),
313
+ pendingTasks?.map((task) => task.taskId).includes(taskId),
313
314
  ),
314
315
  );
315
316
  });
316
317
  }
317
- }, [dashboardState.initializationState.hasCompleted, tasks]);
318
+ }, [dashboardState.fetchingPendingTasksState.hasCompleted, pendingTasks]);
318
319
 
319
320
  useEffect(() => {
320
321
  setSearchParams((params) => {
@@ -350,13 +351,9 @@ export const EntitlementsPendingTasksDashboard = observer(
350
351
  const handleCellClicked = (
351
352
  event: DataGridCellClickedEvent<V1_ContractUserEventRecord, unknown>,
352
353
  ) => {
353
- if (
354
- event.colDef.colId !== 'selection' &&
355
- event.colDef.colId !== 'targetUser' &&
356
- event.colDef.colId !== 'requester'
357
- ) {
358
- const contract = allContracts?.find(
359
- (_contract) => _contract.guid === event.data?.dataContractId,
354
+ if (event.colDef.colId !== 'selection') {
355
+ const contract = pendingTaskContracts.find(
356
+ (c) => c.guid === event.data?.dataContractId,
360
357
  );
361
358
  setSelectedContract(contract);
362
359
  setSelectedContractTargetUser(event.data?.consumer);
@@ -451,18 +448,29 @@ export const EntitlementsPendingTasksDashboard = observer(
451
448
  useMemo(
452
449
  () => [
453
450
  {
454
- minWidth: 50,
455
- sortable: true,
456
- resizable: true,
457
- headerName: 'Action Date',
458
- flex: 1,
451
+ headerName: 'Date Created',
452
+ colId: 'dateCreated',
459
453
  valueGetter: (params) => {
460
- const taskType = params.data?.eventPayload?.type;
461
- const timestamp = params.data?.eventPayload?.eventTimestamp;
462
- if (taskType === undefined && timestamp === undefined) {
463
- return 'Unknown';
464
- }
465
- return `${taskType}: ${timestamp}`;
454
+ const contractId = params.data?.dataContractId;
455
+ const createdAt = pendingTaskContracts.find(
456
+ (c) => c.guid === contractId,
457
+ )?.createdAt;
458
+ return formatOrderDate(createdAt) ?? 'Unknown';
459
+ },
460
+ sortable: true,
461
+ sort: 'desc',
462
+ comparator: (_, __, val1, val2) => {
463
+ const contractId1 = val1.data?.dataContractId;
464
+ const contractId2 = val2.data?.dataContractId;
465
+ const createdAt1 = pendingTaskContracts.find(
466
+ (c) => c.guid === contractId1,
467
+ )?.createdAt;
468
+ const createdAt2 = pendingTaskContracts.find(
469
+ (c) => c.guid === contractId2,
470
+ )?.createdAt;
471
+ const dateA = createdAt1 ? new Date(createdAt1).getTime() : 0;
472
+ const dateB = createdAt2 ? new Date(createdAt2).getTime() : 0;
473
+ return dateA - dateB;
466
474
  },
467
475
  },
468
476
  {
@@ -472,12 +480,25 @@ export const EntitlementsPendingTasksDashboard = observer(
472
480
  colId: 'consumerType',
473
481
  headerName: 'Consumer Type',
474
482
  flex: 1,
483
+ valueGetter: (params) => {
484
+ const contractId = params.data?.dataContractId;
485
+ const consumer = pendingTaskContracts.find(
486
+ (c) => c.guid === contractId,
487
+ )?.consumer;
488
+ const typeName = consumer
489
+ ? getOrganizationalScopeTypeName(
490
+ consumer,
491
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
492
+ )
493
+ : undefined;
494
+ return typeName ?? 'Unknown';
495
+ },
475
496
  cellRenderer: (
476
497
  params: DataGridCellRendererParams<V1_ContractUserEventRecord>,
477
498
  ) => {
478
499
  const contractId = params.data?.dataContractId;
479
- const consumer = allContracts?.find(
480
- (contract) => contract.guid === contractId,
500
+ const consumer = pendingTaskContracts.find(
501
+ (c) => c.guid === contractId,
481
502
  )?.consumer;
482
503
  const typeName = consumer
483
504
  ? getOrganizationalScopeTypeName(
@@ -513,6 +534,9 @@ export const EntitlementsPendingTasksDashboard = observer(
513
534
  colId: 'targetUser',
514
535
  headerName: 'Target User',
515
536
  flex: 1,
537
+ valueGetter: (params) => {
538
+ return params.data?.consumer ?? 'Unknown';
539
+ },
516
540
  cellRenderer: (
517
541
  params: DataGridCellRendererParams<V1_ContractUserEventRecord>,
518
542
  ) => {
@@ -521,6 +545,7 @@ export const EntitlementsPendingTasksDashboard = observer(
521
545
  userId={params.data?.consumer}
522
546
  applicationStore={marketplaceBaseStore.applicationStore}
523
547
  userSearchService={marketplaceBaseStore.userSearchService}
548
+ disableOnClick={true}
524
549
  className="marketplace-lakehouse-entitlements__grid__user-display"
525
550
  />
526
551
  );
@@ -533,18 +558,26 @@ export const EntitlementsPendingTasksDashboard = observer(
533
558
  colId: 'requester',
534
559
  headerName: 'Requester',
535
560
  flex: 1,
561
+ valueGetter: (params) => {
562
+ const contractId = params.data?.dataContractId;
563
+ const requester = pendingTaskContracts.find(
564
+ (c) => c.guid === contractId,
565
+ )?.createdBy;
566
+ return requester ?? 'Unknown';
567
+ },
536
568
  cellRenderer: (
537
569
  params: DataGridCellRendererParams<V1_ContractUserEventRecord>,
538
570
  ) => {
539
571
  const contractId = params.data?.dataContractId;
540
- const requester = allContracts?.find(
541
- (contract) => contract.guid === contractId,
572
+ const requester = pendingTaskContracts.find(
573
+ (c) => c.guid === contractId,
542
574
  )?.createdBy;
543
575
  return requester ? (
544
576
  <UserRenderer
545
577
  userId={requester}
546
578
  applicationStore={marketplaceBaseStore.applicationStore}
547
579
  userSearchService={marketplaceBaseStore.userSearchService}
580
+ disableOnClick={true}
548
581
  className="marketplace-lakehouse-entitlements__grid__user-display"
549
582
  />
550
583
  ) : (
@@ -560,8 +593,8 @@ export const EntitlementsPendingTasksDashboard = observer(
560
593
  flex: 1,
561
594
  valueGetter: (params) => {
562
595
  const contractId = params.data?.dataContractId;
563
- const contract = allContracts?.find(
564
- (_contract) => _contract.guid === contractId,
596
+ const contract = pendingTaskContracts.find(
597
+ (c) => c.guid === contractId,
565
598
  );
566
599
  return contract?.resourceId ?? 'Unknown';
567
600
  },
@@ -574,8 +607,8 @@ export const EntitlementsPendingTasksDashboard = observer(
574
607
  flex: 1,
575
608
  valueGetter: (params) => {
576
609
  const contractId = params.data?.dataContractId;
577
- const contract = allContracts?.find(
578
- (_contract) => _contract.guid === contractId,
610
+ const contract = pendingTaskContracts.find(
611
+ (c) => c.guid === contractId,
579
612
  );
580
613
  const accessPointGroup =
581
614
  contract?.resourceType === V1_ResourceType.ACCESS_POINT_GROUP
@@ -592,8 +625,8 @@ export const EntitlementsPendingTasksDashboard = observer(
592
625
  flex: 2,
593
626
  valueGetter: (params) => {
594
627
  const contractId = params.data?.dataContractId;
595
- const businessJustification = allContracts?.find(
596
- (contract) => contract.guid === contractId,
628
+ const businessJustification = pendingTaskContracts.find(
629
+ (c) => c.guid === contractId,
597
630
  )?.description;
598
631
  return businessJustification ?? 'Unknown';
599
632
  },
@@ -609,11 +642,11 @@ export const EntitlementsPendingTasksDashboard = observer(
609
642
  },
610
643
  ],
611
644
  [
612
- allContracts,
613
645
  dashboardState.lakehouseEntitlementsStore.applicationStore
614
646
  .pluginManager,
615
647
  marketplaceBaseStore.applicationStore,
616
648
  marketplaceBaseStore.userSearchService,
649
+ pendingTaskContracts,
617
650
  ],
618
651
  );
619
652
 
@@ -822,12 +855,14 @@ export const EntitlementsPendingTasksDashboard = observer(
822
855
  <EntitlementsDashboardActionModal
823
856
  open={selectedAction !== undefined}
824
857
  selectedTasks={
825
- tasks?.filter((task) => selectedTaskIdsSet.has(task.taskId)) ?? []
858
+ pendingTasks?.filter((task) =>
859
+ selectedTaskIdsSet.has(task.taskId),
860
+ ) ?? []
826
861
  }
827
862
  dashboardState={dashboardState}
828
863
  onClose={() => setSelectedAction(undefined)}
829
864
  action={selectedAction}
830
- allContracts={allContracts ?? []}
865
+ pendingTaskContracts={pendingTaskContracts}
831
866
  marketplaceBaseStore={marketplaceBaseStore}
832
867
  />
833
868
  {selectedContract !== undefined && (
@@ -177,9 +177,19 @@ export class LegendMarketplaceSearchResultsStore {
177
177
  }
178
178
  } catch (error) {
179
179
  assertErrorThrown(error);
180
- this.marketplaceBaseStore.applicationStore.notificationService.notifyError(
181
- `Error executing search: ${error.message}`,
182
- );
180
+ if (
181
+ this.marketplaceBaseStore.applicationStore.config.options
182
+ .showDevFeatures
183
+ ) {
184
+ this.marketplaceBaseStore.applicationStore.notificationService.notifyError(
185
+ error,
186
+ `Error executing search: ${error.name}\n${error.message}\n${error.cause}\n${error.stack}`,
187
+ );
188
+ } else {
189
+ this.marketplaceBaseStore.applicationStore.notificationService.notifyError(
190
+ `Error executing search: ${error.message}`,
191
+ );
192
+ }
183
193
  }
184
194
  }
185
195