@backstage/plugin-search 0.4.14 → 0.4.18
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 +61 -0
- package/dist/esm/index-01b40466.esm.js +39 -0
- package/dist/esm/index-01b40466.esm.js.map +1 -0
- package/dist/esm/index-207637ef.esm.js +23 -0
- package/dist/esm/index-207637ef.esm.js.map +1 -0
- package/dist/esm/{index-f3589f7b.esm.js → index-766e727c.esm.js} +6 -5
- package/dist/esm/index-766e727c.esm.js.map +1 -0
- package/dist/esm/{index-9891a3b0.esm.js → index-77205085.esm.js} +6 -5
- package/dist/esm/index-77205085.esm.js.map +1 -0
- package/dist/esm/index-b929d40d.esm.js +23 -0
- package/dist/esm/index-b929d40d.esm.js.map +1 -0
- package/dist/esm/{index-9b6a3ac1.esm.js → index-b9474e70.esm.js} +9 -8
- package/dist/esm/{index-9b6a3ac1.esm.js.map → index-b9474e70.esm.js.map} +1 -1
- package/dist/esm/{index-848f077f.esm.js → index-cdccd881.esm.js} +364 -224
- package/dist/esm/index-cdccd881.esm.js.map +1 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.esm.js +6 -5
- package/dist/index.esm.js.map +1 -1
- package/package.json +16 -15
- package/dist/esm/index-4afbd577.esm.js +0 -46
- package/dist/esm/index-4afbd577.esm.js.map +0 -1
- package/dist/esm/index-848f077f.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-9891a3b0.esm.js.map +0 -1
- package/dist/esm/index-f3589f7b.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
|
});
|
|
@@ -205,6 +219,7 @@ const useSearch = () => {
|
|
|
205
219
|
};
|
|
206
220
|
|
|
207
221
|
const SearchBarBase = ({
|
|
222
|
+
autoFocus,
|
|
208
223
|
value,
|
|
209
224
|
onChange,
|
|
210
225
|
onSubmit,
|
|
@@ -212,39 +227,45 @@ const SearchBarBase = ({
|
|
|
212
227
|
placeholder: overridePlaceholder
|
|
213
228
|
}) => {
|
|
214
229
|
const configApi = useApi(configApiRef);
|
|
215
|
-
const onKeyDown =
|
|
230
|
+
const onKeyDown = React__default.useCallback((e) => {
|
|
216
231
|
if (onSubmit && e.key === "Enter") {
|
|
217
232
|
onSubmit();
|
|
218
233
|
}
|
|
219
234
|
}, [onSubmit]);
|
|
220
|
-
const handleClear =
|
|
235
|
+
const handleClear = React__default.useCallback(() => {
|
|
221
236
|
onChange("");
|
|
222
237
|
}, [onChange]);
|
|
223
238
|
const placeholder = overridePlaceholder != null ? overridePlaceholder : `Search in ${configApi.getOptionalString("app.title") || "Backstage"}`;
|
|
224
|
-
return /* @__PURE__ */
|
|
239
|
+
return /* @__PURE__ */ React__default.createElement(InputBase, {
|
|
240
|
+
autoFocus,
|
|
225
241
|
"data-testid": "search-bar-next",
|
|
226
242
|
fullWidth: true,
|
|
227
243
|
placeholder,
|
|
228
244
|
value,
|
|
229
245
|
onChange: (e) => onChange(e.target.value),
|
|
230
246
|
inputProps: {"aria-label": "Search"},
|
|
231
|
-
startAdornment: /* @__PURE__ */
|
|
247
|
+
startAdornment: /* @__PURE__ */ React__default.createElement(InputAdornment, {
|
|
232
248
|
position: "start"
|
|
233
|
-
}, /* @__PURE__ */
|
|
249
|
+
}, /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
234
250
|
"aria-label": "Query",
|
|
235
251
|
disabled: true
|
|
236
|
-
}, /* @__PURE__ */
|
|
237
|
-
endAdornment: /* @__PURE__ */
|
|
252
|
+
}, /* @__PURE__ */ React__default.createElement(SearchIcon, null))),
|
|
253
|
+
endAdornment: /* @__PURE__ */ React__default.createElement(InputAdornment, {
|
|
238
254
|
position: "end"
|
|
239
|
-
}, /* @__PURE__ */
|
|
255
|
+
}, /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
240
256
|
"aria-label": "Clear",
|
|
241
257
|
onClick: handleClear
|
|
242
|
-
}, /* @__PURE__ */
|
|
258
|
+
}, /* @__PURE__ */ React__default.createElement(ClearButton, null))),
|
|
243
259
|
...className && {className},
|
|
244
260
|
...onSubmit && {onKeyDown}
|
|
245
261
|
});
|
|
246
262
|
};
|
|
247
|
-
const SearchBar$1 = ({
|
|
263
|
+
const SearchBar$1 = ({
|
|
264
|
+
autoFocus,
|
|
265
|
+
className,
|
|
266
|
+
debounceTime = 0,
|
|
267
|
+
placeholder
|
|
268
|
+
}) => {
|
|
248
269
|
const {term, setTerm} = useSearch();
|
|
249
270
|
const [value, setValue] = useState(term);
|
|
250
271
|
useEffect(() => {
|
|
@@ -255,15 +276,17 @@ const SearchBar$1 = ({className, debounceTime = 0}) => {
|
|
|
255
276
|
setValue(newValue);
|
|
256
277
|
};
|
|
257
278
|
const handleClear = () => setValue("");
|
|
258
|
-
return /* @__PURE__ */
|
|
279
|
+
return /* @__PURE__ */ React__default.createElement(SearchBarBase, {
|
|
280
|
+
autoFocus,
|
|
259
281
|
className,
|
|
260
282
|
value,
|
|
261
283
|
onChange: handleQuery,
|
|
262
|
-
onClear: handleClear
|
|
284
|
+
onClear: handleClear,
|
|
285
|
+
placeholder
|
|
263
286
|
});
|
|
264
287
|
};
|
|
265
288
|
|
|
266
|
-
const useStyles$
|
|
289
|
+
const useStyles$7 = makeStyles({
|
|
267
290
|
label: {
|
|
268
291
|
textTransform: "capitalize"
|
|
269
292
|
}
|
|
@@ -274,7 +297,7 @@ const CheckboxFilter = ({
|
|
|
274
297
|
defaultValue,
|
|
275
298
|
values = []
|
|
276
299
|
}) => {
|
|
277
|
-
const classes = useStyles$
|
|
300
|
+
const classes = useStyles$7();
|
|
278
301
|
const {filters, setFilters} = useSearch();
|
|
279
302
|
useEffect(() => {
|
|
280
303
|
if (Array.isArray(defaultValue)) {
|
|
@@ -295,17 +318,17 @@ const CheckboxFilter = ({
|
|
|
295
318
|
return items.length ? {...others, [name]: items} : others;
|
|
296
319
|
});
|
|
297
320
|
};
|
|
298
|
-
return /* @__PURE__ */
|
|
321
|
+
return /* @__PURE__ */ React__default.createElement(FormControl, {
|
|
299
322
|
className,
|
|
300
323
|
fullWidth: true,
|
|
301
324
|
"data-testid": "search-checkboxfilter-next"
|
|
302
|
-
}, /* @__PURE__ */
|
|
325
|
+
}, /* @__PURE__ */ React__default.createElement(FormLabel, {
|
|
303
326
|
className: classes.label
|
|
304
327
|
}, name), values.map((value) => {
|
|
305
328
|
var _a;
|
|
306
|
-
return /* @__PURE__ */
|
|
329
|
+
return /* @__PURE__ */ React__default.createElement(FormControlLabel, {
|
|
307
330
|
key: value,
|
|
308
|
-
control: /* @__PURE__ */
|
|
331
|
+
control: /* @__PURE__ */ React__default.createElement(Checkbox, {
|
|
309
332
|
color: "primary",
|
|
310
333
|
tabIndex: -1,
|
|
311
334
|
inputProps: {"aria-labelledby": value},
|
|
@@ -324,7 +347,7 @@ const SelectFilter = ({
|
|
|
324
347
|
defaultValue,
|
|
325
348
|
values = []
|
|
326
349
|
}) => {
|
|
327
|
-
const classes = useStyles$
|
|
350
|
+
const classes = useStyles$7();
|
|
328
351
|
const {filters, setFilters} = useSearch();
|
|
329
352
|
useEffect(() => {
|
|
330
353
|
if (typeof defaultValue === "string") {
|
|
@@ -343,39 +366,259 @@ const SelectFilter = ({
|
|
|
343
366
|
return value ? {...others, [name]: value} : others;
|
|
344
367
|
});
|
|
345
368
|
};
|
|
346
|
-
return /* @__PURE__ */
|
|
369
|
+
return /* @__PURE__ */ React__default.createElement(FormControl, {
|
|
347
370
|
className,
|
|
348
371
|
variant: "filled",
|
|
349
372
|
fullWidth: true,
|
|
350
373
|
"data-testid": "search-selectfilter-next"
|
|
351
|
-
}, /* @__PURE__ */
|
|
374
|
+
}, /* @__PURE__ */ React__default.createElement(InputLabel, {
|
|
352
375
|
className: classes.label,
|
|
353
376
|
margin: "dense"
|
|
354
|
-
}, name), /* @__PURE__ */
|
|
377
|
+
}, name), /* @__PURE__ */ React__default.createElement(Select, {
|
|
355
378
|
variant: "outlined",
|
|
356
379
|
value: filters[name] || "",
|
|
357
380
|
onChange: handleChange
|
|
358
|
-
}, /* @__PURE__ */
|
|
381
|
+
}, /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
359
382
|
value: ""
|
|
360
|
-
}, /* @__PURE__ */
|
|
383
|
+
}, /* @__PURE__ */ React__default.createElement("em", null, "All")), values.map((value) => /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
361
384
|
key: value,
|
|
362
385
|
value
|
|
363
386
|
}, value))));
|
|
364
387
|
};
|
|
365
|
-
const SearchFilter = ({component: Element, ...props}) => /* @__PURE__ */
|
|
388
|
+
const SearchFilter = ({component: Element, ...props}) => /* @__PURE__ */ React__default.createElement(Element, {
|
|
366
389
|
...props
|
|
367
390
|
});
|
|
368
|
-
SearchFilter.Checkbox = (props) => /* @__PURE__ */
|
|
391
|
+
SearchFilter.Checkbox = (props) => /* @__PURE__ */ React__default.createElement(SearchFilter, {
|
|
369
392
|
...props,
|
|
370
393
|
component: CheckboxFilter
|
|
371
394
|
});
|
|
372
|
-
SearchFilter.Select = (props) => /* @__PURE__ */
|
|
395
|
+
SearchFilter.Select = (props) => /* @__PURE__ */ React__default.createElement(SearchFilter, {
|
|
373
396
|
...props,
|
|
374
397
|
component: SelectFilter
|
|
375
398
|
});
|
|
376
399
|
const SearchFilterNext = SearchFilter;
|
|
377
400
|
|
|
378
|
-
|
|
401
|
+
var Launch = createSvgIcon( /*#__PURE__*/React.createElement("path", {
|
|
402
|
+
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"
|
|
403
|
+
}), 'Launch');
|
|
404
|
+
|
|
405
|
+
const SearchResultComponent = ({children}) => {
|
|
406
|
+
const {
|
|
407
|
+
result: {loading, error, value}
|
|
408
|
+
} = useSearch();
|
|
409
|
+
if (loading) {
|
|
410
|
+
return /* @__PURE__ */ React__default.createElement(Progress, null);
|
|
411
|
+
}
|
|
412
|
+
if (error) {
|
|
413
|
+
return /* @__PURE__ */ React__default.createElement(ResponseErrorPanel, {
|
|
414
|
+
title: "Error encountered while fetching search results",
|
|
415
|
+
error
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
if (!(value == null ? void 0 : value.results.length)) {
|
|
419
|
+
return /* @__PURE__ */ React__default.createElement(EmptyState, {
|
|
420
|
+
missing: "data",
|
|
421
|
+
title: "Sorry, no results were found"
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children({results: value.results}));
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
const useStyles$6 = makeStyles((theme) => ({
|
|
428
|
+
root: {
|
|
429
|
+
display: "flex",
|
|
430
|
+
justifyContent: "space-between",
|
|
431
|
+
gap: theme.spacing(2),
|
|
432
|
+
margin: theme.spacing(2, 0)
|
|
433
|
+
}
|
|
434
|
+
}));
|
|
435
|
+
const SearchResultPager = () => {
|
|
436
|
+
const {fetchNextPage, fetchPreviousPage} = useSearch();
|
|
437
|
+
const classes = useStyles$6();
|
|
438
|
+
if (!fetchNextPage && !fetchPreviousPage) {
|
|
439
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
|
|
440
|
+
}
|
|
441
|
+
return /* @__PURE__ */ React__default.createElement("nav", {
|
|
442
|
+
"arial-label": "pagination navigation",
|
|
443
|
+
className: classes.root
|
|
444
|
+
}, /* @__PURE__ */ React__default.createElement(Button, {
|
|
445
|
+
"aria-label": "previous page",
|
|
446
|
+
disabled: !fetchPreviousPage,
|
|
447
|
+
onClick: fetchPreviousPage,
|
|
448
|
+
startIcon: /* @__PURE__ */ React__default.createElement(ArrowBackIosIcon, null)
|
|
449
|
+
}, "Previous"), /* @__PURE__ */ React__default.createElement(Button, {
|
|
450
|
+
"aria-label": "next page",
|
|
451
|
+
disabled: !fetchNextPage,
|
|
452
|
+
onClick: fetchNextPage,
|
|
453
|
+
endIcon: /* @__PURE__ */ React__default.createElement(ArrowForwardIosIcon, null)
|
|
454
|
+
}, "Next"));
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
const rootRouteRef = createRouteRef({
|
|
458
|
+
id: "search"
|
|
459
|
+
});
|
|
460
|
+
const rootNextRouteRef = createRouteRef({
|
|
461
|
+
id: "search:next"
|
|
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-77205085.esm.js').then((m) => m.SearchPage),
|
|
482
|
+
mountPoint: rootRouteRef
|
|
483
|
+
}));
|
|
484
|
+
const SearchPageNext = searchPlugin.provide(createRoutableExtension({
|
|
485
|
+
name: "SearchPageNext",
|
|
486
|
+
component: () => import('./index-77205085.esm.js').then((m) => m.SearchPage),
|
|
487
|
+
mountPoint: rootNextRouteRef
|
|
488
|
+
}));
|
|
489
|
+
searchPlugin.provide(createComponentExtension({
|
|
490
|
+
name: "SearchBar",
|
|
491
|
+
component: {
|
|
492
|
+
lazy: () => import('./index-b929d40d.esm.js').then((m) => m.SearchBar)
|
|
493
|
+
}
|
|
494
|
+
}));
|
|
495
|
+
const SearchBarNext = searchPlugin.provide(createComponentExtension({
|
|
496
|
+
name: "SearchBarNext",
|
|
497
|
+
component: {
|
|
498
|
+
lazy: () => import('./index-b929d40d.esm.js').then((m) => m.SearchBar)
|
|
499
|
+
}
|
|
500
|
+
}));
|
|
501
|
+
const SearchResult$1 = searchPlugin.provide(createComponentExtension({
|
|
502
|
+
name: "SearchResult",
|
|
503
|
+
component: {
|
|
504
|
+
lazy: () => import('./index-766e727c.esm.js').then((m) => m.SearchResult)
|
|
505
|
+
}
|
|
506
|
+
}));
|
|
507
|
+
searchPlugin.provide(createComponentExtension({
|
|
508
|
+
name: "SearchResultNext",
|
|
509
|
+
component: {
|
|
510
|
+
lazy: () => import('./index-766e727c.esm.js').then((m) => m.SearchResult)
|
|
511
|
+
}
|
|
512
|
+
}));
|
|
513
|
+
const SidebarSearchModal = searchPlugin.provide(createComponentExtension({
|
|
514
|
+
name: "SidebarSearchModal",
|
|
515
|
+
component: {
|
|
516
|
+
lazy: () => import('./index-01b40466.esm.js').then((m) => m.SidebarSearchModal)
|
|
517
|
+
}
|
|
518
|
+
}));
|
|
519
|
+
const DefaultResultListItem = searchPlugin.provide(createComponentExtension({
|
|
520
|
+
name: "DefaultResultListItem",
|
|
521
|
+
component: {
|
|
522
|
+
lazy: () => import('./index-207637ef.esm.js').then((m) => m.DefaultResultListItem)
|
|
523
|
+
}
|
|
524
|
+
}));
|
|
525
|
+
const HomePageSearchBar = searchPlugin.provide(createComponentExtension({
|
|
526
|
+
name: "HomePageSearchBar",
|
|
527
|
+
component: {
|
|
528
|
+
lazy: () => import('./index-b9474e70.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), 500, [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
|
+
onClick: toggleModal,
|
|
590
|
+
to: `${getSearchLink()}?query=${value}`
|
|
591
|
+
}, /* @__PURE__ */ React__default.createElement("span", {
|
|
592
|
+
className: classes.viewResultsLink
|
|
593
|
+
}, "View Full Results"), /* @__PURE__ */ React__default.createElement(Launch, {
|
|
594
|
+
color: "primary"
|
|
595
|
+
})))), /* @__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", {
|
|
596
|
+
role: "button",
|
|
597
|
+
tabIndex: 0,
|
|
598
|
+
key: `${document.location}-btn`,
|
|
599
|
+
onClick: handleResultClick,
|
|
600
|
+
onKeyPress: handleKeyPress
|
|
601
|
+
}, /* @__PURE__ */ React__default.createElement(DefaultResultListItem$1, {
|
|
602
|
+
key: document.location,
|
|
603
|
+
result: document
|
|
604
|
+
})))))), /* @__PURE__ */ React__default.createElement(DialogActions, {
|
|
605
|
+
className: classes.dialogActionsContainer
|
|
606
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
607
|
+
container: true,
|
|
608
|
+
direction: "row"
|
|
609
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
610
|
+
item: true,
|
|
611
|
+
xs: 12
|
|
612
|
+
}, /* @__PURE__ */ React__default.createElement(SearchResultPager, null)))));
|
|
613
|
+
};
|
|
614
|
+
const SearchModal = ({open = true, toggleModal}) => {
|
|
615
|
+
return /* @__PURE__ */ React__default.createElement(SearchContextProvider, null, /* @__PURE__ */ React__default.createElement(Modal, {
|
|
616
|
+
open,
|
|
617
|
+
toggleModal
|
|
618
|
+
}));
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
const useStyles$4 = makeStyles$1(() => ({
|
|
379
622
|
root: {
|
|
380
623
|
display: "flex",
|
|
381
624
|
alignItems: "center"
|
|
@@ -389,28 +632,28 @@ const SearchBar = ({
|
|
|
389
632
|
handleSearch,
|
|
390
633
|
handleClearSearchBar
|
|
391
634
|
}) => {
|
|
392
|
-
const classes = useStyles$
|
|
393
|
-
return /* @__PURE__ */
|
|
635
|
+
const classes = useStyles$4();
|
|
636
|
+
return /* @__PURE__ */ React__default.createElement(Paper, {
|
|
394
637
|
component: "form",
|
|
395
638
|
onSubmit: (e) => handleSearch(e),
|
|
396
639
|
className: classes.root
|
|
397
|
-
}, /* @__PURE__ */
|
|
640
|
+
}, /* @__PURE__ */ React__default.createElement(IconButton$1, {
|
|
398
641
|
disabled: true,
|
|
399
642
|
type: "submit",
|
|
400
643
|
"aria-label": "search"
|
|
401
|
-
}, /* @__PURE__ */
|
|
644
|
+
}, /* @__PURE__ */ React__default.createElement(SearchIcon, null)), /* @__PURE__ */ React__default.createElement(InputBase$1, {
|
|
402
645
|
className: classes.input,
|
|
403
646
|
placeholder: "Search in Backstage",
|
|
404
647
|
value: searchQuery,
|
|
405
648
|
onChange: (e) => handleSearch(e),
|
|
406
649
|
inputProps: {"aria-label": "search backstage"}
|
|
407
|
-
}), /* @__PURE__ */
|
|
650
|
+
}), /* @__PURE__ */ React__default.createElement(IconButton$1, {
|
|
408
651
|
"aria-label": "search",
|
|
409
652
|
onClick: () => handleClearSearchBar()
|
|
410
|
-
}, /* @__PURE__ */
|
|
653
|
+
}, /* @__PURE__ */ React__default.createElement(ClearButton, null)));
|
|
411
654
|
};
|
|
412
655
|
|
|
413
|
-
const useStyles$
|
|
656
|
+
const useStyles$3 = makeStyles((theme) => ({
|
|
414
657
|
filters: {
|
|
415
658
|
width: "250px",
|
|
416
659
|
display: "flex"
|
|
@@ -423,19 +666,19 @@ const FiltersButton = ({
|
|
|
423
666
|
numberOfSelectedFilters,
|
|
424
667
|
handleToggleFilters
|
|
425
668
|
}) => {
|
|
426
|
-
const classes = useStyles$
|
|
427
|
-
return /* @__PURE__ */
|
|
669
|
+
const classes = useStyles$3();
|
|
670
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
428
671
|
className: classes.filters
|
|
429
|
-
}, /* @__PURE__ */
|
|
672
|
+
}, /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
430
673
|
className: classes.icon,
|
|
431
674
|
"aria-label": "settings",
|
|
432
675
|
onClick: handleToggleFilters
|
|
433
|
-
}, /* @__PURE__ */
|
|
676
|
+
}, /* @__PURE__ */ React__default.createElement(FilterListIcon, null)), /* @__PURE__ */ React__default.createElement(Typography, {
|
|
434
677
|
variant: "h6"
|
|
435
678
|
}, "Filters (", numberOfSelectedFilters ? numberOfSelectedFilters : 0, ")"));
|
|
436
679
|
};
|
|
437
680
|
|
|
438
|
-
const useStyles$
|
|
681
|
+
const useStyles$2 = makeStyles((theme) => ({
|
|
439
682
|
filters: {
|
|
440
683
|
background: "transparent",
|
|
441
684
|
boxShadow: "0px 0px 0px 0px"
|
|
@@ -454,22 +697,22 @@ const Filters = ({
|
|
|
454
697
|
updateSelected,
|
|
455
698
|
updateChecked
|
|
456
699
|
}) => {
|
|
457
|
-
const classes = useStyles$
|
|
458
|
-
return /* @__PURE__ */
|
|
700
|
+
const classes = useStyles$2();
|
|
701
|
+
return /* @__PURE__ */ React__default.createElement(Card, {
|
|
459
702
|
className: classes.filters
|
|
460
|
-
}, /* @__PURE__ */
|
|
461
|
-
title: /* @__PURE__ */
|
|
703
|
+
}, /* @__PURE__ */ React__default.createElement(CardHeader, {
|
|
704
|
+
title: /* @__PURE__ */ React__default.createElement(Typography, {
|
|
462
705
|
variant: "h6"
|
|
463
706
|
}, "Filters"),
|
|
464
|
-
action: /* @__PURE__ */
|
|
707
|
+
action: /* @__PURE__ */ React__default.createElement(Button, {
|
|
465
708
|
color: "primary",
|
|
466
709
|
onClick: () => resetFilters()
|
|
467
710
|
}, "CLEAR ALL")
|
|
468
|
-
}), /* @__PURE__ */
|
|
711
|
+
}), /* @__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, {
|
|
469
712
|
variant: "subtitle2"
|
|
470
|
-
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */
|
|
713
|
+
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */ React__default.createElement(CardContent, null, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
471
714
|
variant: "subtitle2"
|
|
472
|
-
}, "Kind"), /* @__PURE__ */
|
|
715
|
+
}, "Kind"), /* @__PURE__ */ React__default.createElement(Select, {
|
|
473
716
|
id: "outlined-select",
|
|
474
717
|
onChange: (e) => {
|
|
475
718
|
var _a;
|
|
@@ -478,22 +721,22 @@ const Filters = ({
|
|
|
478
721
|
variant: "outlined",
|
|
479
722
|
className: classes.dropdown,
|
|
480
723
|
value: filters.selected
|
|
481
|
-
}, filterOptions.kind.map((filter) => /* @__PURE__ */
|
|
724
|
+
}, filterOptions.kind.map((filter) => /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
482
725
|
selected: filter === "",
|
|
483
726
|
dense: true,
|
|
484
727
|
key: filter,
|
|
485
728
|
value: filter
|
|
486
|
-
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */
|
|
729
|
+
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */ React__default.createElement(CardContent, null, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
487
730
|
variant: "subtitle2"
|
|
488
|
-
}, "Lifecycle"), /* @__PURE__ */
|
|
731
|
+
}, "Lifecycle"), /* @__PURE__ */ React__default.createElement(List, {
|
|
489
732
|
disablePadding: true,
|
|
490
733
|
dense: true
|
|
491
|
-
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */
|
|
734
|
+
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */ React__default.createElement(ListItem, {
|
|
492
735
|
key: filter,
|
|
493
736
|
dense: true,
|
|
494
737
|
button: true,
|
|
495
738
|
onClick: () => updateChecked(filter)
|
|
496
|
-
}, /* @__PURE__ */
|
|
739
|
+
}, /* @__PURE__ */ React__default.createElement(Checkbox, {
|
|
497
740
|
edge: "start",
|
|
498
741
|
disableRipple: true,
|
|
499
742
|
className: classes.checkbox,
|
|
@@ -502,13 +745,13 @@ const Filters = ({
|
|
|
502
745
|
tabIndex: -1,
|
|
503
746
|
value: filter,
|
|
504
747
|
name: filter
|
|
505
|
-
}), /* @__PURE__ */
|
|
748
|
+
}), /* @__PURE__ */ React__default.createElement(ListItemText, {
|
|
506
749
|
id: filter,
|
|
507
750
|
primary: filter
|
|
508
751
|
}))))));
|
|
509
752
|
};
|
|
510
753
|
|
|
511
|
-
const useStyles$
|
|
754
|
+
const useStyles$1 = makeStyles((theme) => ({
|
|
512
755
|
searchQuery: {
|
|
513
756
|
color: theme.palette.text.primary,
|
|
514
757
|
background: theme.palette.background.default,
|
|
@@ -529,7 +772,7 @@ const columns = [
|
|
|
529
772
|
title: "Name",
|
|
530
773
|
field: "name",
|
|
531
774
|
highlight: true,
|
|
532
|
-
render: (result) => /* @__PURE__ */
|
|
775
|
+
render: (result) => /* @__PURE__ */ React__default.createElement(Link, {
|
|
533
776
|
to: result.url || ""
|
|
534
777
|
}, result.name)
|
|
535
778
|
},
|
|
@@ -556,27 +799,27 @@ const TableHeader = ({
|
|
|
556
799
|
numberOfResults,
|
|
557
800
|
handleToggleFilters
|
|
558
801
|
}) => {
|
|
559
|
-
const classes = useStyles$
|
|
560
|
-
return /* @__PURE__ */
|
|
802
|
+
const classes = useStyles$1();
|
|
803
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
561
804
|
className: classes.tableHeader
|
|
562
|
-
}, /* @__PURE__ */
|
|
805
|
+
}, /* @__PURE__ */ React__default.createElement(FiltersButton, {
|
|
563
806
|
numberOfSelectedFilters,
|
|
564
807
|
handleToggleFilters
|
|
565
|
-
}), /* @__PURE__ */
|
|
808
|
+
}), /* @__PURE__ */ React__default.createElement(Divider, {
|
|
566
809
|
className: classes.divider,
|
|
567
810
|
orientation: "vertical"
|
|
568
|
-
}), /* @__PURE__ */
|
|
811
|
+
}), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
569
812
|
item: true,
|
|
570
813
|
xs: 12
|
|
571
|
-
}, searchQuery ? /* @__PURE__ */
|
|
814
|
+
}, searchQuery ? /* @__PURE__ */ React__default.createElement(Typography, {
|
|
572
815
|
variant: "h6"
|
|
573
|
-
}, `${numberOfResults} `, numberOfResults > 1 ? `results for ` : `result for `, /* @__PURE__ */
|
|
816
|
+
}, `${numberOfResults} `, numberOfResults > 1 ? `results for ` : `result for `, /* @__PURE__ */ React__default.createElement("span", {
|
|
574
817
|
className: classes.searchQuery
|
|
575
|
-
}, '"', searchQuery, '"'), " ") : /* @__PURE__ */
|
|
818
|
+
}, '"', searchQuery, '"'), " ") : /* @__PURE__ */ React__default.createElement(Typography, {
|
|
576
819
|
variant: "h6"
|
|
577
820
|
}, `${numberOfResults} results`)));
|
|
578
821
|
};
|
|
579
|
-
const SearchResult
|
|
822
|
+
const SearchResult = ({searchQuery}) => {
|
|
580
823
|
const catalogApi = useApi(catalogApiRef);
|
|
581
824
|
const [showFilters, toggleFilters] = useState(false);
|
|
582
825
|
const [selectedFilters, setSelectedFilters] = useState({
|
|
@@ -621,15 +864,15 @@ const SearchResult$1 = ({searchQuery}) => {
|
|
|
621
864
|
}
|
|
622
865
|
}, [selectedFilters, searchQuery, results]);
|
|
623
866
|
if (loading) {
|
|
624
|
-
return /* @__PURE__ */
|
|
867
|
+
return /* @__PURE__ */ React__default.createElement(Progress, null);
|
|
625
868
|
}
|
|
626
869
|
if (error) {
|
|
627
|
-
return /* @__PURE__ */
|
|
870
|
+
return /* @__PURE__ */ React__default.createElement(Alert, {
|
|
628
871
|
severity: "error"
|
|
629
872
|
}, "Error encountered while fetching search results. ", error.toString());
|
|
630
873
|
}
|
|
631
874
|
if (!results || results.length === 0) {
|
|
632
|
-
return /* @__PURE__ */
|
|
875
|
+
return /* @__PURE__ */ React__default.createElement(EmptyState, {
|
|
633
876
|
missing: "data",
|
|
634
877
|
title: "Sorry, no results were found"
|
|
635
878
|
});
|
|
@@ -671,25 +914,25 @@ const SearchResult$1 = ({searchQuery}) => {
|
|
|
671
914
|
kind: [],
|
|
672
915
|
lifecycle: []
|
|
673
916
|
});
|
|
674
|
-
return /* @__PURE__ */
|
|
917
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
675
918
|
container: true
|
|
676
|
-
}, showFilters && /* @__PURE__ */
|
|
919
|
+
}, showFilters && /* @__PURE__ */ React__default.createElement(Grid, {
|
|
677
920
|
item: true,
|
|
678
921
|
xs: 3
|
|
679
|
-
}, /* @__PURE__ */
|
|
922
|
+
}, /* @__PURE__ */ React__default.createElement(Filters, {
|
|
680
923
|
filters: selectedFilters,
|
|
681
924
|
filterOptions,
|
|
682
925
|
resetFilters,
|
|
683
926
|
updateSelected,
|
|
684
927
|
updateChecked
|
|
685
|
-
})), /* @__PURE__ */
|
|
928
|
+
})), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
686
929
|
item: true,
|
|
687
930
|
xs: showFilters ? 9 : 12
|
|
688
|
-
}, /* @__PURE__ */
|
|
931
|
+
}, /* @__PURE__ */ React__default.createElement(Table, {
|
|
689
932
|
options: {paging: true, pageSize: 20, search: false},
|
|
690
933
|
data: filteredResults,
|
|
691
934
|
columns,
|
|
692
|
-
title: /* @__PURE__ */
|
|
935
|
+
title: /* @__PURE__ */ React__default.createElement(TableHeader, {
|
|
693
936
|
searchQuery,
|
|
694
937
|
numberOfResults: filteredResults.length,
|
|
695
938
|
numberOfSelectedFilters: (selectedFilters.selected !== "" ? 1 : 0) + selectedFilters.checked.length,
|
|
@@ -712,24 +955,24 @@ const LegacySearchPage = () => {
|
|
|
712
955
|
const handleClearSearchBar = () => {
|
|
713
956
|
setSearchQuery("");
|
|
714
957
|
};
|
|
715
|
-
return /* @__PURE__ */
|
|
958
|
+
return /* @__PURE__ */ React__default.createElement(Page, {
|
|
716
959
|
themeId: "home"
|
|
717
|
-
}, /* @__PURE__ */
|
|
960
|
+
}, /* @__PURE__ */ React__default.createElement(Header, {
|
|
718
961
|
title: "Search"
|
|
719
|
-
}), /* @__PURE__ */
|
|
962
|
+
}), /* @__PURE__ */ React__default.createElement(Content, null, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
720
963
|
container: true,
|
|
721
964
|
direction: "row"
|
|
722
|
-
}, /* @__PURE__ */
|
|
965
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
723
966
|
item: true,
|
|
724
967
|
xs: 12
|
|
725
|
-
}, /* @__PURE__ */
|
|
968
|
+
}, /* @__PURE__ */ React__default.createElement(SearchBar, {
|
|
726
969
|
handleSearch,
|
|
727
970
|
handleClearSearchBar,
|
|
728
971
|
searchQuery
|
|
729
|
-
})), /* @__PURE__ */
|
|
972
|
+
})), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
730
973
|
item: true,
|
|
731
974
|
xs: 12
|
|
732
|
-
}, /* @__PURE__ */
|
|
975
|
+
}, /* @__PURE__ */ React__default.createElement(SearchResult, {
|
|
733
976
|
searchQuery: (queryString != null ? queryString : "").toLocaleLowerCase("en-US")
|
|
734
977
|
})))));
|
|
735
978
|
};
|
|
@@ -777,41 +1020,9 @@ const UrlUpdater = () => {
|
|
|
777
1020
|
}, [term, types, pageCursor, filters]);
|
|
778
1021
|
return null;
|
|
779
1022
|
};
|
|
780
|
-
const SearchPage
|
|
1023
|
+
const SearchPage = () => {
|
|
781
1024
|
const outlet = useOutlet();
|
|
782
|
-
return /* @__PURE__ */
|
|
783
|
-
};
|
|
784
|
-
|
|
785
|
-
const useStyles$1 = makeStyles((theme) => ({
|
|
786
|
-
root: {
|
|
787
|
-
display: "flex",
|
|
788
|
-
justifyContent: "space-between",
|
|
789
|
-
gap: theme.spacing(2),
|
|
790
|
-
margin: theme.spacing(4)
|
|
791
|
-
}
|
|
792
|
-
}));
|
|
793
|
-
const SearchResultPager = () => {
|
|
794
|
-
const {fetchNextPage, fetchPreviousPage} = useSearch();
|
|
795
|
-
const classes = useStyles$1();
|
|
796
|
-
if (!fetchNextPage && !fetchPreviousPage) {
|
|
797
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
798
|
-
}
|
|
799
|
-
return /* @__PURE__ */ React.createElement("nav", {
|
|
800
|
-
"arial-label": "pagination navigation",
|
|
801
|
-
className: classes.root
|
|
802
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
803
|
-
"aria-label": "previous page",
|
|
804
|
-
disabled: !fetchPreviousPage,
|
|
805
|
-
onClick: fetchPreviousPage,
|
|
806
|
-
startIcon: /* @__PURE__ */ React.createElement(ArrowBackIosIcon, null),
|
|
807
|
-
size: "small"
|
|
808
|
-
}, "Back"), /* @__PURE__ */ React.createElement(Button, {
|
|
809
|
-
"aria-label": "next page",
|
|
810
|
-
disabled: !fetchNextPage,
|
|
811
|
-
onClick: fetchNextPage,
|
|
812
|
-
endIcon: /* @__PURE__ */ React.createElement(ArrowForwardIosIcon, null),
|
|
813
|
-
size: "small"
|
|
814
|
-
}, "Next"));
|
|
1025
|
+
return /* @__PURE__ */ React__default.createElement(SearchContextProvider, null, /* @__PURE__ */ React__default.createElement(UrlUpdater, null), outlet || /* @__PURE__ */ React__default.createElement(LegacySearchPage, null));
|
|
815
1026
|
};
|
|
816
1027
|
|
|
817
1028
|
const useStyles = makeStyles((theme) => ({
|
|
@@ -848,109 +1059,38 @@ const SearchType = ({
|
|
|
848
1059
|
const value = e.target.value;
|
|
849
1060
|
setTypes(value);
|
|
850
1061
|
};
|
|
851
|
-
return /* @__PURE__ */
|
|
1062
|
+
return /* @__PURE__ */ React__default.createElement(FormControl, {
|
|
852
1063
|
className,
|
|
853
1064
|
variant: "filled",
|
|
854
1065
|
fullWidth: true,
|
|
855
1066
|
"data-testid": "search-typefilter-next"
|
|
856
|
-
}, /* @__PURE__ */
|
|
1067
|
+
}, /* @__PURE__ */ React__default.createElement(InputLabel, {
|
|
857
1068
|
className: classes.label,
|
|
858
1069
|
margin: "dense"
|
|
859
|
-
}, name), /* @__PURE__ */
|
|
1070
|
+
}, name), /* @__PURE__ */ React__default.createElement(Select, {
|
|
860
1071
|
multiple: true,
|
|
861
1072
|
variant: "outlined",
|
|
862
1073
|
value: types,
|
|
863
1074
|
onChange: handleChange,
|
|
864
1075
|
placeholder: "All Results",
|
|
865
|
-
renderValue: (selected) => /* @__PURE__ */
|
|
1076
|
+
renderValue: (selected) => /* @__PURE__ */ React__default.createElement("div", {
|
|
866
1077
|
className: classes.chips
|
|
867
|
-
}, selected.map((value) => /* @__PURE__ */
|
|
1078
|
+
}, selected.map((value) => /* @__PURE__ */ React__default.createElement(Chip, {
|
|
868
1079
|
key: value,
|
|
869
1080
|
label: value,
|
|
870
1081
|
className: classes.chip,
|
|
871
1082
|
size: "small"
|
|
872
1083
|
})))
|
|
873
|
-
}, values.map((value) => /* @__PURE__ */
|
|
1084
|
+
}, values.map((value) => /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
874
1085
|
key: value,
|
|
875
1086
|
value
|
|
876
|
-
}, /* @__PURE__ */
|
|
1087
|
+
}, /* @__PURE__ */ React__default.createElement(Checkbox, {
|
|
877
1088
|
checked: types.indexOf(value) > -1
|
|
878
|
-
}), /* @__PURE__ */
|
|
1089
|
+
}), /* @__PURE__ */ React__default.createElement(ListItemText, {
|
|
879
1090
|
primary: value
|
|
880
1091
|
})))));
|
|
881
1092
|
};
|
|
882
1093
|
|
|
883
|
-
const rootRouteRef = createRouteRef({
|
|
884
|
-
path: "/search",
|
|
885
|
-
title: "search"
|
|
886
|
-
});
|
|
887
|
-
const rootNextRouteRef = createRouteRef({
|
|
888
|
-
path: "/search-next",
|
|
889
|
-
title: "search"
|
|
890
|
-
});
|
|
891
|
-
const searchPlugin = createPlugin({
|
|
892
|
-
id: "search",
|
|
893
|
-
apis: [
|
|
894
|
-
createApiFactory({
|
|
895
|
-
api: searchApiRef,
|
|
896
|
-
deps: {discoveryApi: discoveryApiRef, identityApi: identityApiRef},
|
|
897
|
-
factory: ({discoveryApi, identityApi}) => {
|
|
898
|
-
return new SearchClient({discoveryApi, identityApi});
|
|
899
|
-
}
|
|
900
|
-
})
|
|
901
|
-
],
|
|
902
|
-
routes: {
|
|
903
|
-
root: rootRouteRef,
|
|
904
|
-
nextRoot: rootNextRouteRef
|
|
905
|
-
}
|
|
906
|
-
});
|
|
907
|
-
const SearchPage = searchPlugin.provide(createRoutableExtension({
|
|
908
|
-
name: "SearchPage",
|
|
909
|
-
component: () => import('./index-9891a3b0.esm.js').then((m) => m.SearchPage),
|
|
910
|
-
mountPoint: rootRouteRef
|
|
911
|
-
}));
|
|
912
|
-
const SearchPageNext = searchPlugin.provide(createRoutableExtension({
|
|
913
|
-
name: "SearchPageNext",
|
|
914
|
-
component: () => import('./index-9891a3b0.esm.js').then((m) => m.SearchPage),
|
|
915
|
-
mountPoint: rootNextRouteRef
|
|
916
|
-
}));
|
|
917
|
-
searchPlugin.provide(createComponentExtension({
|
|
918
|
-
name: "SearchBar",
|
|
919
|
-
component: {
|
|
920
|
-
lazy: () => import('./index-f3589f7b.esm.js').then((m) => m.SearchBar)
|
|
921
|
-
}
|
|
922
|
-
}));
|
|
923
|
-
const SearchBarNext = searchPlugin.provide(createComponentExtension({
|
|
924
|
-
name: "SearchBarNext",
|
|
925
|
-
component: {
|
|
926
|
-
lazy: () => import('./index-f3589f7b.esm.js').then((m) => m.SearchBar)
|
|
927
|
-
}
|
|
928
|
-
}));
|
|
929
|
-
const SearchResult = searchPlugin.provide(createComponentExtension({
|
|
930
|
-
name: "SearchResult",
|
|
931
|
-
component: {
|
|
932
|
-
lazy: () => import('./index-4afbd577.esm.js').then((m) => m.SearchResult)
|
|
933
|
-
}
|
|
934
|
-
}));
|
|
935
|
-
searchPlugin.provide(createComponentExtension({
|
|
936
|
-
name: "SearchResultNext",
|
|
937
|
-
component: {
|
|
938
|
-
lazy: () => import('./index-4afbd577.esm.js').then((m) => m.SearchResult)
|
|
939
|
-
}
|
|
940
|
-
}));
|
|
941
|
-
const DefaultResultListItem = searchPlugin.provide(createComponentExtension({
|
|
942
|
-
name: "DefaultResultListItem",
|
|
943
|
-
component: {
|
|
944
|
-
lazy: () => import('./index-92a9e2ec.esm.js').then((m) => m.DefaultResultListItem)
|
|
945
|
-
}
|
|
946
|
-
}));
|
|
947
|
-
const HomePageSearchBar = searchPlugin.provide(createComponentExtension({
|
|
948
|
-
name: "HomePageSearchBar",
|
|
949
|
-
component: {
|
|
950
|
-
lazy: () => import('./index-9b6a3ac1.esm.js').then((m) => m.HomePageSearchBar)
|
|
951
|
-
}
|
|
952
|
-
}));
|
|
953
|
-
|
|
954
1094
|
const SidebarSearch = () => {
|
|
955
1095
|
const searchRoute = useRouteRef(rootRouteRef);
|
|
956
1096
|
const navigate = useNavigate();
|
|
@@ -958,11 +1098,11 @@ const SidebarSearch = () => {
|
|
|
958
1098
|
const queryString = qs.stringify({query}, {addQueryPrefix: true});
|
|
959
1099
|
navigate(`${searchRoute()}${queryString}`);
|
|
960
1100
|
}, [navigate, searchRoute]);
|
|
961
|
-
return /* @__PURE__ */
|
|
1101
|
+
return /* @__PURE__ */ React__default.createElement(SidebarSearchField, {
|
|
962
1102
|
onSearch: handleSearch,
|
|
963
1103
|
to: "/search"
|
|
964
1104
|
});
|
|
965
1105
|
};
|
|
966
1106
|
|
|
967
|
-
export { DefaultResultListItem as D, Filters$1 as F, HomePageSearchBar as H, SearchPage
|
|
968
|
-
//# sourceMappingURL=index-
|
|
1107
|
+
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 };
|
|
1108
|
+
//# sourceMappingURL=index-cdccd881.esm.js.map
|