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