@backstage/plugin-search 0.4.13 → 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 +61 -0
- package/dist/esm/{index-5da0411f.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-f5f6f3f0.esm.js → index-17c9e868.esm.js} +364 -217
- 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-03e6e5c1.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-b832898d.esm.js → index-b3bf028c.esm.js} +9 -8
- package/dist/esm/{index-b832898d.esm.js.map → index-b3bf028c.esm.js.map} +1 -1
- package/dist/index.d.ts +13 -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-03e6e5c1.esm.js.map +0 -1
- package/dist/esm/index-329be754.esm.js +0 -46
- package/dist/esm/index-329be754.esm.js.map +0 -1
- package/dist/esm/index-5da0411f.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-f5f6f3f0.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,39 +226,43 @@ 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
|
});
|
|
246
260
|
};
|
|
247
|
-
const SearchBar$1 = ({
|
|
261
|
+
const SearchBar$1 = ({
|
|
262
|
+
className,
|
|
263
|
+
debounceTime = 0,
|
|
264
|
+
placeholder
|
|
265
|
+
}) => {
|
|
248
266
|
const {term, setTerm} = useSearch();
|
|
249
267
|
const [value, setValue] = useState(term);
|
|
250
268
|
useEffect(() => {
|
|
@@ -255,15 +273,16 @@ const SearchBar$1 = ({className, debounceTime = 0}) => {
|
|
|
255
273
|
setValue(newValue);
|
|
256
274
|
};
|
|
257
275
|
const handleClear = () => setValue("");
|
|
258
|
-
return /* @__PURE__ */
|
|
276
|
+
return /* @__PURE__ */ React__default.createElement(SearchBarBase, {
|
|
259
277
|
className,
|
|
260
278
|
value,
|
|
261
279
|
onChange: handleQuery,
|
|
262
|
-
onClear: handleClear
|
|
280
|
+
onClear: handleClear,
|
|
281
|
+
placeholder
|
|
263
282
|
});
|
|
264
283
|
};
|
|
265
284
|
|
|
266
|
-
const useStyles$
|
|
285
|
+
const useStyles$7 = makeStyles({
|
|
267
286
|
label: {
|
|
268
287
|
textTransform: "capitalize"
|
|
269
288
|
}
|
|
@@ -274,7 +293,7 @@ const CheckboxFilter = ({
|
|
|
274
293
|
defaultValue,
|
|
275
294
|
values = []
|
|
276
295
|
}) => {
|
|
277
|
-
const classes = useStyles$
|
|
296
|
+
const classes = useStyles$7();
|
|
278
297
|
const {filters, setFilters} = useSearch();
|
|
279
298
|
useEffect(() => {
|
|
280
299
|
if (Array.isArray(defaultValue)) {
|
|
@@ -295,17 +314,17 @@ const CheckboxFilter = ({
|
|
|
295
314
|
return items.length ? {...others, [name]: items} : others;
|
|
296
315
|
});
|
|
297
316
|
};
|
|
298
|
-
return /* @__PURE__ */
|
|
317
|
+
return /* @__PURE__ */ React__default.createElement(FormControl, {
|
|
299
318
|
className,
|
|
300
319
|
fullWidth: true,
|
|
301
320
|
"data-testid": "search-checkboxfilter-next"
|
|
302
|
-
}, /* @__PURE__ */
|
|
321
|
+
}, /* @__PURE__ */ React__default.createElement(FormLabel, {
|
|
303
322
|
className: classes.label
|
|
304
323
|
}, name), values.map((value) => {
|
|
305
324
|
var _a;
|
|
306
|
-
return /* @__PURE__ */
|
|
325
|
+
return /* @__PURE__ */ React__default.createElement(FormControlLabel, {
|
|
307
326
|
key: value,
|
|
308
|
-
control: /* @__PURE__ */
|
|
327
|
+
control: /* @__PURE__ */ React__default.createElement(Checkbox, {
|
|
309
328
|
color: "primary",
|
|
310
329
|
tabIndex: -1,
|
|
311
330
|
inputProps: {"aria-labelledby": value},
|
|
@@ -324,7 +343,7 @@ const SelectFilter = ({
|
|
|
324
343
|
defaultValue,
|
|
325
344
|
values = []
|
|
326
345
|
}) => {
|
|
327
|
-
const classes = useStyles$
|
|
346
|
+
const classes = useStyles$7();
|
|
328
347
|
const {filters, setFilters} = useSearch();
|
|
329
348
|
useEffect(() => {
|
|
330
349
|
if (typeof defaultValue === "string") {
|
|
@@ -343,39 +362,262 @@ const SelectFilter = ({
|
|
|
343
362
|
return value ? {...others, [name]: value} : others;
|
|
344
363
|
});
|
|
345
364
|
};
|
|
346
|
-
return /* @__PURE__ */
|
|
365
|
+
return /* @__PURE__ */ React__default.createElement(FormControl, {
|
|
347
366
|
className,
|
|
348
367
|
variant: "filled",
|
|
349
368
|
fullWidth: true,
|
|
350
369
|
"data-testid": "search-selectfilter-next"
|
|
351
|
-
}, /* @__PURE__ */
|
|
370
|
+
}, /* @__PURE__ */ React__default.createElement(InputLabel, {
|
|
352
371
|
className: classes.label,
|
|
353
372
|
margin: "dense"
|
|
354
|
-
}, name), /* @__PURE__ */
|
|
373
|
+
}, name), /* @__PURE__ */ React__default.createElement(Select, {
|
|
355
374
|
variant: "outlined",
|
|
356
375
|
value: filters[name] || "",
|
|
357
376
|
onChange: handleChange
|
|
358
|
-
}, /* @__PURE__ */
|
|
377
|
+
}, /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
359
378
|
value: ""
|
|
360
|
-
}, /* @__PURE__ */
|
|
379
|
+
}, /* @__PURE__ */ React__default.createElement("em", null, "All")), values.map((value) => /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
361
380
|
key: value,
|
|
362
381
|
value
|
|
363
382
|
}, value))));
|
|
364
383
|
};
|
|
365
|
-
const SearchFilter = ({component: Element, ...props}) => /* @__PURE__ */
|
|
384
|
+
const SearchFilter = ({component: Element, ...props}) => /* @__PURE__ */ React__default.createElement(Element, {
|
|
366
385
|
...props
|
|
367
386
|
});
|
|
368
|
-
SearchFilter.Checkbox = (props) => /* @__PURE__ */
|
|
387
|
+
SearchFilter.Checkbox = (props) => /* @__PURE__ */ React__default.createElement(SearchFilter, {
|
|
369
388
|
...props,
|
|
370
389
|
component: CheckboxFilter
|
|
371
390
|
});
|
|
372
|
-
SearchFilter.Select = (props) => /* @__PURE__ */
|
|
391
|
+
SearchFilter.Select = (props) => /* @__PURE__ */ React__default.createElement(SearchFilter, {
|
|
373
392
|
...props,
|
|
374
393
|
component: SelectFilter
|
|
375
394
|
});
|
|
376
395
|
const SearchFilterNext = SearchFilter;
|
|
377
396
|
|
|
378
|
-
|
|
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(() => ({
|
|
379
621
|
root: {
|
|
380
622
|
display: "flex",
|
|
381
623
|
alignItems: "center"
|
|
@@ -389,28 +631,28 @@ const SearchBar = ({
|
|
|
389
631
|
handleSearch,
|
|
390
632
|
handleClearSearchBar
|
|
391
633
|
}) => {
|
|
392
|
-
const classes = useStyles$
|
|
393
|
-
return /* @__PURE__ */
|
|
634
|
+
const classes = useStyles$4();
|
|
635
|
+
return /* @__PURE__ */ React__default.createElement(Paper, {
|
|
394
636
|
component: "form",
|
|
395
637
|
onSubmit: (e) => handleSearch(e),
|
|
396
638
|
className: classes.root
|
|
397
|
-
}, /* @__PURE__ */
|
|
639
|
+
}, /* @__PURE__ */ React__default.createElement(IconButton$1, {
|
|
398
640
|
disabled: true,
|
|
399
641
|
type: "submit",
|
|
400
642
|
"aria-label": "search"
|
|
401
|
-
}, /* @__PURE__ */
|
|
643
|
+
}, /* @__PURE__ */ React__default.createElement(SearchIcon, null)), /* @__PURE__ */ React__default.createElement(InputBase$1, {
|
|
402
644
|
className: classes.input,
|
|
403
645
|
placeholder: "Search in Backstage",
|
|
404
646
|
value: searchQuery,
|
|
405
647
|
onChange: (e) => handleSearch(e),
|
|
406
648
|
inputProps: {"aria-label": "search backstage"}
|
|
407
|
-
}), /* @__PURE__ */
|
|
649
|
+
}), /* @__PURE__ */ React__default.createElement(IconButton$1, {
|
|
408
650
|
"aria-label": "search",
|
|
409
651
|
onClick: () => handleClearSearchBar()
|
|
410
|
-
}, /* @__PURE__ */
|
|
652
|
+
}, /* @__PURE__ */ React__default.createElement(ClearButton, null)));
|
|
411
653
|
};
|
|
412
654
|
|
|
413
|
-
const useStyles$
|
|
655
|
+
const useStyles$3 = makeStyles((theme) => ({
|
|
414
656
|
filters: {
|
|
415
657
|
width: "250px",
|
|
416
658
|
display: "flex"
|
|
@@ -423,19 +665,19 @@ const FiltersButton = ({
|
|
|
423
665
|
numberOfSelectedFilters,
|
|
424
666
|
handleToggleFilters
|
|
425
667
|
}) => {
|
|
426
|
-
const classes = useStyles$
|
|
427
|
-
return /* @__PURE__ */
|
|
668
|
+
const classes = useStyles$3();
|
|
669
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
428
670
|
className: classes.filters
|
|
429
|
-
}, /* @__PURE__ */
|
|
671
|
+
}, /* @__PURE__ */ React__default.createElement(IconButton, {
|
|
430
672
|
className: classes.icon,
|
|
431
673
|
"aria-label": "settings",
|
|
432
674
|
onClick: handleToggleFilters
|
|
433
|
-
}, /* @__PURE__ */
|
|
675
|
+
}, /* @__PURE__ */ React__default.createElement(FilterListIcon, null)), /* @__PURE__ */ React__default.createElement(Typography, {
|
|
434
676
|
variant: "h6"
|
|
435
677
|
}, "Filters (", numberOfSelectedFilters ? numberOfSelectedFilters : 0, ")"));
|
|
436
678
|
};
|
|
437
679
|
|
|
438
|
-
const useStyles$
|
|
680
|
+
const useStyles$2 = makeStyles((theme) => ({
|
|
439
681
|
filters: {
|
|
440
682
|
background: "transparent",
|
|
441
683
|
boxShadow: "0px 0px 0px 0px"
|
|
@@ -454,22 +696,22 @@ const Filters = ({
|
|
|
454
696
|
updateSelected,
|
|
455
697
|
updateChecked
|
|
456
698
|
}) => {
|
|
457
|
-
const classes = useStyles$
|
|
458
|
-
return /* @__PURE__ */
|
|
699
|
+
const classes = useStyles$2();
|
|
700
|
+
return /* @__PURE__ */ React__default.createElement(Card, {
|
|
459
701
|
className: classes.filters
|
|
460
|
-
}, /* @__PURE__ */
|
|
461
|
-
title: /* @__PURE__ */
|
|
702
|
+
}, /* @__PURE__ */ React__default.createElement(CardHeader, {
|
|
703
|
+
title: /* @__PURE__ */ React__default.createElement(Typography, {
|
|
462
704
|
variant: "h6"
|
|
463
705
|
}, "Filters"),
|
|
464
|
-
action: /* @__PURE__ */
|
|
706
|
+
action: /* @__PURE__ */ React__default.createElement(Button, {
|
|
465
707
|
color: "primary",
|
|
466
708
|
onClick: () => resetFilters()
|
|
467
709
|
}, "CLEAR ALL")
|
|
468
|
-
}), /* @__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, {
|
|
469
711
|
variant: "subtitle2"
|
|
470
|
-
}, "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, {
|
|
471
713
|
variant: "subtitle2"
|
|
472
|
-
}, "Kind"), /* @__PURE__ */
|
|
714
|
+
}, "Kind"), /* @__PURE__ */ React__default.createElement(Select, {
|
|
473
715
|
id: "outlined-select",
|
|
474
716
|
onChange: (e) => {
|
|
475
717
|
var _a;
|
|
@@ -478,22 +720,22 @@ const Filters = ({
|
|
|
478
720
|
variant: "outlined",
|
|
479
721
|
className: classes.dropdown,
|
|
480
722
|
value: filters.selected
|
|
481
|
-
}, filterOptions.kind.map((filter) => /* @__PURE__ */
|
|
723
|
+
}, filterOptions.kind.map((filter) => /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
482
724
|
selected: filter === "",
|
|
483
725
|
dense: true,
|
|
484
726
|
key: filter,
|
|
485
727
|
value: filter
|
|
486
|
-
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */
|
|
728
|
+
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */ React__default.createElement(CardContent, null, /* @__PURE__ */ React__default.createElement(Typography, {
|
|
487
729
|
variant: "subtitle2"
|
|
488
|
-
}, "Lifecycle"), /* @__PURE__ */
|
|
730
|
+
}, "Lifecycle"), /* @__PURE__ */ React__default.createElement(List, {
|
|
489
731
|
disablePadding: true,
|
|
490
732
|
dense: true
|
|
491
|
-
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */
|
|
733
|
+
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */ React__default.createElement(ListItem, {
|
|
492
734
|
key: filter,
|
|
493
735
|
dense: true,
|
|
494
736
|
button: true,
|
|
495
737
|
onClick: () => updateChecked(filter)
|
|
496
|
-
}, /* @__PURE__ */
|
|
738
|
+
}, /* @__PURE__ */ React__default.createElement(Checkbox, {
|
|
497
739
|
edge: "start",
|
|
498
740
|
disableRipple: true,
|
|
499
741
|
className: classes.checkbox,
|
|
@@ -502,13 +744,13 @@ const Filters = ({
|
|
|
502
744
|
tabIndex: -1,
|
|
503
745
|
value: filter,
|
|
504
746
|
name: filter
|
|
505
|
-
}), /* @__PURE__ */
|
|
747
|
+
}), /* @__PURE__ */ React__default.createElement(ListItemText, {
|
|
506
748
|
id: filter,
|
|
507
749
|
primary: filter
|
|
508
750
|
}))))));
|
|
509
751
|
};
|
|
510
752
|
|
|
511
|
-
const useStyles$
|
|
753
|
+
const useStyles$1 = makeStyles((theme) => ({
|
|
512
754
|
searchQuery: {
|
|
513
755
|
color: theme.palette.text.primary,
|
|
514
756
|
background: theme.palette.background.default,
|
|
@@ -529,7 +771,7 @@ const columns = [
|
|
|
529
771
|
title: "Name",
|
|
530
772
|
field: "name",
|
|
531
773
|
highlight: true,
|
|
532
|
-
render: (result) => /* @__PURE__ */
|
|
774
|
+
render: (result) => /* @__PURE__ */ React__default.createElement(Link, {
|
|
533
775
|
to: result.url || ""
|
|
534
776
|
}, result.name)
|
|
535
777
|
},
|
|
@@ -556,27 +798,27 @@ const TableHeader = ({
|
|
|
556
798
|
numberOfResults,
|
|
557
799
|
handleToggleFilters
|
|
558
800
|
}) => {
|
|
559
|
-
const classes = useStyles$
|
|
560
|
-
return /* @__PURE__ */
|
|
801
|
+
const classes = useStyles$1();
|
|
802
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
561
803
|
className: classes.tableHeader
|
|
562
|
-
}, /* @__PURE__ */
|
|
804
|
+
}, /* @__PURE__ */ React__default.createElement(FiltersButton, {
|
|
563
805
|
numberOfSelectedFilters,
|
|
564
806
|
handleToggleFilters
|
|
565
|
-
}), /* @__PURE__ */
|
|
807
|
+
}), /* @__PURE__ */ React__default.createElement(Divider, {
|
|
566
808
|
className: classes.divider,
|
|
567
809
|
orientation: "vertical"
|
|
568
|
-
}), /* @__PURE__ */
|
|
810
|
+
}), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
569
811
|
item: true,
|
|
570
812
|
xs: 12
|
|
571
|
-
}, searchQuery ? /* @__PURE__ */
|
|
813
|
+
}, searchQuery ? /* @__PURE__ */ React__default.createElement(Typography, {
|
|
572
814
|
variant: "h6"
|
|
573
|
-
}, `${numberOfResults} `, numberOfResults > 1 ? `results for ` : `result for `, /* @__PURE__ */
|
|
815
|
+
}, `${numberOfResults} `, numberOfResults > 1 ? `results for ` : `result for `, /* @__PURE__ */ React__default.createElement("span", {
|
|
574
816
|
className: classes.searchQuery
|
|
575
|
-
}, '"', searchQuery, '"'), " ") : /* @__PURE__ */
|
|
817
|
+
}, '"', searchQuery, '"'), " ") : /* @__PURE__ */ React__default.createElement(Typography, {
|
|
576
818
|
variant: "h6"
|
|
577
819
|
}, `${numberOfResults} results`)));
|
|
578
820
|
};
|
|
579
|
-
const SearchResult
|
|
821
|
+
const SearchResult = ({searchQuery}) => {
|
|
580
822
|
const catalogApi = useApi(catalogApiRef);
|
|
581
823
|
const [showFilters, toggleFilters] = useState(false);
|
|
582
824
|
const [selectedFilters, setSelectedFilters] = useState({
|
|
@@ -598,7 +840,7 @@ const SearchResult$1 = ({searchQuery}) => {
|
|
|
598
840
|
owner: typeof ((_a = entity.spec) == null ? void 0 : _a.owner) === "string" ? (_b = entity.spec) == null ? void 0 : _b.owner : void 0,
|
|
599
841
|
kind: entity.kind,
|
|
600
842
|
lifecycle: typeof ((_c = entity.spec) == null ? void 0 : _c.lifecycle) === "string" ? (_d = entity.spec) == null ? void 0 : _d.lifecycle : void 0,
|
|
601
|
-
url: `/catalog/${((_e = entity.metadata.namespace) == null ? void 0 : _e.
|
|
843
|
+
url: `/catalog/${((_e = entity.metadata.namespace) == null ? void 0 : _e.toLocaleLowerCase("en-US")) || ENTITY_DEFAULT_NAMESPACE}/${entity.kind.toLocaleLowerCase("en-US")}/${entity.metadata.name}`
|
|
602
844
|
};
|
|
603
845
|
});
|
|
604
846
|
}, []);
|
|
@@ -621,15 +863,15 @@ const SearchResult$1 = ({searchQuery}) => {
|
|
|
621
863
|
}
|
|
622
864
|
}, [selectedFilters, searchQuery, results]);
|
|
623
865
|
if (loading) {
|
|
624
|
-
return /* @__PURE__ */
|
|
866
|
+
return /* @__PURE__ */ React__default.createElement(Progress, null);
|
|
625
867
|
}
|
|
626
868
|
if (error) {
|
|
627
|
-
return /* @__PURE__ */
|
|
869
|
+
return /* @__PURE__ */ React__default.createElement(Alert, {
|
|
628
870
|
severity: "error"
|
|
629
871
|
}, "Error encountered while fetching search results. ", error.toString());
|
|
630
872
|
}
|
|
631
873
|
if (!results || results.length === 0) {
|
|
632
|
-
return /* @__PURE__ */
|
|
874
|
+
return /* @__PURE__ */ React__default.createElement(EmptyState, {
|
|
633
875
|
missing: "data",
|
|
634
876
|
title: "Sorry, no results were found"
|
|
635
877
|
});
|
|
@@ -671,25 +913,25 @@ const SearchResult$1 = ({searchQuery}) => {
|
|
|
671
913
|
kind: [],
|
|
672
914
|
lifecycle: []
|
|
673
915
|
});
|
|
674
|
-
return /* @__PURE__ */
|
|
916
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
675
917
|
container: true
|
|
676
|
-
}, showFilters && /* @__PURE__ */
|
|
918
|
+
}, showFilters && /* @__PURE__ */ React__default.createElement(Grid, {
|
|
677
919
|
item: true,
|
|
678
920
|
xs: 3
|
|
679
|
-
}, /* @__PURE__ */
|
|
921
|
+
}, /* @__PURE__ */ React__default.createElement(Filters, {
|
|
680
922
|
filters: selectedFilters,
|
|
681
923
|
filterOptions,
|
|
682
924
|
resetFilters,
|
|
683
925
|
updateSelected,
|
|
684
926
|
updateChecked
|
|
685
|
-
})), /* @__PURE__ */
|
|
927
|
+
})), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
686
928
|
item: true,
|
|
687
929
|
xs: showFilters ? 9 : 12
|
|
688
|
-
}, /* @__PURE__ */
|
|
930
|
+
}, /* @__PURE__ */ React__default.createElement(Table, {
|
|
689
931
|
options: {paging: true, pageSize: 20, search: false},
|
|
690
932
|
data: filteredResults,
|
|
691
933
|
columns,
|
|
692
|
-
title: /* @__PURE__ */
|
|
934
|
+
title: /* @__PURE__ */ React__default.createElement(TableHeader, {
|
|
693
935
|
searchQuery,
|
|
694
936
|
numberOfResults: filteredResults.length,
|
|
695
937
|
numberOfSelectedFilters: (selectedFilters.selected !== "" ? 1 : 0) + selectedFilters.checked.length,
|
|
@@ -712,24 +954,24 @@ const LegacySearchPage = () => {
|
|
|
712
954
|
const handleClearSearchBar = () => {
|
|
713
955
|
setSearchQuery("");
|
|
714
956
|
};
|
|
715
|
-
return /* @__PURE__ */
|
|
957
|
+
return /* @__PURE__ */ React__default.createElement(Page, {
|
|
716
958
|
themeId: "home"
|
|
717
|
-
}, /* @__PURE__ */
|
|
959
|
+
}, /* @__PURE__ */ React__default.createElement(Header, {
|
|
718
960
|
title: "Search"
|
|
719
|
-
}), /* @__PURE__ */
|
|
961
|
+
}), /* @__PURE__ */ React__default.createElement(Content, null, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
720
962
|
container: true,
|
|
721
963
|
direction: "row"
|
|
722
|
-
}, /* @__PURE__ */
|
|
964
|
+
}, /* @__PURE__ */ React__default.createElement(Grid, {
|
|
723
965
|
item: true,
|
|
724
966
|
xs: 12
|
|
725
|
-
}, /* @__PURE__ */
|
|
967
|
+
}, /* @__PURE__ */ React__default.createElement(SearchBar, {
|
|
726
968
|
handleSearch,
|
|
727
969
|
handleClearSearchBar,
|
|
728
970
|
searchQuery
|
|
729
|
-
})), /* @__PURE__ */
|
|
971
|
+
})), /* @__PURE__ */ React__default.createElement(Grid, {
|
|
730
972
|
item: true,
|
|
731
973
|
xs: 12
|
|
732
|
-
}, /* @__PURE__ */
|
|
974
|
+
}, /* @__PURE__ */ React__default.createElement(SearchResult, {
|
|
733
975
|
searchQuery: (queryString != null ? queryString : "").toLocaleLowerCase("en-US")
|
|
734
976
|
})))));
|
|
735
977
|
};
|
|
@@ -777,41 +1019,9 @@ const UrlUpdater = () => {
|
|
|
777
1019
|
}, [term, types, pageCursor, filters]);
|
|
778
1020
|
return null;
|
|
779
1021
|
};
|
|
780
|
-
const SearchPage
|
|
1022
|
+
const SearchPage = () => {
|
|
781
1023
|
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"));
|
|
1024
|
+
return /* @__PURE__ */ React__default.createElement(SearchContextProvider, null, /* @__PURE__ */ React__default.createElement(UrlUpdater, null), outlet || /* @__PURE__ */ React__default.createElement(LegacySearchPage, null));
|
|
815
1025
|
};
|
|
816
1026
|
|
|
817
1027
|
const useStyles = makeStyles((theme) => ({
|
|
@@ -848,101 +1058,38 @@ const SearchType = ({
|
|
|
848
1058
|
const value = e.target.value;
|
|
849
1059
|
setTypes(value);
|
|
850
1060
|
};
|
|
851
|
-
return /* @__PURE__ */
|
|
1061
|
+
return /* @__PURE__ */ React__default.createElement(FormControl, {
|
|
852
1062
|
className,
|
|
853
1063
|
variant: "filled",
|
|
854
1064
|
fullWidth: true,
|
|
855
1065
|
"data-testid": "search-typefilter-next"
|
|
856
|
-
}, /* @__PURE__ */
|
|
1066
|
+
}, /* @__PURE__ */ React__default.createElement(InputLabel, {
|
|
857
1067
|
className: classes.label,
|
|
858
1068
|
margin: "dense"
|
|
859
|
-
}, name), /* @__PURE__ */
|
|
1069
|
+
}, name), /* @__PURE__ */ React__default.createElement(Select, {
|
|
860
1070
|
multiple: true,
|
|
861
1071
|
variant: "outlined",
|
|
862
1072
|
value: types,
|
|
863
1073
|
onChange: handleChange,
|
|
864
1074
|
placeholder: "All Results",
|
|
865
|
-
renderValue: (selected) => /* @__PURE__ */
|
|
1075
|
+
renderValue: (selected) => /* @__PURE__ */ React__default.createElement("div", {
|
|
866
1076
|
className: classes.chips
|
|
867
|
-
}, selected.map((value) => /* @__PURE__ */
|
|
1077
|
+
}, selected.map((value) => /* @__PURE__ */ React__default.createElement(Chip, {
|
|
868
1078
|
key: value,
|
|
869
1079
|
label: value,
|
|
870
1080
|
className: classes.chip,
|
|
871
1081
|
size: "small"
|
|
872
1082
|
})))
|
|
873
|
-
}, values.map((value) => /* @__PURE__ */
|
|
1083
|
+
}, values.map((value) => /* @__PURE__ */ React__default.createElement(MenuItem, {
|
|
874
1084
|
key: value,
|
|
875
1085
|
value
|
|
876
|
-
}, /* @__PURE__ */
|
|
1086
|
+
}, /* @__PURE__ */ React__default.createElement(Checkbox, {
|
|
877
1087
|
checked: types.indexOf(value) > -1
|
|
878
|
-
}), /* @__PURE__ */
|
|
1088
|
+
}), /* @__PURE__ */ React__default.createElement(ListItemText, {
|
|
879
1089
|
primary: value
|
|
880
1090
|
})))));
|
|
881
1091
|
};
|
|
882
1092
|
|
|
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
|
-
component: () => import('./index-03e6e5c1.esm.js').then((m) => m.SearchPage),
|
|
909
|
-
mountPoint: rootRouteRef
|
|
910
|
-
}));
|
|
911
|
-
const SearchPageNext = searchPlugin.provide(createRoutableExtension({
|
|
912
|
-
component: () => import('./index-03e6e5c1.esm.js').then((m) => m.SearchPage),
|
|
913
|
-
mountPoint: rootNextRouteRef
|
|
914
|
-
}));
|
|
915
|
-
searchPlugin.provide(createComponentExtension({
|
|
916
|
-
component: {
|
|
917
|
-
lazy: () => import('./index-5da0411f.esm.js').then((m) => m.SearchBar)
|
|
918
|
-
}
|
|
919
|
-
}));
|
|
920
|
-
const SearchBarNext = searchPlugin.provide(createComponentExtension({
|
|
921
|
-
component: {
|
|
922
|
-
lazy: () => import('./index-5da0411f.esm.js').then((m) => m.SearchBar)
|
|
923
|
-
}
|
|
924
|
-
}));
|
|
925
|
-
const SearchResult = searchPlugin.provide(createComponentExtension({
|
|
926
|
-
component: {
|
|
927
|
-
lazy: () => import('./index-329be754.esm.js').then((m) => m.SearchResult)
|
|
928
|
-
}
|
|
929
|
-
}));
|
|
930
|
-
searchPlugin.provide(createComponentExtension({
|
|
931
|
-
component: {
|
|
932
|
-
lazy: () => import('./index-329be754.esm.js').then((m) => m.SearchResult)
|
|
933
|
-
}
|
|
934
|
-
}));
|
|
935
|
-
const DefaultResultListItem = searchPlugin.provide(createComponentExtension({
|
|
936
|
-
component: {
|
|
937
|
-
lazy: () => import('./index-92a9e2ec.esm.js').then((m) => m.DefaultResultListItem)
|
|
938
|
-
}
|
|
939
|
-
}));
|
|
940
|
-
const HomePageSearchBar = searchPlugin.provide(createComponentExtension({
|
|
941
|
-
component: {
|
|
942
|
-
lazy: () => import('./index-b832898d.esm.js').then((m) => m.HomePageSearchBar)
|
|
943
|
-
}
|
|
944
|
-
}));
|
|
945
|
-
|
|
946
1093
|
const SidebarSearch = () => {
|
|
947
1094
|
const searchRoute = useRouteRef(rootRouteRef);
|
|
948
1095
|
const navigate = useNavigate();
|
|
@@ -950,11 +1097,11 @@ const SidebarSearch = () => {
|
|
|
950
1097
|
const queryString = qs.stringify({query}, {addQueryPrefix: true});
|
|
951
1098
|
navigate(`${searchRoute()}${queryString}`);
|
|
952
1099
|
}, [navigate, searchRoute]);
|
|
953
|
-
return /* @__PURE__ */
|
|
1100
|
+
return /* @__PURE__ */ React__default.createElement(SidebarSearchField, {
|
|
954
1101
|
onSearch: handleSearch,
|
|
955
1102
|
to: "/search"
|
|
956
1103
|
});
|
|
957
1104
|
};
|
|
958
1105
|
|
|
959
|
-
export { DefaultResultListItem as D, Filters$1 as F, HomePageSearchBar as H, SearchPage
|
|
960
|
-
//# 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
|