@backstage/plugin-search 0.4.16 → 0.4.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.
- package/CHANGELOG.md +24 -0
- package/dist/esm/{index-4ef7a5c8.esm.js → index-022e0330.esm.js} +6 -5
- package/dist/esm/index-022e0330.esm.js.map +1 -0
- package/dist/esm/index-12477c15.esm.js +23 -0
- package/dist/esm/index-12477c15.esm.js.map +1 -0
- package/dist/esm/{index-9c0d67e6.esm.js → index-17c9e868.esm.js} +356 -222
- package/dist/esm/index-17c9e868.esm.js.map +1 -0
- package/dist/esm/index-226c47ca.esm.js +39 -0
- package/dist/esm/index-226c47ca.esm.js.map +1 -0
- package/dist/esm/{index-6f14e751.esm.js → index-3b720a86.esm.js} +6 -5
- package/dist/esm/index-3b720a86.esm.js.map +1 -0
- package/dist/esm/index-597d3990.esm.js +23 -0
- package/dist/esm/index-597d3990.esm.js.map +1 -0
- package/dist/esm/{index-3eebaa65.esm.js → index-b3bf028c.esm.js} +9 -8
- package/dist/esm/{index-3eebaa65.esm.js.map → index-b3bf028c.esm.js.map} +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.esm.js +6 -5
- package/dist/index.esm.js.map +1 -1
- package/package.json +9 -9
- package/dist/esm/index-4ef7a5c8.esm.js.map +0 -1
- package/dist/esm/index-6f14e751.esm.js.map +0 -1
- package/dist/esm/index-92a9e2ec.esm.js +0 -18
- package/dist/esm/index-92a9e2ec.esm.js.map +0 -1
- package/dist/esm/index-9c0d67e6.esm.js.map +0 -1
- package/dist/esm/index-ee8d2563.esm.js +0 -46
- package/dist/esm/index-ee8d2563.esm.js.map +0 -1
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { createApiRef, useApi, configApiRef, createRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, createRoutableExtension, createComponentExtension, useRouteRef } from '@backstage/core-plugin-api';
|
|
2
2
|
import { ResponseError } from '@backstage/errors';
|
|
3
3
|
import qs from 'qs';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import React__default, { createContext, useState, useCallback, useEffect, useContext } from 'react';
|
|
6
|
+
import { ListItem, ListItemText, Divider, makeStyles, IconButton, Typography, Card, CardHeader, Button, CardContent, Select, MenuItem, List, Checkbox, InputBase, InputAdornment, FormControl, FormLabel, FormControlLabel, InputLabel, Dialog, DialogTitle, Paper, DialogContent, Grid, DialogActions, Chip } from '@material-ui/core';
|
|
7
|
+
import { Link, Progress, ResponseErrorPanel, EmptyState, Table, useQueryParamState, Page, Header, Content, SidebarSearchField } from '@backstage/core-components';
|
|
7
8
|
import FilterListIcon from '@material-ui/icons/FilterList';
|
|
8
9
|
import { usePrevious, useAsync, useDebounce, useEffectOnce } from 'react-use';
|
|
9
10
|
import SearchIcon from '@material-ui/icons/Search';
|
|
10
11
|
import ClearButton from '@material-ui/icons/Clear';
|
|
11
|
-
import { useOutlet, useLocation } from 'react-router';
|
|
12
12
|
import { makeStyles as makeStyles$1 } from '@material-ui/core/styles';
|
|
13
|
+
import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';
|
|
14
|
+
import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';
|
|
15
|
+
import { createSvgIcon } from '@material-ui/core/utils';
|
|
16
|
+
import { useOutlet, useLocation } from 'react-router';
|
|
13
17
|
import InputBase$1 from '@material-ui/core/InputBase';
|
|
14
18
|
import IconButton$1 from '@material-ui/core/IconButton';
|
|
15
19
|
import { Alert } from '@material-ui/lab';
|
|
16
20
|
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
17
21
|
import { ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
|
18
|
-
import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';
|
|
19
|
-
import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';
|
|
20
22
|
import { useNavigate } from 'react-router-dom';
|
|
21
23
|
|
|
22
24
|
const searchApiRef = createApiRef({
|
|
@@ -42,7 +44,19 @@ class SearchClient {
|
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
const
|
|
47
|
+
const DefaultResultListItem$1 = ({result}) => {
|
|
48
|
+
return /* @__PURE__ */ React__default.createElement(Link, {
|
|
49
|
+
to: result.location
|
|
50
|
+
}, /* @__PURE__ */ React__default.createElement(ListItem, {
|
|
51
|
+
alignItems: "flex-start"
|
|
52
|
+
}, /* @__PURE__ */ React__default.createElement(ListItemText, {
|
|
53
|
+
primaryTypographyProps: {variant: "h6"},
|
|
54
|
+
primary: result.title,
|
|
55
|
+
secondary: result.text
|
|
56
|
+
})), /* @__PURE__ */ React__default.createElement(Divider, null));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const useStyles$9 = makeStyles((theme) => ({
|
|
46
60
|
filters: {
|
|
47
61
|
width: "250px",
|
|
48
62
|
display: "flex"
|
|
@@ -55,19 +69,19 @@ const FiltersButton$1 = ({
|
|
|
55
69
|
numberOfSelectedFilters,
|
|
56
70
|
handleToggleFilters
|
|
57
71
|
}) => {
|
|
58
|
-
const classes = useStyles$
|
|
59
|
-
return /* @__PURE__ */
|
|
72
|
+
const classes = useStyles$9();
|
|
73
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
60
74
|
className: classes.filters
|
|
61
|
-
}, /* @__PURE__ */
|
|
75
|
+
}, /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
62
76
|
className: classes.icon,
|
|
63
77
|
"aria-label": "settings",
|
|
64
78
|
onClick: handleToggleFilters
|
|
65
|
-
}, /* @__PURE__ */
|
|
79
|
+
}, /* @__PURE__ */ React__default.createElement(FilterListIcon, null)), /* @__PURE__ */ React__default.createElement(Typography, {
|
|
66
80
|
variant: "h6"
|
|
67
81
|
}, "Filters (", numberOfSelectedFilters ? numberOfSelectedFilters : 0, ")"));
|
|
68
82
|
};
|
|
69
83
|
|
|
70
|
-
const useStyles$
|
|
84
|
+
const useStyles$8 = makeStyles((theme) => ({
|
|
71
85
|
filters: {
|
|
72
86
|
background: "transparent",
|
|
73
87
|
boxShadow: "0px 0px 0px 0px"
|
|
@@ -86,22 +100,22 @@ const Filters$1 = ({
|
|
|
86
100
|
updateSelected,
|
|
87
101
|
updateChecked
|
|
88
102
|
}) => {
|
|
89
|
-
const classes = useStyles$
|
|
90
|
-
return /* @__PURE__ */
|
|
103
|
+
const classes = useStyles$8();
|
|
104
|
+
return /* @__PURE__ */ React__default.createElement(Card, {
|
|
91
105
|
className: classes.filters
|
|
92
|
-
}, /* @__PURE__ */
|
|
93
|
-
title: /* @__PURE__ */
|
|
106
|
+
}, /* @__PURE__ */ React__default.createElement(CardHeader, {
|
|
107
|
+
title: /* @__PURE__ */ React__default.createElement(Typography, {
|
|
94
108
|
variant: "h6"
|
|
95
109
|
}, "Filters"),
|
|
96
|
-
action: /* @__PURE__ */
|
|
110
|
+
action: /* @__PURE__ */ React__default.createElement(Button, {
|
|
97
111
|
color: "primary",
|
|
98
112
|
onClick: () => resetFilters()
|
|
99
113
|
}, "CLEAR ALL")
|
|
100
|
-
}), /* @__PURE__ */
|
|
114
|
+
}), /* @__PURE__ */ React__default.createElement(Divider, null), filterOptions.kind.length === 0 && filterOptions.lifecycle.length === 0 && /* @__PURE__ */ React__default.createElement(CardContent, null, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
101
115
|
variant: "subtitle2"
|
|
102
|
-
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */
|
|
116
|
+
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */ React__default.createElement(CardContent, null, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
103
117
|
variant: "subtitle2"
|
|
104
|
-
}, "Kind"), /* @__PURE__ */
|
|
118
|
+
}, "Kind"), /* @__PURE__ */ React__default.createElement(Select, {
|
|
105
119
|
id: "outlined-select",
|
|
106
120
|
onChange: (e) => {
|
|
107
121
|
var _a;
|
|
@@ -110,22 +124,22 @@ const Filters$1 = ({
|
|
|
110
124
|
variant: "outlined",
|
|
111
125
|
className: classes.dropdown,
|
|
112
126
|
value: filters.selected
|
|
113
|
-
}, filterOptions.kind.map((filter) => /* @__PURE__ */
|
|
127
|
+
}, filterOptions.kind.map((filter) => /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
114
128
|
selected: filter === "",
|
|
115
129
|
dense: true,
|
|
116
130
|
key: filter,
|
|
117
131
|
value: filter
|
|
118
|
-
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */
|
|
132
|
+
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */ React__default.createElement(CardContent, null, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
119
133
|
variant: "subtitle2"
|
|
120
|
-
}, "Lifecycle"), /* @__PURE__ */
|
|
134
|
+
}, "Lifecycle"), /* @__PURE__ */ React__default.createElement(List, {
|
|
121
135
|
disablePadding: true,
|
|
122
136
|
dense: true
|
|
123
|
-
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */
|
|
137
|
+
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */ React__default.createElement(ListItem, {
|
|
124
138
|
key: filter,
|
|
125
139
|
dense: true,
|
|
126
140
|
button: true,
|
|
127
141
|
onClick: () => updateChecked(filter)
|
|
128
|
-
}, /* @__PURE__ */
|
|
142
|
+
}, /* @__PURE__ */ React__default.createElement(Checkbox, {
|
|
129
143
|
edge: "start",
|
|
130
144
|
disableRipple: true,
|
|
131
145
|
className: classes.checkbox,
|
|
@@ -134,7 +148,7 @@ const Filters$1 = ({
|
|
|
134
148
|
tabIndex: -1,
|
|
135
149
|
value: filter,
|
|
136
150
|
name: filter
|
|
137
|
-
}), /* @__PURE__ */
|
|
151
|
+
}), /* @__PURE__ */ React__default.createElement(ListItemText, {
|
|
138
152
|
id: filter,
|
|
139
153
|
primary: filter
|
|
140
154
|
}))))));
|
|
@@ -191,7 +205,7 @@ const SearchContextProvider = ({
|
|
|
191
205
|
fetchNextPage: hasNextPage ? fetchNextPage : void 0,
|
|
192
206
|
fetchPreviousPage: hasPreviousPage ? fetchPreviousPage : void 0
|
|
193
207
|
};
|
|
194
|
-
return /* @__PURE__ */
|
|
208
|
+
return /* @__PURE__ */ React__default.createElement(SearchContext.Provider, {
|
|
195
209
|
value,
|
|
196
210
|
children
|
|
197
211
|
});
|
|
@@ -212,34 +226,34 @@ const SearchBarBase = ({
|
|
|
212
226
|
placeholder: overridePlaceholder
|
|
213
227
|
}) => {
|
|
214
228
|
const configApi = useApi(configApiRef);
|
|
215
|
-
const onKeyDown =
|
|
229
|
+
const onKeyDown = React__default.useCallback((e) => {
|
|
216
230
|
if (onSubmit && e.key === "Enter") {
|
|
217
231
|
onSubmit();
|
|
218
232
|
}
|
|
219
233
|
}, [onSubmit]);
|
|
220
|
-
const handleClear =
|
|
234
|
+
const handleClear = React__default.useCallback(() => {
|
|
221
235
|
onChange("");
|
|
222
236
|
}, [onChange]);
|
|
223
237
|
const placeholder = overridePlaceholder != null ? overridePlaceholder : `Search in ${configApi.getOptionalString("app.title") || "Backstage"}`;
|
|
224
|
-
return /* @__PURE__ */
|
|
238
|
+
return /* @__PURE__ */ React__default.createElement(InputBase, {
|
|
225
239
|
"data-testid": "search-bar-next",
|
|
226
240
|
fullWidth: true,
|
|
227
241
|
placeholder,
|
|
228
242
|
value,
|
|
229
243
|
onChange: (e) => onChange(e.target.value),
|
|
230
244
|
inputProps: {"aria-label": "Search"},
|
|
231
|
-
startAdornment: /* @__PURE__ */
|
|
245
|
+
startAdornment: /* @__PURE__ */ React__default.createElement(InputAdornment, {
|
|
232
246
|
position: "start"
|
|
233
|
-
}, /* @__PURE__ */
|
|
247
|
+
}, /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
234
248
|
"aria-label": "Query",
|
|
235
249
|
disabled: true
|
|
236
|
-
}, /* @__PURE__ */
|
|
237
|
-
endAdornment: /* @__PURE__ */
|
|
250
|
+
}, /* @__PURE__ */ React__default.createElement(SearchIcon, null))),
|
|
251
|
+
endAdornment: /* @__PURE__ */ React__default.createElement(InputAdornment, {
|
|
238
252
|
position: "end"
|
|
239
|
-
}, /* @__PURE__ */
|
|
253
|
+
}, /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
240
254
|
"aria-label": "Clear",
|
|
241
255
|
onClick: handleClear
|
|
242
|
-
}, /* @__PURE__ */
|
|
256
|
+
}, /* @__PURE__ */ React__default.createElement(ClearButton, null))),
|
|
243
257
|
...className && {className},
|
|
244
258
|
...onSubmit && {onKeyDown}
|
|
245
259
|
});
|
|
@@ -259,7 +273,7 @@ const SearchBar$1 = ({
|
|
|
259
273
|
setValue(newValue);
|
|
260
274
|
};
|
|
261
275
|
const handleClear = () => setValue("");
|
|
262
|
-
return /* @__PURE__ */
|
|
276
|
+
return /* @__PURE__ */ React__default.createElement(SearchBarBase, {
|
|
263
277
|
className,
|
|
264
278
|
value,
|
|
265
279
|
onChange: handleQuery,
|
|
@@ -268,7 +282,7 @@ const SearchBar$1 = ({
|
|
|
268
282
|
});
|
|
269
283
|
};
|
|
270
284
|
|
|
271
|
-
const useStyles$
|
|
285
|
+
const useStyles$7 = makeStyles({
|
|
272
286
|
label: {
|
|
273
287
|
textTransform: "capitalize"
|
|
274
288
|
}
|
|
@@ -279,7 +293,7 @@ const CheckboxFilter = ({
|
|
|
279
293
|
defaultValue,
|
|
280
294
|
values = []
|
|
281
295
|
}) => {
|
|
282
|
-
const classes = useStyles$
|
|
296
|
+
const classes = useStyles$7();
|
|
283
297
|
const {filters, setFilters} = useSearch();
|
|
284
298
|
useEffect(() => {
|
|
285
299
|
if (Array.isArray(defaultValue)) {
|
|
@@ -300,17 +314,17 @@ const CheckboxFilter = ({
|
|
|
300
314
|
return items.length ? {...others, [name]: items} : others;
|
|
301
315
|
});
|
|
302
316
|
};
|
|
303
|
-
return /* @__PURE__ */
|
|
317
|
+
return /* @__PURE__ */ React__default.createElement(FormControl, {
|
|
304
318
|
className,
|
|
305
319
|
fullWidth: true,
|
|
306
320
|
"data-testid": "search-checkboxfilter-next"
|
|
307
|
-
}, /* @__PURE__ */
|
|
321
|
+
}, /* @__PURE__ */ React__default.createElement(FormLabel, {
|
|
308
322
|
className: classes.label
|
|
309
323
|
}, name), values.map((value) => {
|
|
310
324
|
var _a;
|
|
311
|
-
return /* @__PURE__ */
|
|
325
|
+
return /* @__PURE__ */ React__default.createElement(FormControlLabel, {
|
|
312
326
|
key: value,
|
|
313
|
-
control: /* @__PURE__ */
|
|
327
|
+
control: /* @__PURE__ */ React__default.createElement(Checkbox, {
|
|
314
328
|
color: "primary",
|
|
315
329
|
tabIndex: -1,
|
|
316
330
|
inputProps: {"aria-labelledby": value},
|
|
@@ -329,7 +343,7 @@ const SelectFilter = ({
|
|
|
329
343
|
defaultValue,
|
|
330
344
|
values = []
|
|
331
345
|
}) => {
|
|
332
|
-
const classes = useStyles$
|
|
346
|
+
const classes = useStyles$7();
|
|
333
347
|
const {filters, setFilters} = useSearch();
|
|
334
348
|
useEffect(() => {
|
|
335
349
|
if (typeof defaultValue === "string") {
|
|
@@ -348,39 +362,262 @@ const SelectFilter = ({
|
|
|
348
362
|
return value ? {...others, [name]: value} : others;
|
|
349
363
|
});
|
|
350
364
|
};
|
|
351
|
-
return /* @__PURE__ */
|
|
365
|
+
return /* @__PURE__ */ React__default.createElement(FormControl, {
|
|
352
366
|
className,
|
|
353
367
|
variant: "filled",
|
|
354
368
|
fullWidth: true,
|
|
355
369
|
"data-testid": "search-selectfilter-next"
|
|
356
|
-
}, /* @__PURE__ */
|
|
370
|
+
}, /* @__PURE__ */ React__default.createElement(InputLabel, {
|
|
357
371
|
className: classes.label,
|
|
358
372
|
margin: "dense"
|
|
359
|
-
}, name), /* @__PURE__ */
|
|
373
|
+
}, name), /* @__PURE__ */ React__default.createElement(Select, {
|
|
360
374
|
variant: "outlined",
|
|
361
375
|
value: filters[name] || "",
|
|
362
376
|
onChange: handleChange
|
|
363
|
-
}, /* @__PURE__ */
|
|
377
|
+
}, /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
364
378
|
value: ""
|
|
365
|
-
}, /* @__PURE__ */
|
|
379
|
+
}, /* @__PURE__ */ React__default.createElement("em", null, "All")), values.map((value) => /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
366
380
|
key: value,
|
|
367
381
|
value
|
|
368
382
|
}, value))));
|
|
369
383
|
};
|
|
370
|
-
const SearchFilter = ({component: Element, ...props}) => /* @__PURE__ */
|
|
384
|
+
const SearchFilter = ({component: Element, ...props}) => /* @__PURE__ */ React__default.createElement(Element, {
|
|
371
385
|
...props
|
|
372
386
|
});
|
|
373
|
-
SearchFilter.Checkbox = (props) => /* @__PURE__ */
|
|
387
|
+
SearchFilter.Checkbox = (props) => /* @__PURE__ */ React__default.createElement(SearchFilter, {
|
|
374
388
|
...props,
|
|
375
389
|
component: CheckboxFilter
|
|
376
390
|
});
|
|
377
|
-
SearchFilter.Select = (props) => /* @__PURE__ */
|
|
391
|
+
SearchFilter.Select = (props) => /* @__PURE__ */ React__default.createElement(SearchFilter, {
|
|
378
392
|
...props,
|
|
379
393
|
component: SelectFilter
|
|
380
394
|
});
|
|
381
395
|
const SearchFilterNext = SearchFilter;
|
|
382
396
|
|
|
383
|
-
|
|
397
|
+
var Launch = createSvgIcon( /*#__PURE__*/React.createElement("path", {
|
|
398
|
+
d: "M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
|
|
399
|
+
}), 'Launch');
|
|
400
|
+
|
|
401
|
+
const SearchResultComponent = ({children}) => {
|
|
402
|
+
const {
|
|
403
|
+
result: {loading, error, value}
|
|
404
|
+
} = useSearch();
|
|
405
|
+
if (loading) {
|
|
406
|
+
return /* @__PURE__ */ React__default.createElement(Progress, null);
|
|
407
|
+
}
|
|
408
|
+
if (error) {
|
|
409
|
+
return /* @__PURE__ */ React__default.createElement(ResponseErrorPanel, {
|
|
410
|
+
title: "Error encountered while fetching search results",
|
|
411
|
+
error
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
if (!(value == null ? void 0 : value.results.length)) {
|
|
415
|
+
return /* @__PURE__ */ React__default.createElement(EmptyState, {
|
|
416
|
+
missing: "data",
|
|
417
|
+
title: "Sorry, no results were found"
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children({results: value.results}));
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
const useStyles$6 = makeStyles((theme) => ({
|
|
424
|
+
root: {
|
|
425
|
+
display: "flex",
|
|
426
|
+
justifyContent: "space-between",
|
|
427
|
+
gap: theme.spacing(2),
|
|
428
|
+
margin: theme.spacing(4)
|
|
429
|
+
}
|
|
430
|
+
}));
|
|
431
|
+
const SearchResultPager = () => {
|
|
432
|
+
const {fetchNextPage, fetchPreviousPage} = useSearch();
|
|
433
|
+
const classes = useStyles$6();
|
|
434
|
+
if (!fetchNextPage && !fetchPreviousPage) {
|
|
435
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
|
|
436
|
+
}
|
|
437
|
+
return /* @__PURE__ */ React__default.createElement("nav", {
|
|
438
|
+
"arial-label": "pagination navigation",
|
|
439
|
+
className: classes.root
|
|
440
|
+
}, /* @__PURE__ */ React__default.createElement(Button, {
|
|
441
|
+
"aria-label": "previous page",
|
|
442
|
+
disabled: !fetchPreviousPage,
|
|
443
|
+
onClick: fetchPreviousPage,
|
|
444
|
+
startIcon: /* @__PURE__ */ React__default.createElement(ArrowBackIosIcon, null),
|
|
445
|
+
size: "small"
|
|
446
|
+
}, "Back"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
447
|
+
"aria-label": "next page",
|
|
448
|
+
disabled: !fetchNextPage,
|
|
449
|
+
onClick: fetchNextPage,
|
|
450
|
+
endIcon: /* @__PURE__ */ React__default.createElement(ArrowForwardIosIcon, null),
|
|
451
|
+
size: "small"
|
|
452
|
+
}, "Next"));
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
const rootRouteRef = createRouteRef({
|
|
456
|
+
path: "/search",
|
|
457
|
+
title: "search"
|
|
458
|
+
});
|
|
459
|
+
const rootNextRouteRef = createRouteRef({
|
|
460
|
+
path: "/search-next",
|
|
461
|
+
title: "search"
|
|
462
|
+
});
|
|
463
|
+
const searchPlugin = createPlugin({
|
|
464
|
+
id: "search",
|
|
465
|
+
apis: [
|
|
466
|
+
createApiFactory({
|
|
467
|
+
api: searchApiRef,
|
|
468
|
+
deps: {discoveryApi: discoveryApiRef, identityApi: identityApiRef},
|
|
469
|
+
factory: ({discoveryApi, identityApi}) => {
|
|
470
|
+
return new SearchClient({discoveryApi, identityApi});
|
|
471
|
+
}
|
|
472
|
+
})
|
|
473
|
+
],
|
|
474
|
+
routes: {
|
|
475
|
+
root: rootRouteRef,
|
|
476
|
+
nextRoot: rootNextRouteRef
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
const SearchPage$1 = searchPlugin.provide(createRoutableExtension({
|
|
480
|
+
name: "SearchPage",
|
|
481
|
+
component: () => import('./index-3b720a86.esm.js').then((m) => m.SearchPage),
|
|
482
|
+
mountPoint: rootRouteRef
|
|
483
|
+
}));
|
|
484
|
+
const SearchPageNext = searchPlugin.provide(createRoutableExtension({
|
|
485
|
+
name: "SearchPageNext",
|
|
486
|
+
component: () => import('./index-3b720a86.esm.js').then((m) => m.SearchPage),
|
|
487
|
+
mountPoint: rootNextRouteRef
|
|
488
|
+
}));
|
|
489
|
+
searchPlugin.provide(createComponentExtension({
|
|
490
|
+
name: "SearchBar",
|
|
491
|
+
component: {
|
|
492
|
+
lazy: () => import('./index-597d3990.esm.js').then((m) => m.SearchBar)
|
|
493
|
+
}
|
|
494
|
+
}));
|
|
495
|
+
const SearchBarNext = searchPlugin.provide(createComponentExtension({
|
|
496
|
+
name: "SearchBarNext",
|
|
497
|
+
component: {
|
|
498
|
+
lazy: () => import('./index-597d3990.esm.js').then((m) => m.SearchBar)
|
|
499
|
+
}
|
|
500
|
+
}));
|
|
501
|
+
const SearchResult$1 = searchPlugin.provide(createComponentExtension({
|
|
502
|
+
name: "SearchResult",
|
|
503
|
+
component: {
|
|
504
|
+
lazy: () => import('./index-022e0330.esm.js').then((m) => m.SearchResult)
|
|
505
|
+
}
|
|
506
|
+
}));
|
|
507
|
+
searchPlugin.provide(createComponentExtension({
|
|
508
|
+
name: "SearchResultNext",
|
|
509
|
+
component: {
|
|
510
|
+
lazy: () => import('./index-022e0330.esm.js').then((m) => m.SearchResult)
|
|
511
|
+
}
|
|
512
|
+
}));
|
|
513
|
+
const SidebarSearchModal = searchPlugin.provide(createComponentExtension({
|
|
514
|
+
name: "SidebarSearchModal",
|
|
515
|
+
component: {
|
|
516
|
+
lazy: () => import('./index-226c47ca.esm.js').then((m) => m.SidebarSearchModal)
|
|
517
|
+
}
|
|
518
|
+
}));
|
|
519
|
+
const DefaultResultListItem = searchPlugin.provide(createComponentExtension({
|
|
520
|
+
name: "DefaultResultListItem",
|
|
521
|
+
component: {
|
|
522
|
+
lazy: () => import('./index-12477c15.esm.js').then((m) => m.DefaultResultListItem)
|
|
523
|
+
}
|
|
524
|
+
}));
|
|
525
|
+
const HomePageSearchBar = searchPlugin.provide(createComponentExtension({
|
|
526
|
+
name: "HomePageSearchBar",
|
|
527
|
+
component: {
|
|
528
|
+
lazy: () => import('./index-b3bf028c.esm.js').then((m) => m.HomePageSearchBar)
|
|
529
|
+
}
|
|
530
|
+
}));
|
|
531
|
+
|
|
532
|
+
const useStyles$5 = makeStyles$1((theme) => ({
|
|
533
|
+
container: {
|
|
534
|
+
borderRadius: 30,
|
|
535
|
+
display: "flex",
|
|
536
|
+
height: "2.4em"
|
|
537
|
+
},
|
|
538
|
+
input: {
|
|
539
|
+
flex: 1
|
|
540
|
+
},
|
|
541
|
+
paperFullWidth: {height: "calc(100% - 128px)"},
|
|
542
|
+
dialogActionsContainer: {padding: theme.spacing(1, 3)},
|
|
543
|
+
viewResultsLink: {verticalAlign: "0.5em"}
|
|
544
|
+
}));
|
|
545
|
+
const Modal = ({open = true, toggleModal}) => {
|
|
546
|
+
const getSearchLink = useRouteRef(rootRouteRef);
|
|
547
|
+
const classes = useStyles$5();
|
|
548
|
+
const {term, setTerm} = useSearch();
|
|
549
|
+
const [value, setValue] = useState(term);
|
|
550
|
+
useEffect(() => {
|
|
551
|
+
setValue((prevValue) => prevValue !== term ? term : prevValue);
|
|
552
|
+
}, [term]);
|
|
553
|
+
useDebounce(() => setTerm(value), 1e3, [value]);
|
|
554
|
+
const handleQuery = (newValue) => {
|
|
555
|
+
setValue(newValue);
|
|
556
|
+
};
|
|
557
|
+
const handleClear = () => setValue("");
|
|
558
|
+
const handleResultClick = () => {
|
|
559
|
+
toggleModal();
|
|
560
|
+
handleClear();
|
|
561
|
+
};
|
|
562
|
+
const handleKeyPress = () => {
|
|
563
|
+
handleResultClick();
|
|
564
|
+
};
|
|
565
|
+
return /* @__PURE__ */ React__default.createElement(Dialog, {
|
|
566
|
+
classes: {
|
|
567
|
+
paperFullWidth: classes.paperFullWidth
|
|
568
|
+
},
|
|
569
|
+
onClose: toggleModal,
|
|
570
|
+
"aria-labelledby": "search-modal-title",
|
|
571
|
+
open,
|
|
572
|
+
fullWidth: true,
|
|
573
|
+
maxWidth: "lg"
|
|
574
|
+
}, /* @__PURE__ */ React__default.createElement(DialogTitle, null, /* @__PURE__ */ React__default.createElement(Paper, {
|
|
575
|
+
className: classes.container
|
|
576
|
+
}, /* @__PURE__ */ React__default.createElement(SearchBarBase, {
|
|
577
|
+
className: classes.input,
|
|
578
|
+
value,
|
|
579
|
+
onChange: handleQuery,
|
|
580
|
+
onClear: handleClear
|
|
581
|
+
}))), /* @__PURE__ */ React__default.createElement(DialogContent, null, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
582
|
+
container: true,
|
|
583
|
+
direction: "row-reverse",
|
|
584
|
+
justifyContent: "flex-start",
|
|
585
|
+
alignItems: "center"
|
|
586
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
587
|
+
item: true
|
|
588
|
+
}, /* @__PURE__ */ React__default.createElement(Link, {
|
|
589
|
+
to: `${getSearchLink()}?query=${value}`
|
|
590
|
+
}, /* @__PURE__ */ React__default.createElement("span", {
|
|
591
|
+
className: classes.viewResultsLink
|
|
592
|
+
}, "View Full Results"), /* @__PURE__ */ React__default.createElement(Launch, {
|
|
593
|
+
color: "primary"
|
|
594
|
+
})))), /* @__PURE__ */ React__default.createElement(Divider, null), /* @__PURE__ */ React__default.createElement(SearchResultComponent, null, ({results}) => /* @__PURE__ */ React__default.createElement(List, null, results.map(({document}) => /* @__PURE__ */ React__default.createElement("div", {
|
|
595
|
+
role: "button",
|
|
596
|
+
tabIndex: 0,
|
|
597
|
+
key: `${document.location}-btn`,
|
|
598
|
+
onClick: handleResultClick,
|
|
599
|
+
onKeyPress: handleKeyPress
|
|
600
|
+
}, /* @__PURE__ */ React__default.createElement(DefaultResultListItem$1, {
|
|
601
|
+
key: document.location,
|
|
602
|
+
result: document
|
|
603
|
+
})))))), /* @__PURE__ */ React__default.createElement(DialogActions, {
|
|
604
|
+
className: classes.dialogActionsContainer
|
|
605
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
606
|
+
container: true,
|
|
607
|
+
direction: "row"
|
|
608
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
609
|
+
item: true,
|
|
610
|
+
xs: 12
|
|
611
|
+
}, /* @__PURE__ */ React__default.createElement(SearchResultPager, null)))));
|
|
612
|
+
};
|
|
613
|
+
const SearchModal = ({open = true, toggleModal}) => {
|
|
614
|
+
return /* @__PURE__ */ React__default.createElement(SearchContextProvider, null, /* @__PURE__ */ React__default.createElement(Modal, {
|
|
615
|
+
open,
|
|
616
|
+
toggleModal
|
|
617
|
+
}));
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
const useStyles$4 = makeStyles$1(() => ({
|
|
384
621
|
root: {
|
|
385
622
|
display: "flex",
|
|
386
623
|
alignItems: "center"
|
|
@@ -394,28 +631,28 @@ const SearchBar = ({
|
|
|
394
631
|
handleSearch,
|
|
395
632
|
handleClearSearchBar
|
|
396
633
|
}) => {
|
|
397
|
-
const classes = useStyles$
|
|
398
|
-
return /* @__PURE__ */
|
|
634
|
+
const classes = useStyles$4();
|
|
635
|
+
return /* @__PURE__ */ React__default.createElement(Paper, {
|
|
399
636
|
component: "form",
|
|
400
637
|
onSubmit: (e) => handleSearch(e),
|
|
401
638
|
className: classes.root
|
|
402
|
-
}, /* @__PURE__ */
|
|
639
|
+
}, /* @__PURE__ */ React__default.createElement(IconButton$1, {
|
|
403
640
|
disabled: true,
|
|
404
641
|
type: "submit",
|
|
405
642
|
"aria-label": "search"
|
|
406
|
-
}, /* @__PURE__ */
|
|
643
|
+
}, /* @__PURE__ */ React__default.createElement(SearchIcon, null)), /* @__PURE__ */ React__default.createElement(InputBase$1, {
|
|
407
644
|
className: classes.input,
|
|
408
645
|
placeholder: "Search in Backstage",
|
|
409
646
|
value: searchQuery,
|
|
410
647
|
onChange: (e) => handleSearch(e),
|
|
411
648
|
inputProps: {"aria-label": "search backstage"}
|
|
412
|
-
}), /* @__PURE__ */
|
|
649
|
+
}), /* @__PURE__ */ React__default.createElement(IconButton$1, {
|
|
413
650
|
"aria-label": "search",
|
|
414
651
|
onClick: () => handleClearSearchBar()
|
|
415
|
-
}, /* @__PURE__ */
|
|
652
|
+
}, /* @__PURE__ */ React__default.createElement(ClearButton, null)));
|
|
416
653
|
};
|
|
417
654
|
|
|
418
|
-
const useStyles$
|
|
655
|
+
const useStyles$3 = makeStyles((theme) => ({
|
|
419
656
|
filters: {
|
|
420
657
|
width: "250px",
|
|
421
658
|
display: "flex"
|
|
@@ -428,19 +665,19 @@ const FiltersButton = ({
|
|
|
428
665
|
numberOfSelectedFilters,
|
|
429
666
|
handleToggleFilters
|
|
430
667
|
}) => {
|
|
431
|
-
const classes = useStyles$
|
|
432
|
-
return /* @__PURE__ */
|
|
668
|
+
const classes = useStyles$3();
|
|
669
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
433
670
|
className: classes.filters
|
|
434
|
-
}, /* @__PURE__ */
|
|
671
|
+
}, /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
435
672
|
className: classes.icon,
|
|
436
673
|
"aria-label": "settings",
|
|
437
674
|
onClick: handleToggleFilters
|
|
438
|
-
}, /* @__PURE__ */
|
|
675
|
+
}, /* @__PURE__ */ React__default.createElement(FilterListIcon, null)), /* @__PURE__ */ React__default.createElement(Typography, {
|
|
439
676
|
variant: "h6"
|
|
440
677
|
}, "Filters (", numberOfSelectedFilters ? numberOfSelectedFilters : 0, ")"));
|
|
441
678
|
};
|
|
442
679
|
|
|
443
|
-
const useStyles$
|
|
680
|
+
const useStyles$2 = makeStyles((theme) => ({
|
|
444
681
|
filters: {
|
|
445
682
|
background: "transparent",
|
|
446
683
|
boxShadow: "0px 0px 0px 0px"
|
|
@@ -459,22 +696,22 @@ const Filters = ({
|
|
|
459
696
|
updateSelected,
|
|
460
697
|
updateChecked
|
|
461
698
|
}) => {
|
|
462
|
-
const classes = useStyles$
|
|
463
|
-
return /* @__PURE__ */
|
|
699
|
+
const classes = useStyles$2();
|
|
700
|
+
return /* @__PURE__ */ React__default.createElement(Card, {
|
|
464
701
|
className: classes.filters
|
|
465
|
-
}, /* @__PURE__ */
|
|
466
|
-
title: /* @__PURE__ */
|
|
702
|
+
}, /* @__PURE__ */ React__default.createElement(CardHeader, {
|
|
703
|
+
title: /* @__PURE__ */ React__default.createElement(Typography, {
|
|
467
704
|
variant: "h6"
|
|
468
705
|
}, "Filters"),
|
|
469
|
-
action: /* @__PURE__ */
|
|
706
|
+
action: /* @__PURE__ */ React__default.createElement(Button, {
|
|
470
707
|
color: "primary",
|
|
471
708
|
onClick: () => resetFilters()
|
|
472
709
|
}, "CLEAR ALL")
|
|
473
|
-
}), /* @__PURE__ */
|
|
710
|
+
}), /* @__PURE__ */ React__default.createElement(Divider, null), filterOptions.kind.length === 0 && filterOptions.lifecycle.length === 0 && /* @__PURE__ */ React__default.createElement(CardContent, null, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
474
711
|
variant: "subtitle2"
|
|
475
|
-
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */
|
|
712
|
+
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */ React__default.createElement(CardContent, null, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
476
713
|
variant: "subtitle2"
|
|
477
|
-
}, "Kind"), /* @__PURE__ */
|
|
714
|
+
}, "Kind"), /* @__PURE__ */ React__default.createElement(Select, {
|
|
478
715
|
id: "outlined-select",
|
|
479
716
|
onChange: (e) => {
|
|
480
717
|
var _a;
|
|
@@ -483,22 +720,22 @@ const Filters = ({
|
|
|
483
720
|
variant: "outlined",
|
|
484
721
|
className: classes.dropdown,
|
|
485
722
|
value: filters.selected
|
|
486
|
-
}, filterOptions.kind.map((filter) => /* @__PURE__ */
|
|
723
|
+
}, filterOptions.kind.map((filter) => /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
487
724
|
selected: filter === "",
|
|
488
725
|
dense: true,
|
|
489
726
|
key: filter,
|
|
490
727
|
value: filter
|
|
491
|
-
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */
|
|
728
|
+
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */ React__default.createElement(CardContent, null, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
492
729
|
variant: "subtitle2"
|
|
493
|
-
}, "Lifecycle"), /* @__PURE__ */
|
|
730
|
+
}, "Lifecycle"), /* @__PURE__ */ React__default.createElement(List, {
|
|
494
731
|
disablePadding: true,
|
|
495
732
|
dense: true
|
|
496
|
-
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */
|
|
733
|
+
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */ React__default.createElement(ListItem, {
|
|
497
734
|
key: filter,
|
|
498
735
|
dense: true,
|
|
499
736
|
button: true,
|
|
500
737
|
onClick: () => updateChecked(filter)
|
|
501
|
-
}, /* @__PURE__ */
|
|
738
|
+
}, /* @__PURE__ */ React__default.createElement(Checkbox, {
|
|
502
739
|
edge: "start",
|
|
503
740
|
disableRipple: true,
|
|
504
741
|
className: classes.checkbox,
|
|
@@ -507,13 +744,13 @@ const Filters = ({
|
|
|
507
744
|
tabIndex: -1,
|
|
508
745
|
value: filter,
|
|
509
746
|
name: filter
|
|
510
|
-
}), /* @__PURE__ */
|
|
747
|
+
}), /* @__PURE__ */ React__default.createElement(ListItemText, {
|
|
511
748
|
id: filter,
|
|
512
749
|
primary: filter
|
|
513
750
|
}))))));
|
|
514
751
|
};
|
|
515
752
|
|
|
516
|
-
const useStyles$
|
|
753
|
+
const useStyles$1 = makeStyles((theme) => ({
|
|
517
754
|
searchQuery: {
|
|
518
755
|
color: theme.palette.text.primary,
|
|
519
756
|
background: theme.palette.background.default,
|
|
@@ -534,7 +771,7 @@ const columns = [
|
|
|
534
771
|
title: "Name",
|
|
535
772
|
field: "name",
|
|
536
773
|
highlight: true,
|
|
537
|
-
render: (result) => /* @__PURE__ */
|
|
774
|
+
render: (result) => /* @__PURE__ */ React__default.createElement(Link, {
|
|
538
775
|
to: result.url || ""
|
|
539
776
|
}, result.name)
|
|
540
777
|
},
|
|
@@ -561,27 +798,27 @@ const TableHeader = ({
|
|
|
561
798
|
numberOfResults,
|
|
562
799
|
handleToggleFilters
|
|
563
800
|
}) => {
|
|
564
|
-
const classes = useStyles$
|
|
565
|
-
return /* @__PURE__ */
|
|
801
|
+
const classes = useStyles$1();
|
|
802
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
566
803
|
className: classes.tableHeader
|
|
567
|
-
}, /* @__PURE__ */
|
|
804
|
+
}, /* @__PURE__ */ React__default.createElement(FiltersButton, {
|
|
568
805
|
numberOfSelectedFilters,
|
|
569
806
|
handleToggleFilters
|
|
570
|
-
}), /* @__PURE__ */
|
|
807
|
+
}), /* @__PURE__ */ React__default.createElement(Divider, {
|
|
571
808
|
className: classes.divider,
|
|
572
809
|
orientation: "vertical"
|
|
573
|
-
}), /* @__PURE__ */
|
|
810
|
+
}), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
574
811
|
item: true,
|
|
575
812
|
xs: 12
|
|
576
|
-
}, searchQuery ? /* @__PURE__ */
|
|
813
|
+
}, searchQuery ? /* @__PURE__ */ React__default.createElement(Typography, {
|
|
577
814
|
variant: "h6"
|
|
578
|
-
}, `${numberOfResults} `, numberOfResults > 1 ? `results for ` : `result for `, /* @__PURE__ */
|
|
815
|
+
}, `${numberOfResults} `, numberOfResults > 1 ? `results for ` : `result for `, /* @__PURE__ */ React__default.createElement("span", {
|
|
579
816
|
className: classes.searchQuery
|
|
580
|
-
}, '"', searchQuery, '"'), " ") : /* @__PURE__ */
|
|
817
|
+
}, '"', searchQuery, '"'), " ") : /* @__PURE__ */ React__default.createElement(Typography, {
|
|
581
818
|
variant: "h6"
|
|
582
819
|
}, `${numberOfResults} results`)));
|
|
583
820
|
};
|
|
584
|
-
const SearchResult
|
|
821
|
+
const SearchResult = ({searchQuery}) => {
|
|
585
822
|
const catalogApi = useApi(catalogApiRef);
|
|
586
823
|
const [showFilters, toggleFilters] = useState(false);
|
|
587
824
|
const [selectedFilters, setSelectedFilters] = useState({
|
|
@@ -626,15 +863,15 @@ const SearchResult$1 = ({searchQuery}) => {
|
|
|
626
863
|
}
|
|
627
864
|
}, [selectedFilters, searchQuery, results]);
|
|
628
865
|
if (loading) {
|
|
629
|
-
return /* @__PURE__ */
|
|
866
|
+
return /* @__PURE__ */ React__default.createElement(Progress, null);
|
|
630
867
|
}
|
|
631
868
|
if (error) {
|
|
632
|
-
return /* @__PURE__ */
|
|
869
|
+
return /* @__PURE__ */ React__default.createElement(Alert, {
|
|
633
870
|
severity: "error"
|
|
634
871
|
}, "Error encountered while fetching search results. ", error.toString());
|
|
635
872
|
}
|
|
636
873
|
if (!results || results.length === 0) {
|
|
637
|
-
return /* @__PURE__ */
|
|
874
|
+
return /* @__PURE__ */ React__default.createElement(EmptyState, {
|
|
638
875
|
missing: "data",
|
|
639
876
|
title: "Sorry, no results were found"
|
|
640
877
|
});
|
|
@@ -676,25 +913,25 @@ const SearchResult$1 = ({searchQuery}) => {
|
|
|
676
913
|
kind: [],
|
|
677
914
|
lifecycle: []
|
|
678
915
|
});
|
|
679
|
-
return /* @__PURE__ */
|
|
916
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
680
917
|
container: true
|
|
681
|
-
}, showFilters && /* @__PURE__ */
|
|
918
|
+
}, showFilters && /* @__PURE__ */ React__default.createElement(Grid, {
|
|
682
919
|
item: true,
|
|
683
920
|
xs: 3
|
|
684
|
-
}, /* @__PURE__ */
|
|
921
|
+
}, /* @__PURE__ */ React__default.createElement(Filters, {
|
|
685
922
|
filters: selectedFilters,
|
|
686
923
|
filterOptions,
|
|
687
924
|
resetFilters,
|
|
688
925
|
updateSelected,
|
|
689
926
|
updateChecked
|
|
690
|
-
})), /* @__PURE__ */
|
|
927
|
+
})), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
691
928
|
item: true,
|
|
692
929
|
xs: showFilters ? 9 : 12
|
|
693
|
-
}, /* @__PURE__ */
|
|
930
|
+
}, /* @__PURE__ */ React__default.createElement(Table, {
|
|
694
931
|
options: {paging: true, pageSize: 20, search: false},
|
|
695
932
|
data: filteredResults,
|
|
696
933
|
columns,
|
|
697
|
-
title: /* @__PURE__ */
|
|
934
|
+
title: /* @__PURE__ */ React__default.createElement(TableHeader, {
|
|
698
935
|
searchQuery,
|
|
699
936
|
numberOfResults: filteredResults.length,
|
|
700
937
|
numberOfSelectedFilters: (selectedFilters.selected !== "" ? 1 : 0) + selectedFilters.checked.length,
|
|
@@ -717,24 +954,24 @@ const LegacySearchPage = () => {
|
|
|
717
954
|
const handleClearSearchBar = () => {
|
|
718
955
|
setSearchQuery("");
|
|
719
956
|
};
|
|
720
|
-
return /* @__PURE__ */
|
|
957
|
+
return /* @__PURE__ */ React__default.createElement(Page, {
|
|
721
958
|
themeId: "home"
|
|
722
|
-
}, /* @__PURE__ */
|
|
959
|
+
}, /* @__PURE__ */ React__default.createElement(Header, {
|
|
723
960
|
title: "Search"
|
|
724
|
-
}), /* @__PURE__ */
|
|
961
|
+
}), /* @__PURE__ */ React__default.createElement(Content, null, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
725
962
|
container: true,
|
|
726
963
|
direction: "row"
|
|
727
|
-
}, /* @__PURE__ */
|
|
964
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
728
965
|
item: true,
|
|
729
966
|
xs: 12
|
|
730
|
-
}, /* @__PURE__ */
|
|
967
|
+
}, /* @__PURE__ */ React__default.createElement(SearchBar, {
|
|
731
968
|
handleSearch,
|
|
732
969
|
handleClearSearchBar,
|
|
733
970
|
searchQuery
|
|
734
|
-
})), /* @__PURE__ */
|
|
971
|
+
})), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
735
972
|
item: true,
|
|
736
973
|
xs: 12
|
|
737
|
-
}, /* @__PURE__ */
|
|
974
|
+
}, /* @__PURE__ */ React__default.createElement(SearchResult, {
|
|
738
975
|
searchQuery: (queryString != null ? queryString : "").toLocaleLowerCase("en-US")
|
|
739
976
|
})))));
|
|
740
977
|
};
|
|
@@ -782,41 +1019,9 @@ const UrlUpdater = () => {
|
|
|
782
1019
|
}, [term, types, pageCursor, filters]);
|
|
783
1020
|
return null;
|
|
784
1021
|
};
|
|
785
|
-
const SearchPage
|
|
1022
|
+
const SearchPage = () => {
|
|
786
1023
|
const outlet = useOutlet();
|
|
787
|
-
return /* @__PURE__ */
|
|
788
|
-
};
|
|
789
|
-
|
|
790
|
-
const useStyles$1 = makeStyles((theme) => ({
|
|
791
|
-
root: {
|
|
792
|
-
display: "flex",
|
|
793
|
-
justifyContent: "space-between",
|
|
794
|
-
gap: theme.spacing(2),
|
|
795
|
-
margin: theme.spacing(4)
|
|
796
|
-
}
|
|
797
|
-
}));
|
|
798
|
-
const SearchResultPager = () => {
|
|
799
|
-
const {fetchNextPage, fetchPreviousPage} = useSearch();
|
|
800
|
-
const classes = useStyles$1();
|
|
801
|
-
if (!fetchNextPage && !fetchPreviousPage) {
|
|
802
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
803
|
-
}
|
|
804
|
-
return /* @__PURE__ */ React.createElement("nav", {
|
|
805
|
-
"arial-label": "pagination navigation",
|
|
806
|
-
className: classes.root
|
|
807
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
808
|
-
"aria-label": "previous page",
|
|
809
|
-
disabled: !fetchPreviousPage,
|
|
810
|
-
onClick: fetchPreviousPage,
|
|
811
|
-
startIcon: /* @__PURE__ */ React.createElement(ArrowBackIosIcon, null),
|
|
812
|
-
size: "small"
|
|
813
|
-
}, "Back"), /* @__PURE__ */ React.createElement(Button, {
|
|
814
|
-
"aria-label": "next page",
|
|
815
|
-
disabled: !fetchNextPage,
|
|
816
|
-
onClick: fetchNextPage,
|
|
817
|
-
endIcon: /* @__PURE__ */ React.createElement(ArrowForwardIosIcon, null),
|
|
818
|
-
size: "small"
|
|
819
|
-
}, "Next"));
|
|
1024
|
+
return /* @__PURE__ */ React__default.createElement(SearchContextProvider, null, /* @__PURE__ */ React__default.createElement(UrlUpdater, null), outlet || /* @__PURE__ */ React__default.createElement(LegacySearchPage, null));
|
|
820
1025
|
};
|
|
821
1026
|
|
|
822
1027
|
const useStyles = makeStyles((theme) => ({
|
|
@@ -853,109 +1058,38 @@ const SearchType = ({
|
|
|
853
1058
|
const value = e.target.value;
|
|
854
1059
|
setTypes(value);
|
|
855
1060
|
};
|
|
856
|
-
return /* @__PURE__ */
|
|
1061
|
+
return /* @__PURE__ */ React__default.createElement(FormControl, {
|
|
857
1062
|
className,
|
|
858
1063
|
variant: "filled",
|
|
859
1064
|
fullWidth: true,
|
|
860
1065
|
"data-testid": "search-typefilter-next"
|
|
861
|
-
}, /* @__PURE__ */
|
|
1066
|
+
}, /* @__PURE__ */ React__default.createElement(InputLabel, {
|
|
862
1067
|
className: classes.label,
|
|
863
1068
|
margin: "dense"
|
|
864
|
-
}, name), /* @__PURE__ */
|
|
1069
|
+
}, name), /* @__PURE__ */ React__default.createElement(Select, {
|
|
865
1070
|
multiple: true,
|
|
866
1071
|
variant: "outlined",
|
|
867
1072
|
value: types,
|
|
868
1073
|
onChange: handleChange,
|
|
869
1074
|
placeholder: "All Results",
|
|
870
|
-
renderValue: (selected) => /* @__PURE__ */
|
|
1075
|
+
renderValue: (selected) => /* @__PURE__ */ React__default.createElement("div", {
|
|
871
1076
|
className: classes.chips
|
|
872
|
-
}, selected.map((value) => /* @__PURE__ */
|
|
1077
|
+
}, selected.map((value) => /* @__PURE__ */ React__default.createElement(Chip, {
|
|
873
1078
|
key: value,
|
|
874
1079
|
label: value,
|
|
875
1080
|
className: classes.chip,
|
|
876
1081
|
size: "small"
|
|
877
1082
|
})))
|
|
878
|
-
}, values.map((value) => /* @__PURE__ */
|
|
1083
|
+
}, values.map((value) => /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
879
1084
|
key: value,
|
|
880
1085
|
value
|
|
881
|
-
}, /* @__PURE__ */
|
|
1086
|
+
}, /* @__PURE__ */ React__default.createElement(Checkbox, {
|
|
882
1087
|
checked: types.indexOf(value) > -1
|
|
883
|
-
}), /* @__PURE__ */
|
|
1088
|
+
}), /* @__PURE__ */ React__default.createElement(ListItemText, {
|
|
884
1089
|
primary: value
|
|
885
1090
|
})))));
|
|
886
1091
|
};
|
|
887
1092
|
|
|
888
|
-
const rootRouteRef = createRouteRef({
|
|
889
|
-
path: "/search",
|
|
890
|
-
title: "search"
|
|
891
|
-
});
|
|
892
|
-
const rootNextRouteRef = createRouteRef({
|
|
893
|
-
path: "/search-next",
|
|
894
|
-
title: "search"
|
|
895
|
-
});
|
|
896
|
-
const searchPlugin = createPlugin({
|
|
897
|
-
id: "search",
|
|
898
|
-
apis: [
|
|
899
|
-
createApiFactory({
|
|
900
|
-
api: searchApiRef,
|
|
901
|
-
deps: {discoveryApi: discoveryApiRef, identityApi: identityApiRef},
|
|
902
|
-
factory: ({discoveryApi, identityApi}) => {
|
|
903
|
-
return new SearchClient({discoveryApi, identityApi});
|
|
904
|
-
}
|
|
905
|
-
})
|
|
906
|
-
],
|
|
907
|
-
routes: {
|
|
908
|
-
root: rootRouteRef,
|
|
909
|
-
nextRoot: rootNextRouteRef
|
|
910
|
-
}
|
|
911
|
-
});
|
|
912
|
-
const SearchPage = searchPlugin.provide(createRoutableExtension({
|
|
913
|
-
name: "SearchPage",
|
|
914
|
-
component: () => import('./index-4ef7a5c8.esm.js').then((m) => m.SearchPage),
|
|
915
|
-
mountPoint: rootRouteRef
|
|
916
|
-
}));
|
|
917
|
-
const SearchPageNext = searchPlugin.provide(createRoutableExtension({
|
|
918
|
-
name: "SearchPageNext",
|
|
919
|
-
component: () => import('./index-4ef7a5c8.esm.js').then((m) => m.SearchPage),
|
|
920
|
-
mountPoint: rootNextRouteRef
|
|
921
|
-
}));
|
|
922
|
-
searchPlugin.provide(createComponentExtension({
|
|
923
|
-
name: "SearchBar",
|
|
924
|
-
component: {
|
|
925
|
-
lazy: () => import('./index-6f14e751.esm.js').then((m) => m.SearchBar)
|
|
926
|
-
}
|
|
927
|
-
}));
|
|
928
|
-
const SearchBarNext = searchPlugin.provide(createComponentExtension({
|
|
929
|
-
name: "SearchBarNext",
|
|
930
|
-
component: {
|
|
931
|
-
lazy: () => import('./index-6f14e751.esm.js').then((m) => m.SearchBar)
|
|
932
|
-
}
|
|
933
|
-
}));
|
|
934
|
-
const SearchResult = searchPlugin.provide(createComponentExtension({
|
|
935
|
-
name: "SearchResult",
|
|
936
|
-
component: {
|
|
937
|
-
lazy: () => import('./index-ee8d2563.esm.js').then((m) => m.SearchResult)
|
|
938
|
-
}
|
|
939
|
-
}));
|
|
940
|
-
searchPlugin.provide(createComponentExtension({
|
|
941
|
-
name: "SearchResultNext",
|
|
942
|
-
component: {
|
|
943
|
-
lazy: () => import('./index-ee8d2563.esm.js').then((m) => m.SearchResult)
|
|
944
|
-
}
|
|
945
|
-
}));
|
|
946
|
-
const DefaultResultListItem = searchPlugin.provide(createComponentExtension({
|
|
947
|
-
name: "DefaultResultListItem",
|
|
948
|
-
component: {
|
|
949
|
-
lazy: () => import('./index-92a9e2ec.esm.js').then((m) => m.DefaultResultListItem)
|
|
950
|
-
}
|
|
951
|
-
}));
|
|
952
|
-
const HomePageSearchBar = searchPlugin.provide(createComponentExtension({
|
|
953
|
-
name: "HomePageSearchBar",
|
|
954
|
-
component: {
|
|
955
|
-
lazy: () => import('./index-3eebaa65.esm.js').then((m) => m.HomePageSearchBar)
|
|
956
|
-
}
|
|
957
|
-
}));
|
|
958
|
-
|
|
959
1093
|
const SidebarSearch = () => {
|
|
960
1094
|
const searchRoute = useRouteRef(rootRouteRef);
|
|
961
1095
|
const navigate = useNavigate();
|
|
@@ -963,11 +1097,11 @@ const SidebarSearch = () => {
|
|
|
963
1097
|
const queryString = qs.stringify({query}, {addQueryPrefix: true});
|
|
964
1098
|
navigate(`${searchRoute()}${queryString}`);
|
|
965
1099
|
}, [navigate, searchRoute]);
|
|
966
|
-
return /* @__PURE__ */
|
|
1100
|
+
return /* @__PURE__ */ React__default.createElement(SidebarSearchField, {
|
|
967
1101
|
onSearch: handleSearch,
|
|
968
1102
|
to: "/search"
|
|
969
1103
|
});
|
|
970
1104
|
};
|
|
971
1105
|
|
|
972
|
-
export { DefaultResultListItem as D, Filters$1 as F, HomePageSearchBar as H, SearchPage
|
|
973
|
-
//# sourceMappingURL=index-
|
|
1106
|
+
export { DefaultResultListItem$1 as D, Filters$1 as F, HomePageSearchBar as H, SearchPage as S, SearchBar$1 as a, SearchBarBase as b, SearchResultComponent as c, SearchModal as d, FiltersButton$1 as e, SearchContextProvider as f, SearchFilter as g, SearchFilterNext as h, SearchResultPager as i, SearchType as j, SidebarSearch as k, DefaultResultListItem as l, SearchBarNext as m, SearchPage$1 as n, SearchPageNext as o, searchPlugin as p, SearchResult$1 as q, rootRouteRef as r, searchApiRef as s, SidebarSearchModal as t, useSearch as u };
|
|
1107
|
+
//# sourceMappingURL=index-17c9e868.esm.js.map
|