@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
@@ -14,9 +14,15 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { V1_LiteDataContractWithUserStatus } from '@finos/legend-graph';
17
+ import {
18
+ GraphManagerState,
19
+ V1_ContractState,
20
+ type V1_LiteDataContract,
21
+ V1_LiteDataContractWithUserStatus,
22
+ } from '@finos/legend-graph';
18
23
  import {
19
24
  DataGrid,
25
+ type DataGridCellClickedEvent,
20
26
  type DataGridCellRendererParams,
21
27
  type DataGridColumnDefinition,
22
28
  } from '@finos/legend-lego/data-grid';
@@ -27,8 +33,11 @@ import {
27
33
  FormGroup,
28
34
  Switch,
29
35
  } from '@mui/material';
30
- import { useEffect, useMemo, useState } from 'react';
31
- import type { EntitlementsDashboardState } from '../../../stores/lakehouse/entitlements/EntitlementsDashboardState.js';
36
+ import { useMemo, useState } from 'react';
37
+ import type {
38
+ ContractCreatedByUserDetails,
39
+ EntitlementsDashboardState,
40
+ } from '../../../stores/lakehouse/entitlements/EntitlementsDashboardState.js';
32
41
  import { useLegendMarketplaceBaseStore } from '../../../application/providers/LegendMarketplaceFrameworkProvider.js';
33
42
  import { observer } from 'mobx-react-lite';
34
43
  import { startCase } from '@finos/legend-shared';
@@ -39,72 +48,49 @@ import {
39
48
  isContractInTerminalState,
40
49
  DataAccessRequestViewer,
41
50
  isApprovalStatusTerminal,
51
+ DataContractViewerState,
42
52
  } from '@finos/legend-extension-dsl-data-product';
53
+ import {
54
+ generateContractPagePath,
55
+ generateLakehouseDataProductPath,
56
+ } from '../../../__lib__/LegendMarketplaceNavigation.js';
43
57
  import type { LakehouseEntitlementsStore } from '../../../stores/lakehouse/entitlements/LakehouseEntitlementsStore.js';
44
58
  import { flowResult } from 'mobx';
45
- import {
46
- getCommonEntitlementsColDefs,
47
- type EntitlementsRow,
48
- getContractData,
49
- getSelectedRowId,
50
- getSelectedContractGuid,
51
- getOpenTaskAssignees,
52
- EntitlementsColumnHeader,
53
- CONTRACT_STATE_DISPLAY_LABELS,
54
- ENTITLEMENTS_DEFAULT_COL_DEF,
55
- ROW_KIND_CONTRACT,
56
- ROW_KIND_REQUEST,
57
- TERMINAL_DATA_REQUEST_STATES,
58
- UNKNOWN,
59
- useSelectedViewerState,
60
- useGetDataProductUrl,
61
- } from '../../../utils/EntitlementsUtils.js';
59
+ import { getCommonEntitlementsColDefs } from '../../../utils/EntitlementsUtils.js';
62
60
 
63
- const AssigneesCellRenderer = observer(
64
- (props: {
65
- row: EntitlementsRow | undefined;
66
- entitlementsStore: LakehouseEntitlementsStore;
67
- }): React.ReactNode => {
68
- const { row, entitlementsStore } = props;
69
- if (!row) {
70
- return null;
71
- }
61
+ const AssigneesCellRenderer = (props: {
62
+ dataContract:
63
+ | V1_LiteDataContractWithUserStatus
64
+ | ContractCreatedByUserDetails
65
+ | undefined;
66
+ entitlementsStore: LakehouseEntitlementsStore;
67
+ }): React.ReactNode => {
68
+ const { dataContract, entitlementsStore } = props;
72
69
 
73
- let assignees: string[];
74
- if (row.kind === ROW_KIND_CONTRACT) {
75
- assignees =
76
- (row.data instanceof V1_LiteDataContractWithUserStatus
77
- ? row.data.pendingTaskWithAssignees?.assignees.toSorted()
78
- : row.data.sortedAssigneeIds) ?? [];
79
- } else {
80
- assignees = getOpenTaskAssignees(row.data);
81
- }
70
+ const assignees =
71
+ (dataContract instanceof V1_LiteDataContractWithUserStatus
72
+ ? dataContract.pendingTaskWithAssignees?.assignees.toSorted()
73
+ : dataContract?.sortedAssigneeIds) ?? [];
82
74
 
83
- return (
84
- <MultiUserRenderer
85
- userIds={assignees}
86
- applicationStore={entitlementsStore.applicationStore}
87
- userSearchService={
88
- entitlementsStore.marketplaceBaseStore.userSearchService
89
- }
90
- disableOnClick={true}
91
- singleUserClassName="marketplace-lakehouse-entitlements__grid__user-display"
92
- />
93
- );
94
- },
95
- );
75
+ return (
76
+ <MultiUserRenderer
77
+ userIds={assignees}
78
+ applicationStore={entitlementsStore.applicationStore}
79
+ userSearchService={
80
+ entitlementsStore.marketplaceBaseStore.userSearchService
81
+ }
82
+ disableOnClick={true}
83
+ singleUserClassName="marketplace-lakehouse-entitlements__grid__user-display"
84
+ />
85
+ );
86
+ };
96
87
 
97
88
  export const EntitlementsPendingContractsDashboard = observer(
98
89
  (props: { dashboardState: EntitlementsDashboardState }): React.ReactNode => {
99
90
  const { dashboardState } = props;
100
- const {
101
- allContractsForUser,
102
- allContractsCreatedByUser,
103
- dataRequestsCreatedByUser,
104
- } = dashboardState;
91
+ const { allContractsForUser, allContractsCreatedByUser } = dashboardState;
105
92
  const marketplaceBaseStore = useLegendMarketplaceBaseStore();
106
93
  const auth = useAuth();
107
- const getDataProductUrl = useGetDataProductUrl();
108
94
 
109
95
  const myPendingContracts = useMemo(
110
96
  () =>
@@ -127,110 +113,105 @@ export const EntitlementsPendingContractsDashboard = observer(
127
113
  [allContractsCreatedByUser, myPendingContractIds],
128
114
  );
129
115
 
130
- const pendingDataRequests = useMemo(
131
- () =>
132
- (dataRequestsCreatedByUser ?? []).filter(
133
- (dr) => !TERMINAL_DATA_REQUEST_STATES.has(dr.dataRequest.state),
134
- ),
135
- [dataRequestsCreatedByUser],
136
- );
137
-
138
- const [selectedRow, setSelectedRow] = useState<
139
- EntitlementsRow | undefined
116
+ const [selectedContract, setSelectedContract] = useState<
117
+ V1_LiteDataContract | undefined
140
118
  >();
141
119
  const [contractErrors, setContractErrors] = useState<
142
120
  ContractErrorLayer | undefined
143
121
  >(undefined);
144
-
145
- const selectedRowId = getSelectedRowId(selectedRow);
146
- const selectedViewerState = useSelectedViewerState(
147
- selectedRow,
148
- selectedRowId,
149
- );
150
-
151
122
  const [showForOthers, setShowForOthers] = useState<boolean>(
152
123
  myPendingContracts.length === 0 && pendingContractsForOthers.length > 0,
153
124
  );
154
125
 
155
- useEffect(() => {
126
+ const handleCellClicked = async (
127
+ event: DataGridCellClickedEvent<
128
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
129
+ >,
130
+ ) => {
131
+ const contract = event.data?.contractResultLite;
132
+ setSelectedContract(contract);
156
133
  setContractErrors(undefined);
157
- if (selectedRow?.kind === ROW_KIND_CONTRACT) {
158
- const contract = selectedRow.data.contractResultLite;
159
- dashboardState
160
- .getContractErrors(contract.guid, auth.user?.access_token)
161
- .then((result) => setContractErrors(result))
162
- .catch(() => setContractErrors(undefined));
134
+ if (contract !== undefined) {
135
+ const result = await dashboardState.getContractErrors(
136
+ contract.guid,
137
+ auth.user?.access_token,
138
+ );
139
+ setContractErrors(result);
163
140
  }
164
- }, [selectedRow, auth.user?.access_token, dashboardState]);
141
+ };
165
142
 
166
- const selectedContractGuid = getSelectedContractGuid(selectedRow);
143
+ const defaultColDef: DataGridColumnDefinition<
144
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
145
+ > = useMemo(
146
+ () => ({
147
+ minWidth: 50,
148
+ sortable: true,
149
+ resizable: true,
150
+ flex: 1,
151
+ }),
152
+ [],
153
+ );
167
154
 
168
- const colDefs: DataGridColumnDefinition<EntitlementsRow>[] = useMemo(
155
+ const colDefs: DataGridColumnDefinition<
156
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
157
+ >[] = useMemo(
169
158
  () => [
170
159
  ...getCommonEntitlementsColDefs(dashboardState),
171
160
  {
172
- headerName: EntitlementsColumnHeader.STATE,
161
+ headerName: 'State',
173
162
  valueGetter: (params) => {
174
- if (!params.data) {
175
- return UNKNOWN;
176
- }
177
- if (params.data.kind === ROW_KIND_CONTRACT) {
178
- const state = getContractData(params.data)?.state;
179
- return state
180
- ? (CONTRACT_STATE_DISPLAY_LABELS[state] ?? startCase(state))
181
- : UNKNOWN;
163
+ const state = params.data?.contractResultLite.state;
164
+ switch (state) {
165
+ case V1_ContractState.PENDING_DATA_OWNER_APPROVAL:
166
+ return 'Data Owner Approval';
167
+ case V1_ContractState.OPEN_FOR_PRIVILEGE_MANAGER_APPROVAL:
168
+ return 'Privilege Manager Approval';
169
+ default:
170
+ return state ? startCase(state) : 'Unknown';
182
171
  }
183
- return startCase(params.data.data.dataRequest.state);
184
172
  },
185
173
  },
186
174
  {
187
- headerName: EntitlementsColumnHeader.ASSIGNEES,
175
+ headerName: 'Business Justification',
176
+ valueGetter: (p) => p.data?.contractResultLite.description,
177
+ },
178
+ {
179
+ headerName: 'Assignees',
188
180
  colId: 'assignees',
189
181
  valueGetter: (params) => {
190
- if (!params.data) {
191
- return UNKNOWN;
192
- }
193
- if (params.data.kind === ROW_KIND_CONTRACT) {
194
- const assignees =
195
- (params.data.data instanceof V1_LiteDataContractWithUserStatus
196
- ? params.data.data.pendingTaskWithAssignees?.assignees.toSorted()
197
- : params.data.data.sortedAssigneeIds) ?? [];
198
- return assignees.length > 0 ? assignees.join(', ') : UNKNOWN;
199
- }
200
- const openAssignees = getOpenTaskAssignees(params.data.data);
201
- return openAssignees.length > 0 ? openAssignees.join(', ') : 'None';
182
+ const assignees =
183
+ (params.data instanceof V1_LiteDataContractWithUserStatus
184
+ ? params.data.pendingTaskWithAssignees?.assignees.toSorted()
185
+ : params.data?.sortedAssigneeIds) ?? [];
186
+ return assignees.length > 0 ? assignees.join(', ') : 'Unknown';
202
187
  },
203
188
  cellRenderer: (
204
- params: DataGridCellRendererParams<EntitlementsRow>,
189
+ params: DataGridCellRendererParams<
190
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
191
+ >,
205
192
  ) => (
206
193
  <AssigneesCellRenderer
207
- row={params.data}
194
+ dataContract={params.data}
208
195
  entitlementsStore={dashboardState.lakehouseEntitlementsStore}
209
196
  />
210
197
  ),
211
198
  },
199
+ {
200
+ hide: true,
201
+ headerName: 'Contract ID',
202
+ valueGetter: (p) => p.data?.contractResultLite.guid,
203
+ },
212
204
  ],
213
205
  [dashboardState],
214
206
  );
215
207
 
216
- const gridRowData: EntitlementsRow[] = useMemo(() => {
217
- const contracts = showForOthers
218
- ? [...myPendingContracts, ...pendingContractsForOthers]
219
- : myPendingContracts;
220
- return [
221
- ...contracts.map(
222
- (c): EntitlementsRow => ({ kind: ROW_KIND_CONTRACT, data: c }),
223
- ),
224
- ...pendingDataRequests.map(
225
- (r): EntitlementsRow => ({ kind: ROW_KIND_REQUEST, data: r }),
226
- ),
227
- ];
228
- }, [
229
- showForOthers,
230
- myPendingContracts,
231
- pendingContractsForOthers,
232
- pendingDataRequests,
233
- ]);
208
+ const gridRowData = useMemo(
209
+ () =>
210
+ showForOthers
211
+ ? [...myPendingContracts, ...pendingContractsForOthers]
212
+ : myPendingContracts,
213
+ [showForOthers, myPendingContracts, pendingContractsForOthers],
214
+ );
234
215
 
235
216
  return (
236
217
  <Box className="marketplace-lakehouse-entitlements__pending-contracts">
@@ -267,39 +248,60 @@ export const EntitlementsPendingContractsDashboard = observer(
267
248
  suppressFieldDotNotation={true}
268
249
  suppressContextMenu={false}
269
250
  columnDefs={colDefs}
270
- onCellClicked={(event) => event.data && setSelectedRow(event.data)}
271
- defaultColDef={ENTITLEMENTS_DEFAULT_COL_DEF}
272
- rowHeight={45}
273
- overlayNoRowsTemplate="You have no pending contracts or data requests"
274
- loading={
275
- dashboardState.fetchingContractsForUserState.isInProgress ||
276
- dashboardState.fetchingDataRequestsCreatedByUserState.isInProgress
251
+ onCellClicked={(
252
+ event: DataGridCellClickedEvent<
253
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
254
+ >,
255
+ ) =>
256
+ // eslint-disable-next-line no-void
257
+ void handleCellClicked(event)
277
258
  }
278
- overlayLoadingTemplate="Loading"
259
+ defaultColDef={defaultColDef}
260
+ rowHeight={45}
261
+ overlayNoRowsTemplate="You have no pending contracts"
262
+ loading={dashboardState.fetchingContractsForUserState.isInProgress}
263
+ overlayLoadingTemplate="Loading contracts"
279
264
  />
280
265
  </Box>
281
- {selectedRow !== undefined && selectedViewerState !== undefined && (
266
+ {selectedContract !== undefined && (
282
267
  <DataAccessRequestViewer
283
268
  open={true}
284
269
  onClose={() => {
285
- setSelectedRow(undefined);
270
+ setSelectedContract(undefined);
286
271
  setContractErrors(undefined);
287
272
  }}
288
273
  contractErrors={contractErrors}
289
- viewerState={selectedViewerState}
290
- {...(selectedContractGuid
291
- ? {
292
- onRefresh: async () => {
293
- await flowResult(
294
- dashboardState.updateContract(
295
- selectedContractGuid,
296
- auth.user?.access_token,
297
- ),
298
- );
299
- },
300
- }
301
- : {})}
302
- getDataProductUrl={getDataProductUrl}
274
+ viewerState={
275
+ new DataContractViewerState(
276
+ selectedContract,
277
+ (contractId: string, taskId: string) =>
278
+ marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
279
+ generateContractPagePath(contractId, taskId),
280
+ ),
281
+ undefined,
282
+ marketplaceBaseStore.applicationStore,
283
+ marketplaceBaseStore.lakehouseContractServerClient,
284
+ new GraphManagerState(
285
+ marketplaceBaseStore.applicationStore.pluginManager,
286
+ marketplaceBaseStore.applicationStore.logService,
287
+ ),
288
+ marketplaceBaseStore.userSearchService,
289
+ )
290
+ }
291
+ onRefresh={async () => {
292
+ await flowResult(
293
+ dashboardState.updateContract(
294
+ selectedContract.guid,
295
+ auth.user?.access_token,
296
+ ),
297
+ );
298
+ }}
299
+ getDataProductUrl={(dataProductId: string, deploymentId: number) =>
300
+ marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
301
+ generateLakehouseDataProductPath(dataProductId, deploymentId),
302
+ )
303
+ }
304
+ //Derives environment from the fact that other environments are filtered out
303
305
  dataProductEnvironment={
304
306
  marketplaceBaseStore.envState.lakehouseEnvironment
305
307
  }
@@ -15,7 +15,10 @@
15
15
  */
16
16
 
17
17
  import { observer } from 'mobx-react-lite';
18
- import { ActionAlertType } from '@finos/legend-application';
18
+ import {
19
+ ActionAlertActionType,
20
+ ActionAlertType,
21
+ } from '@finos/legend-application';
19
22
  import { withLegendMarketplaceProductViewerStore } from '../../../application/providers/LegendMarketplaceProductViewerStoreProvider.js';
20
23
  import { useParams } from '@finos/legend-application/browser';
21
24
  import {
@@ -33,7 +36,7 @@ import {
33
36
  V1_RawWorkflowTask,
34
37
  V1_WorkflowTaskStatus,
35
38
  } from '@finos/legend-graph';
36
- import { Box, Button } from '@mui/material';
39
+ import { Box, Button, TextField } from '@mui/material';
37
40
  import {
38
41
  CubesLoadingIndicator,
39
42
  CubesLoadingIndicatorIcon,
@@ -43,7 +46,6 @@ import {
43
46
  WorkflowDataAccessRequestState,
44
47
  } from '@finos/legend-extension-dsl-data-product';
45
48
  import { flowResult } from 'mobx';
46
- import { showTaskActionAlert } from './showTaskActionAlert.js';
47
49
 
48
50
  export const WorkflowDataAccessRequestTask =
49
51
  withLegendMarketplaceProductViewerStore(
@@ -69,11 +71,10 @@ export const WorkflowDataAccessRequestTask =
69
71
  return undefined;
70
72
  }
71
73
  // Prefer workflow server tasks
72
- const { privilegeManagerTasks, dataOwnerTasks } =
74
+ const { privilegeManagerTask, dataOwnerTask } =
73
75
  workflowState.workflowTasks;
74
- const allTasks = [...privilegeManagerTasks, ...dataOwnerTasks];
75
- const workflowServerTask = allTasks.find(
76
- (task) => task.status === 'OPEN',
76
+ const workflowServerTask = [privilegeManagerTask, dataOwnerTask].find(
77
+ (task) => task !== undefined && task.status === 'OPEN',
77
78
  );
78
79
  if (workflowServerTask) {
79
80
  return workflowServerTask;
@@ -84,8 +85,8 @@ export const WorkflowDataAccessRequestTask =
84
85
  .find((task) => task.status === V1_WorkflowTaskStatus.OPEN);
85
86
  if (fallbackTask) {
86
87
  // Find the matching raw workflow task by taskId, or build a minimal one from the fallback
87
- const matchingRaw = allTasks.find(
88
- (t) => t.taskId === fallbackTask.taskId,
88
+ const matchingRaw = [privilegeManagerTask, dataOwnerTask].find(
89
+ (t) => t?.taskId === fallbackTask.taskId,
89
90
  );
90
91
  if (matchingRaw) {
91
92
  return matchingRaw;
@@ -179,32 +180,100 @@ export const WorkflowDataAccessRequestTask =
179
180
  };
180
181
 
181
182
  const handleApproveClick = () => {
182
- showTaskActionAlert({
183
- applicationStore: marketplaceBaseStore.applicationStore,
183
+ let justification = '';
184
+ marketplaceBaseStore.applicationStore.alertService.setActionAlertInfo({
184
185
  title: 'Approve Request',
185
186
  message:
186
187
  'Please provide a business justification for approving this request.',
187
- confirmLabel: 'Approve',
188
- alertType: ActionAlertType.STANDARD,
189
- isLoading,
190
- setIsLoading,
191
- onConfirm: (justification) => handleApprove(justification),
192
- errorPrefix: 'Error approving request',
188
+ prompt: (
189
+ <TextField
190
+ fullWidth={true}
191
+ autoFocus={true}
192
+ multiline={true}
193
+ minRows={3}
194
+ placeholder="Business Justification"
195
+ onChange={(e) => {
196
+ justification = e.target.value;
197
+ }}
198
+ sx={{ marginTop: 2 }}
199
+ />
200
+ ),
201
+ type: ActionAlertType.STANDARD,
202
+ actions: [
203
+ {
204
+ label: 'Approve',
205
+ type: ActionAlertActionType.PROCEED_WITH_CAUTION,
206
+ handler: () => {
207
+ if (!isLoading) {
208
+ setIsLoading(true);
209
+ handleApprove(justification)
210
+ .catch((error) => {
211
+ assertErrorThrown(error);
212
+ marketplaceBaseStore.applicationStore.notificationService.notifyError(
213
+ `Error approving request: ${error.message}`,
214
+ );
215
+ })
216
+ .finally(() => {
217
+ setIsLoading(false);
218
+ });
219
+ }
220
+ },
221
+ },
222
+ {
223
+ label: 'Cancel',
224
+ type: ActionAlertActionType.PROCEED,
225
+ default: true,
226
+ },
227
+ ],
193
228
  });
194
229
  };
195
230
 
196
231
  const handleDenyClick = () => {
197
- showTaskActionAlert({
198
- applicationStore: marketplaceBaseStore.applicationStore,
232
+ let justification = '';
233
+ marketplaceBaseStore.applicationStore.alertService.setActionAlertInfo({
199
234
  title: 'Deny Request',
200
235
  message:
201
236
  'Please provide a business justification for denying this request.',
202
- confirmLabel: 'Deny',
203
- alertType: ActionAlertType.CAUTION,
204
- isLoading,
205
- setIsLoading,
206
- onConfirm: (justification) => handleDeny(justification),
207
- errorPrefix: 'Error denying request',
237
+ prompt: (
238
+ <TextField
239
+ fullWidth={true}
240
+ autoFocus={true}
241
+ multiline={true}
242
+ minRows={3}
243
+ placeholder="Business Justification"
244
+ onChange={(e) => {
245
+ justification = e.target.value;
246
+ }}
247
+ sx={{ marginTop: 2 }}
248
+ />
249
+ ),
250
+ type: ActionAlertType.CAUTION,
251
+ actions: [
252
+ {
253
+ label: 'Deny',
254
+ type: ActionAlertActionType.PROCEED_WITH_CAUTION,
255
+ handler: () => {
256
+ if (!isLoading) {
257
+ setIsLoading(true);
258
+ handleDeny(justification)
259
+ .catch((error) => {
260
+ assertErrorThrown(error);
261
+ marketplaceBaseStore.applicationStore.notificationService.notifyError(
262
+ `Error denying request: ${error.message}`,
263
+ );
264
+ })
265
+ .finally(() => {
266
+ setIsLoading(false);
267
+ });
268
+ }
269
+ },
270
+ },
271
+ {
272
+ label: 'Cancel',
273
+ type: ActionAlertActionType.PROCEED,
274
+ default: true,
275
+ },
276
+ ],
208
277
  });
209
278
  };
210
279
 
@@ -53,7 +53,6 @@ import {
53
53
  LakehouseIngestServerClient,
54
54
  LakehousePlatformServerClient,
55
55
  LakehouseWorkflowServerClient,
56
- PermitWorkflowServerClient,
57
56
  } from '@finos/legend-server-lakehouse';
58
57
  import { CartStore } from './cart/CartStore.js';
59
58
  import { parseGAVCoordinates, type Entity } from '@finos/legend-storage';
@@ -93,7 +92,6 @@ export class LegendMarketplaceBaseStore {
93
92
  readonly remoteEngine: V1_RemoteEngine;
94
93
  readonly userSearchService: UserSearchService | undefined;
95
94
  readonly lakehouseWorkflowServerClient: LakehouseWorkflowServerClient;
96
- readonly permitWorkflowServerClient: PermitWorkflowServerClient;
97
95
  readonly lakehouseDataProductService: LakehouseDataProductService;
98
96
  readonly cartStore: CartStore;
99
97
  readonly terminalAccessServerClient: TerminalAccessServerClient;
@@ -179,16 +177,6 @@ export class LegendMarketplaceBaseStore {
179
177
  this.applicationStore.tracerService,
180
178
  );
181
179
 
182
- // permit + eTask workflow
183
- this.permitWorkflowServerClient = new PermitWorkflowServerClient({
184
- authBaseUrl: this.applicationStore.config.lakehouseServerUrl,
185
- workflowBaseUrl:
186
- this.applicationStore.config.lakehousePermitWorkflowServerUrl,
187
- });
188
- this.permitWorkflowServerClient.setTracerService(
189
- this.applicationStore.tracerService,
190
- );
191
-
192
180
  // lakehouse ingest
193
181
  this.lakehouseIngestServerClient = new LakehouseIngestServerClient(
194
182
  undefined,
@@ -77,7 +77,6 @@ import {
77
77
  EXTERNAL_APPLICATION_NAVIGATION__generateStudioSDLCProjectViewUrl,
78
78
  generateLakehouseDataProductPath,
79
79
  generateContractPagePath,
80
- generatePermitDataAccessRequestPagePath,
81
80
  } from '../../__lib__/LegendMarketplaceNavigation.js';
82
81
  import {
83
82
  DataSpaceViewerState,
@@ -444,12 +443,7 @@ export class LegendMarketplaceProductViewerStore {
444
443
  this.marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
445
444
  generateLakehouseDataProductPath(_dataProductId, _deploymentId),
446
445
  ),
447
- getTaskPageUrl: (id: string) =>
448
- this.marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
449
- generatePermitDataAccessRequestPagePath(id),
450
- ),
451
446
  },
452
- this.marketplaceBaseStore.permitWorkflowServerClient,
453
447
  );
454
448
  this.setDataProductViewer(dataProductViewerState);
455
449
  this.setDataProductDataAccess(dataProductDataAccessState);
@@ -67,7 +67,7 @@ export class ProductCardState {
67
67
  searchResult: DataProductSearchResult,
68
68
  graphManager: V1_PureGraphManager,
69
69
  vendorImageMap: ReadonlyMap<string, string>,
70
- usedImages?: Set<string>,
70
+ usedImages?: Set<string> | undefined,
71
71
  ) {
72
72
  makeObservable(this, {
73
73
  dataProductElement: observable,
@@ -87,7 +87,8 @@ export class ProductCardState {
87
87
  }
88
88
 
89
89
  get title(): string {
90
- return this.searchResult.dataProductTitle ?? this.dataProductId;
90
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
91
+ return this.searchResult.dataProductTitle || this.dataProductId;
91
92
  }
92
93
 
93
94
  get description(): string {
@@ -231,7 +232,7 @@ export class ProductCardState {
231
232
 
232
233
  private resolveDisplayImage(
233
234
  vendorImageMap: ReadonlyMap<string, string>,
234
- usedImages?: Set<string>,
235
+ usedImages?: Set<string> | undefined,
235
236
  ): string {
236
237
  const GENERIC_IMAGE_COUNT = 20;
237
238
  const guidUpper = this.guid.toUpperCase();