@finos/legend-application-marketplace 0.2.26 → 0.2.28

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 (64) hide show
  1. package/lib/__lib__/LegendMarketplaceNavigation.d.ts +4 -0
  2. package/lib/__lib__/LegendMarketplaceNavigation.d.ts.map +1 -1
  3. package/lib/__lib__/LegendMarketplaceNavigation.js +4 -0
  4. package/lib/__lib__/LegendMarketplaceNavigation.js.map +1 -1
  5. package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts +2 -2
  6. package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts.map +1 -1
  7. package/lib/__lib__/LegendMarketplaceTelemetryHelper.js +2 -2
  8. package/lib/__lib__/LegendMarketplaceTelemetryHelper.js.map +1 -1
  9. package/lib/application/LegendMarketplaceApplicationConfig.d.ts +2 -0
  10. package/lib/application/LegendMarketplaceApplicationConfig.d.ts.map +1 -1
  11. package/lib/application/LegendMarketplaceApplicationConfig.js +4 -0
  12. package/lib/application/LegendMarketplaceApplicationConfig.js.map +1 -1
  13. package/lib/components/__test-utils__/LegendMarketplaceStoreTestUtils.d.ts.map +1 -1
  14. package/lib/components/__test-utils__/LegendMarketplaceStoreTestUtils.js +11 -6
  15. package/lib/components/__test-utils__/LegendMarketplaceStoreTestUtils.js.map +1 -1
  16. package/lib/index.css +2 -2
  17. package/lib/index.css.map +1 -1
  18. package/lib/package.json +1 -1
  19. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.d.ts.map +1 -1
  20. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js +10 -7
  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 +3 -2
  24. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js.map +1 -1
  25. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.d.ts +1 -1
  26. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.d.ts.map +1 -1
  27. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js +67 -38
  28. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js.map +1 -1
  29. package/lib/stores/LegendMarketplaceBaseStore.d.ts.map +1 -1
  30. package/lib/stores/LegendMarketplaceBaseStore.js +1 -0
  31. package/lib/stores/LegendMarketplaceBaseStore.js.map +1 -1
  32. package/lib/stores/ai/LegendMarketplaceAIChatStore.d.ts +1 -2
  33. package/lib/stores/ai/LegendMarketplaceAIChatStore.d.ts.map +1 -1
  34. package/lib/stores/ai/LegendMarketplaceAIChatStore.js +12 -8
  35. package/lib/stores/ai/LegendMarketplaceAIChatStore.js.map +1 -1
  36. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.d.ts.map +1 -1
  37. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js +11 -1
  38. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js.map +1 -1
  39. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts +39 -15
  40. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts.map +1 -1
  41. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js +324 -39
  42. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js.map +1 -1
  43. package/lib/utils/EntitlementsUtils.d.ts +2 -2
  44. package/lib/utils/EntitlementsUtils.d.ts.map +1 -1
  45. package/lib/utils/EntitlementsUtils.js +11 -2
  46. package/lib/utils/EntitlementsUtils.js.map +1 -1
  47. package/lib/utils/LakehouseUtils.d.ts +2 -1
  48. package/lib/utils/LakehouseUtils.d.ts.map +1 -1
  49. package/lib/utils/LakehouseUtils.js +31 -2
  50. package/lib/utils/LakehouseUtils.js.map +1 -1
  51. package/package.json +12 -12
  52. package/src/__lib__/LegendMarketplaceNavigation.ts +17 -0
  53. package/src/__lib__/LegendMarketplaceTelemetryHelper.ts +6 -6
  54. package/src/application/LegendMarketplaceApplicationConfig.ts +7 -0
  55. package/src/components/__test-utils__/LegendMarketplaceStoreTestUtils.tsx +20 -8
  56. package/src/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.tsx +13 -5
  57. package/src/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.tsx +5 -1
  58. package/src/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.tsx +306 -299
  59. package/src/stores/LegendMarketplaceBaseStore.ts +1 -0
  60. package/src/stores/ai/LegendMarketplaceAIChatStore.ts +14 -9
  61. package/src/stores/lakehouse/LegendMarketplaceProductViewerStore.ts +38 -0
  62. package/src/stores/lakehouse/entitlements/EntitlementsDashboardState.ts +538 -91
  63. package/src/utils/EntitlementsUtils.tsx +13 -2
  64. package/src/utils/LakehouseUtils.tsx +80 -1
@@ -15,9 +15,8 @@
15
15
  */
16
16
 
17
17
  import {
18
- type V1_ContractUserEventRecord,
19
- type V1_LiteDataContract,
20
- GraphManagerState,
18
+ type V1_PendingTaskRecord,
19
+ type V1_LiteAccessRequest,
21
20
  V1_ApprovalType,
22
21
  V1_ResourceType,
23
22
  } from '@finos/legend-graph';
@@ -42,7 +41,6 @@ import {
42
41
  Tooltip,
43
42
  } from '@mui/material';
44
43
  import { useCallback, useMemo, useState, type ChangeEvent } from 'react';
45
- import type { EntitlementsDashboardState } from '../../../stores/lakehouse/entitlements/EntitlementsDashboardState.js';
46
44
  import { useLegendMarketplaceBaseStore } from '../../../application/providers/LegendMarketplaceFrameworkProvider.js';
47
45
  import {
48
46
  CubesLoadingIndicator,
@@ -59,26 +57,35 @@ import {
59
57
  UserRenderer,
60
58
  getOrganizationalScopeTypeName,
61
59
  getOrganizationalScopeTypeDetails,
60
+ stringifyOrganizationalScope,
62
61
  DataAccessRequestViewer,
63
- DataContractViewerState,
64
62
  } from '@finos/legend-extension-dsl-data-product';
65
- import {
66
- generateContractPagePath,
67
- generateLakehouseDataProductPath,
68
- } from '../../../__lib__/LegendMarketplaceNavigation.js';
69
63
  import {
70
64
  CONTRACT_ACTION,
71
65
  LegendMarketplaceTelemetryHelper,
72
66
  } from '../../../__lib__/LegendMarketplaceTelemetryHelper.js';
73
67
  import { formatOrderDate } from '../../../stores/orders/OrderHelpers.js';
68
+ import {
69
+ ContractCreatedByUserDetails,
70
+ type EntitlementsDashboardState,
71
+ } from '../../../stores/lakehouse/entitlements/EntitlementsDashboardState.js';
72
+ import {
73
+ type EntitlementsRow,
74
+ ROW_KIND_CONTRACT,
75
+ ROW_KIND_REQUEST,
76
+ getSelectedRowId,
77
+ getSelectedContractGuid,
78
+ useSelectedViewerState,
79
+ useGetDataProductUrl,
80
+ } from '../../../utils/EntitlementsUtils.js';
74
81
 
75
82
  const EntitlementsDashboardActionModal = (props: {
76
83
  open: boolean;
77
- selectedTasks: V1_ContractUserEventRecord[];
84
+ selectedTasks: V1_PendingTaskRecord[];
78
85
  dashboardState: EntitlementsDashboardState;
79
86
  onClose: () => void;
80
87
  action: 'approve' | 'deny' | undefined;
81
- pendingTaskContracts: V1_LiteDataContract[];
88
+ pendingTaskContracts: V1_LiteAccessRequest[];
82
89
  marketplaceBaseStore: LegendMarketplaceBaseStore;
83
90
  }) => {
84
91
  const {
@@ -94,7 +101,7 @@ const EntitlementsDashboardActionModal = (props: {
94
101
  const auth = useAuth();
95
102
  const [isLoading, setIsLoading] = useState(false);
96
103
  const [errorMessages, setErrorMessages] = useState<
97
- [V1_ContractUserEventRecord, string][]
104
+ [V1_PendingTaskRecord, string][]
98
105
  >([]);
99
106
  const [successCount, setSuccessCount] = useState(0);
100
107
 
@@ -188,7 +195,7 @@ const EntitlementsDashboardActionModal = (props: {
188
195
  </Box>
189
196
  )}
190
197
  {errorMessages.map(([task, errorMessage]) => {
191
- const contractId = task.dataContractId;
198
+ const contractId = task.accessRequestId;
192
199
  const contract = pendingTaskContracts.find(
193
200
  (c) => c.guid === contractId,
194
201
  );
@@ -285,8 +292,8 @@ export const EntitlementsPendingTasksDashboard = observer(
285
292
  'approve' | 'deny' | undefined
286
293
  >();
287
294
  const selectedTaskIdsSet = dashboardState.selectedTaskIds;
288
- const [selectedContract, setSelectedContract] = useState<
289
- V1_LiteDataContract | undefined
295
+ const [selectedRow, setSelectedRow] = useState<
296
+ EntitlementsRow | undefined
290
297
  >();
291
298
  const [selectedContractTargetUser, setSelectedContractTargetUser] =
292
299
  useState<string | undefined>();
@@ -295,16 +302,21 @@ export const EntitlementsPendingTasksDashboard = observer(
295
302
  >(undefined);
296
303
 
297
304
  const auth = useAuth();
305
+ const getDataProductUrl = useGetDataProductUrl();
306
+
307
+ const selectedRowId = getSelectedRowId(selectedRow);
308
+ const selectedViewerState = useSelectedViewerState(
309
+ selectedRow,
310
+ selectedRowId,
311
+ );
312
+ const selectedContractGuid = getSelectedContractGuid(selectedRow);
298
313
 
299
314
  // Callbacks
300
315
 
301
316
  const handleFirstDataRendered = (
302
- event: DataGridFirstDataRenderedEvent<
303
- V1_ContractUserEventRecord,
304
- unknown
305
- >,
317
+ event: DataGridFirstDataRenderedEvent<V1_PendingTaskRecord, unknown>,
306
318
  ) => {
307
- const nodesToSelect: DataGridIRowNode<V1_ContractUserEventRecord>[] = [];
319
+ const nodesToSelect: DataGridIRowNode<V1_PendingTaskRecord>[] = [];
308
320
  event.api.forEachNode((node) => {
309
321
  if (node.data && selectedTaskIdsSet.has(node.data.taskId)) {
310
322
  nodesToSelect.push(node);
@@ -313,22 +325,39 @@ export const EntitlementsPendingTasksDashboard = observer(
313
325
  event.api.setNodesSelected({ nodes: nodesToSelect, newValue: true });
314
326
  };
315
327
 
316
- const handleCellClicked = async (
317
- event: DataGridCellClickedEvent<V1_ContractUserEventRecord, unknown>,
328
+ const handleCellClicked = (
329
+ event: DataGridCellClickedEvent<V1_PendingTaskRecord, unknown>,
318
330
  ) => {
319
331
  if (event.colDef.colId !== 'selection') {
320
- const contract = pendingTaskContracts.find(
321
- (c) => c.guid === event.data?.dataContractId,
322
- );
323
- setSelectedContract(contract);
324
332
  setSelectedContractTargetUser(event.data?.consumer);
325
- setContractErrors(undefined);
326
- if (contract !== undefined) {
327
- const result = await dashboardState.getContractErrors(
328
- contract.guid,
329
- auth.user?.access_token,
333
+
334
+ const dataRequestId = event.data?.accessRequestId;
335
+ const isDataRequest =
336
+ dataRequestId !== undefined &&
337
+ dashboardState.pendingDataRequestIds.has(dataRequestId);
338
+
339
+ if (isDataRequest && dataRequestId) {
340
+ const detail =
341
+ dashboardState.pendingDataRequestDetailsMap.get(dataRequestId);
342
+ if (detail) {
343
+ setContractErrors(undefined);
344
+ setSelectedRow({ kind: ROW_KIND_REQUEST, data: detail });
345
+ }
346
+ } else {
347
+ const contract = pendingTaskContracts.find(
348
+ (c) => c.guid === event.data?.accessRequestId,
330
349
  );
331
- setContractErrors(result);
350
+ if (contract) {
351
+ setContractErrors(undefined);
352
+ setSelectedRow({
353
+ kind: ROW_KIND_CONTRACT,
354
+ data: new ContractCreatedByUserDetails(contract),
355
+ });
356
+ dashboardState
357
+ .getContractErrors(contract.guid, auth.user?.access_token)
358
+ .then((result) => setContractErrors(result))
359
+ .catch(() => setContractErrors(undefined));
360
+ }
332
361
  }
333
362
  }
334
363
  };
@@ -345,7 +374,7 @@ export const EntitlementsPendingTasksDashboard = observer(
345
374
  );
346
375
 
347
376
  const CustomSelectionRenderer = useCallback(
348
- (params: DataGridCellRendererParams<V1_ContractUserEventRecord>) => {
377
+ (params: DataGridCellRendererParams<V1_PendingTaskRecord>) => {
349
378
  const handleChange = (_: ChangeEvent<HTMLInputElement>) => {
350
379
  if (params.data) {
351
380
  const newSet = new Set<string>(selectedTaskIdsSet);
@@ -372,8 +401,8 @@ export const EntitlementsPendingTasksDashboard = observer(
372
401
 
373
402
  const CustomSelectionHeaderRenderer = useCallback(
374
403
  (_props: {
375
- params: DataGridCustomHeaderProps<V1_ContractUserEventRecord>;
376
- taskSet: V1_ContractUserEventRecord[];
404
+ params: DataGridCustomHeaderProps<V1_PendingTaskRecord>;
405
+ taskSet: V1_PendingTaskRecord[];
377
406
  }) => {
378
407
  const { taskSet } = _props;
379
408
  const checked =
@@ -410,213 +439,231 @@ export const EntitlementsPendingTasksDashboard = observer(
410
439
  [selectedTaskIdsSet, dashboardState],
411
440
  );
412
441
 
413
- const colDefs: DataGridColumnDefinition<V1_ContractUserEventRecord>[] =
414
- useMemo(
415
- () => [
416
- {
417
- headerName: 'Date Created',
418
- colId: 'dateCreated',
419
- valueGetter: (params) => {
420
- const contractId = params.data?.dataContractId;
421
- const createdAt = pendingTaskContracts.find(
422
- (c) => c.guid === contractId,
423
- )?.createdAt;
424
- return formatOrderDate(createdAt) ?? 'Unknown';
425
- },
426
- sortable: true,
427
- sort: 'desc',
428
- comparator: (_, __, val1, val2) => {
429
- const contractId1 = val1.data?.dataContractId;
430
- const contractId2 = val2.data?.dataContractId;
431
- const createdAt1 = pendingTaskContracts.find(
432
- (c) => c.guid === contractId1,
433
- )?.createdAt;
434
- const createdAt2 = pendingTaskContracts.find(
435
- (c) => c.guid === contractId2,
436
- )?.createdAt;
437
- const dateA = createdAt1 ? new Date(createdAt1).getTime() : 0;
438
- const dateB = createdAt2 ? new Date(createdAt2).getTime() : 0;
439
- return dateA - dateB;
440
- },
442
+ const colDefs: DataGridColumnDefinition<V1_PendingTaskRecord>[] = useMemo(
443
+ () => [
444
+ {
445
+ headerName: 'Date Created',
446
+ colId: 'dateCreated',
447
+ valueGetter: (params) => {
448
+ const contractId = params.data?.accessRequestId;
449
+ const createdAt = pendingTaskContracts.find(
450
+ (c) => c.guid === contractId,
451
+ )?.createdAt;
452
+ return formatOrderDate(createdAt) ?? 'Unknown';
441
453
  },
442
- {
443
- minWidth: 25,
444
- sortable: true,
445
- resizable: true,
446
- colId: 'consumerType',
447
- headerName: 'Consumer Type',
448
- flex: 1,
449
- valueGetter: (params) => {
450
- const contractId = params.data?.dataContractId;
451
- const consumer = pendingTaskContracts.find(
452
- (c) => c.guid === contractId,
453
- )?.consumer;
454
- const typeName = consumer
455
- ? getOrganizationalScopeTypeName(
456
- consumer,
457
- dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
458
- )
459
- : undefined;
460
- return typeName ?? 'Unknown';
461
- },
462
- cellRenderer: (
463
- params: DataGridCellRendererParams<V1_ContractUserEventRecord>,
464
- ) => {
465
- const contractId = params.data?.dataContractId;
466
- const consumer = pendingTaskContracts.find(
467
- (c) => c.guid === contractId,
468
- )?.consumer;
469
- const typeName = consumer
470
- ? getOrganizationalScopeTypeName(
471
- consumer,
472
- dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
473
- )
474
- : undefined;
475
- const typeDetails = consumer
476
- ? getOrganizationalScopeTypeDetails(
477
- consumer,
478
- dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
479
- )
480
- : undefined;
481
- return (
482
- <>
483
- {typeName ?? 'Unknown'}
484
- {typeDetails !== undefined && (
485
- <Tooltip
486
- className="marketplace-lakehouse-entitlements__grid__consumer-type__tooltip__icon"
487
- title={typeDetails}
488
- >
489
- <InfoCircleIcon />
490
- </Tooltip>
491
- )}
492
- </>
493
- );
494
- },
454
+ sortable: true,
455
+ sort: 'desc',
456
+ comparator: (_, __, val1, val2) => {
457
+ const contractId1 = val1.data?.accessRequestId;
458
+ const contractId2 = val2.data?.accessRequestId;
459
+ const createdAt1 = pendingTaskContracts.find(
460
+ (c) => c.guid === contractId1,
461
+ )?.createdAt;
462
+ const createdAt2 = pendingTaskContracts.find(
463
+ (c) => c.guid === contractId2,
464
+ )?.createdAt;
465
+ const dateA = createdAt1 ? new Date(createdAt1).getTime() : 0;
466
+ const dateB = createdAt2 ? new Date(createdAt2).getTime() : 0;
467
+ return dateA - dateB;
495
468
  },
496
- {
497
- minWidth: 50,
498
- sortable: true,
499
- resizable: true,
500
- colId: 'targetUser',
501
- headerName: 'Target User',
502
- flex: 1,
503
- valueGetter: (params) => {
504
- return params.data?.consumer ?? 'Unknown';
505
- },
506
- cellRenderer: (
507
- params: DataGridCellRendererParams<V1_ContractUserEventRecord>,
508
- ) => {
509
- return (
510
- <UserRenderer
511
- userId={params.data?.consumer}
512
- applicationStore={marketplaceBaseStore.applicationStore}
513
- userSearchService={marketplaceBaseStore.userSearchService}
514
- disableOnClick={true}
515
- className="marketplace-lakehouse-entitlements__grid__user-display"
516
- />
517
- );
518
- },
469
+ },
470
+ {
471
+ minWidth: 25,
472
+ sortable: true,
473
+ resizable: true,
474
+ colId: 'consumerType',
475
+ headerName: 'Consumer Type',
476
+ flex: 1,
477
+ valueGetter: (params) => {
478
+ const contractId = params.data?.accessRequestId;
479
+ const consumer = pendingTaskContracts.find(
480
+ (c) => c.guid === contractId,
481
+ )?.consumer;
482
+ const typeName = consumer
483
+ ? getOrganizationalScopeTypeName(
484
+ consumer,
485
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
486
+ )
487
+ : undefined;
488
+ return typeName ?? 'Unknown';
519
489
  },
520
- {
521
- minWidth: 50,
522
- sortable: true,
523
- resizable: true,
524
- colId: 'requester',
525
- headerName: 'Requester',
526
- flex: 1,
527
- valueGetter: (params) => {
528
- const contractId = params.data?.dataContractId;
529
- const requester = pendingTaskContracts.find(
530
- (c) => c.guid === contractId,
531
- )?.createdBy;
532
- return requester ?? 'Unknown';
533
- },
534
- cellRenderer: (
535
- params: DataGridCellRendererParams<V1_ContractUserEventRecord>,
536
- ) => {
537
- const contractId = params.data?.dataContractId;
538
- const requester = pendingTaskContracts.find(
539
- (c) => c.guid === contractId,
540
- )?.createdBy;
541
- return requester ? (
542
- <UserRenderer
543
- userId={requester}
544
- applicationStore={marketplaceBaseStore.applicationStore}
545
- userSearchService={marketplaceBaseStore.userSearchService}
546
- disableOnClick={true}
547
- className="marketplace-lakehouse-entitlements__grid__user-display"
548
- />
549
- ) : (
550
- <>Unknown</>
551
- );
552
- },
490
+ cellRenderer: (
491
+ params: DataGridCellRendererParams<V1_PendingTaskRecord>,
492
+ ) => {
493
+ const contractId = params.data?.accessRequestId;
494
+ const consumer = pendingTaskContracts.find(
495
+ (c) => c.guid === contractId,
496
+ )?.consumer;
497
+ const typeName = consumer
498
+ ? getOrganizationalScopeTypeName(
499
+ consumer,
500
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
501
+ )
502
+ : undefined;
503
+ const typeDetails = consumer
504
+ ? getOrganizationalScopeTypeDetails(
505
+ consumer,
506
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
507
+ )
508
+ : undefined;
509
+ return (
510
+ <>
511
+ {typeName ?? 'Unknown'}
512
+ {typeDetails !== undefined && (
513
+ <Tooltip
514
+ className="marketplace-lakehouse-entitlements__grid__consumer-type__tooltip__icon"
515
+ title={typeDetails}
516
+ >
517
+ <InfoCircleIcon />
518
+ </Tooltip>
519
+ )}
520
+ </>
521
+ );
553
522
  },
554
- {
555
- minWidth: 50,
556
- sortable: true,
557
- resizable: true,
558
- headerName: 'Target Data Product',
559
- flex: 1,
560
- valueGetter: (params) => {
561
- const contractId = params.data?.dataContractId;
562
- const contract = pendingTaskContracts.find(
563
- (c) => c.guid === contractId,
564
- );
565
- return contract?.resourceId ?? 'Unknown';
566
- },
523
+ },
524
+ {
525
+ minWidth: 50,
526
+ sortable: true,
527
+ resizable: true,
528
+ colId: 'targetUser',
529
+ headerName: 'Target User',
530
+ flex: 1,
531
+ valueGetter: (params) => {
532
+ const contractId = params.data?.accessRequestId;
533
+ const consumer = pendingTaskContracts.find(
534
+ (c) => c.guid === contractId,
535
+ )?.consumer;
536
+ return consumer
537
+ ? stringifyOrganizationalScope(
538
+ consumer,
539
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
540
+ )
541
+ : 'Unknown';
567
542
  },
568
- {
569
- minWidth: 50,
570
- sortable: true,
571
- resizable: true,
572
- headerName: 'Target Access Point Group',
573
- flex: 1,
574
- valueGetter: (params) => {
575
- const contractId = params.data?.dataContractId;
576
- const contract = pendingTaskContracts.find(
577
- (c) => c.guid === contractId,
578
- );
579
- const accessPointGroup =
580
- contract?.resourceType === V1_ResourceType.ACCESS_POINT_GROUP
581
- ? contract.accessPointGroup
582
- : `${contract?.accessPointGroup ?? 'Unknown'} (${contract?.resourceType ?? 'Unknown Type'})`;
583
- return accessPointGroup ?? 'Unknown';
584
- },
543
+ cellRenderer: (
544
+ params: DataGridCellRendererParams<V1_PendingTaskRecord>,
545
+ ) => {
546
+ const contractId = params.data?.accessRequestId;
547
+ const consumer = pendingTaskContracts.find(
548
+ (c) => c.guid === contractId,
549
+ )?.consumer;
550
+ const userId = consumer
551
+ ? stringifyOrganizationalScope(
552
+ consumer,
553
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
554
+ )
555
+ : undefined;
556
+ return (
557
+ <UserRenderer
558
+ userId={userId}
559
+ applicationStore={marketplaceBaseStore.applicationStore}
560
+ userSearchService={marketplaceBaseStore.userSearchService}
561
+ disableOnClick={true}
562
+ className="marketplace-lakehouse-entitlements__grid__user-display"
563
+ />
564
+ );
585
565
  },
586
- {
587
- minWidth: 50,
588
- sortable: true,
589
- resizable: true,
590
- headerName: 'Business Justification',
591
- flex: 2,
592
- valueGetter: (params) => {
593
- const contractId = params.data?.dataContractId;
594
- const businessJustification = pendingTaskContracts.find(
595
- (c) => c.guid === contractId,
596
- )?.description;
597
- return businessJustification ?? 'Unknown';
598
- },
566
+ },
567
+ {
568
+ minWidth: 50,
569
+ sortable: true,
570
+ resizable: true,
571
+ colId: 'requester',
572
+ headerName: 'Requester',
573
+ flex: 1,
574
+ valueGetter: (params) => {
575
+ const contractId = params.data?.accessRequestId;
576
+ const requester = pendingTaskContracts.find(
577
+ (c) => c.guid === contractId,
578
+ )?.createdBy;
579
+ return requester ?? 'Unknown';
599
580
  },
600
- {
601
- minWidth: 50,
602
- sortable: true,
603
- resizable: true,
604
- hide: true,
605
- headerName: 'Contract ID',
606
- flex: 2,
607
- valueGetter: (params) => params.data?.dataContractId ?? 'Unknown',
581
+ cellRenderer: (
582
+ params: DataGridCellRendererParams<V1_PendingTaskRecord>,
583
+ ) => {
584
+ const contractId = params.data?.accessRequestId;
585
+ const requester = pendingTaskContracts.find(
586
+ (c) => c.guid === contractId,
587
+ )?.createdBy;
588
+ return requester ? (
589
+ <UserRenderer
590
+ userId={requester}
591
+ applicationStore={marketplaceBaseStore.applicationStore}
592
+ userSearchService={marketplaceBaseStore.userSearchService}
593
+ disableOnClick={true}
594
+ className="marketplace-lakehouse-entitlements__grid__user-display"
595
+ />
596
+ ) : (
597
+ <>Unknown</>
598
+ );
608
599
  },
609
- ],
610
- [
611
- dashboardState.lakehouseEntitlementsStore.applicationStore
612
- .pluginManager,
613
- marketplaceBaseStore.applicationStore,
614
- marketplaceBaseStore.userSearchService,
615
- pendingTaskContracts,
616
- ],
617
- );
600
+ },
601
+ {
602
+ minWidth: 50,
603
+ sortable: true,
604
+ resizable: true,
605
+ headerName: 'Target Data Product',
606
+ flex: 1,
607
+ valueGetter: (params) => {
608
+ const contractId = params.data?.accessRequestId;
609
+ const contract = pendingTaskContracts.find(
610
+ (c) => c.guid === contractId,
611
+ );
612
+ return contract?.resourceId ?? 'Unknown';
613
+ },
614
+ },
615
+ {
616
+ minWidth: 50,
617
+ sortable: true,
618
+ resizable: true,
619
+ headerName: 'Target Access Point Group',
620
+ flex: 1,
621
+ valueGetter: (params) => {
622
+ const contractId = params.data?.accessRequestId;
623
+ const contract = pendingTaskContracts.find(
624
+ (c) => c.guid === contractId,
625
+ );
626
+ const accessPointGroup =
627
+ contract?.resourceType === V1_ResourceType.ACCESS_POINT_GROUP
628
+ ? contract.accessPointGroup
629
+ : `${contract?.accessPointGroup ?? 'Unknown'} (${contract?.resourceType ?? 'Unknown Type'})`;
630
+ return accessPointGroup ?? 'Unknown';
631
+ },
632
+ },
633
+ {
634
+ minWidth: 50,
635
+ sortable: true,
636
+ resizable: true,
637
+ headerName: 'Business Justification',
638
+ flex: 2,
639
+ valueGetter: (params) => {
640
+ const contractId = params.data?.accessRequestId;
641
+ const businessJustification = pendingTaskContracts.find(
642
+ (c) => c.guid === contractId,
643
+ )?.description;
644
+ return businessJustification ?? 'Unknown';
645
+ },
646
+ },
647
+ {
648
+ minWidth: 50,
649
+ sortable: true,
650
+ resizable: true,
651
+ hide: true,
652
+ headerName: 'Contract ID',
653
+ flex: 2,
654
+ valueGetter: (params) => params.data?.accessRequestId ?? 'Unknown',
655
+ },
656
+ ],
657
+ [
658
+ dashboardState.lakehouseEntitlementsStore.applicationStore
659
+ .pluginManager,
660
+ marketplaceBaseStore.applicationStore,
661
+ marketplaceBaseStore.userSearchService,
662
+ pendingTaskContracts,
663
+ ],
664
+ );
618
665
 
619
- const privilegeManagerColDefs: DataGridColumnDefinition<V1_ContractUserEventRecord>[] =
666
+ const privilegeManagerColDefs: DataGridColumnDefinition<V1_PendingTaskRecord>[] =
620
667
  useMemo(
621
668
  () => [
622
669
  {
@@ -625,7 +672,7 @@ export const EntitlementsPendingTasksDashboard = observer(
625
672
  width: 50,
626
673
  cellRenderer: CustomSelectionRenderer,
627
674
  headerComponent: (
628
- params: DataGridCustomHeaderProps<V1_ContractUserEventRecord>,
675
+ params: DataGridCustomHeaderProps<V1_PendingTaskRecord>,
629
676
  ) => (
630
677
  <CustomSelectionHeaderRenderer
631
678
  params={params}
@@ -644,7 +691,7 @@ export const EntitlementsPendingTasksDashboard = observer(
644
691
  ],
645
692
  );
646
693
 
647
- const dataOwnerColDefs: DataGridColumnDefinition<V1_ContractUserEventRecord>[] =
694
+ const dataOwnerColDefs: DataGridColumnDefinition<V1_PendingTaskRecord>[] =
648
695
  useMemo(
649
696
  () => [
650
697
  {
@@ -653,7 +700,7 @@ export const EntitlementsPendingTasksDashboard = observer(
653
700
  width: 50,
654
701
  cellRenderer: CustomSelectionRenderer,
655
702
  headerComponent: (
656
- params: DataGridCustomHeaderProps<V1_ContractUserEventRecord>,
703
+ params: DataGridCustomHeaderProps<V1_PendingTaskRecord>,
657
704
  ) => (
658
705
  <CustomSelectionHeaderRenderer
659
706
  params={params}
@@ -672,7 +719,7 @@ export const EntitlementsPendingTasksDashboard = observer(
672
719
  ],
673
720
  );
674
721
 
675
- const otherTasksColDefs: DataGridColumnDefinition<V1_ContractUserEventRecord>[] =
722
+ const otherTasksColDefs: DataGridColumnDefinition<V1_PendingTaskRecord>[] =
676
723
  useMemo(
677
724
  () => [
678
725
  {
@@ -681,7 +728,7 @@ export const EntitlementsPendingTasksDashboard = observer(
681
728
  width: 50,
682
729
  cellRenderer: CustomSelectionRenderer,
683
730
  headerComponent: (
684
- params: DataGridCustomHeaderProps<V1_ContractUserEventRecord>,
731
+ params: DataGridCustomHeaderProps<V1_PendingTaskRecord>,
685
732
  ) => (
686
733
  <CustomSelectionHeaderRenderer
687
734
  params={params}
@@ -749,17 +796,9 @@ export const EntitlementsPendingTasksDashboard = observer(
749
796
  rowHeight={45}
750
797
  rowSelection={rowSelection}
751
798
  onFirstDataRendered={handleFirstDataRendered}
752
- onCellClicked={(
753
- event: DataGridCellClickedEvent<
754
- V1_ContractUserEventRecord,
755
- unknown
756
- >,
757
- ) =>
758
- // eslint-disable-next-line no-void
759
- void handleCellClicked(event)
760
- }
799
+ onCellClicked={handleCellClicked}
761
800
  columnDefs={privilegeManagerColDefs}
762
- overlayNoRowsTemplate="You have no contracts to approve as a Privilege Manager"
801
+ overlayNoRowsTemplate="You have no contracts or data requests to approve as a Privilege Manager"
763
802
  loading={loading}
764
803
  overlayLoadingTemplate="Loading contracts"
765
804
  />
@@ -792,17 +831,9 @@ export const EntitlementsPendingTasksDashboard = observer(
792
831
  rowHeight={45}
793
832
  rowSelection={rowSelection}
794
833
  onFirstDataRendered={handleFirstDataRendered}
795
- onCellClicked={(
796
- event: DataGridCellClickedEvent<
797
- V1_ContractUserEventRecord,
798
- unknown
799
- >,
800
- ) =>
801
- // eslint-disable-next-line no-void
802
- void handleCellClicked(event)
803
- }
834
+ onCellClicked={handleCellClicked}
804
835
  columnDefs={dataOwnerColDefs}
805
- overlayNoRowsTemplate="You have no contracts to approve as a Data Owner"
836
+ overlayNoRowsTemplate="You have no contracts or data requests to approve as a Data Owner"
806
837
  loading={loading}
807
838
  overlayLoadingTemplate="Loading contracts"
808
839
  />
@@ -824,15 +855,7 @@ export const EntitlementsPendingTasksDashboard = observer(
824
855
  rowHeight={45}
825
856
  rowSelection={rowSelection}
826
857
  onFirstDataRendered={handleFirstDataRendered}
827
- onCellClicked={(
828
- event: DataGridCellClickedEvent<
829
- V1_ContractUserEventRecord,
830
- unknown
831
- >,
832
- ) =>
833
- // eslint-disable-next-line no-void
834
- void handleCellClicked(event)
835
- }
858
+ onCellClicked={handleCellClicked}
836
859
  columnDefs={otherTasksColDefs}
837
860
  loading={loading}
838
861
  overlayLoadingTemplate="Loading contracts"
@@ -855,44 +878,28 @@ export const EntitlementsPendingTasksDashboard = observer(
855
878
  pendingTaskContracts={pendingTaskContracts}
856
879
  marketplaceBaseStore={marketplaceBaseStore}
857
880
  />
858
- {selectedContract !== undefined && (
881
+ {selectedRow !== undefined && selectedViewerState !== undefined && (
859
882
  <DataAccessRequestViewer
860
883
  open={true}
861
884
  onClose={() => {
862
- setSelectedContract(undefined);
885
+ setSelectedRow(undefined);
863
886
  setContractErrors(undefined);
864
887
  }}
865
888
  contractErrors={contractErrors}
866
- viewerState={
867
- new DataContractViewerState(
868
- selectedContract,
869
- (contractId: string, taskId: string) =>
870
- marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
871
- generateContractPagePath(contractId, taskId),
872
- ),
873
- undefined,
874
- marketplaceBaseStore.applicationStore,
875
- marketplaceBaseStore.lakehouseContractServerClient,
876
- new GraphManagerState(
877
- marketplaceBaseStore.applicationStore.pluginManager,
878
- marketplaceBaseStore.applicationStore.logService,
879
- ),
880
- marketplaceBaseStore.userSearchService,
881
- )
882
- }
883
- onRefresh={async () => {
884
- await flowResult(
885
- dashboardState.updateContract(
886
- selectedContract.guid,
887
- auth.user?.access_token,
888
- ),
889
- );
890
- }}
891
- getDataProductUrl={(dataProductId: string, deploymentId: number) =>
892
- marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
893
- generateLakehouseDataProductPath(dataProductId, deploymentId),
894
- )
895
- }
889
+ viewerState={selectedViewerState}
890
+ {...(selectedContractGuid
891
+ ? {
892
+ onRefresh: async () => {
893
+ await flowResult(
894
+ dashboardState.updateContract(
895
+ selectedContractGuid,
896
+ auth.user?.access_token,
897
+ ),
898
+ );
899
+ },
900
+ }
901
+ : {})}
902
+ getDataProductUrl={getDataProductUrl}
896
903
  initialSelectedUser={selectedContractTargetUser}
897
904
  //Derives environment from the fact that other environments are filtered out
898
905
  dataProductEnvironment={