@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
@@ -97,13 +97,6 @@ const WorkflowDataAccessRequestTask = React.lazy(() =>
97
97
  }),
98
98
  ),
99
99
  );
100
- const PermitDataAccessRequestTask = React.lazy(() =>
101
- import('../pages/Lakehouse/entitlements/PermitDataAccessRequest.js').then(
102
- (module) => ({
103
- default: module.PermitDataAccessRequestTask,
104
- }),
105
- ),
106
- );
107
100
  const LakehouseAdmin = React.lazy(() =>
108
101
  import('../pages/Lakehouse/admin/LakehouseAdmin.js').then((module) => ({
109
102
  default: module.LakehouseAdmin,
@@ -341,14 +334,6 @@ export const LegendMarketplaceWebApplicationRouter = observer(() => {
341
334
  useProtectedPage(WorkflowDataAccessRequestTask),
342
335
  )}
343
336
  />
344
- <Route
345
- path={
346
- LEGEND_MARKETPLACE_ROUTE_PATTERN.LAKEHOUSE_ENTITLEMENTS_PERMIT_DATA_ACCESS_REQUEST
347
- }
348
- element={React.createElement(
349
- useProtectedPage(PermitDataAccessRequestTask),
350
- )}
351
- />
352
337
  <Route
353
338
  path={
354
339
  LEGEND_MARKETPLACE_ROUTE_PATTERN.LAKEHOUSE_ENTITLEMENTS_CONTRACT_TASK
@@ -42,7 +42,6 @@ const TEST_DATA__appConfig: LegendMarketplaceApplicationConfigurationData = {
42
42
  url: 'https://testLakehouseUrl',
43
43
  platformUrl: 'https://testLakehousePlatformUrl',
44
44
  workflowUrl: 'https://testLakehouseWorkflowUrl',
45
- permitWorkflowUrl: 'https://testLakehousePermitWorkflowUrl',
46
45
  entitlements: {
47
46
  applicationDirectoryUrl: 'https://testApplicationDirectoryUrl',
48
47
  applicationIDUrl: 'https://testApplicationIDUrl',
@@ -95,12 +94,6 @@ const TEST_DATA__appConfig: LegendMarketplaceApplicationConfigurationData = {
95
94
  'Search for product catalog information',
96
95
  'Display user activity datasets',
97
96
  ],
98
- defaultAISuggestedQueries: [
99
- 'What BVAL bond pricing data is available?',
100
- 'Show me credit risk data products',
101
- 'Find FX rates and currency data',
102
- 'What equity analytics data do we have?',
103
- ],
104
97
  },
105
98
  },
106
99
  assets: {
@@ -14,162 +14,40 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { useCallback, useState } from 'react';
18
17
  import { observer } from 'mobx-react-lite';
18
+ import { LegendMarketplacePage } from '../LegendMarketplacePage.js';
19
+ import { ComingSoonDisplay } from '../../components/ComingSoon/ComingSoonDisplay.js';
19
20
  import {
20
21
  AnalyticsIcon,
21
- ArrowLeftIcon,
22
- CaretRightIcon,
23
22
  PsychologyIcon,
24
23
  RobotOutlineIcon,
25
24
  SparkleStarsIcon,
26
25
  } from '@finos/legend-art';
27
- import { Container, Typography } from '@mui/material';
28
- import { LegendMarketplacePage } from '../LegendMarketplacePage.js';
29
- import { LegendMarketplaceAIChatStoreProvider } from '../../application/providers/LegendMarketplaceAIChatStoreProvider.js';
30
- import { MarketplaceAIChatView } from './MarketplaceAIChatView.js';
31
- import { LegendMarketplaceSearchBar } from '../../components/SearchBar/LegendMarketplaceSearchBar.js';
32
- import { useLegendMarketplaceBaseStore } from '../../application/providers/LegendMarketplaceFrameworkProvider.js';
33
- import { ComingSoonDisplay } from '../../components/ComingSoon/ComingSoonDisplay.js';
34
-
35
- const AGENT_DESCRIPTION =
36
- 'Ask questions about your data, discover data products, and run queries using natural language.';
37
-
38
- const AgentCardsView = observer(
39
- (props: { onSelectAgent: (query?: string) => void }) => {
40
- const { onSelectAgent } = props;
41
- const legendMarketplaceBaseStore = useLegendMarketplaceBaseStore();
42
- const applicationStore = legendMarketplaceBaseStore.applicationStore;
43
- const isDarkMode =
44
- !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled;
45
-
46
- return (
47
- <>
48
- <Container className="marketplace-agents__search-container">
49
- <LegendMarketplaceSearchBar
50
- onSearch={onSelectAgent}
51
- placeholder="Ask a question about your data..."
52
- className="marketplace-agents__search-bar"
53
- enableAutosuggest={false}
54
- />
55
- </Container>
56
- <div className="marketplace-agents__section-bar">
57
- <div className="marketplace-agents__section-bar__container">
58
- <Typography
59
- variant="h4"
60
- className="marketplace-agents__section-title"
61
- >
62
- Intelligence &amp; AI Agents
63
- </Typography>
64
- </div>
65
- </div>
66
- <Container
67
- maxWidth="xxxl"
68
- className="marketplace-agents__content-container"
69
- >
70
- <div className="marketplace-agents__cards">
71
- <button
72
- type="button"
73
- className="marketplace-agents__agent-card"
74
- onClick={(): void => onSelectAgent()}
75
- >
76
- <div className="marketplace-agents__agent-card-icon">
77
- <img
78
- src={
79
- isDarkMode
80
- ? '/assets/legendmarketplacehomelogodark.png'
81
- : '/assets/legendmarketplacehomelogolight.png'
82
- }
83
- alt="Legend Marketplace AI"
84
- className="marketplace-agents__agent-card-logo"
85
- />
86
- </div>
87
- <div className="marketplace-agents__agent-card-content">
88
- <h3 className="marketplace-agents__agent-card-title">
89
- Legend Marketplace AI
90
- </h3>
91
- <p className="marketplace-agents__agent-card-desc">
92
- {AGENT_DESCRIPTION}
93
- </p>
94
- </div>
95
- <div className="marketplace-agents__agent-card-action">
96
- Launch Agent <CaretRightIcon />
97
- </div>
98
- </button>
99
- </div>
100
- </Container>
101
- </>
102
- );
103
- },
104
- );
105
26
 
106
27
  export const LegendMarketplaceAgents = observer(() => {
107
- const legendMarketplaceBaseStore = useLegendMarketplaceBaseStore();
108
- const applicationStore = legendMarketplaceBaseStore.applicationStore;
109
- const showDevFeatures = applicationStore.config.options.showDevFeatures;
110
-
111
- const [showChat, setShowChat] = useState(false);
112
- const [initialQuery, setInitialQuery] = useState<string | undefined>(
113
- undefined,
114
- );
115
-
116
- const handleSelectAgent = useCallback((query?: string): void => {
117
- setInitialQuery(query);
118
- setShowChat(true);
119
- }, []);
120
-
121
- if (!showDevFeatures) {
122
- const featuresPreviewItems = [
123
- {
124
- icon: <SparkleStarsIcon />,
125
- title: 'Smart Recommendations',
126
- },
127
- {
128
- icon: <AnalyticsIcon />,
129
- title: 'Data Analysis',
130
- },
131
- {
132
- icon: <PsychologyIcon />,
133
- title: 'Intelligent Insights',
134
- },
135
- ];
136
-
137
- return (
138
- <LegendMarketplacePage className="agents-coming-soon">
139
- <ComingSoonDisplay
140
- loadingIcon={<RobotOutlineIcon />}
141
- title="Legend Intelligence"
142
- description="Transform your data operations with intelligent AI agents that learn, adapt, and deliver autonomous insights. Experience the future of data-driven automation and decision-making excellence."
143
- featuresPreviewItems={featuresPreviewItems}
144
- />
145
- </LegendMarketplacePage>
146
- );
147
- }
148
-
149
- const initialQueryProp = initialQuery === undefined ? {} : { initialQuery };
28
+ const featuresPreviewItems = [
29
+ {
30
+ icon: <SparkleStarsIcon />,
31
+ title: 'Smart Recommendations',
32
+ },
33
+ {
34
+ icon: <AnalyticsIcon />,
35
+ title: 'Data Analysis',
36
+ },
37
+ {
38
+ icon: <PsychologyIcon />,
39
+ title: 'Intelligent Insights',
40
+ },
41
+ ];
150
42
 
151
43
  return (
152
- <LegendMarketplacePage className="legend-marketplace-ai-page">
153
- {showChat ? (
154
- <LegendMarketplaceAIChatStoreProvider>
155
- <div className="marketplace-agents__chat-wrapper">
156
- <button
157
- type="button"
158
- className="marketplace-agents__back-btn"
159
- onClick={(): void => {
160
- setShowChat(false);
161
- setInitialQuery(undefined);
162
- }}
163
- >
164
- <ArrowLeftIcon />
165
- <span>Back to Agents</span>
166
- </button>
167
- <MarketplaceAIChatView {...initialQueryProp} />
168
- </div>
169
- </LegendMarketplaceAIChatStoreProvider>
170
- ) : (
171
- <AgentCardsView onSelectAgent={handleSelectAgent} />
172
- )}
44
+ <LegendMarketplacePage className="agents-coming-soon">
45
+ <ComingSoonDisplay
46
+ loadingIcon={<RobotOutlineIcon />}
47
+ title="Legend Intelligence"
48
+ description="Transform your data operations with intelligent AI agents that learn, adapt, and deliver autonomous insights. Experience the future of data-driven automation and decision-making excellence."
49
+ featuresPreviewItems={featuresPreviewItems}
50
+ />
173
51
  </LegendMarketplacePage>
174
52
  );
175
53
  });
@@ -15,12 +15,15 @@
15
15
  */
16
16
 
17
17
  import {
18
+ type V1_LiteDataContract,
19
+ GraphManagerState,
18
20
  V1_AdhocTeam,
19
21
  V1_ContractState,
20
22
  V1_LiteDataContractWithUserStatus,
21
23
  } from '@finos/legend-graph';
22
24
  import {
23
25
  DataGrid,
26
+ type DataGridCellClickedEvent,
24
27
  type DataGridColumnDefinition,
25
28
  } from '@finos/legend-lego/data-grid';
26
29
  import {
@@ -30,45 +33,34 @@ import {
30
33
  FormGroup,
31
34
  Switch,
32
35
  } from '@mui/material';
33
- import { useEffect, useMemo, useState } from 'react';
34
- import { startCase } from '@finos/legend-shared';
35
- 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';
36
41
  import { useLegendMarketplaceBaseStore } from '../../../application/providers/LegendMarketplaceFrameworkProvider.js';
37
42
  import { observer } from 'mobx-react-lite';
38
43
  import { useAuth } from 'react-oidc-context';
39
44
  import {
40
45
  type ContractErrorLayer,
41
46
  DataAccessRequestViewer,
47
+ DataContractViewerState,
42
48
  isApprovalStatusTerminal,
43
49
  isContractInTerminalState,
44
50
  } from '@finos/legend-extension-dsl-data-product';
45
- import { flowResult } from 'mobx';
46
51
  import {
47
- getCommonEntitlementsColDefs,
48
- type EntitlementsRow,
49
- getSelectedRowId,
50
- getSelectedContractGuid,
51
- EntitlementsColumnHeader,
52
- ENTITLEMENTS_DEFAULT_COL_DEF,
53
- ROW_KIND_CONTRACT,
54
- ROW_KIND_REQUEST,
55
- TERMINAL_DATA_REQUEST_STATES,
56
- UNKNOWN,
57
- useSelectedViewerState,
58
- useGetDataProductUrl,
59
- } from '../../../utils/EntitlementsUtils.js';
52
+ generateContractPagePath,
53
+ generateLakehouseDataProductPath,
54
+ } from '../../../__lib__/LegendMarketplaceNavigation.js';
55
+ import { flowResult } from 'mobx';
56
+ import { getCommonEntitlementsColDefs } from '../../../utils/EntitlementsUtils.js';
60
57
 
61
58
  export const EntitlementsClosedContractsDashboard = observer(
62
59
  (props: { dashboardState: EntitlementsDashboardState }): React.ReactNode => {
63
60
  const { dashboardState } = props;
64
- const {
65
- allContractsForUser,
66
- allContractsCreatedByUser,
67
- dataRequestsCreatedByUser,
68
- } = dashboardState;
61
+ const { allContractsForUser, allContractsCreatedByUser } = dashboardState;
69
62
  const marketplaceBaseStore = useLegendMarketplaceBaseStore();
70
63
  const auth = useAuth();
71
- const getDataProductUrl = useGetDataProductUrl();
72
64
 
73
65
  const myClosedContracts = useMemo(
74
66
  () =>
@@ -91,16 +83,8 @@ export const EntitlementsClosedContractsDashboard = observer(
91
83
  [allContractsCreatedByUser, myClosedContractIds],
92
84
  );
93
85
 
94
- const closedDataRequests = useMemo(
95
- () =>
96
- (dataRequestsCreatedByUser ?? []).filter((dr) =>
97
- TERMINAL_DATA_REQUEST_STATES.has(dr.dataRequest.state),
98
- ),
99
- [dataRequestsCreatedByUser],
100
- );
101
-
102
- const [selectedRow, setSelectedRow] = useState<
103
- EntitlementsRow | undefined
86
+ const [selectedContract, setSelectedContract] = useState<
87
+ V1_LiteDataContract | undefined
104
88
  >();
105
89
  const [contractErrors, setContractErrors] = useState<
106
90
  ContractErrorLayer | undefined
@@ -109,91 +93,89 @@ export const EntitlementsClosedContractsDashboard = observer(
109
93
  myClosedContracts.length === 0 && closedContractsForOthers.length > 0,
110
94
  );
111
95
 
112
- useEffect(() => {
96
+ const handleCellClicked = async (
97
+ event: DataGridCellClickedEvent<
98
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
99
+ >,
100
+ ) => {
101
+ const contract = event.data?.contractResultLite;
102
+ setSelectedContract(contract);
113
103
  setContractErrors(undefined);
114
- if (selectedRow?.kind === ROW_KIND_CONTRACT) {
115
- const contract = selectedRow.data.contractResultLite;
104
+ if (contract !== undefined) {
116
105
  const isCompleted = contract.state === V1_ContractState.COMPLETED;
117
- dashboardState
118
- .getContractErrors(
119
- contract.guid,
120
- auth.user?.access_token,
121
- isCompleted,
122
- )
123
- .then((result) => setContractErrors(result))
124
- .catch(() => setContractErrors(undefined));
106
+ const result = await dashboardState.getContractErrors(
107
+ contract.guid,
108
+ auth.user?.access_token,
109
+ isCompleted,
110
+ );
111
+ setContractErrors(result);
125
112
  }
126
- }, [selectedRow, auth.user?.access_token, dashboardState]);
113
+ };
114
+
115
+ const defaultColDef: DataGridColumnDefinition<
116
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
117
+ > = useMemo(
118
+ () => ({
119
+ minWidth: 50,
120
+ sortable: true,
121
+ resizable: true,
122
+ flex: 1,
123
+ }),
124
+ [],
125
+ );
127
126
 
128
- const selectedRowId = getSelectedRowId(selectedRow);
127
+ const colDefs: DataGridColumnDefinition<
128
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
129
+ >[] = useMemo(
130
+ () => [
131
+ ...getCommonEntitlementsColDefs(dashboardState),
132
+ {
133
+ headerName: 'State',
134
+ valueGetter: (params) =>
135
+ params.data instanceof V1_LiteDataContractWithUserStatus
136
+ ? params.data.status
137
+ : (params.data?.contractResultLite.state ?? 'Unknown'),
138
+ },
139
+ {
140
+ headerName: 'Business Justification',
141
+ valueGetter: (p) => p.data?.contractResultLite.description,
142
+ },
143
+ {
144
+ hide: true,
145
+ headerName: 'Contract ID',
146
+ valueGetter: (p) => p.data?.contractResultLite.guid,
147
+ },
148
+ ],
149
+ [dashboardState],
150
+ );
129
151
 
130
- const selectedViewerState = useSelectedViewerState(
131
- selectedRow,
132
- selectedRowId,
152
+ const gridRowData = useMemo(
153
+ () =>
154
+ showForOthers
155
+ ? [...myClosedContracts, ...closedContractsForOthers]
156
+ : myClosedContracts,
157
+ [myClosedContracts, closedContractsForOthers, showForOthers],
133
158
  );
134
159
 
135
160
  const getInitialUserForViewer = (): string | undefined => {
136
- if (selectedRow?.kind !== ROW_KIND_CONTRACT) {
137
- return undefined;
138
- }
139
- const contract = selectedRow.data.contractResultLite;
140
161
  const currentUser =
141
- marketplaceBaseStore.applicationStore.identityService.currentUser;
142
- if (myClosedContractIds.has(contract.guid)) {
162
+ dashboardState.lakehouseEntitlementsStore.applicationStore
163
+ .identityService.currentUser;
164
+ if (selectedContract && myClosedContractIds.has(selectedContract.guid)) {
143
165
  return currentUser;
144
166
  }
145
167
  if (
146
- contract.consumer instanceof V1_AdhocTeam &&
147
- contract.consumer.users.some((user) => user.name === currentUser)
168
+ selectedContract &&
169
+ selectedContract.consumer instanceof V1_AdhocTeam &&
170
+ selectedContract.consumer.users.some(
171
+ (user) => user.name === currentUser,
172
+ )
148
173
  ) {
149
174
  return currentUser;
150
175
  }
151
176
  return undefined;
152
177
  };
153
178
 
154
- const selectedContractGuid = getSelectedContractGuid(selectedRow);
155
-
156
- const colDefs: DataGridColumnDefinition<EntitlementsRow>[] = useMemo(
157
- () => [
158
- ...getCommonEntitlementsColDefs(dashboardState),
159
- {
160
- headerName: EntitlementsColumnHeader.STATE,
161
- valueGetter: (params) => {
162
- if (!params.data) {
163
- return UNKNOWN;
164
- }
165
- if (params.data.kind === ROW_KIND_CONTRACT) {
166
- return params.data.data instanceof
167
- V1_LiteDataContractWithUserStatus
168
- ? params.data.data.status
169
- : params.data.data.contractResultLite.state;
170
- }
171
- return startCase(params.data.data.dataRequest.state);
172
- },
173
- },
174
- ],
175
- [dashboardState],
176
- );
177
-
178
- const gridRowData: EntitlementsRow[] = useMemo(() => {
179
- const contracts = showForOthers
180
- ? [...myClosedContracts, ...closedContractsForOthers]
181
- : myClosedContracts;
182
- return [
183
- ...contracts.map(
184
- (c): EntitlementsRow => ({ kind: ROW_KIND_CONTRACT, data: c }),
185
- ),
186
- ...closedDataRequests.map(
187
- (r): EntitlementsRow => ({ kind: ROW_KIND_REQUEST, data: r }),
188
- ),
189
- ];
190
- }, [
191
- showForOthers,
192
- myClosedContracts,
193
- closedContractsForOthers,
194
- closedDataRequests,
195
- ]);
196
-
197
179
  return (
198
180
  <Box className="marketplace-lakehouse-entitlements__completed-contracts">
199
181
  <FormGroup className="marketplace-lakehouse-entitlements__completed-contracts__action-btns">
@@ -229,40 +211,61 @@ export const EntitlementsClosedContractsDashboard = observer(
229
211
  suppressFieldDotNotation={true}
230
212
  suppressContextMenu={false}
231
213
  columnDefs={colDefs}
232
- onCellClicked={(event) => event.data && setSelectedRow(event.data)}
233
- defaultColDef={ENTITLEMENTS_DEFAULT_COL_DEF}
234
- rowHeight={45}
235
- overlayNoRowsTemplate="You have no closed contracts or data requests"
236
- loading={
237
- dashboardState.fetchingContractsForUserState.isInProgress ||
238
- dashboardState.fetchingDataRequestsCreatedByUserState.isInProgress
214
+ onCellClicked={(
215
+ event: DataGridCellClickedEvent<
216
+ V1_LiteDataContractWithUserStatus | ContractCreatedByUserDetails
217
+ >,
218
+ ) =>
219
+ // eslint-disable-next-line no-void
220
+ void handleCellClicked(event)
239
221
  }
240
- overlayLoadingTemplate="Loading"
222
+ defaultColDef={defaultColDef}
223
+ rowHeight={45}
224
+ overlayNoRowsTemplate="You have no closed contracts"
225
+ loading={dashboardState.fetchingContractsForUserState.isInProgress}
226
+ overlayLoadingTemplate="Loading contracts"
241
227
  />
242
228
  </Box>
243
- {selectedRow !== undefined && selectedViewerState !== undefined && (
229
+ {selectedContract !== undefined && (
244
230
  <DataAccessRequestViewer
245
231
  open={true}
246
232
  onClose={() => {
247
- setSelectedRow(undefined);
233
+ setSelectedContract(undefined);
248
234
  setContractErrors(undefined);
249
235
  }}
250
236
  contractErrors={contractErrors}
251
- viewerState={selectedViewerState}
237
+ viewerState={
238
+ new DataContractViewerState(
239
+ selectedContract,
240
+ (contractId: string, taskId: string) =>
241
+ marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
242
+ generateContractPagePath(contractId, taskId),
243
+ ),
244
+ undefined,
245
+ marketplaceBaseStore.applicationStore,
246
+ marketplaceBaseStore.lakehouseContractServerClient,
247
+ new GraphManagerState(
248
+ marketplaceBaseStore.applicationStore.pluginManager,
249
+ marketplaceBaseStore.applicationStore.logService,
250
+ ),
251
+ marketplaceBaseStore.userSearchService,
252
+ )
253
+ }
252
254
  initialSelectedUser={getInitialUserForViewer()}
253
- {...(selectedContractGuid
254
- ? {
255
- onRefresh: async () => {
256
- await flowResult(
257
- dashboardState.updateContract(
258
- selectedContractGuid,
259
- auth.user?.access_token,
260
- ),
261
- );
262
- },
263
- }
264
- : {})}
265
- getDataProductUrl={getDataProductUrl}
255
+ onRefresh={async () => {
256
+ await flowResult(
257
+ dashboardState.updateContract(
258
+ selectedContract.guid,
259
+ auth.user?.access_token,
260
+ ),
261
+ );
262
+ }}
263
+ getDataProductUrl={(dataProductId: string, deploymentId: number) =>
264
+ marketplaceBaseStore.applicationStore.navigationService.navigator.generateAddress(
265
+ generateLakehouseDataProductPath(dataProductId, deploymentId),
266
+ )
267
+ }
268
+ //Derives environment from the fact that other environments are filtered out
266
269
  dataProductEnvironment={
267
270
  marketplaceBaseStore.envState.lakehouseEnvironment
268
271
  }