@finos/legend-application-marketplace 0.2.16 → 0.2.17

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 (112) hide show
  1. package/lib/__lib__/LegendMarketplaceNavigation.d.ts +0 -2
  2. package/lib/__lib__/LegendMarketplaceNavigation.d.ts.map +1 -1
  3. package/lib/__lib__/LegendMarketplaceNavigation.js +0 -4
  4. package/lib/__lib__/LegendMarketplaceNavigation.js.map +1 -1
  5. package/lib/application/LegendMarketplaceApplicationConfig.d.ts +0 -9
  6. package/lib/application/LegendMarketplaceApplicationConfig.d.ts.map +1 -1
  7. package/lib/application/LegendMarketplaceApplicationConfig.js +22 -40
  8. package/lib/application/LegendMarketplaceApplicationConfig.js.map +1 -1
  9. package/lib/application/LegendMarketplaceWebApplication.d.ts.map +1 -1
  10. package/lib/application/LegendMarketplaceWebApplication.js +1 -4
  11. package/lib/application/LegendMarketplaceWebApplication.js.map +1 -1
  12. package/lib/application/__test-utils__/LegendMarketplaceApplicationTestUtils.d.ts.map +1 -1
  13. package/lib/application/__test-utils__/LegendMarketplaceApplicationTestUtils.js +0 -7
  14. package/lib/application/__test-utils__/LegendMarketplaceApplicationTestUtils.js.map +1 -1
  15. package/lib/index.css +2 -2
  16. package/lib/index.css.map +1 -1
  17. package/lib/package.json +1 -1
  18. package/lib/pages/Agents/LegendMarketplaceAgents.d.ts.map +1 -1
  19. package/lib/pages/Agents/LegendMarketplaceAgents.js +17 -49
  20. package/lib/pages/Agents/LegendMarketplaceAgents.js.map +1 -1
  21. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.d.ts.map +1 -1
  22. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js +56 -70
  23. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js.map +1 -1
  24. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.d.ts.map +1 -1
  25. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js +62 -82
  26. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js.map +1 -1
  27. package/lib/pages/Lakehouse/entitlements/WorkflowDataAccessRequest.d.ts.map +1 -1
  28. package/lib/pages/Lakehouse/entitlements/WorkflowDataAccessRequest.js +65 -23
  29. package/lib/pages/Lakehouse/entitlements/WorkflowDataAccessRequest.js.map +1 -1
  30. package/lib/stores/LegendMarketplaceBaseStore.d.ts +1 -2
  31. package/lib/stores/LegendMarketplaceBaseStore.d.ts.map +1 -1
  32. package/lib/stores/LegendMarketplaceBaseStore.js +1 -8
  33. package/lib/stores/LegendMarketplaceBaseStore.js.map +1 -1
  34. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.d.ts.map +1 -1
  35. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js +2 -3
  36. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js.map +1 -1
  37. package/lib/stores/lakehouse/dataProducts/ProductCardState.d.ts +1 -1
  38. package/lib/stores/lakehouse/dataProducts/ProductCardState.d.ts.map +1 -1
  39. package/lib/stores/lakehouse/dataProducts/ProductCardState.js +2 -1
  40. package/lib/stores/lakehouse/dataProducts/ProductCardState.js.map +1 -1
  41. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts +1 -4
  42. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts.map +1 -1
  43. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js +2 -22
  44. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js.map +1 -1
  45. package/lib/utils/EntitlementsUtils.d.ts +2 -36
  46. package/lib/utils/EntitlementsUtils.d.ts.map +1 -1
  47. package/lib/utils/EntitlementsUtils.js +46 -225
  48. package/lib/utils/EntitlementsUtils.js.map +1 -1
  49. package/lib/utils/SearchUtils.d.ts.map +1 -1
  50. package/lib/utils/SearchUtils.js +4 -7
  51. package/lib/utils/SearchUtils.js.map +1 -1
  52. package/package.json +10 -10
  53. package/src/__lib__/LegendMarketplaceNavigation.ts +0 -11
  54. package/src/application/LegendMarketplaceApplicationConfig.ts +24 -62
  55. package/src/application/LegendMarketplaceWebApplication.tsx +0 -15
  56. package/src/application/__test-utils__/LegendMarketplaceApplicationTestUtils.ts +0 -7
  57. package/src/pages/Agents/LegendMarketplaceAgents.tsx +23 -145
  58. package/src/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.tsx +127 -124
  59. package/src/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.tsx +153 -151
  60. package/src/pages/Lakehouse/entitlements/WorkflowDataAccessRequest.tsx +94 -25
  61. package/src/stores/LegendMarketplaceBaseStore.ts +0 -12
  62. package/src/stores/lakehouse/LegendMarketplaceProductViewerStore.ts +0 -6
  63. package/src/stores/lakehouse/dataProducts/ProductCardState.ts +4 -3
  64. package/src/stores/lakehouse/entitlements/EntitlementsDashboardState.ts +30 -69
  65. package/src/utils/EntitlementsUtils.tsx +86 -341
  66. package/src/utils/SearchUtils.tsx +4 -7
  67. package/tsconfig.json +0 -9
  68. package/lib/application/providers/LegendMarketplaceAIChatStoreProvider.d.ts +0 -21
  69. package/lib/application/providers/LegendMarketplaceAIChatStoreProvider.d.ts.map +0 -1
  70. package/lib/application/providers/LegendMarketplaceAIChatStoreProvider.js +0 -29
  71. package/lib/application/providers/LegendMarketplaceAIChatStoreProvider.js.map +0 -1
  72. package/lib/pages/Agents/MarketplaceAIChatView.d.ts +0 -21
  73. package/lib/pages/Agents/MarketplaceAIChatView.d.ts.map +0 -1
  74. package/lib/pages/Agents/MarketplaceAIChatView.js +0 -141
  75. package/lib/pages/Agents/MarketplaceAIChatView.js.map +0 -1
  76. package/lib/pages/Agents/MarketplaceAIInputBar.d.ts +0 -22
  77. package/lib/pages/Agents/MarketplaceAIInputBar.d.ts.map +0 -1
  78. package/lib/pages/Agents/MarketplaceAIInputBar.js +0 -40
  79. package/lib/pages/Agents/MarketplaceAIInputBar.js.map +0 -1
  80. package/lib/pages/Agents/MarketplaceAIProductAutosuggest.d.ts +0 -25
  81. package/lib/pages/Agents/MarketplaceAIProductAutosuggest.d.ts.map +0 -1
  82. package/lib/pages/Agents/MarketplaceAIProductAutosuggest.js +0 -86
  83. package/lib/pages/Agents/MarketplaceAIProductAutosuggest.js.map +0 -1
  84. package/lib/pages/Agents/MarketplaceAIProductCards.d.ts +0 -23
  85. package/lib/pages/Agents/MarketplaceAIProductCards.d.ts.map +0 -1
  86. package/lib/pages/Agents/MarketplaceAIProductCards.js +0 -20
  87. package/lib/pages/Agents/MarketplaceAIProductCards.js.map +0 -1
  88. package/lib/pages/Agents/MarketplaceAIScopeSelector.d.ts +0 -19
  89. package/lib/pages/Agents/MarketplaceAIScopeSelector.d.ts.map +0 -1
  90. package/lib/pages/Agents/MarketplaceAIScopeSelector.js +0 -46
  91. package/lib/pages/Agents/MarketplaceAIScopeSelector.js.map +0 -1
  92. package/lib/pages/Lakehouse/entitlements/PermitDataAccessRequest.d.ts +0 -17
  93. package/lib/pages/Lakehouse/entitlements/PermitDataAccessRequest.d.ts.map +0 -1
  94. package/lib/pages/Lakehouse/entitlements/PermitDataAccessRequest.js +0 -126
  95. package/lib/pages/Lakehouse/entitlements/PermitDataAccessRequest.js.map +0 -1
  96. package/lib/pages/Lakehouse/entitlements/showTaskActionAlert.d.ts +0 -29
  97. package/lib/pages/Lakehouse/entitlements/showTaskActionAlert.d.ts.map +0 -1
  98. package/lib/pages/Lakehouse/entitlements/showTaskActionAlert.js +0 -60
  99. package/lib/pages/Lakehouse/entitlements/showTaskActionAlert.js.map +0 -1
  100. package/lib/stores/ai/LegendMarketplaceAIChatStore.d.ts +0 -109
  101. package/lib/stores/ai/LegendMarketplaceAIChatStore.d.ts.map +0 -1
  102. package/lib/stores/ai/LegendMarketplaceAIChatStore.js +0 -1106
  103. package/lib/stores/ai/LegendMarketplaceAIChatStore.js.map +0 -1
  104. package/src/application/providers/LegendMarketplaceAIChatStoreProvider.tsx +0 -47
  105. package/src/pages/Agents/MarketplaceAIChatView.tsx +0 -555
  106. package/src/pages/Agents/MarketplaceAIInputBar.tsx +0 -91
  107. package/src/pages/Agents/MarketplaceAIProductAutosuggest.tsx +0 -181
  108. package/src/pages/Agents/MarketplaceAIProductCards.tsx +0 -111
  109. package/src/pages/Agents/MarketplaceAIScopeSelector.tsx +0 -84
  110. package/src/pages/Lakehouse/entitlements/PermitDataAccessRequest.tsx +0 -245
  111. package/src/pages/Lakehouse/entitlements/showTaskActionAlert.tsx +0 -101
  112. package/src/stores/ai/LegendMarketplaceAIChatStore.ts +0 -1720
@@ -39,7 +39,6 @@ import {
39
39
  RawLambda,
40
40
  V1_DataProductAccessor,
41
41
  V1_deserializeDataContractResponse,
42
- type V1_DataRequestWithWorkflow,
43
42
  V1_entitlementsDataProductDetailsResponseToDataProductDetails,
44
43
  V1_IngestDefinitionAccessor,
45
44
  V1_LakehouseAccessPoint,
@@ -51,8 +50,6 @@ import {
51
50
  V1_SdlcDeploymentDataProductOrigin,
52
51
  V1_TaskStatusChangeResponseModelSchema,
53
52
  V1_transformDataContractToLiteDatacontract,
54
- V1_deserializeDataRequestsWithWorkflowResponse,
55
- type V1_DataRequestsWithWorkflowResponse,
56
53
  } from '@finos/legend-graph';
57
54
  import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
58
55
  import type { ContractErrorLayer } from '@finos/legend-extension-dsl-data-product';
@@ -202,14 +199,12 @@ export class EntitlementsDashboardState {
202
199
  // consolidated user information from the tasks.
203
200
  allContractsCreatedByUserMap: Map<string, ContractCreatedByUserDetails> =
204
201
  new Map();
205
- dataRequestsCreatedByUser: V1_DataRequestWithWorkflow[] | undefined;
206
202
  selectedTaskIds: Set<string> = new Set();
207
203
 
208
204
  readonly initializationState = ActionState.create();
209
205
  readonly fetchingPendingTasksState = ActionState.create();
210
206
  readonly fetchingContractsForUserState = ActionState.create();
211
207
  readonly fetchingContractsByUserState = ActionState.create();
212
- readonly fetchingDataRequestsCreatedByUserState = ActionState.create();
213
208
  readonly changingState = ActionState.create();
214
209
 
215
210
  constructor(state: LakehouseEntitlementsStore) {
@@ -221,7 +216,6 @@ export class EntitlementsDashboardState {
221
216
  allContractsCreatedByUserMap: observable,
222
217
  pendingTaskContractMap: observable,
223
218
  selectedTaskIds: observable,
224
- dataRequestsCreatedByUser: observable,
225
219
  pendingTaskContracts: computed,
226
220
  allContractsCreatedByUser: computed,
227
221
  setSelectedTaskIds: action,
@@ -234,7 +228,6 @@ export class EntitlementsDashboardState {
234
228
  fetchContractsCreatedByUser: flow,
235
229
  fetchContractDeploymentEnvironments: flow,
236
230
  updateContract: flow,
237
- fetchDataRequestsCreatedByUser: flow,
238
231
  });
239
232
  }
240
233
 
@@ -257,44 +250,37 @@ export class EntitlementsDashboardState {
257
250
  this.fetchingPendingTasksState.inProgress();
258
251
  this.fetchingContractsForUserState.inProgress();
259
252
  this.fetchingContractsByUserState.inProgress();
260
- this.fetchingDataRequestsCreatedByUserState.inProgress();
261
253
 
262
- const [
263
- pendingTasksData,
264
- contractsForUser,
265
- contractsCreatedByUserMap,
266
- dataRequestsCreatedByUser,
267
- ] = (yield Promise.all([
268
- (async () => {
269
- try {
270
- const tasks = await flowResult(this.fetchPendingTasks(token));
271
- const taskContractMap = await flowResult(
272
- this.fetchPendingTaskContracts(token, tasks),
273
- );
274
- return { tasks, taskContractMap };
275
- } catch (error) {
276
- assertErrorThrown(error);
277
- this.lakehouseEntitlementsStore.applicationStore.alertUnhandledError(
278
- error,
279
- );
280
- return {
281
- tasks: [] as V1_ContractUserEventRecord[],
282
- taskContractMap: new Map<string, V1_LiteDataContract>(),
283
- };
284
- }
285
- })(),
286
- flowResult(this.fetchContractsForUser(token)),
287
- flowResult(this.fetchContractsCreatedByUser(token)),
288
- flowResult(this.fetchDataRequestsCreatedByUser(token)),
289
- ])) as [
290
- {
291
- tasks: V1_ContractUserEventRecord[];
292
- taskContractMap: Map<string, V1_LiteDataContract>;
293
- },
294
- V1_LiteDataContractWithUserStatus[],
295
- Map<string, ContractCreatedByUserDetails>,
296
- V1_DataRequestWithWorkflow[],
297
- ];
254
+ const [pendingTasksData, contractsForUser, contractsCreatedByUserMap] =
255
+ (yield Promise.all([
256
+ (async () => {
257
+ try {
258
+ const tasks = await flowResult(this.fetchPendingTasks(token));
259
+ const taskContractMap = await flowResult(
260
+ this.fetchPendingTaskContracts(token, tasks),
261
+ );
262
+ return { tasks, taskContractMap };
263
+ } catch (error) {
264
+ assertErrorThrown(error);
265
+ this.lakehouseEntitlementsStore.applicationStore.alertUnhandledError(
266
+ error,
267
+ );
268
+ return {
269
+ tasks: [] as V1_ContractUserEventRecord[],
270
+ taskContractMap: new Map<string, V1_LiteDataContract>(),
271
+ };
272
+ }
273
+ })(),
274
+ flowResult(this.fetchContractsForUser(token)),
275
+ flowResult(this.fetchContractsCreatedByUser(token)),
276
+ ])) as [
277
+ {
278
+ tasks: V1_ContractUserEventRecord[];
279
+ taskContractMap: Map<string, V1_LiteDataContract>;
280
+ },
281
+ V1_LiteDataContractWithUserStatus[],
282
+ Map<string, ContractCreatedByUserDetails>,
283
+ ];
298
284
 
299
285
  const allContracts: V1_LiteDataContract[] = [
300
286
  ...Array.from(pendingTasksData.taskContractMap.values()),
@@ -321,12 +307,10 @@ export class EntitlementsDashboardState {
321
307
  this.pendingTasks = filteredTasks;
322
308
  this.allContractsForUser = filteredContractsForUser;
323
309
  this.allContractsCreatedByUserMap = filteredCreatedByUserMap;
324
- this.dataRequestsCreatedByUser = dataRequestsCreatedByUser;
325
310
 
326
311
  this.fetchingPendingTasksState.complete();
327
312
  this.fetchingContractsForUserState.complete();
328
313
  this.fetchingContractsByUserState.complete();
329
- this.fetchingDataRequestsCreatedByUserState.complete();
330
314
  } catch (error) {
331
315
  assertErrorThrown(error);
332
316
  this.lakehouseEntitlementsStore.applicationStore.alertUnhandledError(
@@ -469,29 +453,6 @@ export class EntitlementsDashboardState {
469
453
  }
470
454
  }
471
455
 
472
- *fetchDataRequestsCreatedByUser(
473
- token: string | undefined,
474
- ): GeneratorFn<V1_DataRequestWithWorkflow[]> {
475
- try {
476
- const raw =
477
- (yield this.lakehouseEntitlementsStore.lakehouseContractServerClient.getDataAccessRequestsCreatedBy(
478
- this.lakehouseEntitlementsStore.applicationStore.identityService
479
- .currentUser,
480
- token,
481
- )) as PlainObject<V1_DataRequestsWithWorkflowResponse>;
482
- return V1_deserializeDataRequestsWithWorkflowResponse(
483
- raw,
484
- this.lakehouseEntitlementsStore.applicationStore.pluginManager.getPureProtocolProcessorPlugins(),
485
- );
486
- } catch (error) {
487
- assertErrorThrown(error);
488
- this.lakehouseEntitlementsStore.applicationStore.notificationService.notifyError(
489
- `Error fetching data requests created by user: ${error.message}`,
490
- );
491
- return [];
492
- }
493
- }
494
-
495
456
  *fetchContractDeploymentEnvironments(
496
457
  allContracts: V1_LiteDataContract[],
497
458
  token: string | undefined,
@@ -19,20 +19,10 @@ import {
19
19
  getOrganizationalScopeTypeDetails,
20
20
  UserRenderer,
21
21
  MultiUserRenderer,
22
- stringifyOrganizationalScope,
23
- DataContractViewerState,
24
- PermitDataAccessRequestState,
25
22
  } from '@finos/legend-extension-dsl-data-product';
26
23
  import {
27
- GraphManagerState,
28
24
  V1_LiteDataContractWithUserStatus,
29
25
  V1_ResourceType,
30
- V1_AccessPointGroupReference,
31
- V1_ContractState,
32
- V1_RequestState,
33
- V1_WorkflowTaskStatus,
34
- type V1_DataRequestWithWorkflow,
35
- V1_deserializeDataRequestsWithWorkflowResponse,
36
26
  } from '@finos/legend-graph';
37
27
  import type {
38
28
  DataGridCellRendererParams,
@@ -47,222 +37,94 @@ import { InfoCircleIcon } from '@finos/legend-art';
47
37
  import { Tooltip } from '@mui/material';
48
38
  import { observer } from 'mobx-react-lite';
49
39
  import type { LakehouseEntitlementsStore } from '../stores/lakehouse/entitlements/LakehouseEntitlementsStore.js';
50
- import { useMemo } from 'react';
51
- import { useLegendMarketplaceBaseStore } from '../application/providers/LegendMarketplaceFrameworkProvider.js';
52
- import {
53
- generateContractPagePath,
54
- generateLakehouseDataProductPath,
55
- generatePermitDataAccessRequestPagePath,
56
- } from '../__lib__/LegendMarketplaceNavigation.js';
57
-
58
- export const UNKNOWN = 'Unknown';
59
- export const ROW_KIND_CONTRACT = 'contract';
60
- export const ROW_KIND_REQUEST = 'request';
61
-
62
- export enum EntitlementsColumnHeader {
63
- TYPE = 'Type',
64
- DATE_CREATED = 'Date Created',
65
- CONSUMER_TYPE = 'Consumer Type',
66
- TARGET_USERS = 'Target User(s)',
67
- REQUESTER = 'Requester',
68
- TARGET_DATA_PRODUCT = 'Target Data Product',
69
- TARGET_ACCESS_POINT_GROUP = 'Target Access Point Group',
70
- BUSINESS_JUSTIFICATION = 'Business Justification',
71
- STATE = 'State',
72
- ASSIGNEES = 'Assignees',
73
- }
74
-
75
- export const CONTRACT_STATE_DISPLAY_LABELS: Record<string, string> = {
76
- [V1_ContractState.DRAFT]: 'Draft',
77
- [V1_ContractState.PENDING_DATA_OWNER_APPROVAL]: 'Data Owner Approval',
78
- [V1_ContractState.OPEN_FOR_PRIVILEGE_MANAGER_APPROVAL]:
79
- 'Privilege Manager Approval',
80
- [V1_ContractState.COMPLETED]: 'Completed',
81
- [V1_ContractState.REJECTED]: 'Rejected',
82
- [V1_ContractState.CLOSED]: 'Closed',
83
- };
84
-
85
- export const TERMINAL_DATA_REQUEST_STATES = new Set<string>([
86
- V1_RequestState.COMPLETED,
87
- V1_RequestState.REJECTED,
88
- V1_RequestState.INVALIDATED,
89
- V1_RequestState.OBSOLETE,
90
- ]);
91
-
92
- export const ENTITLEMENTS_DEFAULT_COL_DEF: DataGridColumnDefinition<EntitlementsRow> =
93
- {
94
- minWidth: 50,
95
- sortable: true,
96
- resizable: true,
97
- flex: 1,
98
- };
99
-
100
- export type EntitlementsRow =
101
- | {
102
- kind: 'contract';
103
- data: V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails;
104
- }
105
- | { kind: 'request'; data: V1_DataRequestWithWorkflow };
106
-
107
- export const getContractData = (row: EntitlementsRow) =>
108
- row.kind === ROW_KIND_CONTRACT ? row.data.contractResultLite : undefined;
109
-
110
- export const getRequestData = (row: EntitlementsRow) =>
111
- row.kind === ROW_KIND_REQUEST ? row.data.dataRequest : undefined;
112
-
113
- export const getSelectedRowId = (
114
- row: EntitlementsRow | undefined,
115
- ): string | undefined =>
116
- row ? (getContractData(row)?.guid ?? getRequestData(row)?.guid) : undefined;
117
-
118
- export const getSelectedContractGuid = (
119
- row: EntitlementsRow | undefined,
120
- ): string | undefined => (row ? getContractData(row)?.guid : undefined);
121
-
122
- export const getOpenTaskAssignees = (
123
- data: V1_DataRequestWithWorkflow,
124
- ): string[] => {
125
- const openTask = data.workflows
126
- .flatMap((w) => w.tasks)
127
- .find((t) => t.status === V1_WorkflowTaskStatus.OPEN);
128
- return openTask?.assignees.toSorted() ?? [];
129
- };
130
-
131
- export const getConsumer = (row: EntitlementsRow) =>
132
- getContractData(row)?.consumer ?? getRequestData(row)?.consumer;
133
40
 
134
41
  const TargetUserCellRenderer = observer(
135
42
  (props: {
136
- row: EntitlementsRow | undefined;
43
+ dataContract:
44
+ | V1_LiteDataContractWithUserStatus
45
+ | ContractCreatedByUserDetails
46
+ | undefined;
137
47
  entitlementsStore: LakehouseEntitlementsStore;
138
48
  }): React.ReactNode => {
139
- const { row, entitlementsStore } = props;
140
- if (!row) {
141
- return <>{UNKNOWN}</>;
142
- }
143
- if (row.kind === ROW_KIND_CONTRACT) {
144
- const dataContract = row.data;
145
- const userIds =
146
- dataContract instanceof V1_LiteDataContractWithUserStatus
147
- ? [dataContract.user]
148
- : dataContract.sortedMemberIds;
149
- return (
150
- <MultiUserRenderer
151
- userIds={userIds}
152
- applicationStore={entitlementsStore.applicationStore}
153
- userSearchService={
154
- entitlementsStore.marketplaceBaseStore.userSearchService
155
- }
156
- disableOnClick={true}
157
- singleUserClassName="marketplace-lakehouse-entitlements__grid__user-display"
158
- />
159
- );
160
- }
161
- const consumer = row.data.dataRequest.consumer;
49
+ const { dataContract, entitlementsStore } = props;
50
+
51
+ const userIds =
52
+ dataContract instanceof V1_LiteDataContractWithUserStatus
53
+ ? [dataContract.user]
54
+ : (dataContract?.sortedMemberIds ?? []);
55
+
162
56
  return (
163
- <>
164
- {stringifyOrganizationalScope(
165
- consumer,
166
- entitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
167
- )}
168
- </>
57
+ <MultiUserRenderer
58
+ userIds={userIds}
59
+ applicationStore={entitlementsStore.applicationStore}
60
+ userSearchService={
61
+ entitlementsStore.marketplaceBaseStore.userSearchService
62
+ }
63
+ disableOnClick={true}
64
+ singleUserClassName="marketplace-lakehouse-entitlements__grid__user-display"
65
+ />
169
66
  );
170
67
  },
171
68
  );
172
69
 
173
70
  export const getCommonEntitlementsColDefs = (
174
71
  dashboardState: EntitlementsDashboardState,
175
- ): DataGridColumnDefinition<EntitlementsRow>[] => [
72
+ ): DataGridColumnDefinition<
73
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
74
+ >[] => [
176
75
  {
177
- headerName: EntitlementsColumnHeader.TYPE,
178
- colId: 'type',
179
- valueGetter: (params) =>
180
- params.data?.kind === ROW_KIND_CONTRACT
181
- ? 'Data Contract'
182
- : 'Data Request',
183
- },
184
- {
185
- headerName: EntitlementsColumnHeader.DATE_CREATED,
76
+ headerName: 'Date Created',
186
77
  colId: 'dateCreated',
187
- sort: 'desc',
188
- comparator: (_, __, val1, val2) => {
189
- const getTime = (row: EntitlementsRow | undefined): number => {
190
- if (!row) {
191
- return 0;
192
- }
193
- const contract = getContractData(row);
194
- if (contract) {
195
- return contract.createdAt
196
- ? new Date(contract.createdAt).getTime()
197
- : 0;
198
- }
199
- if (row.kind !== ROW_KIND_REQUEST) {
200
- return 0;
201
- }
202
- const c = row.data.workflows[0]?.tasks[0]?.createdOn;
203
- if (!c) {
204
- return 0;
205
- }
206
- const dateStr = c instanceof Date ? c.toISOString() : String(c);
207
- return new Date(dateStr).getTime();
208
- };
209
- return getTime(val1.data) - getTime(val2.data);
210
- },
211
78
  valueGetter: (params) => {
212
- if (!params.data) {
213
- return UNKNOWN;
214
- }
215
- const contract = getContractData(params.data);
216
- if (contract) {
217
- return formatOrderDate(contract.createdAt) ?? UNKNOWN;
218
- }
219
- if (params.data.kind !== ROW_KIND_REQUEST) {
220
- return UNKNOWN;
221
- }
222
- const createdOn = params.data.data.workflows[0]?.tasks[0]?.createdOn;
223
- if (!createdOn) {
224
- return UNKNOWN;
225
- }
226
79
  return (
227
- formatOrderDate(
228
- createdOn instanceof Date
229
- ? createdOn.toISOString()
230
- : String(createdOn),
231
- ) ?? UNKNOWN
80
+ formatOrderDate(params.data?.contractResultLite.createdAt) ?? 'Unknown'
232
81
  );
233
82
  },
83
+ sort: 'desc',
84
+ comparator: (_, __, val1, val2) => {
85
+ const dateA = val1.data?.contractResultLite.createdAt
86
+ ? new Date(val1.data.contractResultLite.createdAt).getTime()
87
+ : 0;
88
+ const dateB = val2.data?.contractResultLite.createdAt
89
+ ? new Date(val2.data.contractResultLite.createdAt).getTime()
90
+ : 0;
91
+ return dateA - dateB;
92
+ },
234
93
  },
235
94
  {
236
95
  colId: 'consumerType',
237
- headerName: EntitlementsColumnHeader.CONSUMER_TYPE,
96
+ headerName: 'Consumer Type',
238
97
  valueGetter: (params) => {
239
- if (!params.data) {
240
- return UNKNOWN;
241
- }
242
- const consumer = getConsumer(params.data);
243
- return consumer
98
+ const consumer = params.data?.contractResultLite.consumer;
99
+ const typeName = consumer
244
100
  ? getOrganizationalScopeTypeName(
245
101
  consumer,
246
102
  dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
247
103
  )
248
- : UNKNOWN;
104
+ : undefined;
105
+ return typeName ?? 'Unknown';
249
106
  },
250
- cellRenderer: (params: DataGridCellRendererParams<EntitlementsRow>) => {
251
- if (!params.data) {
252
- return UNKNOWN;
253
- }
254
- const consumer = getConsumer(params.data);
255
- const plugins =
256
- dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins();
107
+ cellRenderer: (
108
+ params: DataGridCellRendererParams<
109
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
110
+ >,
111
+ ) => {
112
+ const consumer = params.data?.contractResultLite.consumer;
257
113
  const typeName = consumer
258
- ? getOrganizationalScopeTypeName(consumer, plugins)
114
+ ? getOrganizationalScopeTypeName(
115
+ consumer,
116
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
117
+ )
259
118
  : undefined;
260
119
  const typeDetails = consumer
261
- ? getOrganizationalScopeTypeDetails(consumer, plugins)
120
+ ? getOrganizationalScopeTypeDetails(
121
+ consumer,
122
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
123
+ )
262
124
  : undefined;
263
125
  return (
264
126
  <>
265
- {typeName ?? UNKNOWN}
127
+ {typeName ?? 'Unknown'}
266
128
  {typeDetails !== undefined && (
267
129
  <Tooltip
268
130
  className="marketplace-lakehouse-entitlements__grid__consumer-type__tooltip__icon"
@@ -276,52 +138,37 @@ export const getCommonEntitlementsColDefs = (
276
138
  },
277
139
  },
278
140
  {
279
- headerName: EntitlementsColumnHeader.TARGET_USERS,
141
+ headerName: 'Target User(s)',
280
142
  colId: 'targetUser',
281
143
  valueGetter: (params) => {
282
- if (!params.data) {
283
- return UNKNOWN;
284
- }
285
- if (params.data.kind === ROW_KIND_CONTRACT) {
286
- const userIds =
287
- params.data.data instanceof V1_LiteDataContractWithUserStatus
288
- ? [params.data.data.user]
289
- : params.data.data.sortedMemberIds;
290
- return userIds.length > 0 ? userIds.join(', ') : UNKNOWN;
291
- }
292
- const consumer = params.data.data.dataRequest.consumer;
293
- return stringifyOrganizationalScope(
294
- consumer,
295
- dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
296
- );
144
+ const userIds =
145
+ params.data instanceof V1_LiteDataContractWithUserStatus
146
+ ? [params.data.user]
147
+ : (params.data?.sortedMemberIds ?? []);
148
+ return userIds.length > 0 ? userIds.join(', ') : 'Unknown';
297
149
  },
298
- cellRenderer: (params: DataGridCellRendererParams<EntitlementsRow>) => (
150
+ cellRenderer: (
151
+ params: DataGridCellRendererParams<
152
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
153
+ >,
154
+ ) => (
299
155
  <TargetUserCellRenderer
300
- row={params.data}
156
+ dataContract={params.data}
301
157
  entitlementsStore={dashboardState.lakehouseEntitlementsStore}
302
158
  />
303
159
  ),
304
160
  },
305
161
  {
306
- headerName: EntitlementsColumnHeader.REQUESTER,
162
+ headerName: 'Requester',
307
163
  colId: 'requester',
308
- valueGetter: (params) => {
309
- if (!params.data) {
310
- return UNKNOWN;
311
- }
312
- return (
313
- getContractData(params.data)?.createdBy ??
314
- getRequestData(params.data)?.createdBy ??
315
- UNKNOWN
316
- );
317
- },
318
- cellRenderer: (params: DataGridCellRendererParams<EntitlementsRow>) => {
319
- if (!params.data) {
320
- return <>{UNKNOWN}</>;
321
- }
322
- const requester =
323
- getContractData(params.data)?.createdBy ??
324
- getRequestData(params.data)?.createdBy;
164
+ valueGetter: (params) =>
165
+ params.data?.contractResultLite.createdBy ?? 'Unknown',
166
+ cellRenderer: (
167
+ params: DataGridCellRendererParams<
168
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
169
+ >,
170
+ ) => {
171
+ const requester = params.data?.contractResultLite.createdBy;
325
172
  return requester ? (
326
173
  <UserRenderer
327
174
  userId={requester}
@@ -336,127 +183,25 @@ export const getCommonEntitlementsColDefs = (
336
183
  className="marketplace-lakehouse-entitlements__grid__user-display"
337
184
  />
338
185
  ) : (
339
- <>{UNKNOWN}</>
186
+ <>Unknown</>
340
187
  );
341
188
  },
342
189
  },
343
190
  {
344
- headerName: EntitlementsColumnHeader.TARGET_DATA_PRODUCT,
345
- valueGetter: (params) => {
346
- if (!params.data) {
347
- return UNKNOWN;
348
- }
349
- const contract = getContractData(params.data);
350
- if (contract) {
351
- return contract.resourceId;
352
- }
353
- const resource = getRequestData(params.data)?.resource;
354
- return resource instanceof V1_AccessPointGroupReference
355
- ? resource.dataProduct.name
356
- : UNKNOWN;
357
- },
358
- },
359
- {
360
- headerName: EntitlementsColumnHeader.TARGET_ACCESS_POINT_GROUP,
191
+ headerName: 'Target Data Product',
361
192
  valueGetter: (params) => {
362
- if (!params.data) {
363
- return UNKNOWN;
364
- }
365
- const contract = getContractData(params.data);
366
- if (contract) {
367
- const accessPointGroup =
368
- contract.resourceType === V1_ResourceType.ACCESS_POINT_GROUP
369
- ? contract.accessPointGroup
370
- : `${contract.accessPointGroup ?? UNKNOWN} (${contract.resourceType})`;
371
- return accessPointGroup ?? UNKNOWN;
372
- }
373
- const resource = getRequestData(params.data)?.resource;
374
- return resource instanceof V1_AccessPointGroupReference
375
- ? resource.accessPointGroup
376
- : UNKNOWN;
193
+ return params.data?.contractResultLite.resourceId ?? 'Unknown';
377
194
  },
378
195
  },
379
196
  {
380
- headerName: EntitlementsColumnHeader.BUSINESS_JUSTIFICATION,
197
+ headerName: 'Target Access Point Group',
381
198
  valueGetter: (params) => {
382
- if (!params.data) {
383
- return UNKNOWN;
384
- }
385
- return (
386
- getContractData(params.data)?.description ??
387
- getRequestData(params.data)?.businessJustification ??
388
- UNKNOWN
389
- );
199
+ const accessPointGroup =
200
+ params.data?.contractResultLite.resourceType ===
201
+ V1_ResourceType.ACCESS_POINT_GROUP
202
+ ? params.data.contractResultLite.accessPointGroup
203
+ : `${params.data?.contractResultLite.accessPointGroup ?? 'Unknown'} (${params.data?.contractResultLite.resourceType ?? 'Unknown Type'})`;
204
+ return accessPointGroup ?? 'Unknown';
390
205
  },
391
206
  },
392
207
  ];
393
-
394
- export const useSelectedViewerState = (
395
- selectedRow: EntitlementsRow | undefined,
396
- selectedRowId: string | undefined,
397
- ) => {
398
- const marketplaceBaseStore = useLegendMarketplaceBaseStore();
399
- return useMemo(() => {
400
- if (!selectedRow) {
401
- return undefined;
402
- }
403
- if (selectedRow.kind === ROW_KIND_CONTRACT) {
404
- const contract = selectedRow.data.contractResultLite;
405
- return new DataContractViewerState(
406
- contract,
407
- (contractId: string, taskId: string) =>
408
- marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
409
- generateContractPagePath(contractId, taskId),
410
- ),
411
- undefined,
412
- marketplaceBaseStore.applicationStore,
413
- marketplaceBaseStore.lakehouseContractServerClient,
414
- new GraphManagerState(
415
- marketplaceBaseStore.applicationStore.pluginManager,
416
- marketplaceBaseStore.applicationStore.logService,
417
- ),
418
- marketplaceBaseStore.userSearchService,
419
- );
420
- }
421
- const guid = selectedRow.data.dataRequest.guid;
422
- const authClient = marketplaceBaseStore.lakehouseContractServerClient;
423
- const pluginManager = marketplaceBaseStore.applicationStore.pluginManager;
424
- return new PermitDataAccessRequestState(
425
- guid,
426
- marketplaceBaseStore.applicationStore,
427
- marketplaceBaseStore.permitWorkflowServerClient,
428
- marketplaceBaseStore.userSearchService,
429
- {
430
- authServerClient: authClient,
431
- initialData: selectedRow.data,
432
- fetchFresh: async (token) => {
433
- const raw = await authClient.getDataAccessRequestWithWorkflow(
434
- guid,
435
- token,
436
- );
437
- return V1_deserializeDataRequestsWithWorkflowResponse(
438
- raw,
439
- pluginManager.getPureProtocolProcessorPlugins(),
440
- )[0];
441
- },
442
- getTaskPageUrl: (id) =>
443
- marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
444
- generatePermitDataAccessRequestPagePath(id),
445
- ),
446
- },
447
- );
448
- // Re-create only when the selected row changes (different guid)
449
- // eslint-disable-next-line react-hooks/exhaustive-deps
450
- }, [selectedRowId]);
451
- };
452
-
453
- export const useGetDataProductUrl = (): ((
454
- dataProductId: string,
455
- deploymentId: number,
456
- ) => string) => {
457
- const marketplaceBaseStore = useLegendMarketplaceBaseStore();
458
- return (dataProductId: string, deploymentId: number) =>
459
- marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
460
- generateLakehouseDataProductPath(dataProductId, deploymentId),
461
- );
462
- };