@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.
Files changed (74) hide show
  1. package/lib/__lib__/LegendMarketplaceAppEvent.d.ts +1 -0
  2. package/lib/__lib__/LegendMarketplaceAppEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendMarketplaceAppEvent.js +1 -0
  4. package/lib/__lib__/LegendMarketplaceAppEvent.js.map +1 -1
  5. package/lib/__lib__/LegendMarketplaceNavigation.d.ts +9 -2
  6. package/lib/__lib__/LegendMarketplaceNavigation.d.ts.map +1 -1
  7. package/lib/__lib__/LegendMarketplaceNavigation.js +7 -1
  8. package/lib/__lib__/LegendMarketplaceNavigation.js.map +1 -1
  9. package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts +11 -1
  10. package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts.map +1 -1
  11. package/lib/__lib__/LegendMarketplaceTelemetryHelper.js +57 -3
  12. package/lib/__lib__/LegendMarketplaceTelemetryHelper.js.map +1 -1
  13. package/lib/application/LegendMarketplaceWebApplication.d.ts.map +1 -1
  14. package/lib/application/LegendMarketplaceWebApplication.js +4 -1
  15. package/lib/application/LegendMarketplaceWebApplication.js.map +1 -1
  16. package/lib/components/Header/LegendMarketplaceIconToolbar.d.ts.map +1 -1
  17. package/lib/components/Header/LegendMarketplaceIconToolbar.js +11 -2
  18. package/lib/components/Header/LegendMarketplaceIconToolbar.js.map +1 -1
  19. package/lib/components/SearchBar/LegendMarketplaceSearchBar.d.ts.map +1 -1
  20. package/lib/components/SearchBar/LegendMarketplaceSearchBar.js +4 -0
  21. package/lib/components/SearchBar/LegendMarketplaceSearchBar.js.map +1 -1
  22. package/lib/index.css +2 -2
  23. package/lib/index.css.map +1 -1
  24. package/lib/package.json +1 -1
  25. package/lib/pages/Lakehouse/MarketplaceLakehouseHome.d.ts.map +1 -1
  26. package/lib/pages/Lakehouse/MarketplaceLakehouseHome.js +5 -19
  27. package/lib/pages/Lakehouse/MarketplaceLakehouseHome.js.map +1 -1
  28. package/lib/pages/Lakehouse/admin/LakehouseAdminContractsDashboard.js +2 -2
  29. package/lib/pages/Lakehouse/admin/LakehouseAdminContractsDashboard.js.map +1 -1
  30. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.d.ts.map +1 -1
  31. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js +38 -132
  32. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js.map +1 -1
  33. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.d.ts.map +1 -1
  34. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js +36 -160
  35. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js.map +1 -1
  36. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.d.ts.map +1 -1
  37. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js +60 -40
  38. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js.map +1 -1
  39. package/lib/pages/Lakehouse/entitlements/LakehouseDataContract.d.ts +17 -0
  40. package/lib/pages/Lakehouse/entitlements/LakehouseDataContract.d.ts.map +1 -0
  41. package/lib/pages/Lakehouse/entitlements/LakehouseDataContract.js +124 -0
  42. package/lib/pages/Lakehouse/entitlements/LakehouseDataContract.js.map +1 -0
  43. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js +2 -2
  44. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js.map +1 -1
  45. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts +22 -11
  46. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts.map +1 -1
  47. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js +145 -74
  48. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js.map +1 -1
  49. package/lib/stores/orders/OrderHelpers.d.ts +1 -1
  50. package/lib/stores/orders/OrderHelpers.d.ts.map +1 -1
  51. package/lib/stores/orders/OrderHelpers.js +7 -6
  52. package/lib/stores/orders/OrderHelpers.js.map +1 -1
  53. package/lib/utils/EntitlementsUtils.d.ts +20 -0
  54. package/lib/utils/EntitlementsUtils.d.ts.map +1 -0
  55. package/lib/utils/EntitlementsUtils.js +107 -0
  56. package/lib/utils/EntitlementsUtils.js.map +1 -0
  57. package/package.json +10 -10
  58. package/src/__lib__/LegendMarketplaceAppEvent.ts +1 -0
  59. package/src/__lib__/LegendMarketplaceNavigation.ts +19 -3
  60. package/src/__lib__/LegendMarketplaceTelemetryHelper.ts +80 -4
  61. package/src/application/LegendMarketplaceWebApplication.tsx +15 -0
  62. package/src/components/Header/LegendMarketplaceIconToolbar.tsx +29 -0
  63. package/src/components/SearchBar/LegendMarketplaceSearchBar.tsx +7 -0
  64. package/src/pages/Lakehouse/MarketplaceLakehouseHome.tsx +4 -54
  65. package/src/pages/Lakehouse/admin/LakehouseAdminContractsDashboard.tsx +3 -3
  66. package/src/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.tsx +91 -244
  67. package/src/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.tsx +91 -298
  68. package/src/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.tsx +87 -52
  69. package/src/pages/Lakehouse/entitlements/LakehouseDataContract.tsx +284 -0
  70. package/src/stores/lakehouse/LegendMarketplaceProductViewerStore.ts +3 -3
  71. package/src/stores/lakehouse/entitlements/EntitlementsDashboardState.ts +234 -109
  72. package/src/stores/orders/OrderHelpers.ts +8 -7
  73. package/src/utils/EntitlementsUtils.tsx +207 -0
  74. package/tsconfig.json +2 -0
@@ -0,0 +1,207 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import {
18
+ getOrganizationalScopeTypeName,
19
+ getOrganizationalScopeTypeDetails,
20
+ UserRenderer,
21
+ MultiUserRenderer,
22
+ } from '@finos/legend-extension-dsl-data-product';
23
+ import {
24
+ V1_LiteDataContractWithUserStatus,
25
+ V1_ResourceType,
26
+ } from '@finos/legend-graph';
27
+ import type {
28
+ DataGridCellRendererParams,
29
+ DataGridColumnDefinition,
30
+ } from '@finos/legend-lego/data-grid';
31
+ import type {
32
+ ContractCreatedByUserDetails,
33
+ EntitlementsDashboardState,
34
+ } from '../stores/lakehouse/entitlements/EntitlementsDashboardState.js';
35
+ import { formatOrderDate } from '../stores/orders/OrderHelpers.js';
36
+ import { InfoCircleIcon } from '@finos/legend-art';
37
+ import { Tooltip } from '@mui/material';
38
+ import { observer } from 'mobx-react-lite';
39
+ import type { LakehouseEntitlementsStore } from '../stores/lakehouse/entitlements/LakehouseEntitlementsStore.js';
40
+
41
+ const TargetUserCellRenderer = observer(
42
+ (props: {
43
+ dataContract:
44
+ | V1_LiteDataContractWithUserStatus
45
+ | ContractCreatedByUserDetails
46
+ | undefined;
47
+ entitlementsStore: LakehouseEntitlementsStore;
48
+ }): React.ReactNode => {
49
+ const { dataContract, entitlementsStore } = props;
50
+
51
+ const userIds =
52
+ dataContract instanceof V1_LiteDataContractWithUserStatus
53
+ ? [dataContract.user]
54
+ : (dataContract?.sortedMemberIds ?? []);
55
+
56
+ return (
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
+ />
66
+ );
67
+ },
68
+ );
69
+
70
+ export const getCommonEntitlementsColDefs = (
71
+ dashboardState: EntitlementsDashboardState,
72
+ ): DataGridColumnDefinition<
73
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
74
+ >[] => [
75
+ {
76
+ headerName: 'Date Created',
77
+ colId: 'dateCreated',
78
+ valueGetter: (params) => {
79
+ return (
80
+ formatOrderDate(params.data?.contractResultLite.createdAt) ?? 'Unknown'
81
+ );
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
+ },
93
+ },
94
+ {
95
+ colId: 'consumerType',
96
+ headerName: 'Consumer Type',
97
+ valueGetter: (params) => {
98
+ const consumer = params.data?.contractResultLite.consumer;
99
+ const typeName = consumer
100
+ ? getOrganizationalScopeTypeName(
101
+ consumer,
102
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
103
+ )
104
+ : undefined;
105
+ return typeName ?? 'Unknown';
106
+ },
107
+ cellRenderer: (
108
+ params: DataGridCellRendererParams<
109
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
110
+ >,
111
+ ) => {
112
+ const consumer = params.data?.contractResultLite.consumer;
113
+ const typeName = consumer
114
+ ? getOrganizationalScopeTypeName(
115
+ consumer,
116
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
117
+ )
118
+ : undefined;
119
+ const typeDetails = consumer
120
+ ? getOrganizationalScopeTypeDetails(
121
+ consumer,
122
+ dashboardState.lakehouseEntitlementsStore.applicationStore.pluginManager.getApplicationPlugins(),
123
+ )
124
+ : undefined;
125
+ return (
126
+ <>
127
+ {typeName ?? 'Unknown'}
128
+ {typeDetails !== undefined && (
129
+ <Tooltip
130
+ className="marketplace-lakehouse-entitlements__grid__consumer-type__tooltip__icon"
131
+ title={typeDetails}
132
+ >
133
+ <InfoCircleIcon />
134
+ </Tooltip>
135
+ )}
136
+ </>
137
+ );
138
+ },
139
+ },
140
+ {
141
+ headerName: 'Target User(s)',
142
+ colId: 'targetUser',
143
+ valueGetter: (params) => {
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';
149
+ },
150
+ cellRenderer: (
151
+ params: DataGridCellRendererParams<
152
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
153
+ >,
154
+ ) => (
155
+ <TargetUserCellRenderer
156
+ dataContract={params.data}
157
+ entitlementsStore={dashboardState.lakehouseEntitlementsStore}
158
+ />
159
+ ),
160
+ },
161
+ {
162
+ headerName: 'Requester',
163
+ colId: 'requester',
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;
172
+ return requester ? (
173
+ <UserRenderer
174
+ userId={requester}
175
+ applicationStore={
176
+ dashboardState.lakehouseEntitlementsStore.applicationStore
177
+ }
178
+ userSearchService={
179
+ dashboardState.lakehouseEntitlementsStore.marketplaceBaseStore
180
+ .userSearchService
181
+ }
182
+ disableOnClick={true}
183
+ className="marketplace-lakehouse-entitlements__grid__user-display"
184
+ />
185
+ ) : (
186
+ <>Unknown</>
187
+ );
188
+ },
189
+ },
190
+ {
191
+ headerName: 'Target Data Product',
192
+ valueGetter: (params) => {
193
+ return params.data?.contractResultLite.resourceId ?? 'Unknown';
194
+ },
195
+ },
196
+ {
197
+ headerName: 'Target Access Point Group',
198
+ valueGetter: (params) => {
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';
205
+ },
206
+ },
207
+ ];
package/tsconfig.json CHANGED
@@ -122,12 +122,14 @@
122
122
  "./src/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.tsx",
123
123
  "./src/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.tsx",
124
124
  "./src/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.tsx",
125
+ "./src/pages/Lakehouse/entitlements/LakehouseDataContract.tsx",
125
126
  "./src/pages/Lakehouse/entitlements/LakehouseEntitlements.tsx",
126
127
  "./src/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.tsx",
127
128
  "./src/pages/Profile/LegendMarketplaceSubscriptions.tsx",
128
129
  "./src/pages/Profile/LegendMarketplaceYourOrders.tsx",
129
130
  "./src/pages/TerminalsAddons/LegendMarketplaceTerminalsAddons.tsx",
130
131
  "./src/stores/LegendMarketPlaceVendorDataStore.tsx",
132
+ "./src/utils/EntitlementsUtils.tsx",
131
133
  "./src/utils/LakehouseUtils.tsx",
132
134
  "./src/utils/LogUtils.tsx",
133
135
  "./src/utils/SearchUtils.tsx",