@backstage/plugin-search 0.5.2 → 0.5.6-next.0
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 +49 -0
- package/dist/esm/{index-0a2fab21.esm.js → index-1c086301.esm.js} +11 -6
- package/dist/esm/index-1c086301.esm.js.map +1 -0
- package/dist/esm/{index-655809db.esm.js → index-1eb3943d.esm.js} +365 -227
- package/dist/esm/index-1eb3943d.esm.js.map +1 -0
- package/dist/esm/{index-a71e930d.esm.js → index-28edd923.esm.js} +11 -6
- package/dist/esm/index-28edd923.esm.js.map +1 -0
- package/dist/esm/{index-af05ea86.esm.js → index-6ca40e41.esm.js} +13 -8
- package/dist/esm/{index-af05ea86.esm.js.map → index-6ca40e41.esm.js.map} +1 -1
- package/dist/esm/index-85c3d310.esm.js +69 -0
- package/dist/esm/index-85c3d310.esm.js.map +1 -0
- package/dist/esm/{index-18219c65.esm.js → index-9b4814a6.esm.js} +11 -6
- package/dist/esm/index-9b4814a6.esm.js.map +1 -0
- package/dist/esm/{index-2a318193.esm.js → index-e7aaeef5.esm.js} +11 -6
- package/dist/esm/index-e7aaeef5.esm.js.map +1 -0
- package/dist/index.d.ts +50 -9
- package/dist/index.esm.js +12 -7
- package/dist/index.esm.js.map +1 -1
- package/package.json +12 -12
- package/dist/esm/index-0a2fab21.esm.js.map +0 -1
- package/dist/esm/index-18219c65.esm.js.map +0 -1
- package/dist/esm/index-2a318193.esm.js.map +0 -1
- package/dist/esm/index-655809db.esm.js.map +0 -1
- package/dist/esm/index-a71e930d.esm.js.map +0 -1
- package/dist/esm/index-d5ddea91.esm.js +0 -23
- package/dist/esm/index-d5ddea91.esm.js.map +0 -1
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import { createApiRef, useApi, configApiRef, createRouteRef, createPlugin, createApiFactory, discoveryApiRef, identityApiRef, createRoutableExtension, createComponentExtension, useRouteRef } from '@backstage/core-plugin-api';
|
|
1
|
+
import { createApiRef, useApi, AnalyticsContext, useAnalytics, 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 React__default, { createContext, useState, useCallback, useEffect, useContext } from 'react';
|
|
6
|
-
import { ListItem, ListItemIcon, ListItemText, Box, 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';
|
|
4
|
+
import React, { createContext, useState, useCallback, useEffect, useContext, Fragment, cloneElement } from 'react';
|
|
8
5
|
import FilterListIcon from '@material-ui/icons/FilterList';
|
|
9
|
-
import {
|
|
6
|
+
import { makeStyles, IconButton, Typography, Card, CardHeader, Button, Divider, CardContent, Select, MenuItem, List, ListItem, Checkbox, ListItemText, InputBase, InputAdornment, FormControl, FormLabel, FormControlLabel, InputLabel, ListItemIcon, Box, Dialog, DialogTitle, Paper, DialogContent, Grid, DialogActions, Accordion, AccordionSummary, AccordionDetails, Tabs, Tab, Chip } from '@material-ui/core';
|
|
7
|
+
import useDebounce from 'react-use/lib/useDebounce';
|
|
10
8
|
import SearchIcon from '@material-ui/icons/Search';
|
|
11
9
|
import ClearButton from '@material-ui/icons/Clear';
|
|
10
|
+
import useAsync from 'react-use/lib/useAsync';
|
|
11
|
+
import usePrevious from 'react-use/lib/usePrevious';
|
|
12
|
+
import LaunchIcon from '@material-ui/icons/Launch';
|
|
12
13
|
import { makeStyles as makeStyles$1 } from '@material-ui/core/styles';
|
|
14
|
+
import { Link, Progress, ResponseErrorPanel, EmptyState, Table, useQueryParamState, Page, Header, Content, SidebarSearchField } from '@backstage/core-components';
|
|
13
15
|
import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';
|
|
14
16
|
import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';
|
|
15
|
-
import { createSvgIcon } from '@material-ui/core/utils';
|
|
16
17
|
import { useOutlet, useLocation } from 'react-router';
|
|
17
18
|
import InputBase$1 from '@material-ui/core/InputBase';
|
|
18
19
|
import IconButton$1 from '@material-ui/core/IconButton';
|
|
19
20
|
import { Alert } from '@material-ui/lab';
|
|
20
21
|
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
21
22
|
import { ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
|
23
|
+
import useEffectOnce from 'react-use/lib/useEffectOnce';
|
|
24
|
+
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
|
25
|
+
import AllIcon from '@material-ui/icons/FontDownload';
|
|
22
26
|
import { useNavigate } from 'react-router-dom';
|
|
23
27
|
|
|
24
28
|
const searchApiRef = createApiRef({
|
|
@@ -30,7 +34,7 @@ class SearchClient {
|
|
|
30
34
|
this.identityApi = options.identityApi;
|
|
31
35
|
}
|
|
32
36
|
async query(query) {
|
|
33
|
-
const token = await this.identityApi.
|
|
37
|
+
const { token } = await this.identityApi.getCredentials();
|
|
34
38
|
const queryString = qs.stringify(query);
|
|
35
39
|
const url = `${await this.discoveryApi.getBaseUrl("search/query")}?${queryString}`;
|
|
36
40
|
const response = await fetch(url, {
|
|
@@ -43,25 +47,7 @@ class SearchClient {
|
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
const
|
|
47
|
-
result,
|
|
48
|
-
icon,
|
|
49
|
-
secondaryAction
|
|
50
|
-
}) => {
|
|
51
|
-
return /* @__PURE__ */ React__default.createElement(Link, {
|
|
52
|
-
to: result.location
|
|
53
|
-
}, /* @__PURE__ */ React__default.createElement(ListItem, {
|
|
54
|
-
alignItems: "center"
|
|
55
|
-
}, icon && /* @__PURE__ */ React__default.createElement(ListItemIcon, null, icon), /* @__PURE__ */ React__default.createElement(ListItemText, {
|
|
56
|
-
primaryTypographyProps: { variant: "h6" },
|
|
57
|
-
primary: result.title,
|
|
58
|
-
secondary: result.text
|
|
59
|
-
}), secondaryAction && /* @__PURE__ */ React__default.createElement(Box, {
|
|
60
|
-
alignItems: "flex-end"
|
|
61
|
-
}, secondaryAction)), /* @__PURE__ */ React__default.createElement(Divider, null));
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const useStyles$a = makeStyles((theme) => ({
|
|
50
|
+
const useStyles$b = makeStyles((theme) => ({
|
|
65
51
|
filters: {
|
|
66
52
|
width: "250px",
|
|
67
53
|
display: "flex"
|
|
@@ -74,19 +60,19 @@ const FiltersButton$1 = ({
|
|
|
74
60
|
numberOfSelectedFilters,
|
|
75
61
|
handleToggleFilters
|
|
76
62
|
}) => {
|
|
77
|
-
const classes = useStyles$
|
|
78
|
-
return /* @__PURE__ */
|
|
63
|
+
const classes = useStyles$b();
|
|
64
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
79
65
|
className: classes.filters
|
|
80
|
-
}, /* @__PURE__ */
|
|
66
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
81
67
|
className: classes.icon,
|
|
82
68
|
"aria-label": "settings",
|
|
83
69
|
onClick: handleToggleFilters
|
|
84
|
-
}, /* @__PURE__ */
|
|
70
|
+
}, /* @__PURE__ */ React.createElement(FilterListIcon, null)), /* @__PURE__ */ React.createElement(Typography, {
|
|
85
71
|
variant: "h6"
|
|
86
72
|
}, "Filters (", numberOfSelectedFilters ? numberOfSelectedFilters : 0, ")"));
|
|
87
73
|
};
|
|
88
74
|
|
|
89
|
-
const useStyles$
|
|
75
|
+
const useStyles$a = makeStyles((theme) => ({
|
|
90
76
|
filters: {
|
|
91
77
|
background: "transparent",
|
|
92
78
|
boxShadow: "0px 0px 0px 0px"
|
|
@@ -105,22 +91,22 @@ const Filters$1 = ({
|
|
|
105
91
|
updateSelected,
|
|
106
92
|
updateChecked
|
|
107
93
|
}) => {
|
|
108
|
-
const classes = useStyles$
|
|
109
|
-
return /* @__PURE__ */
|
|
94
|
+
const classes = useStyles$a();
|
|
95
|
+
return /* @__PURE__ */ React.createElement(Card, {
|
|
110
96
|
className: classes.filters
|
|
111
|
-
}, /* @__PURE__ */
|
|
112
|
-
title: /* @__PURE__ */
|
|
97
|
+
}, /* @__PURE__ */ React.createElement(CardHeader, {
|
|
98
|
+
title: /* @__PURE__ */ React.createElement(Typography, {
|
|
113
99
|
variant: "h6"
|
|
114
100
|
}, "Filters"),
|
|
115
|
-
action: /* @__PURE__ */
|
|
101
|
+
action: /* @__PURE__ */ React.createElement(Button, {
|
|
116
102
|
color: "primary",
|
|
117
103
|
onClick: () => resetFilters()
|
|
118
104
|
}, "CLEAR ALL")
|
|
119
|
-
}), /* @__PURE__ */
|
|
105
|
+
}), /* @__PURE__ */ React.createElement(Divider, null), filterOptions.kind.length === 0 && filterOptions.lifecycle.length === 0 && /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
120
106
|
variant: "subtitle2"
|
|
121
|
-
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */
|
|
107
|
+
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
122
108
|
variant: "subtitle2"
|
|
123
|
-
}, "Kind"), /* @__PURE__ */
|
|
109
|
+
}, "Kind"), /* @__PURE__ */ React.createElement(Select, {
|
|
124
110
|
id: "outlined-select",
|
|
125
111
|
onChange: (e) => {
|
|
126
112
|
var _a;
|
|
@@ -129,22 +115,22 @@ const Filters$1 = ({
|
|
|
129
115
|
variant: "outlined",
|
|
130
116
|
className: classes.dropdown,
|
|
131
117
|
value: filters.selected
|
|
132
|
-
}, filterOptions.kind.map((filter) => /* @__PURE__ */
|
|
118
|
+
}, filterOptions.kind.map((filter) => /* @__PURE__ */ React.createElement(MenuItem, {
|
|
133
119
|
selected: filter === "",
|
|
134
120
|
dense: true,
|
|
135
121
|
key: filter,
|
|
136
122
|
value: filter
|
|
137
|
-
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */
|
|
123
|
+
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
138
124
|
variant: "subtitle2"
|
|
139
|
-
}, "Lifecycle"), /* @__PURE__ */
|
|
125
|
+
}, "Lifecycle"), /* @__PURE__ */ React.createElement(List, {
|
|
140
126
|
disablePadding: true,
|
|
141
127
|
dense: true
|
|
142
|
-
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */
|
|
128
|
+
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */ React.createElement(ListItem, {
|
|
143
129
|
key: filter,
|
|
144
130
|
dense: true,
|
|
145
131
|
button: true,
|
|
146
132
|
onClick: () => updateChecked(filter)
|
|
147
|
-
}, /* @__PURE__ */
|
|
133
|
+
}, /* @__PURE__ */ React.createElement(Checkbox, {
|
|
148
134
|
edge: "start",
|
|
149
135
|
disableRipple: true,
|
|
150
136
|
className: classes.checkbox,
|
|
@@ -153,7 +139,7 @@ const Filters$1 = ({
|
|
|
153
139
|
tabIndex: -1,
|
|
154
140
|
value: filter,
|
|
155
141
|
name: filter
|
|
156
|
-
}), /* @__PURE__ */
|
|
142
|
+
}), /* @__PURE__ */ React.createElement(ListItemText, {
|
|
157
143
|
id: filter,
|
|
158
144
|
primary: filter
|
|
159
145
|
}))))));
|
|
@@ -214,10 +200,12 @@ const SearchContextProvider = ({
|
|
|
214
200
|
fetchNextPage: hasNextPage ? fetchNextPage : void 0,
|
|
215
201
|
fetchPreviousPage: hasPreviousPage ? fetchPreviousPage : void 0
|
|
216
202
|
};
|
|
217
|
-
return /* @__PURE__ */
|
|
203
|
+
return /* @__PURE__ */ React.createElement(AnalyticsContext, {
|
|
204
|
+
attributes: { searchTypes: types.sort().join(",") }
|
|
205
|
+
}, /* @__PURE__ */ React.createElement(SearchContext.Provider, {
|
|
218
206
|
value,
|
|
219
207
|
children
|
|
220
|
-
});
|
|
208
|
+
}));
|
|
221
209
|
};
|
|
222
210
|
const useSearch = () => {
|
|
223
211
|
const context = useContext(SearchContext);
|
|
@@ -227,6 +215,21 @@ const useSearch = () => {
|
|
|
227
215
|
return context;
|
|
228
216
|
};
|
|
229
217
|
|
|
218
|
+
const TrackSearch = ({ children }) => {
|
|
219
|
+
const analytics = useAnalytics();
|
|
220
|
+
const { term } = useSearch();
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
if (term) {
|
|
223
|
+
analytics.captureEvent("search", term);
|
|
224
|
+
}
|
|
225
|
+
}, [analytics, term]);
|
|
226
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
const useSearchContextCheck = () => {
|
|
230
|
+
const context = useContext(SearchContext);
|
|
231
|
+
return context !== void 0;
|
|
232
|
+
};
|
|
230
233
|
const SearchBarBase = ({
|
|
231
234
|
onChange,
|
|
232
235
|
onKeyDown,
|
|
@@ -241,6 +244,7 @@ const SearchBarBase = ({
|
|
|
241
244
|
}) => {
|
|
242
245
|
const configApi = useApi(configApiRef);
|
|
243
246
|
const [value, setValue] = useState(defaultValue);
|
|
247
|
+
const hasSearchContext = useSearchContextCheck();
|
|
244
248
|
useEffect(() => {
|
|
245
249
|
setValue((prevValue) => prevValue !== defaultValue ? defaultValue : prevValue);
|
|
246
250
|
}, [defaultValue]);
|
|
@@ -259,19 +263,19 @@ const SearchBarBase = ({
|
|
|
259
263
|
onChange("");
|
|
260
264
|
}, [onChange]);
|
|
261
265
|
const placeholder = `Search in ${configApi.getOptionalString("app.title") || "Backstage"}`;
|
|
262
|
-
const startAdornment = /* @__PURE__ */
|
|
266
|
+
const startAdornment = /* @__PURE__ */ React.createElement(InputAdornment, {
|
|
263
267
|
position: "start"
|
|
264
|
-
}, /* @__PURE__ */
|
|
268
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
265
269
|
"aria-label": "Query",
|
|
266
270
|
disabled: true
|
|
267
|
-
}, /* @__PURE__ */
|
|
268
|
-
const endAdornment = /* @__PURE__ */
|
|
271
|
+
}, /* @__PURE__ */ React.createElement(SearchIcon, null)));
|
|
272
|
+
const endAdornment = /* @__PURE__ */ React.createElement(InputAdornment, {
|
|
269
273
|
position: "end"
|
|
270
|
-
}, /* @__PURE__ */
|
|
274
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
271
275
|
"aria-label": "Clear",
|
|
272
276
|
onClick: handleClear
|
|
273
|
-
}, /* @__PURE__ */
|
|
274
|
-
|
|
277
|
+
}, /* @__PURE__ */ React.createElement(ClearButton, null)));
|
|
278
|
+
const searchBar = /* @__PURE__ */ React.createElement(TrackSearch, null, /* @__PURE__ */ React.createElement(InputBase, {
|
|
275
279
|
"data-testid": "search-bar-next",
|
|
276
280
|
value,
|
|
277
281
|
placeholder,
|
|
@@ -282,23 +286,26 @@ const SearchBarBase = ({
|
|
|
282
286
|
onChange: handleChange,
|
|
283
287
|
onKeyDown: handleKeyDown,
|
|
284
288
|
...props
|
|
285
|
-
});
|
|
289
|
+
}));
|
|
290
|
+
return hasSearchContext ? searchBar : /* @__PURE__ */ React.createElement(SearchContextProvider, null, searchBar);
|
|
286
291
|
};
|
|
287
292
|
const SearchBar$1 = ({ onChange, ...props }) => {
|
|
288
293
|
const { term, setTerm } = useSearch();
|
|
289
294
|
const handleChange = (newValue) => {
|
|
290
|
-
|
|
291
|
-
if (onChange)
|
|
295
|
+
if (onChange) {
|
|
292
296
|
onChange(newValue);
|
|
297
|
+
} else {
|
|
298
|
+
setTerm(newValue);
|
|
299
|
+
}
|
|
293
300
|
};
|
|
294
|
-
return /* @__PURE__ */
|
|
301
|
+
return /* @__PURE__ */ React.createElement(SearchBarBase, {
|
|
295
302
|
value: term,
|
|
296
303
|
onChange: handleChange,
|
|
297
304
|
...props
|
|
298
305
|
});
|
|
299
306
|
};
|
|
300
307
|
|
|
301
|
-
const useStyles$
|
|
308
|
+
const useStyles$9 = makeStyles({
|
|
302
309
|
label: {
|
|
303
310
|
textTransform: "capitalize"
|
|
304
311
|
}
|
|
@@ -309,7 +316,7 @@ const CheckboxFilter = ({
|
|
|
309
316
|
defaultValue,
|
|
310
317
|
values = []
|
|
311
318
|
}) => {
|
|
312
|
-
const classes = useStyles$
|
|
319
|
+
const classes = useStyles$9();
|
|
313
320
|
const { filters, setFilters } = useSearch();
|
|
314
321
|
useEffect(() => {
|
|
315
322
|
if (Array.isArray(defaultValue)) {
|
|
@@ -330,17 +337,17 @@ const CheckboxFilter = ({
|
|
|
330
337
|
return items.length ? { ...others, [name]: items } : others;
|
|
331
338
|
});
|
|
332
339
|
};
|
|
333
|
-
return /* @__PURE__ */
|
|
340
|
+
return /* @__PURE__ */ React.createElement(FormControl, {
|
|
334
341
|
className,
|
|
335
342
|
fullWidth: true,
|
|
336
343
|
"data-testid": "search-checkboxfilter-next"
|
|
337
|
-
}, /* @__PURE__ */
|
|
344
|
+
}, /* @__PURE__ */ React.createElement(FormLabel, {
|
|
338
345
|
className: classes.label
|
|
339
346
|
}, name), values.map((value) => {
|
|
340
347
|
var _a;
|
|
341
|
-
return /* @__PURE__ */
|
|
348
|
+
return /* @__PURE__ */ React.createElement(FormControlLabel, {
|
|
342
349
|
key: value,
|
|
343
|
-
control: /* @__PURE__ */
|
|
350
|
+
control: /* @__PURE__ */ React.createElement(Checkbox, {
|
|
344
351
|
color: "primary",
|
|
345
352
|
tabIndex: -1,
|
|
346
353
|
inputProps: { "aria-labelledby": value },
|
|
@@ -359,7 +366,7 @@ const SelectFilter = ({
|
|
|
359
366
|
defaultValue,
|
|
360
367
|
values = []
|
|
361
368
|
}) => {
|
|
362
|
-
const classes = useStyles$
|
|
369
|
+
const classes = useStyles$9();
|
|
363
370
|
const { filters, setFilters } = useSearch();
|
|
364
371
|
useEffect(() => {
|
|
365
372
|
if (typeof defaultValue === "string") {
|
|
@@ -378,65 +385,79 @@ const SelectFilter = ({
|
|
|
378
385
|
return value ? { ...others, [name]: value } : others;
|
|
379
386
|
});
|
|
380
387
|
};
|
|
381
|
-
return /* @__PURE__ */
|
|
388
|
+
return /* @__PURE__ */ React.createElement(FormControl, {
|
|
382
389
|
className,
|
|
383
390
|
variant: "filled",
|
|
384
391
|
fullWidth: true,
|
|
385
392
|
"data-testid": "search-selectfilter-next"
|
|
386
|
-
}, /* @__PURE__ */
|
|
393
|
+
}, /* @__PURE__ */ React.createElement(InputLabel, {
|
|
387
394
|
className: classes.label,
|
|
388
395
|
margin: "dense"
|
|
389
|
-
}, name), /* @__PURE__ */
|
|
396
|
+
}, name), /* @__PURE__ */ React.createElement(Select, {
|
|
390
397
|
variant: "outlined",
|
|
391
398
|
value: filters[name] || "",
|
|
392
399
|
onChange: handleChange
|
|
393
|
-
}, /* @__PURE__ */
|
|
400
|
+
}, /* @__PURE__ */ React.createElement(MenuItem, {
|
|
394
401
|
value: ""
|
|
395
|
-
}, /* @__PURE__ */
|
|
402
|
+
}, /* @__PURE__ */ React.createElement("em", null, "All")), values.map((value) => /* @__PURE__ */ React.createElement(MenuItem, {
|
|
396
403
|
key: value,
|
|
397
404
|
value
|
|
398
405
|
}, value))));
|
|
399
406
|
};
|
|
400
|
-
const SearchFilter = ({ component: Element, ...props }) => /* @__PURE__ */
|
|
407
|
+
const SearchFilter = ({ component: Element, ...props }) => /* @__PURE__ */ React.createElement(Element, {
|
|
401
408
|
...props
|
|
402
409
|
});
|
|
403
|
-
SearchFilter.Checkbox = (props) => /* @__PURE__ */
|
|
410
|
+
SearchFilter.Checkbox = (props) => /* @__PURE__ */ React.createElement(SearchFilter, {
|
|
404
411
|
...props,
|
|
405
412
|
component: CheckboxFilter
|
|
406
413
|
});
|
|
407
|
-
SearchFilter.Select = (props) => /* @__PURE__ */
|
|
414
|
+
SearchFilter.Select = (props) => /* @__PURE__ */ React.createElement(SearchFilter, {
|
|
408
415
|
...props,
|
|
409
416
|
component: SelectFilter
|
|
410
417
|
});
|
|
411
418
|
const SearchFilterNext = SearchFilter;
|
|
412
419
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
420
|
+
const DefaultResultListItem$1 = ({
|
|
421
|
+
result,
|
|
422
|
+
icon,
|
|
423
|
+
secondaryAction
|
|
424
|
+
}) => {
|
|
425
|
+
return /* @__PURE__ */ React.createElement(Link, {
|
|
426
|
+
to: result.location
|
|
427
|
+
}, /* @__PURE__ */ React.createElement(ListItem, {
|
|
428
|
+
alignItems: "center"
|
|
429
|
+
}, icon && /* @__PURE__ */ React.createElement(ListItemIcon, null, icon), /* @__PURE__ */ React.createElement(ListItemText, {
|
|
430
|
+
primaryTypographyProps: { variant: "h6" },
|
|
431
|
+
primary: result.title,
|
|
432
|
+
secondary: result.text
|
|
433
|
+
}), secondaryAction && /* @__PURE__ */ React.createElement(Box, {
|
|
434
|
+
alignItems: "flex-end"
|
|
435
|
+
}, secondaryAction)), /* @__PURE__ */ React.createElement(Divider, null));
|
|
436
|
+
};
|
|
416
437
|
|
|
417
438
|
const SearchResultComponent = ({ children }) => {
|
|
418
439
|
const {
|
|
419
440
|
result: { loading, error, value }
|
|
420
441
|
} = useSearch();
|
|
421
442
|
if (loading) {
|
|
422
|
-
return /* @__PURE__ */
|
|
443
|
+
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
423
444
|
}
|
|
424
445
|
if (error) {
|
|
425
|
-
return /* @__PURE__ */
|
|
446
|
+
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, {
|
|
426
447
|
title: "Error encountered while fetching search results",
|
|
427
448
|
error
|
|
428
449
|
});
|
|
429
450
|
}
|
|
430
451
|
if (!(value == null ? void 0 : value.results.length)) {
|
|
431
|
-
return /* @__PURE__ */
|
|
452
|
+
return /* @__PURE__ */ React.createElement(EmptyState, {
|
|
432
453
|
missing: "data",
|
|
433
454
|
title: "Sorry, no results were found"
|
|
434
455
|
});
|
|
435
456
|
}
|
|
436
|
-
return /* @__PURE__ */
|
|
457
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children({ results: value.results }));
|
|
437
458
|
};
|
|
438
459
|
|
|
439
|
-
const useStyles$
|
|
460
|
+
const useStyles$8 = makeStyles((theme) => ({
|
|
440
461
|
root: {
|
|
441
462
|
display: "flex",
|
|
442
463
|
justifyContent: "space-between",
|
|
@@ -446,23 +467,23 @@ const useStyles$7 = makeStyles((theme) => ({
|
|
|
446
467
|
}));
|
|
447
468
|
const SearchResultPager = () => {
|
|
448
469
|
const { fetchNextPage, fetchPreviousPage } = useSearch();
|
|
449
|
-
const classes = useStyles$
|
|
470
|
+
const classes = useStyles$8();
|
|
450
471
|
if (!fetchNextPage && !fetchPreviousPage) {
|
|
451
|
-
return /* @__PURE__ */
|
|
472
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
452
473
|
}
|
|
453
|
-
return /* @__PURE__ */
|
|
474
|
+
return /* @__PURE__ */ React.createElement("nav", {
|
|
454
475
|
"arial-label": "pagination navigation",
|
|
455
476
|
className: classes.root
|
|
456
|
-
}, /* @__PURE__ */
|
|
477
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
457
478
|
"aria-label": "previous page",
|
|
458
479
|
disabled: !fetchPreviousPage,
|
|
459
480
|
onClick: fetchPreviousPage,
|
|
460
|
-
startIcon: /* @__PURE__ */
|
|
461
|
-
}, "Previous"), /* @__PURE__ */
|
|
481
|
+
startIcon: /* @__PURE__ */ React.createElement(ArrowBackIosIcon, null)
|
|
482
|
+
}, "Previous"), /* @__PURE__ */ React.createElement(Button, {
|
|
462
483
|
"aria-label": "next page",
|
|
463
484
|
disabled: !fetchNextPage,
|
|
464
485
|
onClick: fetchNextPage,
|
|
465
|
-
endIcon: /* @__PURE__ */
|
|
486
|
+
endIcon: /* @__PURE__ */ React.createElement(ArrowForwardIosIcon, null)
|
|
466
487
|
}, "Next"));
|
|
467
488
|
};
|
|
468
489
|
|
|
@@ -490,58 +511,58 @@ const searchPlugin = createPlugin({
|
|
|
490
511
|
});
|
|
491
512
|
const SearchPage$1 = searchPlugin.provide(createRoutableExtension({
|
|
492
513
|
name: "SearchPage",
|
|
493
|
-
component: () => import('./index-
|
|
514
|
+
component: () => import('./index-1c086301.esm.js').then((m) => m.SearchPage),
|
|
494
515
|
mountPoint: rootRouteRef
|
|
495
516
|
}));
|
|
496
517
|
const SearchPageNext = searchPlugin.provide(createRoutableExtension({
|
|
497
518
|
name: "SearchPageNext",
|
|
498
|
-
component: () => import('./index-
|
|
519
|
+
component: () => import('./index-1c086301.esm.js').then((m) => m.SearchPage),
|
|
499
520
|
mountPoint: rootNextRouteRef
|
|
500
521
|
}));
|
|
501
522
|
searchPlugin.provide(createComponentExtension({
|
|
502
523
|
name: "SearchBar",
|
|
503
524
|
component: {
|
|
504
|
-
lazy: () => import('./index-
|
|
525
|
+
lazy: () => import('./index-28edd923.esm.js').then((m) => m.SearchBar)
|
|
505
526
|
}
|
|
506
527
|
}));
|
|
507
528
|
const SearchBarNext = searchPlugin.provide(createComponentExtension({
|
|
508
529
|
name: "SearchBarNext",
|
|
509
530
|
component: {
|
|
510
|
-
lazy: () => import('./index-
|
|
531
|
+
lazy: () => import('./index-28edd923.esm.js').then((m) => m.SearchBar)
|
|
511
532
|
}
|
|
512
533
|
}));
|
|
513
534
|
const SearchResult$1 = searchPlugin.provide(createComponentExtension({
|
|
514
535
|
name: "SearchResult",
|
|
515
536
|
component: {
|
|
516
|
-
lazy: () => import('./index-
|
|
537
|
+
lazy: () => import('./index-e7aaeef5.esm.js').then((m) => m.SearchResult)
|
|
517
538
|
}
|
|
518
539
|
}));
|
|
519
540
|
searchPlugin.provide(createComponentExtension({
|
|
520
541
|
name: "SearchResultNext",
|
|
521
542
|
component: {
|
|
522
|
-
lazy: () => import('./index-
|
|
543
|
+
lazy: () => import('./index-e7aaeef5.esm.js').then((m) => m.SearchResult)
|
|
523
544
|
}
|
|
524
545
|
}));
|
|
525
546
|
const SidebarSearchModal = searchPlugin.provide(createComponentExtension({
|
|
526
547
|
name: "SidebarSearchModal",
|
|
527
548
|
component: {
|
|
528
|
-
lazy: () => import('./index-
|
|
549
|
+
lazy: () => import('./index-6ca40e41.esm.js').then((m) => m.SidebarSearchModal)
|
|
529
550
|
}
|
|
530
551
|
}));
|
|
531
552
|
const DefaultResultListItem = searchPlugin.provide(createComponentExtension({
|
|
532
553
|
name: "DefaultResultListItem",
|
|
533
554
|
component: {
|
|
534
|
-
lazy: () => import('./index-
|
|
555
|
+
lazy: () => import('./index-9b4814a6.esm.js').then((m) => m.DefaultResultListItem)
|
|
535
556
|
}
|
|
536
557
|
}));
|
|
537
|
-
const HomePageSearchBar
|
|
558
|
+
const HomePageSearchBar = searchPlugin.provide(createComponentExtension({
|
|
538
559
|
name: "HomePageSearchBar",
|
|
539
560
|
component: {
|
|
540
|
-
lazy: () => import('./index-
|
|
561
|
+
lazy: () => import('./index-85c3d310.esm.js').then((m) => m.HomePageSearchBar)
|
|
541
562
|
}
|
|
542
563
|
}));
|
|
543
564
|
|
|
544
|
-
const useStyles$
|
|
565
|
+
const useStyles$7 = makeStyles$1((theme) => ({
|
|
545
566
|
container: {
|
|
546
567
|
borderRadius: 30,
|
|
547
568
|
display: "flex",
|
|
@@ -556,7 +577,7 @@ const useStyles$6 = makeStyles$1((theme) => ({
|
|
|
556
577
|
}));
|
|
557
578
|
const Modal = ({ open = true, toggleModal }) => {
|
|
558
579
|
const getSearchLink = useRouteRef(rootRouteRef);
|
|
559
|
-
const classes = useStyles$
|
|
580
|
+
const classes = useStyles$7();
|
|
560
581
|
const { term } = useSearch();
|
|
561
582
|
const handleResultClick = () => {
|
|
562
583
|
toggleModal();
|
|
@@ -564,7 +585,7 @@ const Modal = ({ open = true, toggleModal }) => {
|
|
|
564
585
|
const handleKeyPress = () => {
|
|
565
586
|
handleResultClick();
|
|
566
587
|
};
|
|
567
|
-
return /* @__PURE__ */
|
|
588
|
+
return /* @__PURE__ */ React.createElement(Dialog, {
|
|
568
589
|
classes: {
|
|
569
590
|
paperFullWidth: classes.paperFullWidth
|
|
570
591
|
},
|
|
@@ -573,51 +594,51 @@ const Modal = ({ open = true, toggleModal }) => {
|
|
|
573
594
|
open,
|
|
574
595
|
fullWidth: true,
|
|
575
596
|
maxWidth: "lg"
|
|
576
|
-
}, /* @__PURE__ */
|
|
597
|
+
}, /* @__PURE__ */ React.createElement(DialogTitle, null, /* @__PURE__ */ React.createElement(Paper, {
|
|
577
598
|
className: classes.container
|
|
578
|
-
}, /* @__PURE__ */
|
|
599
|
+
}, /* @__PURE__ */ React.createElement(SearchBar$1, {
|
|
579
600
|
className: classes.input
|
|
580
|
-
}))), /* @__PURE__ */
|
|
601
|
+
}))), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Grid, {
|
|
581
602
|
container: true,
|
|
582
603
|
direction: "row-reverse",
|
|
583
604
|
justifyContent: "flex-start",
|
|
584
605
|
alignItems: "center"
|
|
585
|
-
}, /* @__PURE__ */
|
|
606
|
+
}, /* @__PURE__ */ React.createElement(Grid, {
|
|
586
607
|
item: true
|
|
587
|
-
}, /* @__PURE__ */
|
|
608
|
+
}, /* @__PURE__ */ React.createElement(Link, {
|
|
588
609
|
onClick: toggleModal,
|
|
589
610
|
to: `${getSearchLink()}?query=${term}`
|
|
590
|
-
}, /* @__PURE__ */
|
|
611
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
591
612
|
className: classes.viewResultsLink
|
|
592
|
-
}, "View Full Results"), /* @__PURE__ */
|
|
613
|
+
}, "View Full Results"), /* @__PURE__ */ React.createElement(LaunchIcon, {
|
|
593
614
|
color: "primary"
|
|
594
|
-
})))), /* @__PURE__ */
|
|
615
|
+
})))), /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(SearchResultComponent, null, ({ results }) => /* @__PURE__ */ React.createElement(List, null, results.map(({ document }) => /* @__PURE__ */ React.createElement("div", {
|
|
595
616
|
role: "button",
|
|
596
617
|
tabIndex: 0,
|
|
597
618
|
key: `${document.location}-btn`,
|
|
598
619
|
onClick: handleResultClick,
|
|
599
620
|
onKeyPress: handleKeyPress
|
|
600
|
-
}, /* @__PURE__ */
|
|
621
|
+
}, /* @__PURE__ */ React.createElement(DefaultResultListItem$1, {
|
|
601
622
|
key: document.location,
|
|
602
623
|
result: document
|
|
603
|
-
})))))), /* @__PURE__ */
|
|
624
|
+
})))))), /* @__PURE__ */ React.createElement(DialogActions, {
|
|
604
625
|
className: classes.dialogActionsContainer
|
|
605
|
-
}, /* @__PURE__ */
|
|
626
|
+
}, /* @__PURE__ */ React.createElement(Grid, {
|
|
606
627
|
container: true,
|
|
607
628
|
direction: "row"
|
|
608
|
-
}, /* @__PURE__ */
|
|
629
|
+
}, /* @__PURE__ */ React.createElement(Grid, {
|
|
609
630
|
item: true,
|
|
610
631
|
xs: 12
|
|
611
|
-
}, /* @__PURE__ */
|
|
632
|
+
}, /* @__PURE__ */ React.createElement(SearchResultPager, null)))));
|
|
612
633
|
};
|
|
613
634
|
const SearchModal = ({ open = true, toggleModal }) => {
|
|
614
|
-
return /* @__PURE__ */
|
|
635
|
+
return /* @__PURE__ */ React.createElement(SearchContextProvider, null, /* @__PURE__ */ React.createElement(Modal, {
|
|
615
636
|
open,
|
|
616
637
|
toggleModal
|
|
617
638
|
}));
|
|
618
639
|
};
|
|
619
640
|
|
|
620
|
-
const useStyles$
|
|
641
|
+
const useStyles$6 = makeStyles$1(() => ({
|
|
621
642
|
root: {
|
|
622
643
|
display: "flex",
|
|
623
644
|
alignItems: "center"
|
|
@@ -631,28 +652,28 @@ const SearchBar = ({
|
|
|
631
652
|
handleSearch,
|
|
632
653
|
handleClearSearchBar
|
|
633
654
|
}) => {
|
|
634
|
-
const classes = useStyles$
|
|
635
|
-
return /* @__PURE__ */
|
|
655
|
+
const classes = useStyles$6();
|
|
656
|
+
return /* @__PURE__ */ React.createElement(Paper, {
|
|
636
657
|
component: "form",
|
|
637
658
|
onSubmit: (e) => handleSearch(e),
|
|
638
659
|
className: classes.root
|
|
639
|
-
}, /* @__PURE__ */
|
|
660
|
+
}, /* @__PURE__ */ React.createElement(IconButton$1, {
|
|
640
661
|
disabled: true,
|
|
641
662
|
type: "submit",
|
|
642
663
|
"aria-label": "search"
|
|
643
|
-
}, /* @__PURE__ */
|
|
664
|
+
}, /* @__PURE__ */ React.createElement(SearchIcon, null)), /* @__PURE__ */ React.createElement(InputBase$1, {
|
|
644
665
|
className: classes.input,
|
|
645
666
|
placeholder: "Search in Backstage",
|
|
646
667
|
value: searchQuery,
|
|
647
668
|
onChange: (e) => handleSearch(e),
|
|
648
669
|
inputProps: { "aria-label": "search backstage" }
|
|
649
|
-
}), /* @__PURE__ */
|
|
670
|
+
}), /* @__PURE__ */ React.createElement(IconButton$1, {
|
|
650
671
|
"aria-label": "search",
|
|
651
672
|
onClick: () => handleClearSearchBar()
|
|
652
|
-
}, /* @__PURE__ */
|
|
673
|
+
}, /* @__PURE__ */ React.createElement(ClearButton, null)));
|
|
653
674
|
};
|
|
654
675
|
|
|
655
|
-
const useStyles$
|
|
676
|
+
const useStyles$5 = makeStyles((theme) => ({
|
|
656
677
|
filters: {
|
|
657
678
|
width: "250px",
|
|
658
679
|
display: "flex"
|
|
@@ -665,19 +686,19 @@ const FiltersButton = ({
|
|
|
665
686
|
numberOfSelectedFilters,
|
|
666
687
|
handleToggleFilters
|
|
667
688
|
}) => {
|
|
668
|
-
const classes = useStyles$
|
|
669
|
-
return /* @__PURE__ */
|
|
689
|
+
const classes = useStyles$5();
|
|
690
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
670
691
|
className: classes.filters
|
|
671
|
-
}, /* @__PURE__ */
|
|
692
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
672
693
|
className: classes.icon,
|
|
673
694
|
"aria-label": "settings",
|
|
674
695
|
onClick: handleToggleFilters
|
|
675
|
-
}, /* @__PURE__ */
|
|
696
|
+
}, /* @__PURE__ */ React.createElement(FilterListIcon, null)), /* @__PURE__ */ React.createElement(Typography, {
|
|
676
697
|
variant: "h6"
|
|
677
698
|
}, "Filters (", numberOfSelectedFilters ? numberOfSelectedFilters : 0, ")"));
|
|
678
699
|
};
|
|
679
700
|
|
|
680
|
-
const useStyles$
|
|
701
|
+
const useStyles$4 = makeStyles((theme) => ({
|
|
681
702
|
filters: {
|
|
682
703
|
background: "transparent",
|
|
683
704
|
boxShadow: "0px 0px 0px 0px"
|
|
@@ -696,22 +717,22 @@ const Filters = ({
|
|
|
696
717
|
updateSelected,
|
|
697
718
|
updateChecked
|
|
698
719
|
}) => {
|
|
699
|
-
const classes = useStyles$
|
|
700
|
-
return /* @__PURE__ */
|
|
720
|
+
const classes = useStyles$4();
|
|
721
|
+
return /* @__PURE__ */ React.createElement(Card, {
|
|
701
722
|
className: classes.filters
|
|
702
|
-
}, /* @__PURE__ */
|
|
703
|
-
title: /* @__PURE__ */
|
|
723
|
+
}, /* @__PURE__ */ React.createElement(CardHeader, {
|
|
724
|
+
title: /* @__PURE__ */ React.createElement(Typography, {
|
|
704
725
|
variant: "h6"
|
|
705
726
|
}, "Filters"),
|
|
706
|
-
action: /* @__PURE__ */
|
|
727
|
+
action: /* @__PURE__ */ React.createElement(Button, {
|
|
707
728
|
color: "primary",
|
|
708
729
|
onClick: () => resetFilters()
|
|
709
730
|
}, "CLEAR ALL")
|
|
710
|
-
}), /* @__PURE__ */
|
|
731
|
+
}), /* @__PURE__ */ React.createElement(Divider, null), filterOptions.kind.length === 0 && filterOptions.lifecycle.length === 0 && /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
711
732
|
variant: "subtitle2"
|
|
712
|
-
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */
|
|
733
|
+
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
713
734
|
variant: "subtitle2"
|
|
714
|
-
}, "Kind"), /* @__PURE__ */
|
|
735
|
+
}, "Kind"), /* @__PURE__ */ React.createElement(Select, {
|
|
715
736
|
id: "outlined-select",
|
|
716
737
|
onChange: (e) => {
|
|
717
738
|
var _a;
|
|
@@ -720,22 +741,22 @@ const Filters = ({
|
|
|
720
741
|
variant: "outlined",
|
|
721
742
|
className: classes.dropdown,
|
|
722
743
|
value: filters.selected
|
|
723
|
-
}, filterOptions.kind.map((filter) => /* @__PURE__ */
|
|
744
|
+
}, filterOptions.kind.map((filter) => /* @__PURE__ */ React.createElement(MenuItem, {
|
|
724
745
|
selected: filter === "",
|
|
725
746
|
dense: true,
|
|
726
747
|
key: filter,
|
|
727
748
|
value: filter
|
|
728
|
-
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */
|
|
749
|
+
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
729
750
|
variant: "subtitle2"
|
|
730
|
-
}, "Lifecycle"), /* @__PURE__ */
|
|
751
|
+
}, "Lifecycle"), /* @__PURE__ */ React.createElement(List, {
|
|
731
752
|
disablePadding: true,
|
|
732
753
|
dense: true
|
|
733
|
-
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */
|
|
754
|
+
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */ React.createElement(ListItem, {
|
|
734
755
|
key: filter,
|
|
735
756
|
dense: true,
|
|
736
757
|
button: true,
|
|
737
758
|
onClick: () => updateChecked(filter)
|
|
738
|
-
}, /* @__PURE__ */
|
|
759
|
+
}, /* @__PURE__ */ React.createElement(Checkbox, {
|
|
739
760
|
edge: "start",
|
|
740
761
|
disableRipple: true,
|
|
741
762
|
className: classes.checkbox,
|
|
@@ -744,13 +765,13 @@ const Filters = ({
|
|
|
744
765
|
tabIndex: -1,
|
|
745
766
|
value: filter,
|
|
746
767
|
name: filter
|
|
747
|
-
}), /* @__PURE__ */
|
|
768
|
+
}), /* @__PURE__ */ React.createElement(ListItemText, {
|
|
748
769
|
id: filter,
|
|
749
770
|
primary: filter
|
|
750
771
|
}))))));
|
|
751
772
|
};
|
|
752
773
|
|
|
753
|
-
const useStyles$
|
|
774
|
+
const useStyles$3 = makeStyles((theme) => ({
|
|
754
775
|
searchQuery: {
|
|
755
776
|
color: theme.palette.text.primary,
|
|
756
777
|
background: theme.palette.background.default,
|
|
@@ -771,7 +792,7 @@ const columns = [
|
|
|
771
792
|
title: "Name",
|
|
772
793
|
field: "name",
|
|
773
794
|
highlight: true,
|
|
774
|
-
render: (result) => /* @__PURE__ */
|
|
795
|
+
render: (result) => /* @__PURE__ */ React.createElement(Link, {
|
|
775
796
|
to: result.url || ""
|
|
776
797
|
}, result.name)
|
|
777
798
|
},
|
|
@@ -798,23 +819,23 @@ const TableHeader = ({
|
|
|
798
819
|
numberOfResults,
|
|
799
820
|
handleToggleFilters
|
|
800
821
|
}) => {
|
|
801
|
-
const classes = useStyles$
|
|
802
|
-
return /* @__PURE__ */
|
|
822
|
+
const classes = useStyles$3();
|
|
823
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
803
824
|
className: classes.tableHeader
|
|
804
|
-
}, /* @__PURE__ */
|
|
825
|
+
}, /* @__PURE__ */ React.createElement(FiltersButton, {
|
|
805
826
|
numberOfSelectedFilters,
|
|
806
827
|
handleToggleFilters
|
|
807
|
-
}), /* @__PURE__ */
|
|
828
|
+
}), /* @__PURE__ */ React.createElement(Divider, {
|
|
808
829
|
className: classes.divider,
|
|
809
830
|
orientation: "vertical"
|
|
810
|
-
}), /* @__PURE__ */
|
|
831
|
+
}), /* @__PURE__ */ React.createElement(Grid, {
|
|
811
832
|
item: true,
|
|
812
833
|
xs: 12
|
|
813
|
-
}, searchQuery ? /* @__PURE__ */
|
|
834
|
+
}, searchQuery ? /* @__PURE__ */ React.createElement(Typography, {
|
|
814
835
|
variant: "h6"
|
|
815
|
-
}, `${numberOfResults} `, numberOfResults > 1 ? `results for ` : `result for `, /* @__PURE__ */
|
|
836
|
+
}, `${numberOfResults} `, numberOfResults > 1 ? `results for ` : `result for `, /* @__PURE__ */ React.createElement("span", {
|
|
816
837
|
className: classes.searchQuery
|
|
817
|
-
}, '"', searchQuery, '"'), " ") : /* @__PURE__ */
|
|
838
|
+
}, '"', searchQuery, '"'), " ") : /* @__PURE__ */ React.createElement(Typography, {
|
|
818
839
|
variant: "h6"
|
|
819
840
|
}, `${numberOfResults} results`)));
|
|
820
841
|
};
|
|
@@ -863,15 +884,15 @@ const SearchResult = ({ searchQuery }) => {
|
|
|
863
884
|
}
|
|
864
885
|
}, [selectedFilters, searchQuery, results]);
|
|
865
886
|
if (loading) {
|
|
866
|
-
return /* @__PURE__ */
|
|
887
|
+
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
867
888
|
}
|
|
868
889
|
if (error) {
|
|
869
|
-
return /* @__PURE__ */
|
|
890
|
+
return /* @__PURE__ */ React.createElement(Alert, {
|
|
870
891
|
severity: "error"
|
|
871
892
|
}, "Error encountered while fetching search results. ", error.toString());
|
|
872
893
|
}
|
|
873
894
|
if (!results || results.length === 0) {
|
|
874
|
-
return /* @__PURE__ */
|
|
895
|
+
return /* @__PURE__ */ React.createElement(EmptyState, {
|
|
875
896
|
missing: "data",
|
|
876
897
|
title: "Sorry, no results were found"
|
|
877
898
|
});
|
|
@@ -913,25 +934,25 @@ const SearchResult = ({ searchQuery }) => {
|
|
|
913
934
|
kind: [],
|
|
914
935
|
lifecycle: []
|
|
915
936
|
});
|
|
916
|
-
return /* @__PURE__ */
|
|
937
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Grid, {
|
|
917
938
|
container: true
|
|
918
|
-
}, showFilters && /* @__PURE__ */
|
|
939
|
+
}, showFilters && /* @__PURE__ */ React.createElement(Grid, {
|
|
919
940
|
item: true,
|
|
920
941
|
xs: 3
|
|
921
|
-
}, /* @__PURE__ */
|
|
942
|
+
}, /* @__PURE__ */ React.createElement(Filters, {
|
|
922
943
|
filters: selectedFilters,
|
|
923
944
|
filterOptions,
|
|
924
945
|
resetFilters,
|
|
925
946
|
updateSelected,
|
|
926
947
|
updateChecked
|
|
927
|
-
})), /* @__PURE__ */
|
|
948
|
+
})), /* @__PURE__ */ React.createElement(Grid, {
|
|
928
949
|
item: true,
|
|
929
950
|
xs: showFilters ? 9 : 12
|
|
930
|
-
}, /* @__PURE__ */
|
|
951
|
+
}, /* @__PURE__ */ React.createElement(Table, {
|
|
931
952
|
options: { paging: true, pageSize: 20, search: false },
|
|
932
953
|
data: filteredResults,
|
|
933
954
|
columns,
|
|
934
|
-
title: /* @__PURE__ */
|
|
955
|
+
title: /* @__PURE__ */ React.createElement(TableHeader, {
|
|
935
956
|
searchQuery,
|
|
936
957
|
numberOfResults: filteredResults.length,
|
|
937
958
|
numberOfSelectedFilters: (selectedFilters.selected !== "" ? 1 : 0) + selectedFilters.checked.length,
|
|
@@ -954,24 +975,24 @@ const LegacySearchPage = () => {
|
|
|
954
975
|
const handleClearSearchBar = () => {
|
|
955
976
|
setSearchQuery("");
|
|
956
977
|
};
|
|
957
|
-
return /* @__PURE__ */
|
|
978
|
+
return /* @__PURE__ */ React.createElement(Page, {
|
|
958
979
|
themeId: "home"
|
|
959
|
-
}, /* @__PURE__ */
|
|
980
|
+
}, /* @__PURE__ */ React.createElement(Header, {
|
|
960
981
|
title: "Search"
|
|
961
|
-
}), /* @__PURE__ */
|
|
982
|
+
}), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, {
|
|
962
983
|
container: true,
|
|
963
984
|
direction: "row"
|
|
964
|
-
}, /* @__PURE__ */
|
|
985
|
+
}, /* @__PURE__ */ React.createElement(Grid, {
|
|
965
986
|
item: true,
|
|
966
987
|
xs: 12
|
|
967
|
-
}, /* @__PURE__ */
|
|
988
|
+
}, /* @__PURE__ */ React.createElement(SearchBar, {
|
|
968
989
|
handleSearch,
|
|
969
990
|
handleClearSearchBar,
|
|
970
991
|
searchQuery
|
|
971
|
-
})), /* @__PURE__ */
|
|
992
|
+
})), /* @__PURE__ */ React.createElement(Grid, {
|
|
972
993
|
item: true,
|
|
973
994
|
xs: 12
|
|
974
|
-
}, /* @__PURE__ */
|
|
995
|
+
}, /* @__PURE__ */ React.createElement(SearchResult, {
|
|
975
996
|
searchQuery: (queryString != null ? queryString : "").toLocaleLowerCase("en-US")
|
|
976
997
|
})))));
|
|
977
998
|
};
|
|
@@ -1021,10 +1042,160 @@ const UrlUpdater = () => {
|
|
|
1021
1042
|
};
|
|
1022
1043
|
const SearchPage = () => {
|
|
1023
1044
|
const outlet = useOutlet();
|
|
1024
|
-
return /* @__PURE__ */
|
|
1045
|
+
return /* @__PURE__ */ React.createElement(SearchContextProvider, null, /* @__PURE__ */ React.createElement(UrlUpdater, null), outlet || /* @__PURE__ */ React.createElement(LegacySearchPage, null));
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
const useStyles$2 = makeStyles((theme) => ({
|
|
1049
|
+
card: {
|
|
1050
|
+
backgroundColor: "rgba(0, 0, 0, .11)"
|
|
1051
|
+
},
|
|
1052
|
+
cardContent: {
|
|
1053
|
+
paddingTop: theme.spacing(1)
|
|
1054
|
+
},
|
|
1055
|
+
icon: {
|
|
1056
|
+
color: theme.palette.common.black
|
|
1057
|
+
},
|
|
1058
|
+
list: {
|
|
1059
|
+
width: "100%"
|
|
1060
|
+
},
|
|
1061
|
+
listItemIcon: {
|
|
1062
|
+
width: "24px",
|
|
1063
|
+
height: "24px"
|
|
1064
|
+
},
|
|
1065
|
+
accordion: {
|
|
1066
|
+
backgroundColor: theme.palette.background.paper
|
|
1067
|
+
},
|
|
1068
|
+
accordionSummary: {
|
|
1069
|
+
minHeight: "auto",
|
|
1070
|
+
"&.Mui-expanded": {
|
|
1071
|
+
minHeight: "auto"
|
|
1072
|
+
}
|
|
1073
|
+
},
|
|
1074
|
+
accordionSummaryContent: {
|
|
1075
|
+
margin: theme.spacing(2, 0),
|
|
1076
|
+
"&.Mui-expanded": {
|
|
1077
|
+
margin: theme.spacing(2, 0)
|
|
1078
|
+
}
|
|
1079
|
+
},
|
|
1080
|
+
accordionDetails: {
|
|
1081
|
+
padding: theme.spacing(0, 0, 1)
|
|
1082
|
+
}
|
|
1083
|
+
}));
|
|
1084
|
+
const SearchTypeAccordion = (props) => {
|
|
1085
|
+
const classes = useStyles$2();
|
|
1086
|
+
const { setPageCursor, setTypes, types } = useSearch();
|
|
1087
|
+
const [expanded, setExpanded] = useState(true);
|
|
1088
|
+
const { defaultValue, name, types: givenTypes } = props;
|
|
1089
|
+
const toggleExpanded = () => setExpanded((prevState) => !prevState);
|
|
1090
|
+
const handleClick = (type) => {
|
|
1091
|
+
return () => {
|
|
1092
|
+
setTypes(type !== "" ? [type] : []);
|
|
1093
|
+
setPageCursor(void 0);
|
|
1094
|
+
setExpanded(false);
|
|
1095
|
+
};
|
|
1096
|
+
};
|
|
1097
|
+
useEffect(() => {
|
|
1098
|
+
if (defaultValue) {
|
|
1099
|
+
setTypes([defaultValue]);
|
|
1100
|
+
}
|
|
1101
|
+
}, []);
|
|
1102
|
+
const definedTypes = [
|
|
1103
|
+
{
|
|
1104
|
+
value: "",
|
|
1105
|
+
name: "All",
|
|
1106
|
+
icon: /* @__PURE__ */ React.createElement(AllIcon, null)
|
|
1107
|
+
},
|
|
1108
|
+
...givenTypes
|
|
1109
|
+
];
|
|
1110
|
+
const selected = types[0] || "";
|
|
1111
|
+
return /* @__PURE__ */ React.createElement(Card, {
|
|
1112
|
+
className: classes.card
|
|
1113
|
+
}, /* @__PURE__ */ React.createElement(CardHeader, {
|
|
1114
|
+
title: name,
|
|
1115
|
+
titleTypographyProps: { variant: "overline" }
|
|
1116
|
+
}), /* @__PURE__ */ React.createElement(CardContent, {
|
|
1117
|
+
className: classes.cardContent
|
|
1118
|
+
}, /* @__PURE__ */ React.createElement(Accordion, {
|
|
1119
|
+
className: classes.accordion,
|
|
1120
|
+
expanded,
|
|
1121
|
+
onChange: toggleExpanded
|
|
1122
|
+
}, /* @__PURE__ */ React.createElement(AccordionSummary, {
|
|
1123
|
+
classes: {
|
|
1124
|
+
root: classes.accordionSummary,
|
|
1125
|
+
content: classes.accordionSummaryContent
|
|
1126
|
+
},
|
|
1127
|
+
expandIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, {
|
|
1128
|
+
className: classes.icon
|
|
1129
|
+
}),
|
|
1130
|
+
IconButtonProps: { size: "small" }
|
|
1131
|
+
}, expanded ? "Collapse" : definedTypes.filter((t) => t.value === selected)[0].name), /* @__PURE__ */ React.createElement(AccordionDetails, {
|
|
1132
|
+
classes: { root: classes.accordionDetails }
|
|
1133
|
+
}, /* @__PURE__ */ React.createElement(List, {
|
|
1134
|
+
className: classes.list,
|
|
1135
|
+
component: "nav",
|
|
1136
|
+
"aria-label": "filter by type",
|
|
1137
|
+
disablePadding: true,
|
|
1138
|
+
dense: true
|
|
1139
|
+
}, definedTypes.map((type) => /* @__PURE__ */ React.createElement(Fragment, {
|
|
1140
|
+
key: type.value
|
|
1141
|
+
}, /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(ListItem, {
|
|
1142
|
+
selected: types[0] === type.value || types.length === 0 && type.value === "",
|
|
1143
|
+
onClick: handleClick(type.value),
|
|
1144
|
+
button: true
|
|
1145
|
+
}, /* @__PURE__ */ React.createElement(ListItemIcon, null, cloneElement(type.icon, {
|
|
1146
|
+
className: classes.listItemIcon
|
|
1147
|
+
})), /* @__PURE__ */ React.createElement(ListItemText, {
|
|
1148
|
+
primary: type.name
|
|
1149
|
+
})))))))));
|
|
1025
1150
|
};
|
|
1026
1151
|
|
|
1027
1152
|
const useStyles$1 = makeStyles((theme) => ({
|
|
1153
|
+
tabs: {
|
|
1154
|
+
borderBottom: `1px solid ${theme.palette.textVerySubtle}`,
|
|
1155
|
+
padding: theme.spacing(0, 4)
|
|
1156
|
+
},
|
|
1157
|
+
tab: {
|
|
1158
|
+
height: "50px",
|
|
1159
|
+
fontWeight: theme.typography.fontWeightBold,
|
|
1160
|
+
fontSize: theme.typography.pxToRem(13),
|
|
1161
|
+
color: theme.palette.textSubtle,
|
|
1162
|
+
minWidth: "130px"
|
|
1163
|
+
}
|
|
1164
|
+
}));
|
|
1165
|
+
const SearchTypeTabs = (props) => {
|
|
1166
|
+
const classes = useStyles$1();
|
|
1167
|
+
const { setPageCursor, setTypes, types } = useSearch();
|
|
1168
|
+
const { defaultValue, types: givenTypes } = props;
|
|
1169
|
+
const changeTab = (_, newType) => {
|
|
1170
|
+
setTypes(newType !== "" ? [newType] : []);
|
|
1171
|
+
setPageCursor(void 0);
|
|
1172
|
+
};
|
|
1173
|
+
useEffect(() => {
|
|
1174
|
+
if (defaultValue) {
|
|
1175
|
+
setTypes([defaultValue]);
|
|
1176
|
+
}
|
|
1177
|
+
}, []);
|
|
1178
|
+
const definedTypes = [
|
|
1179
|
+
{
|
|
1180
|
+
value: "",
|
|
1181
|
+
name: "All"
|
|
1182
|
+
},
|
|
1183
|
+
...givenTypes
|
|
1184
|
+
];
|
|
1185
|
+
return /* @__PURE__ */ React.createElement(Tabs, {
|
|
1186
|
+
className: classes.tabs,
|
|
1187
|
+
indicatorColor: "primary",
|
|
1188
|
+
value: types.length === 0 ? "" : types[0],
|
|
1189
|
+
onChange: changeTab
|
|
1190
|
+
}, definedTypes.map((type) => /* @__PURE__ */ React.createElement(Tab, {
|
|
1191
|
+
className: classes.tab,
|
|
1192
|
+
disableRipple: true,
|
|
1193
|
+
label: type.name,
|
|
1194
|
+
value: type.value
|
|
1195
|
+
})));
|
|
1196
|
+
};
|
|
1197
|
+
|
|
1198
|
+
const useStyles = makeStyles((theme) => ({
|
|
1028
1199
|
label: {
|
|
1029
1200
|
textTransform: "capitalize"
|
|
1030
1201
|
},
|
|
@@ -1037,13 +1208,9 @@ const useStyles$1 = makeStyles((theme) => ({
|
|
|
1037
1208
|
margin: 2
|
|
1038
1209
|
}
|
|
1039
1210
|
}));
|
|
1040
|
-
const SearchType = ({
|
|
1041
|
-
values = []
|
|
1042
|
-
|
|
1043
|
-
name,
|
|
1044
|
-
defaultValue
|
|
1045
|
-
}) => {
|
|
1046
|
-
const classes = useStyles$1();
|
|
1211
|
+
const SearchType = (props) => {
|
|
1212
|
+
const { className, defaultValue, name, values = [] } = props;
|
|
1213
|
+
const classes = useStyles();
|
|
1047
1214
|
const { types, setTypes } = useSearch();
|
|
1048
1215
|
useEffectOnce(() => {
|
|
1049
1216
|
if (!types.length) {
|
|
@@ -1058,37 +1225,47 @@ const SearchType = ({
|
|
|
1058
1225
|
const value = e.target.value;
|
|
1059
1226
|
setTypes(value);
|
|
1060
1227
|
};
|
|
1061
|
-
return /* @__PURE__ */
|
|
1228
|
+
return /* @__PURE__ */ React.createElement(FormControl, {
|
|
1062
1229
|
className,
|
|
1063
1230
|
variant: "filled",
|
|
1064
1231
|
fullWidth: true,
|
|
1065
1232
|
"data-testid": "search-typefilter-next"
|
|
1066
|
-
}, /* @__PURE__ */
|
|
1233
|
+
}, /* @__PURE__ */ React.createElement(InputLabel, {
|
|
1067
1234
|
className: classes.label,
|
|
1068
1235
|
margin: "dense"
|
|
1069
|
-
}, name), /* @__PURE__ */
|
|
1236
|
+
}, name), /* @__PURE__ */ React.createElement(Select, {
|
|
1070
1237
|
multiple: true,
|
|
1071
1238
|
variant: "outlined",
|
|
1072
1239
|
value: types,
|
|
1073
1240
|
onChange: handleChange,
|
|
1074
1241
|
placeholder: "All Results",
|
|
1075
|
-
renderValue: (selected) => /* @__PURE__ */
|
|
1242
|
+
renderValue: (selected) => /* @__PURE__ */ React.createElement("div", {
|
|
1076
1243
|
className: classes.chips
|
|
1077
|
-
}, selected.map((value) => /* @__PURE__ */
|
|
1244
|
+
}, selected.map((value) => /* @__PURE__ */ React.createElement(Chip, {
|
|
1078
1245
|
key: value,
|
|
1079
1246
|
label: value,
|
|
1080
1247
|
className: classes.chip,
|
|
1081
1248
|
size: "small"
|
|
1082
1249
|
})))
|
|
1083
|
-
}, values.map((value) => /* @__PURE__ */
|
|
1250
|
+
}, values.map((value) => /* @__PURE__ */ React.createElement(MenuItem, {
|
|
1084
1251
|
key: value,
|
|
1085
1252
|
value
|
|
1086
|
-
}, /* @__PURE__ */
|
|
1253
|
+
}, /* @__PURE__ */ React.createElement(Checkbox, {
|
|
1087
1254
|
checked: types.indexOf(value) > -1
|
|
1088
|
-
}), /* @__PURE__ */
|
|
1255
|
+
}), /* @__PURE__ */ React.createElement(ListItemText, {
|
|
1089
1256
|
primary: value
|
|
1090
1257
|
})))));
|
|
1091
1258
|
};
|
|
1259
|
+
SearchType.Accordion = (props) => {
|
|
1260
|
+
return /* @__PURE__ */ React.createElement(SearchTypeAccordion, {
|
|
1261
|
+
...props
|
|
1262
|
+
});
|
|
1263
|
+
};
|
|
1264
|
+
SearchType.Tabs = (props) => {
|
|
1265
|
+
return /* @__PURE__ */ React.createElement(SearchTypeTabs, {
|
|
1266
|
+
...props
|
|
1267
|
+
});
|
|
1268
|
+
};
|
|
1092
1269
|
|
|
1093
1270
|
const SidebarSearch = (props) => {
|
|
1094
1271
|
const searchRoute = useRouteRef(rootRouteRef);
|
|
@@ -1097,51 +1274,12 @@ const SidebarSearch = (props) => {
|
|
|
1097
1274
|
const queryString = qs.stringify({ query }, { addQueryPrefix: true });
|
|
1098
1275
|
navigate(`${searchRoute()}${queryString}`);
|
|
1099
1276
|
}, [navigate, searchRoute]);
|
|
1100
|
-
return /* @__PURE__ */
|
|
1277
|
+
return /* @__PURE__ */ React.createElement(SidebarSearchField, {
|
|
1101
1278
|
icon: props.icon,
|
|
1102
1279
|
onSearch: handleSearch,
|
|
1103
1280
|
to: "/search"
|
|
1104
1281
|
});
|
|
1105
1282
|
};
|
|
1106
1283
|
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
const navigate = useNavigate();
|
|
1110
|
-
return useCallback(({ query }) => {
|
|
1111
|
-
const queryString = qs.stringify({ query }, { addQueryPrefix: true });
|
|
1112
|
-
navigate(`${searchRoute()}${queryString}`);
|
|
1113
|
-
}, [navigate, searchRoute]);
|
|
1114
|
-
};
|
|
1115
|
-
|
|
1116
|
-
const useStyles = makeStyles$1({
|
|
1117
|
-
searchBar: {
|
|
1118
|
-
border: "1px solid #555",
|
|
1119
|
-
borderRadius: "6px",
|
|
1120
|
-
fontSize: "1.5em"
|
|
1121
|
-
}
|
|
1122
|
-
});
|
|
1123
|
-
const HomePageSearchBar = ({
|
|
1124
|
-
className: defaultClassName,
|
|
1125
|
-
...props
|
|
1126
|
-
}) => {
|
|
1127
|
-
const classes = useStyles();
|
|
1128
|
-
const [query, setQuery] = useState("");
|
|
1129
|
-
const handleSearch = useNavigateToQuery();
|
|
1130
|
-
const className = defaultClassName ? `${classes.searchBar} ${defaultClassName}` : classes.searchBar;
|
|
1131
|
-
const handleSubmit = () => {
|
|
1132
|
-
handleSearch({ query });
|
|
1133
|
-
};
|
|
1134
|
-
const handleChange = useCallback((value) => {
|
|
1135
|
-
setQuery(value);
|
|
1136
|
-
}, [setQuery]);
|
|
1137
|
-
return /* @__PURE__ */ React__default.createElement(SearchBarBase, {
|
|
1138
|
-
className,
|
|
1139
|
-
value: query,
|
|
1140
|
-
onSubmit: handleSubmit,
|
|
1141
|
-
onChange: handleChange,
|
|
1142
|
-
...props
|
|
1143
|
-
});
|
|
1144
|
-
};
|
|
1145
|
-
|
|
1146
|
-
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, HomePageSearchBar$1 as m, SearchBarNext as n, SearchPage$1 as o, SearchPageNext as p, searchPlugin as q, SearchResult$1 as r, searchApiRef as s, SidebarSearchModal as t, useSearch as u };
|
|
1147
|
-
//# sourceMappingURL=index-655809db.esm.js.map
|
|
1284
|
+
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 };
|
|
1285
|
+
//# sourceMappingURL=index-1eb3943d.esm.js.map
|