@finos/legend-application-marketplace 0.1.55 → 0.1.57
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.
- package/lib/__lib__/LegendMarketplaceAppEvent.d.ts +1 -0
- package/lib/__lib__/LegendMarketplaceAppEvent.d.ts.map +1 -1
- package/lib/__lib__/LegendMarketplaceAppEvent.js +1 -0
- package/lib/__lib__/LegendMarketplaceAppEvent.js.map +1 -1
- package/lib/__lib__/LegendMarketplaceNavigation.d.ts +9 -2
- package/lib/__lib__/LegendMarketplaceNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendMarketplaceNavigation.js +7 -1
- package/lib/__lib__/LegendMarketplaceNavigation.js.map +1 -1
- package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts +11 -1
- package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendMarketplaceTelemetryHelper.js +57 -3
- package/lib/__lib__/LegendMarketplaceTelemetryHelper.js.map +1 -1
- package/lib/application/LegendMarketplaceWebApplication.d.ts.map +1 -1
- package/lib/application/LegendMarketplaceWebApplication.js +4 -1
- package/lib/application/LegendMarketplaceWebApplication.js.map +1 -1
- package/lib/components/Header/LegendMarketplaceIconToolbar.d.ts.map +1 -1
- package/lib/components/Header/LegendMarketplaceIconToolbar.js +11 -2
- package/lib/components/Header/LegendMarketplaceIconToolbar.js.map +1 -1
- package/lib/components/SearchBar/LegendMarketplaceSearchBar.d.ts.map +1 -1
- package/lib/components/SearchBar/LegendMarketplaceSearchBar.js +4 -0
- package/lib/components/SearchBar/LegendMarketplaceSearchBar.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/pages/Lakehouse/MarketplaceLakehouseHome.d.ts.map +1 -1
- package/lib/pages/Lakehouse/MarketplaceLakehouseHome.js +5 -19
- package/lib/pages/Lakehouse/MarketplaceLakehouseHome.js.map +1 -1
- package/lib/pages/Lakehouse/admin/LakehouseAdminContractsDashboard.js +2 -2
- package/lib/pages/Lakehouse/admin/LakehouseAdminContractsDashboard.js.map +1 -1
- package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.d.ts.map +1 -1
- package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js +38 -132
- package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js.map +1 -1
- package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.d.ts.map +1 -1
- package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js +36 -160
- package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js.map +1 -1
- package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.d.ts.map +1 -1
- package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js +60 -40
- package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js.map +1 -1
- package/lib/pages/Lakehouse/entitlements/LakehouseDataContract.d.ts +17 -0
- package/lib/pages/Lakehouse/entitlements/LakehouseDataContract.d.ts.map +1 -0
- package/lib/pages/Lakehouse/entitlements/LakehouseDataContract.js +124 -0
- package/lib/pages/Lakehouse/entitlements/LakehouseDataContract.js.map +1 -0
- package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js +2 -2
- package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js.map +1 -1
- package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts +22 -11
- package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts.map +1 -1
- package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js +145 -74
- package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js.map +1 -1
- package/lib/stores/orders/OrderHelpers.d.ts +1 -1
- package/lib/stores/orders/OrderHelpers.d.ts.map +1 -1
- package/lib/stores/orders/OrderHelpers.js +7 -6
- package/lib/stores/orders/OrderHelpers.js.map +1 -1
- package/lib/utils/EntitlementsUtils.d.ts +20 -0
- package/lib/utils/EntitlementsUtils.d.ts.map +1 -0
- package/lib/utils/EntitlementsUtils.js +107 -0
- package/lib/utils/EntitlementsUtils.js.map +1 -0
- package/package.json +10 -10
- package/src/__lib__/LegendMarketplaceAppEvent.ts +1 -0
- package/src/__lib__/LegendMarketplaceNavigation.ts +19 -3
- package/src/__lib__/LegendMarketplaceTelemetryHelper.ts +80 -4
- package/src/application/LegendMarketplaceWebApplication.tsx +15 -0
- package/src/components/Header/LegendMarketplaceIconToolbar.tsx +29 -0
- package/src/components/SearchBar/LegendMarketplaceSearchBar.tsx +7 -0
- package/src/pages/Lakehouse/MarketplaceLakehouseHome.tsx +4 -54
- package/src/pages/Lakehouse/admin/LakehouseAdminContractsDashboard.tsx +3 -3
- package/src/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.tsx +91 -244
- package/src/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.tsx +91 -298
- package/src/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.tsx +87 -52
- package/src/pages/Lakehouse/entitlements/LakehouseDataContract.tsx +284 -0
- package/src/stores/lakehouse/LegendMarketplaceProductViewerStore.ts +3 -3
- package/src/stores/lakehouse/entitlements/EntitlementsDashboardState.ts +234 -109
- package/src/stores/orders/OrderHelpers.ts +8 -7
- package/src/utils/EntitlementsUtils.tsx +207 -0
- package/tsconfig.json +2 -0
|
@@ -15,149 +15,70 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
|
-
type V1_ContractUserEventRecord,
|
|
19
|
-
type V1_EnrichedUserApprovalStatus,
|
|
20
18
|
type V1_LiteDataContract,
|
|
21
19
|
GraphManagerState,
|
|
22
20
|
V1_AdhocTeam,
|
|
23
|
-
|
|
24
|
-
V1_ResourceType,
|
|
21
|
+
V1_LiteDataContractWithUserStatus,
|
|
25
22
|
} from '@finos/legend-graph';
|
|
26
23
|
import {
|
|
27
24
|
DataGrid,
|
|
28
25
|
type DataGridCellClickedEvent,
|
|
29
|
-
type DataGridCellRendererParams,
|
|
30
26
|
type DataGridColumnDefinition,
|
|
31
27
|
} from '@finos/legend-lego/data-grid';
|
|
32
28
|
import {
|
|
33
29
|
Box,
|
|
34
30
|
CircularProgress,
|
|
35
31
|
FormControlLabel,
|
|
32
|
+
FormGroup,
|
|
36
33
|
Switch,
|
|
37
|
-
Tooltip,
|
|
38
34
|
} from '@mui/material';
|
|
39
|
-
import {
|
|
40
|
-
import type {
|
|
35
|
+
import { useMemo, useState } from 'react';
|
|
36
|
+
import type {
|
|
37
|
+
ContractCreatedByUserDetails,
|
|
38
|
+
EntitlementsDashboardState,
|
|
39
|
+
} from '../../../stores/lakehouse/entitlements/EntitlementsDashboardState.js';
|
|
41
40
|
import { useLegendMarketplaceBaseStore } from '../../../application/providers/LegendMarketplaceFrameworkProvider.js';
|
|
42
41
|
import { observer } from 'mobx-react-lite';
|
|
43
|
-
import { assertErrorThrown, lodashCapitalize } from '@finos/legend-shared';
|
|
44
42
|
import { useAuth } from 'react-oidc-context';
|
|
45
|
-
import { deserialize } from 'serializr';
|
|
46
|
-
import { InfoCircleIcon } from '@finos/legend-art';
|
|
47
43
|
import {
|
|
48
44
|
EntitlementsDataContractViewer,
|
|
49
45
|
EntitlementsDataContractViewerState,
|
|
50
|
-
getOrganizationalScopeTypeDetails,
|
|
51
|
-
getOrganizationalScopeTypeName,
|
|
52
46
|
isApprovalStatusTerminal,
|
|
53
47
|
isContractInTerminalState,
|
|
54
|
-
MultiUserRenderer,
|
|
55
|
-
stringifyOrganizationalScope,
|
|
56
|
-
UserRenderer,
|
|
57
48
|
} from '@finos/legend-extension-dsl-data-product';
|
|
58
49
|
import {
|
|
50
|
+
generateContractPagePath,
|
|
59
51
|
generateLakehouseDataProductPath,
|
|
60
|
-
generateLakehouseTaskPath,
|
|
61
52
|
} from '../../../__lib__/LegendMarketplaceNavigation.js';
|
|
62
|
-
import type { LakehouseEntitlementsStore } from '../../../stores/lakehouse/entitlements/LakehouseEntitlementsStore.js';
|
|
63
53
|
import { flowResult } from 'mobx';
|
|
64
|
-
|
|
65
|
-
const UserAccessStatusCellRenderer = (props: {
|
|
66
|
-
dataContract: V1_LiteDataContract | undefined;
|
|
67
|
-
entitlementsStore: LakehouseEntitlementsStore;
|
|
68
|
-
token: string | undefined;
|
|
69
|
-
}): React.ReactNode => {
|
|
70
|
-
const { dataContract, entitlementsStore, token } = props;
|
|
71
|
-
const [status, setStatus] = useState<
|
|
72
|
-
V1_EnrichedUserApprovalStatus | undefined
|
|
73
|
-
>(
|
|
74
|
-
dataContract
|
|
75
|
-
? entitlementsStore.contractIdToUserStatusMap.get(dataContract.guid)
|
|
76
|
-
: undefined,
|
|
77
|
-
);
|
|
78
|
-
const [loading, setLoading] = useState<boolean>(false);
|
|
79
|
-
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
const fetchUserStatusByContractId = async (): Promise<void> => {
|
|
82
|
-
if (dataContract) {
|
|
83
|
-
setLoading(true);
|
|
84
|
-
try {
|
|
85
|
-
const rawUserStatus =
|
|
86
|
-
await entitlementsStore.lakehouseContractServerClient.getContractUserStatus(
|
|
87
|
-
dataContract.guid,
|
|
88
|
-
entitlementsStore.applicationStore.identityService.currentUser,
|
|
89
|
-
token,
|
|
90
|
-
);
|
|
91
|
-
const userStatus = deserialize(
|
|
92
|
-
V1_ContractUserStatusResponseModelSchema,
|
|
93
|
-
rawUserStatus,
|
|
94
|
-
).status;
|
|
95
|
-
setStatus(userStatus);
|
|
96
|
-
entitlementsStore.contractIdToUserStatusMap.set(
|
|
97
|
-
dataContract.guid,
|
|
98
|
-
userStatus,
|
|
99
|
-
);
|
|
100
|
-
} catch (error) {
|
|
101
|
-
assertErrorThrown(error);
|
|
102
|
-
entitlementsStore.applicationStore.notificationService.notifyError(
|
|
103
|
-
`Error fetching contract user access status: ${error.message}`,
|
|
104
|
-
);
|
|
105
|
-
} finally {
|
|
106
|
-
setLoading(false);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
if (status === undefined) {
|
|
112
|
-
// eslint-disable-next-line no-void
|
|
113
|
-
void fetchUserStatusByContractId();
|
|
114
|
-
}
|
|
115
|
-
}, [
|
|
116
|
-
dataContract,
|
|
117
|
-
entitlementsStore.applicationStore.identityService.currentUser,
|
|
118
|
-
entitlementsStore.applicationStore.notificationService,
|
|
119
|
-
entitlementsStore.contractIdToUserStatusMap,
|
|
120
|
-
entitlementsStore.lakehouseContractServerClient,
|
|
121
|
-
status,
|
|
122
|
-
token,
|
|
123
|
-
]);
|
|
124
|
-
|
|
125
|
-
return loading ? (
|
|
126
|
-
<CircularProgress size={20} />
|
|
127
|
-
) : (
|
|
128
|
-
lodashCapitalize(status ?? dataContract?.state ?? 'Unknown')
|
|
129
|
-
);
|
|
130
|
-
};
|
|
54
|
+
import { getCommonEntitlementsColDefs } from '../../../utils/EntitlementsUtils.js';
|
|
131
55
|
|
|
132
56
|
export const EntitlementsClosedContractsDashboard = observer(
|
|
133
57
|
(props: { dashboardState: EntitlementsDashboardState }): React.ReactNode => {
|
|
134
58
|
const { dashboardState } = props;
|
|
135
|
-
const {
|
|
59
|
+
const { allContractsForUser, allContractsCreatedByUser } = dashboardState;
|
|
136
60
|
const marketplaceBaseStore = useLegendMarketplaceBaseStore();
|
|
137
61
|
const auth = useAuth();
|
|
138
62
|
|
|
139
63
|
const myClosedContracts = useMemo(
|
|
140
64
|
() =>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
[
|
|
65
|
+
allContractsForUser?.filter((contract) =>
|
|
66
|
+
isApprovalStatusTerminal(contract.status),
|
|
67
|
+
) ?? [],
|
|
68
|
+
[allContractsForUser],
|
|
145
69
|
);
|
|
146
70
|
const myClosedContractIds = useMemo(
|
|
147
|
-
() => new Set(myClosedContracts.map((c) => c.guid)),
|
|
71
|
+
() => new Set(myClosedContracts.map((c) => c.contractResultLite.guid)),
|
|
148
72
|
[myClosedContracts],
|
|
149
73
|
);
|
|
150
74
|
const closedContractsForOthers = useMemo(
|
|
151
75
|
() =>
|
|
152
|
-
|
|
76
|
+
allContractsCreatedByUser.filter(
|
|
153
77
|
(contract) =>
|
|
154
|
-
isContractInTerminalState(contract) &&
|
|
155
|
-
contract.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
!myClosedContractIds.has(contract.guid),
|
|
159
|
-
) ?? [],
|
|
160
|
-
[allContracts, myClosedContractIds, dashboardState],
|
|
78
|
+
isContractInTerminalState(contract.contractResultLite) &&
|
|
79
|
+
!myClosedContractIds.has(contract.contractResultLite.guid),
|
|
80
|
+
),
|
|
81
|
+
[allContractsCreatedByUser, myClosedContractIds],
|
|
161
82
|
);
|
|
162
83
|
|
|
163
84
|
const [selectedContract, setSelectedContract] = useState<
|
|
@@ -168,151 +89,48 @@ export const EntitlementsClosedContractsDashboard = observer(
|
|
|
168
89
|
);
|
|
169
90
|
|
|
170
91
|
const handleCellClicked = async (
|
|
171
|
-
event: DataGridCellClickedEvent<
|
|
92
|
+
event: DataGridCellClickedEvent<
|
|
93
|
+
V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
|
|
94
|
+
>,
|
|
172
95
|
) => {
|
|
173
|
-
|
|
174
|
-
event.colDef.colId !== 'targetUser' &&
|
|
175
|
-
event.colDef.colId !== 'requester' &&
|
|
176
|
-
event.colDef.colId !== 'actioner'
|
|
177
|
-
) {
|
|
178
|
-
setSelectedContract(event.data);
|
|
179
|
-
}
|
|
96
|
+
setSelectedContract(event.data?.contractResultLite);
|
|
180
97
|
};
|
|
181
98
|
|
|
182
|
-
const defaultColDef: DataGridColumnDefinition<
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
99
|
+
const defaultColDef: DataGridColumnDefinition<
|
|
100
|
+
V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
|
|
101
|
+
> = useMemo(
|
|
102
|
+
() => ({
|
|
103
|
+
minWidth: 50,
|
|
104
|
+
sortable: true,
|
|
105
|
+
resizable: true,
|
|
106
|
+
flex: 1,
|
|
107
|
+
}),
|
|
108
|
+
[],
|
|
109
|
+
);
|
|
192
110
|
|
|
193
|
-
const colDefs: DataGridColumnDefinition<
|
|
111
|
+
const colDefs: DataGridColumnDefinition<
|
|
112
|
+
V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
|
|
113
|
+
>[] = useMemo(
|
|
194
114
|
() => [
|
|
195
|
-
|
|
196
|
-
colId: 'consumerType',
|
|
197
|
-
headerName: 'Consumer Type',
|
|
198
|
-
cellRenderer: (
|
|
199
|
-
params: DataGridCellRendererParams<V1_ContractUserEventRecord>,
|
|
200
|
-
) => {
|
|
201
|
-
const consumer = params.data?.consumer;
|
|
202
|
-
const typeName = consumer
|
|
203
|
-
? getOrganizationalScopeTypeName(
|
|
204
|
-
consumer,
|
|
205
|
-
dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
|
|
206
|
-
)
|
|
207
|
-
: undefined;
|
|
208
|
-
const typeDetails = consumer
|
|
209
|
-
? getOrganizationalScopeTypeDetails(
|
|
210
|
-
consumer,
|
|
211
|
-
dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
|
|
212
|
-
)
|
|
213
|
-
: undefined;
|
|
214
|
-
return (
|
|
215
|
-
<>
|
|
216
|
-
{typeName ?? 'Unknown'}
|
|
217
|
-
{typeDetails !== undefined && (
|
|
218
|
-
<Tooltip
|
|
219
|
-
className="marketplace-lakehouse-entitlements__grid__consumer-type__tooltip__icon"
|
|
220
|
-
title={typeDetails}
|
|
221
|
-
>
|
|
222
|
-
<InfoCircleIcon />
|
|
223
|
-
</Tooltip>
|
|
224
|
-
)}
|
|
225
|
-
</>
|
|
226
|
-
);
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
headerName: 'Target User',
|
|
231
|
-
colId: 'targetUser',
|
|
232
|
-
cellRenderer: (
|
|
233
|
-
params: DataGridCellRendererParams<V1_LiteDataContract>,
|
|
234
|
-
) => {
|
|
235
|
-
const consumer = params.data?.consumer;
|
|
236
|
-
|
|
237
|
-
if (consumer instanceof V1_AdhocTeam) {
|
|
238
|
-
return (
|
|
239
|
-
<MultiUserRenderer
|
|
240
|
-
userIds={consumer.users.map((user) => user.name)}
|
|
241
|
-
applicationStore={marketplaceBaseStore.applicationStore}
|
|
242
|
-
userSearchService={marketplaceBaseStore.userSearchService}
|
|
243
|
-
singleUserClassName="marketplace-lakehouse-entitlements__grid__user-display"
|
|
244
|
-
/>
|
|
245
|
-
);
|
|
246
|
-
} else if (consumer) {
|
|
247
|
-
return <>{stringifyOrganizationalScope(consumer)}</>;
|
|
248
|
-
} else {
|
|
249
|
-
return <>Unknown</>;
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
headerName: 'Requester',
|
|
255
|
-
colId: 'requester',
|
|
256
|
-
cellRenderer: (
|
|
257
|
-
params: DataGridCellRendererParams<V1_LiteDataContract>,
|
|
258
|
-
) => {
|
|
259
|
-
const requester = params.data?.createdBy;
|
|
260
|
-
return requester ? (
|
|
261
|
-
<UserRenderer
|
|
262
|
-
userId={requester}
|
|
263
|
-
applicationStore={marketplaceBaseStore.applicationStore}
|
|
264
|
-
userSearchService={marketplaceBaseStore.userSearchService}
|
|
265
|
-
className="marketplace-lakehouse-entitlements__grid__user-display"
|
|
266
|
-
/>
|
|
267
|
-
) : (
|
|
268
|
-
<>Unknown</>
|
|
269
|
-
);
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
headerName: 'Target Data Product',
|
|
274
|
-
valueGetter: (params) => {
|
|
275
|
-
return params.data?.resourceId ?? 'Unknown';
|
|
276
|
-
},
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
headerName: 'Target Access Point Group',
|
|
280
|
-
valueGetter: (params) => {
|
|
281
|
-
const accessPointGroup =
|
|
282
|
-
params.data?.resourceType === V1_ResourceType.ACCESS_POINT_GROUP
|
|
283
|
-
? params.data.accessPointGroup
|
|
284
|
-
: `${params.data?.accessPointGroup ?? 'Unknown'} (${params.data?.resourceType ?? 'Unknown Type'})`;
|
|
285
|
-
return accessPointGroup ?? 'Unknown';
|
|
286
|
-
},
|
|
287
|
-
},
|
|
115
|
+
...getCommonEntitlementsColDefs(dashboardState),
|
|
288
116
|
{
|
|
289
117
|
headerName: 'State',
|
|
290
|
-
|
|
291
|
-
params
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
dataContract={params.data}
|
|
295
|
-
entitlementsStore={dashboardState.lakehouseEntitlementsStore}
|
|
296
|
-
token={auth.user?.access_token}
|
|
297
|
-
/>
|
|
298
|
-
),
|
|
118
|
+
valueGetter: (params) =>
|
|
119
|
+
params.data instanceof V1_LiteDataContractWithUserStatus
|
|
120
|
+
? params.data.status
|
|
121
|
+
: (params.data?.contractResultLite.state ?? 'Unknown'),
|
|
299
122
|
},
|
|
300
123
|
{
|
|
301
124
|
headerName: 'Business Justification',
|
|
302
|
-
valueGetter: (p) => p.data?.description,
|
|
125
|
+
valueGetter: (p) => p.data?.contractResultLite.description,
|
|
303
126
|
},
|
|
304
127
|
{
|
|
305
128
|
hide: true,
|
|
306
129
|
headerName: 'Contract ID',
|
|
307
|
-
valueGetter: (p) => p.data?.guid,
|
|
130
|
+
valueGetter: (p) => p.data?.contractResultLite.guid,
|
|
308
131
|
},
|
|
309
132
|
],
|
|
310
|
-
[
|
|
311
|
-
auth.user?.access_token,
|
|
312
|
-
dashboardState.lakehouseEntitlementsStore,
|
|
313
|
-
marketplaceBaseStore.applicationStore,
|
|
314
|
-
marketplaceBaseStore.userSearchService,
|
|
315
|
-
],
|
|
133
|
+
[dashboardState],
|
|
316
134
|
);
|
|
317
135
|
|
|
318
136
|
const gridRowData = useMemo(
|
|
@@ -323,19 +141,51 @@ export const EntitlementsClosedContractsDashboard = observer(
|
|
|
323
141
|
[myClosedContracts, closedContractsForOthers, showForOthers],
|
|
324
142
|
);
|
|
325
143
|
|
|
144
|
+
const getInitialUserForViewer = (): string | undefined => {
|
|
145
|
+
const currentUser =
|
|
146
|
+
dashboardState.lakehouseEntitlementsStore.applicationStore
|
|
147
|
+
.identityService.currentUser;
|
|
148
|
+
if (selectedContract && myClosedContractIds.has(selectedContract.guid)) {
|
|
149
|
+
return currentUser;
|
|
150
|
+
}
|
|
151
|
+
if (
|
|
152
|
+
selectedContract &&
|
|
153
|
+
selectedContract.consumer instanceof V1_AdhocTeam &&
|
|
154
|
+
selectedContract.consumer.users.some(
|
|
155
|
+
(user) => user.name === currentUser,
|
|
156
|
+
)
|
|
157
|
+
) {
|
|
158
|
+
return currentUser;
|
|
159
|
+
}
|
|
160
|
+
return undefined;
|
|
161
|
+
};
|
|
162
|
+
|
|
326
163
|
return (
|
|
327
164
|
<Box className="marketplace-lakehouse-entitlements__completed-contracts">
|
|
328
|
-
<
|
|
165
|
+
<FormGroup className="marketplace-lakehouse-entitlements__completed-contracts__action-btns">
|
|
329
166
|
<FormControlLabel
|
|
330
167
|
control={
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
168
|
+
dashboardState.fetchingContractsByUserState.isInProgress ? (
|
|
169
|
+
<Box className="marketplace-lakehouse-entitlements__pending-contracts__action-btn--loading">
|
|
170
|
+
<CircularProgress size={20} />
|
|
171
|
+
</Box>
|
|
172
|
+
) : (
|
|
173
|
+
<Switch
|
|
174
|
+
checked={showForOthers}
|
|
175
|
+
onChange={(event) => setShowForOthers(event.target.checked)}
|
|
176
|
+
/>
|
|
177
|
+
)
|
|
335
178
|
}
|
|
336
179
|
label="Show my requests for others"
|
|
180
|
+
title={
|
|
181
|
+
dashboardState.fetchingContractsByUserState.isInProgress
|
|
182
|
+
? 'Loading requests for others'
|
|
183
|
+
: undefined
|
|
184
|
+
}
|
|
185
|
+
disabled={dashboardState.fetchingContractsByUserState.isInProgress}
|
|
186
|
+
className="marketplace-lakehouse-entitlements__completed-contracts__action-btn"
|
|
337
187
|
/>
|
|
338
|
-
</
|
|
188
|
+
</FormGroup>
|
|
339
189
|
<Box className="marketplace-lakehouse-entitlements__completed-contracts__grid ag-theme-balham">
|
|
340
190
|
<DataGrid
|
|
341
191
|
rowData={gridRowData}
|
|
@@ -346,7 +196,9 @@ export const EntitlementsClosedContractsDashboard = observer(
|
|
|
346
196
|
suppressContextMenu={false}
|
|
347
197
|
columnDefs={colDefs}
|
|
348
198
|
onCellClicked={(
|
|
349
|
-
event: DataGridCellClickedEvent<
|
|
199
|
+
event: DataGridCellClickedEvent<
|
|
200
|
+
V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
|
|
201
|
+
>,
|
|
350
202
|
) =>
|
|
351
203
|
// eslint-disable-next-line no-void
|
|
352
204
|
void handleCellClicked(event)
|
|
@@ -354,7 +206,7 @@ export const EntitlementsClosedContractsDashboard = observer(
|
|
|
354
206
|
defaultColDef={defaultColDef}
|
|
355
207
|
rowHeight={45}
|
|
356
208
|
overlayNoRowsTemplate="You have no closed contracts"
|
|
357
|
-
loading={dashboardState.
|
|
209
|
+
loading={dashboardState.fetchingContractsForUserState.isInProgress}
|
|
358
210
|
overlayLoadingTemplate="Loading contracts"
|
|
359
211
|
/>
|
|
360
212
|
</Box>
|
|
@@ -375,12 +227,7 @@ export const EntitlementsClosedContractsDashboard = observer(
|
|
|
375
227
|
marketplaceBaseStore.userSearchService,
|
|
376
228
|
)
|
|
377
229
|
}
|
|
378
|
-
initialSelectedUser={
|
|
379
|
-
myClosedContractIds.has(selectedContract.guid)
|
|
380
|
-
? dashboardState.lakehouseEntitlementsStore.applicationStore
|
|
381
|
-
.identityService.currentUser
|
|
382
|
-
: undefined
|
|
383
|
-
}
|
|
230
|
+
initialSelectedUser={getInitialUserForViewer()}
|
|
384
231
|
onRefresh={async () => {
|
|
385
232
|
await flowResult(
|
|
386
233
|
dashboardState.updateContract(
|
|
@@ -389,9 +236,9 @@ export const EntitlementsClosedContractsDashboard = observer(
|
|
|
389
236
|
),
|
|
390
237
|
);
|
|
391
238
|
}}
|
|
392
|
-
getContractTaskUrl={(taskId: string) =>
|
|
239
|
+
getContractTaskUrl={(contractId: string, taskId: string) =>
|
|
393
240
|
marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
|
|
394
|
-
|
|
241
|
+
generateContractPagePath(contractId, taskId),
|
|
395
242
|
)
|
|
396
243
|
}
|
|
397
244
|
getDataProductUrl={(dataProductId: string, deploymentId: number) =>
|