@finos/legend-application-marketplace 0.2.3 → 0.2.4
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 +2 -0
- package/lib/__lib__/LegendMarketplaceAppEvent.d.ts.map +1 -1
- package/lib/__lib__/LegendMarketplaceAppEvent.js +2 -0
- package/lib/__lib__/LegendMarketplaceAppEvent.js.map +1 -1
- package/lib/__lib__/LegendMarketplaceNavigation.d.ts +7 -1
- package/lib/__lib__/LegendMarketplaceNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendMarketplaceNavigation.js +9 -1
- package/lib/__lib__/LegendMarketplaceNavigation.js.map +1 -1
- package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts +2 -1
- package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendMarketplaceTelemetryHelper.js +10 -2
- 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/application/providers/LegendMarketplaceFieldSearchResultsStoreProvider.d.ts +22 -0
- package/lib/application/providers/LegendMarketplaceFieldSearchResultsStoreProvider.d.ts.map +1 -0
- package/lib/application/providers/LegendMarketplaceFieldSearchResultsStoreProvider.js +37 -0
- package/lib/application/providers/LegendMarketplaceFieldSearchResultsStoreProvider.js.map +1 -0
- package/lib/components/AddToCart/CartDrawer.d.ts.map +1 -1
- package/lib/components/AddToCart/CartDrawer.js +36 -4
- package/lib/components/AddToCart/CartDrawer.js.map +1 -1
- package/lib/components/AddToCart/RecommendedAddOnsModal.d.ts +2 -1
- package/lib/components/AddToCart/RecommendedAddOnsModal.d.ts.map +1 -1
- package/lib/components/AddToCart/RecommendedAddOnsModal.js +23 -13
- package/lib/components/AddToCart/RecommendedAddOnsModal.js.map +1 -1
- package/lib/components/AddToCart/RecommendedItemsCard.d.ts +3 -1
- package/lib/components/AddToCart/RecommendedItemsCard.d.ts.map +1 -1
- package/lib/components/AddToCart/RecommendedItemsCard.js +14 -11
- package/lib/components/AddToCart/RecommendedItemsCard.js.map +1 -1
- package/lib/components/FieldSearchFiltersPanel/FieldSearchFiltersPanel.d.ts +23 -0
- package/lib/components/FieldSearchFiltersPanel/FieldSearchFiltersPanel.d.ts.map +1 -0
- package/lib/components/FieldSearchFiltersPanel/FieldSearchFiltersPanel.js +22 -0
- package/lib/components/FieldSearchFiltersPanel/FieldSearchFiltersPanel.js.map +1 -0
- package/lib/components/MarketplaceCard/FieldSearchResultListItem.d.ts +25 -0
- package/lib/components/MarketplaceCard/FieldSearchResultListItem.d.ts.map +1 -0
- package/lib/components/MarketplaceCard/FieldSearchResultListItem.js +58 -0
- package/lib/components/MarketplaceCard/FieldSearchResultListItem.js.map +1 -0
- package/lib/components/MarketplaceSearchFiltersPanel/MarketplaceSearchFiltersPanel.d.ts +10 -0
- package/lib/components/MarketplaceSearchFiltersPanel/MarketplaceSearchFiltersPanel.d.ts.map +1 -1
- package/lib/components/MarketplaceSearchFiltersPanel/MarketplaceSearchFiltersPanel.js +2 -2
- package/lib/components/MarketplaceSearchFiltersPanel/MarketplaceSearchFiltersPanel.js.map +1 -1
- package/lib/components/ProviderCard/LegendMarketplaceTerminalCard.d.ts.map +1 -1
- package/lib/components/ProviderCard/LegendMarketplaceTerminalCard.js +5 -2
- package/lib/components/ProviderCard/LegendMarketplaceTerminalCard.js.map +1 -1
- package/lib/components/SearchBar/LegendMarketplaceSearchBar.d.ts +2 -1
- package/lib/components/SearchBar/LegendMarketplaceSearchBar.d.ts.map +1 -1
- package/lib/components/SearchBar/LegendMarketplaceSearchBar.js +20 -7
- 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 +6 -4
- package/lib/pages/Lakehouse/MarketplaceLakehouseHome.js.map +1 -1
- package/lib/pages/Lakehouse/searchResults/LegendMarketplaceFieldSearchResults.d.ts +17 -0
- package/lib/pages/Lakehouse/searchResults/LegendMarketplaceFieldSearchResults.d.ts.map +1 -0
- package/lib/pages/Lakehouse/searchResults/LegendMarketplaceFieldSearchResults.js +126 -0
- package/lib/pages/Lakehouse/searchResults/LegendMarketplaceFieldSearchResults.js.map +1 -0
- package/lib/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.d.ts.map +1 -1
- package/lib/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.js +8 -3
- package/lib/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.js.map +1 -1
- package/lib/pages/TerminalsAddons/LegendMarketplaceTerminalsAddons.d.ts.map +1 -1
- package/lib/pages/TerminalsAddons/LegendMarketplaceTerminalsAddons.js +2 -2
- package/lib/pages/TerminalsAddons/LegendMarketplaceTerminalsAddons.js.map +1 -1
- package/lib/stores/cart/CartStore.d.ts +10 -3
- package/lib/stores/cart/CartStore.d.ts.map +1 -1
- package/lib/stores/cart/CartStore.js +66 -42
- package/lib/stores/cart/CartStore.js.map +1 -1
- package/lib/stores/lakehouse/LegendMarketplaceFieldSearchResultsStore.d.ts +63 -0
- package/lib/stores/lakehouse/LegendMarketplaceFieldSearchResultsStore.d.ts.map +1 -0
- package/lib/stores/lakehouse/LegendMarketplaceFieldSearchResultsStore.js +228 -0
- package/lib/stores/lakehouse/LegendMarketplaceFieldSearchResultsStore.js.map +1 -0
- package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.d.ts.map +1 -1
- package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js +9 -13
- package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js.map +1 -1
- package/lib/stores/lakehouse/fieldSearch/FieldSearchResultState.d.ts +40 -0
- package/lib/stores/lakehouse/fieldSearch/FieldSearchResultState.d.ts.map +1 -0
- package/lib/stores/lakehouse/fieldSearch/FieldSearchResultState.js +84 -0
- package/lib/stores/lakehouse/fieldSearch/FieldSearchResultState.js.map +1 -0
- package/package.json +8 -8
- package/src/__lib__/LegendMarketplaceAppEvent.ts +2 -0
- package/src/__lib__/LegendMarketplaceNavigation.ts +18 -1
- package/src/__lib__/LegendMarketplaceTelemetryHelper.ts +17 -1
- package/src/application/LegendMarketplaceWebApplication.tsx +13 -0
- package/src/application/providers/LegendMarketplaceFieldSearchResultsStoreProvider.tsx +67 -0
- package/src/components/AddToCart/CartDrawer.tsx +49 -4
- package/src/components/AddToCart/RecommendedAddOnsModal.tsx +86 -24
- package/src/components/AddToCart/RecommendedItemsCard.tsx +143 -120
- package/src/components/FieldSearchFiltersPanel/FieldSearchFiltersPanel.tsx +65 -0
- package/src/components/MarketplaceCard/FieldSearchResultListItem.tsx +163 -0
- package/src/components/MarketplaceSearchFiltersPanel/MarketplaceSearchFiltersPanel.tsx +2 -2
- package/src/components/ProviderCard/LegendMarketplaceTerminalCard.tsx +7 -0
- package/src/components/SearchBar/LegendMarketplaceSearchBar.tsx +44 -3
- package/src/pages/Lakehouse/MarketplaceLakehouseHome.tsx +9 -2
- package/src/pages/Lakehouse/searchResults/LegendMarketplaceFieldSearchResults.tsx +380 -0
- package/src/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.tsx +19 -1
- package/src/pages/TerminalsAddons/LegendMarketplaceTerminalsAddons.tsx +6 -2
- package/src/stores/cart/CartStore.ts +86 -51
- package/src/stores/lakehouse/LegendMarketplaceFieldSearchResultsStore.ts +309 -0
- package/src/stores/lakehouse/LegendMarketplaceProductViewerStore.ts +23 -30
- package/src/stores/lakehouse/fieldSearch/FieldSearchResultState.ts +122 -0
- package/tsconfig.json +6 -0
|
@@ -0,0 +1,163 @@
|
|
|
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 { observer } from 'mobx-react-lite';
|
|
18
|
+
import { useState } from 'react';
|
|
19
|
+
import { Chip, Typography } from '@mui/material';
|
|
20
|
+
import { DatasetIcon, PackageIcon } from '@finos/legend-art';
|
|
21
|
+
import type {
|
|
22
|
+
FieldSearchDataProductEntry,
|
|
23
|
+
FieldSearchResultState,
|
|
24
|
+
} from '../../stores/lakehouse/fieldSearch/FieldSearchResultState.js';
|
|
25
|
+
import { LegendMarketplaceListItem } from '../MarketplaceCard/LegendMarketplaceListItem.js';
|
|
26
|
+
|
|
27
|
+
enum FieldSearchResultListItemLabel {
|
|
28
|
+
SHOW_LESS = 'Show Less',
|
|
29
|
+
MORE_SUFFIX = 'More',
|
|
30
|
+
DATASET_SEPARATOR = '|',
|
|
31
|
+
EMPTY_VALUE = '-',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
enum FieldSearchResultListItemValue {
|
|
35
|
+
COLLAPSED_VISIBLE_DATA_PRODUCTS = 2,
|
|
36
|
+
MAX_DESCRIPTION_LENGTH = 150,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const FieldSearchResultListRow = observer(
|
|
40
|
+
(props: {
|
|
41
|
+
fieldSearchResultState: FieldSearchResultState;
|
|
42
|
+
expanded: boolean;
|
|
43
|
+
onToggleExpanded: (rowId: string) => void;
|
|
44
|
+
onOpenDataProduct: (dataProduct: FieldSearchDataProductEntry) => void;
|
|
45
|
+
}): React.ReactNode => {
|
|
46
|
+
const {
|
|
47
|
+
fieldSearchResultState,
|
|
48
|
+
expanded,
|
|
49
|
+
onToggleExpanded,
|
|
50
|
+
onOpenDataProduct,
|
|
51
|
+
} = props;
|
|
52
|
+
|
|
53
|
+
const [descriptionExpanded, setDescriptionExpanded] = useState(false);
|
|
54
|
+
const description = fieldSearchResultState.fieldDescription;
|
|
55
|
+
const isDescriptionTruncatable =
|
|
56
|
+
description.length >
|
|
57
|
+
FieldSearchResultListItemValue.MAX_DESCRIPTION_LENGTH;
|
|
58
|
+
const displayDescription =
|
|
59
|
+
!descriptionExpanded && isDescriptionTruncatable
|
|
60
|
+
? `${description.substring(0, FieldSearchResultListItemValue.MAX_DESCRIPTION_LENGTH)}...`
|
|
61
|
+
: description;
|
|
62
|
+
|
|
63
|
+
const visibleDataProducts = expanded
|
|
64
|
+
? fieldSearchResultState.dataProducts
|
|
65
|
+
: fieldSearchResultState.dataProducts.slice(
|
|
66
|
+
0,
|
|
67
|
+
FieldSearchResultListItemValue.COLLAPSED_VISIBLE_DATA_PRODUCTS,
|
|
68
|
+
);
|
|
69
|
+
const hiddenDataProductCount = Math.max(
|
|
70
|
+
0,
|
|
71
|
+
fieldSearchResultState.dataProducts.length -
|
|
72
|
+
FieldSearchResultListItemValue.COLLAPSED_VISIBLE_DATA_PRODUCTS,
|
|
73
|
+
);
|
|
74
|
+
const toggleLabel = expanded
|
|
75
|
+
? FieldSearchResultListItemLabel.SHOW_LESS
|
|
76
|
+
: `+${hiddenDataProductCount} ${FieldSearchResultListItemLabel.MORE_SUFFIX}`;
|
|
77
|
+
|
|
78
|
+
const content = (
|
|
79
|
+
<div className="marketplace-lakehouse-field-search-results__list-item-grid">
|
|
80
|
+
<div className="marketplace-lakehouse-field-search-results__field-name-cell">
|
|
81
|
+
<Typography className="marketplace-lakehouse-field-search-results__list-item-text marketplace-lakehouse-field-search-results__list-item-text--primary">
|
|
82
|
+
{fieldSearchResultState.fieldName}
|
|
83
|
+
</Typography>
|
|
84
|
+
</div>
|
|
85
|
+
<div className="marketplace-lakehouse-field-search-results__type-cell">
|
|
86
|
+
<Typography className="marketplace-lakehouse-field-search-results__list-item-text">
|
|
87
|
+
{fieldSearchResultState.fieldType}
|
|
88
|
+
</Typography>
|
|
89
|
+
</div>
|
|
90
|
+
<div className="marketplace-lakehouse-field-search-results__description-cell">
|
|
91
|
+
<Typography className="marketplace-lakehouse-field-search-results__list-item-text">
|
|
92
|
+
{displayDescription}
|
|
93
|
+
</Typography>
|
|
94
|
+
{isDescriptionTruncatable && (
|
|
95
|
+
<button
|
|
96
|
+
className="marketplace-lakehouse-field-search-results__description-toggle"
|
|
97
|
+
onClick={(e) => {
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
setDescriptionExpanded(!descriptionExpanded);
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
{descriptionExpanded ? 'Show less' : 'Show more'}
|
|
103
|
+
</button>
|
|
104
|
+
)}
|
|
105
|
+
</div>
|
|
106
|
+
<div className="marketplace-lakehouse-field-search-results__data-products-cell">
|
|
107
|
+
{fieldSearchResultState.dataProducts.length > 0 ? (
|
|
108
|
+
<>
|
|
109
|
+
{visibleDataProducts.map((dataProduct) => (
|
|
110
|
+
<Chip
|
|
111
|
+
key={`${fieldSearchResultState.id}-${dataProduct.path}-${dataProduct.datasetName ?? ''}`}
|
|
112
|
+
clickable={true}
|
|
113
|
+
label={
|
|
114
|
+
<span className="marketplace-lakehouse-field-search-results__chip-label">
|
|
115
|
+
<PackageIcon className="marketplace-lakehouse-field-search-results__chip-icon" />
|
|
116
|
+
<span>{dataProduct.name}</span>
|
|
117
|
+
{dataProduct.datasetName && (
|
|
118
|
+
<span className="marketplace-lakehouse-field-search-results__chip-secondary">
|
|
119
|
+
<span className="marketplace-lakehouse-field-search-results__chip-separator">
|
|
120
|
+
{FieldSearchResultListItemLabel.DATASET_SEPARATOR}
|
|
121
|
+
</span>
|
|
122
|
+
<DatasetIcon className="marketplace-lakehouse-field-search-results__chip-icon" />
|
|
123
|
+
<span className="marketplace-lakehouse-field-search-results__chip-secondary-text">
|
|
124
|
+
{dataProduct.datasetName}
|
|
125
|
+
</span>
|
|
126
|
+
</span>
|
|
127
|
+
)}
|
|
128
|
+
</span>
|
|
129
|
+
}
|
|
130
|
+
onClick={() => onOpenDataProduct(dataProduct)}
|
|
131
|
+
className="marketplace-lakehouse-field-search-results__data-product-link"
|
|
132
|
+
size="small"
|
|
133
|
+
/>
|
|
134
|
+
))}
|
|
135
|
+
{fieldSearchResultState.dataProducts.length >
|
|
136
|
+
FieldSearchResultListItemValue.COLLAPSED_VISIBLE_DATA_PRODUCTS && (
|
|
137
|
+
<Chip
|
|
138
|
+
key={`${fieldSearchResultState.id}-toggle`}
|
|
139
|
+
label={toggleLabel}
|
|
140
|
+
onClick={() => onToggleExpanded(fieldSearchResultState.id)}
|
|
141
|
+
size="small"
|
|
142
|
+
variant="outlined"
|
|
143
|
+
className="marketplace-lakehouse-field-search-results__data-product-toggle"
|
|
144
|
+
/>
|
|
145
|
+
)}
|
|
146
|
+
</>
|
|
147
|
+
) : (
|
|
148
|
+
<Typography className="marketplace-lakehouse-field-search-results__list-item-text marketplace-lakehouse-field-search-results__list-item-text--empty">
|
|
149
|
+
{FieldSearchResultListItemLabel.EMPTY_VALUE}
|
|
150
|
+
</Typography>
|
|
151
|
+
)}
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<LegendMarketplaceListItem
|
|
158
|
+
className="marketplace-lakehouse-field-search-results__list-item"
|
|
159
|
+
content={content}
|
|
160
|
+
/>
|
|
161
|
+
);
|
|
162
|
+
},
|
|
163
|
+
);
|
|
@@ -181,7 +181,7 @@ const TaxonomyTreeNode: React.FC<{
|
|
|
181
181
|
);
|
|
182
182
|
});
|
|
183
183
|
|
|
184
|
-
const FilterSection: React.FC<{
|
|
184
|
+
export const FilterSection: React.FC<{
|
|
185
185
|
title: string;
|
|
186
186
|
children: React.ReactNode;
|
|
187
187
|
}> = ({ title, children }) => (
|
|
@@ -195,7 +195,7 @@ const FilterSection: React.FC<{
|
|
|
195
195
|
</div>
|
|
196
196
|
);
|
|
197
197
|
|
|
198
|
-
const FilterCheckboxOption: React.FC<{
|
|
198
|
+
export const FilterCheckboxOption: React.FC<{
|
|
199
199
|
label: string;
|
|
200
200
|
checked: boolean;
|
|
201
201
|
onChange: () => void;
|
|
@@ -48,6 +48,9 @@ export const LegendMarketplaceTerminalCard = observer(
|
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
const [modalMessage, setModalMessage] = useState<string>('');
|
|
51
|
+
const [modalTotalCount, setModalTotalCount] = useState<
|
|
52
|
+
number | null | undefined
|
|
53
|
+
>(undefined);
|
|
51
54
|
|
|
52
55
|
const legendMarketplaceBaseStore = useLegendMarketplaceBaseStore();
|
|
53
56
|
const applicationStore = legendMarketplaceBaseStore.applicationStore;
|
|
@@ -72,6 +75,7 @@ export const LegendMarketplaceTerminalCard = observer(
|
|
|
72
75
|
if (result.recommendations && result.recommendations.length > 0) {
|
|
73
76
|
setRecommendedItems(result.recommendations);
|
|
74
77
|
setModalMessage(result.message);
|
|
78
|
+
setModalTotalCount(result.totalCount);
|
|
75
79
|
setShowRecommendationsModal(true);
|
|
76
80
|
}
|
|
77
81
|
} catch (error) {
|
|
@@ -97,9 +101,11 @@ export const LegendMarketplaceTerminalCard = observer(
|
|
|
97
101
|
_selectedTerminal: TerminalResult,
|
|
98
102
|
recommendations: TerminalResult[],
|
|
99
103
|
responseMessage: string,
|
|
104
|
+
totalCount?: number | null,
|
|
100
105
|
) => {
|
|
101
106
|
setRecommendedItems(recommendations);
|
|
102
107
|
setModalMessage(responseMessage);
|
|
108
|
+
setModalTotalCount(totalCount);
|
|
103
109
|
setShowRecommendationsModal(true);
|
|
104
110
|
},
|
|
105
111
|
[],
|
|
@@ -203,6 +209,7 @@ export const LegendMarketplaceTerminalCard = observer(
|
|
|
203
209
|
setShowModal={setShowRecommendationsModal}
|
|
204
210
|
onViewCart={handleViewCart}
|
|
205
211
|
onTerminalSelected={handleTerminalSelected}
|
|
212
|
+
totalCount={modalTotalCount}
|
|
206
213
|
/>
|
|
207
214
|
</Card>
|
|
208
215
|
);
|
|
@@ -63,13 +63,18 @@ export interface Vendor {
|
|
|
63
63
|
|
|
64
64
|
export const LegendMarketplaceSearchBar = observer(
|
|
65
65
|
(props: {
|
|
66
|
-
onSearch?: (
|
|
66
|
+
onSearch?: (
|
|
67
|
+
query: string | undefined,
|
|
68
|
+
useProducerSearch: boolean,
|
|
69
|
+
useFieldSearch: boolean,
|
|
70
|
+
) => void;
|
|
67
71
|
stateSearchQuery?: string | undefined;
|
|
68
72
|
placeholder?: string;
|
|
69
73
|
onChange?: (query: string) => void;
|
|
70
74
|
className?: string | undefined;
|
|
71
75
|
showSettings?: boolean;
|
|
72
76
|
stateUseProducerSearch?: boolean | undefined;
|
|
77
|
+
stateUseFieldSearch?: boolean;
|
|
73
78
|
enableAutosuggest?: boolean;
|
|
74
79
|
}): JSX.Element => {
|
|
75
80
|
const {
|
|
@@ -80,6 +85,7 @@ export const LegendMarketplaceSearchBar = observer(
|
|
|
80
85
|
className,
|
|
81
86
|
showSettings,
|
|
82
87
|
stateUseProducerSearch,
|
|
88
|
+
stateUseFieldSearch,
|
|
83
89
|
enableAutosuggest = true,
|
|
84
90
|
} = props;
|
|
85
91
|
|
|
@@ -92,6 +98,9 @@ export const LegendMarketplaceSearchBar = observer(
|
|
|
92
98
|
const [useProducerSearch, setUseProducerSearch] = useState(
|
|
93
99
|
stateUseProducerSearch ?? false,
|
|
94
100
|
);
|
|
101
|
+
const [useFieldSearch, setUseFieldSearch] = useState(
|
|
102
|
+
stateUseFieldSearch ?? false,
|
|
103
|
+
);
|
|
95
104
|
const [searchMenuAnchorEl, setSearchMenuAnchorEl] =
|
|
96
105
|
useState<HTMLElement | null>();
|
|
97
106
|
const [suggestions, setSuggestions] = useState<SearchSuggestion[]>([]);
|
|
@@ -181,6 +190,10 @@ export const LegendMarketplaceSearchBar = observer(
|
|
|
181
190
|
setUseProducerSearch(stateUseProducerSearch ?? false);
|
|
182
191
|
}, [stateUseProducerSearch]);
|
|
183
192
|
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
setUseFieldSearch(stateUseFieldSearch ?? false);
|
|
195
|
+
}, [stateUseFieldSearch]);
|
|
196
|
+
|
|
184
197
|
useEffect(() => {
|
|
185
198
|
const abortController = new AbortController();
|
|
186
199
|
|
|
@@ -241,7 +254,7 @@ export const LegendMarketplaceSearchBar = observer(
|
|
|
241
254
|
selectedSuggestion.type === SearchSuggestionType.SEARCH_QUERY ||
|
|
242
255
|
selectedSuggestion.type === SearchSuggestionType.DEFAULT
|
|
243
256
|
) {
|
|
244
|
-
onSearch?.(selectedQuery, useProducerSearch);
|
|
257
|
+
onSearch?.(selectedQuery, useProducerSearch, useFieldSearch);
|
|
245
258
|
LegendMarketplaceTelemetryHelper.logEvent_SearchAutosuggestSelection(
|
|
246
259
|
applicationStore.telemetryService,
|
|
247
260
|
selectedQuery,
|
|
@@ -274,7 +287,7 @@ export const LegendMarketplaceSearchBar = observer(
|
|
|
274
287
|
|
|
275
288
|
const handleSubmit = (event: React.FormEvent): void => {
|
|
276
289
|
event.preventDefault();
|
|
277
|
-
onSearch?.(searchQuery, useProducerSearch);
|
|
290
|
+
onSearch?.(searchQuery, useProducerSearch, useFieldSearch);
|
|
278
291
|
};
|
|
279
292
|
|
|
280
293
|
const getOptionLabel = (option: SearchSuggestion | string): string =>
|
|
@@ -525,6 +538,9 @@ export const LegendMarketplaceSearchBar = observer(
|
|
|
525
538
|
checked={useProducerSearch}
|
|
526
539
|
onChange={(event) => {
|
|
527
540
|
setUseProducerSearch(event.target.checked);
|
|
541
|
+
if (event.target.checked) {
|
|
542
|
+
setUseFieldSearch(false);
|
|
543
|
+
}
|
|
528
544
|
LegendMarketplaceTelemetryHelper.logEvent_ToggleProducerSearch(
|
|
529
545
|
applicationStore.telemetryService,
|
|
530
546
|
event.target.checked,
|
|
@@ -540,6 +556,31 @@ export const LegendMarketplaceSearchBar = observer(
|
|
|
540
556
|
}
|
|
541
557
|
/>
|
|
542
558
|
</MenuItem>
|
|
559
|
+
<MenuItem>
|
|
560
|
+
<FormControlLabel
|
|
561
|
+
control={
|
|
562
|
+
<Switch
|
|
563
|
+
checked={useFieldSearch}
|
|
564
|
+
onChange={(event) => {
|
|
565
|
+
setUseFieldSearch(event.target.checked);
|
|
566
|
+
if (event.target.checked) {
|
|
567
|
+
setUseProducerSearch(false);
|
|
568
|
+
}
|
|
569
|
+
LegendMarketplaceTelemetryHelper.logEvent_ToggleFieldSearch(
|
|
570
|
+
applicationStore.telemetryService,
|
|
571
|
+
event.target.checked,
|
|
572
|
+
);
|
|
573
|
+
}}
|
|
574
|
+
/>
|
|
575
|
+
}
|
|
576
|
+
label={
|
|
577
|
+
<>
|
|
578
|
+
Field Search{' '}
|
|
579
|
+
<LegendMarketplaceInfoTooltip title="Use this search to discover data products and datasets that contain a specific field" />
|
|
580
|
+
</>
|
|
581
|
+
}
|
|
582
|
+
/>
|
|
583
|
+
</MenuItem>
|
|
543
584
|
</Menu>
|
|
544
585
|
)}
|
|
545
586
|
</form>
|
|
@@ -25,7 +25,10 @@ import {
|
|
|
25
25
|
CubesLoadingIndicator,
|
|
26
26
|
CubesLoadingIndicatorIcon,
|
|
27
27
|
} from '@finos/legend-art';
|
|
28
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
generateFieldSearchResultsRoute,
|
|
30
|
+
generateLakehouseSearchResultsRoute,
|
|
31
|
+
} from '../../__lib__/LegendMarketplaceNavigation.js';
|
|
29
32
|
import {
|
|
30
33
|
assertErrorThrown,
|
|
31
34
|
isNonEmptyString,
|
|
@@ -217,16 +220,20 @@ export const MarketplaceLakehouseHome = observer(() => {
|
|
|
217
220
|
const handleSearch = (
|
|
218
221
|
_query: string | undefined,
|
|
219
222
|
_useProducerSearch: boolean,
|
|
223
|
+
_useFieldSearch: boolean,
|
|
220
224
|
): void => {
|
|
221
225
|
if (isNonEmptyString(_query)) {
|
|
222
226
|
applicationStore.navigationService.navigator.goToLocation(
|
|
223
|
-
|
|
227
|
+
_useFieldSearch
|
|
228
|
+
? generateFieldSearchResultsRoute(_query)
|
|
229
|
+
: generateLakehouseSearchResultsRoute(_query, _useProducerSearch),
|
|
224
230
|
);
|
|
225
231
|
LegendMarketplaceTelemetryHelper.logEvent_SearchQuery(
|
|
226
232
|
applicationStore.telemetryService,
|
|
227
233
|
_query,
|
|
228
234
|
_useProducerSearch,
|
|
229
235
|
LEGEND_MARKETPLACE_PAGE.HOME_PAGE,
|
|
236
|
+
_useFieldSearch,
|
|
230
237
|
);
|
|
231
238
|
}
|
|
232
239
|
};
|