@backstage/plugin-search 0.5.4 → 0.6.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 +70 -0
- package/dist/esm/{index-05b04684.esm.js → index-0cc5ccb8.esm.js} +5 -4
- package/dist/esm/index-0cc5ccb8.esm.js.map +1 -0
- package/dist/esm/{index-9ed6d72a.esm.js → index-19c51c5a.esm.js} +301 -193
- package/dist/esm/index-19c51c5a.esm.js.map +1 -0
- package/dist/esm/{index-53fbff6a.esm.js → index-1d0bef15.esm.js} +5 -4
- package/dist/esm/index-1d0bef15.esm.js.map +1 -0
- package/dist/esm/{index-b090f4cf.esm.js → index-792f3072.esm.js} +11 -14
- package/dist/esm/{index-b090f4cf.esm.js.map → index-792f3072.esm.js.map} +1 -1
- package/dist/esm/{index-82c9eaed.esm.js → index-968bef26.esm.js} +8 -7
- package/dist/esm/{index-82c9eaed.esm.js.map → index-968bef26.esm.js.map} +1 -1
- package/dist/esm/{index-da49c2d7.esm.js → index-b4cc532f.esm.js} +5 -4
- package/dist/esm/index-b4cc532f.esm.js.map +1 -0
- package/dist/esm/{index-5842ad6f.esm.js → index-eaf72cdc.esm.js} +5 -4
- package/dist/esm/index-eaf72cdc.esm.js.map +1 -0
- package/dist/index.d.ts +53 -12
- package/dist/index.esm.js +4 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +13 -13
- package/dist/esm/index-05b04684.esm.js.map +0 -1
- package/dist/esm/index-53fbff6a.esm.js.map +0 -1
- package/dist/esm/index-5842ad6f.esm.js.map +0 -1
- package/dist/esm/index-9ed6d72a.esm.js.map +0 -1
- package/dist/esm/index-da49c2d7.esm.js.map +0 -1
|
@@ -1,24 +1,24 @@
|
|
|
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, useRef, 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, Tabs, Tab
|
|
6
|
+
import { makeStyles, IconButton, Typography, Card, CardHeader, Button, Divider, CardContent, Select, MenuItem, List, ListItem, Checkbox, ListItemText, InputBase, InputAdornment, TextField, Chip, FormControl, FormLabel, FormControlLabel, InputLabel, ListItemIcon, Box, useTheme, Dialog, DialogTitle, Paper, DialogContent, Grid, DialogActions, Accordion, AccordionSummary, AccordionDetails, Tabs, Tab } from '@material-ui/core';
|
|
8
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';
|
|
11
10
|
import useAsync from 'react-use/lib/useAsync';
|
|
12
11
|
import usePrevious from 'react-use/lib/usePrevious';
|
|
12
|
+
import { Autocomplete, Alert } from '@material-ui/lab';
|
|
13
|
+
import useAsyncFn from 'react-use/lib/useAsyncFn';
|
|
14
|
+
import LaunchIcon from '@material-ui/icons/Launch';
|
|
13
15
|
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';
|
|
16
|
+
import { Link, Progress, ResponseErrorPanel, EmptyState, useContent, Table, useQueryParamState, Page, Header, Content, SidebarSearchField } from '@backstage/core-components';
|
|
15
17
|
import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';
|
|
16
18
|
import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';
|
|
17
|
-
import { createSvgIcon } from '@material-ui/core/utils';
|
|
18
19
|
import { useOutlet, useLocation } from 'react-router';
|
|
19
20
|
import InputBase$1 from '@material-ui/core/InputBase';
|
|
20
21
|
import IconButton$1 from '@material-ui/core/IconButton';
|
|
21
|
-
import { Alert } from '@material-ui/lab';
|
|
22
22
|
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
23
23
|
import { ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
|
24
24
|
import useEffectOnce from 'react-use/lib/useEffectOnce';
|
|
@@ -35,7 +35,7 @@ class SearchClient {
|
|
|
35
35
|
this.identityApi = options.identityApi;
|
|
36
36
|
}
|
|
37
37
|
async query(query) {
|
|
38
|
-
const token = await this.identityApi.
|
|
38
|
+
const { token } = await this.identityApi.getCredentials();
|
|
39
39
|
const queryString = qs.stringify(query);
|
|
40
40
|
const url = `${await this.discoveryApi.getBaseUrl("search/query")}?${queryString}`;
|
|
41
41
|
const response = await fetch(url, {
|
|
@@ -62,13 +62,13 @@ const FiltersButton$1 = ({
|
|
|
62
62
|
handleToggleFilters
|
|
63
63
|
}) => {
|
|
64
64
|
const classes = useStyles$b();
|
|
65
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
66
66
|
className: classes.filters
|
|
67
|
-
}, /* @__PURE__ */
|
|
67
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
68
68
|
className: classes.icon,
|
|
69
69
|
"aria-label": "settings",
|
|
70
70
|
onClick: handleToggleFilters
|
|
71
|
-
}, /* @__PURE__ */
|
|
71
|
+
}, /* @__PURE__ */ React.createElement(FilterListIcon, null)), /* @__PURE__ */ React.createElement(Typography, {
|
|
72
72
|
variant: "h6"
|
|
73
73
|
}, "Filters (", numberOfSelectedFilters ? numberOfSelectedFilters : 0, ")"));
|
|
74
74
|
};
|
|
@@ -93,21 +93,21 @@ const Filters$1 = ({
|
|
|
93
93
|
updateChecked
|
|
94
94
|
}) => {
|
|
95
95
|
const classes = useStyles$a();
|
|
96
|
-
return /* @__PURE__ */
|
|
96
|
+
return /* @__PURE__ */ React.createElement(Card, {
|
|
97
97
|
className: classes.filters
|
|
98
|
-
}, /* @__PURE__ */
|
|
99
|
-
title: /* @__PURE__ */
|
|
98
|
+
}, /* @__PURE__ */ React.createElement(CardHeader, {
|
|
99
|
+
title: /* @__PURE__ */ React.createElement(Typography, {
|
|
100
100
|
variant: "h6"
|
|
101
101
|
}, "Filters"),
|
|
102
|
-
action: /* @__PURE__ */
|
|
102
|
+
action: /* @__PURE__ */ React.createElement(Button, {
|
|
103
103
|
color: "primary",
|
|
104
104
|
onClick: () => resetFilters()
|
|
105
105
|
}, "CLEAR ALL")
|
|
106
|
-
}), /* @__PURE__ */
|
|
106
|
+
}), /* @__PURE__ */ React.createElement(Divider, null), filterOptions.kind.length === 0 && filterOptions.lifecycle.length === 0 && /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
107
107
|
variant: "subtitle2"
|
|
108
|
-
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */
|
|
108
|
+
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
109
109
|
variant: "subtitle2"
|
|
110
|
-
}, "Kind"), /* @__PURE__ */
|
|
110
|
+
}, "Kind"), /* @__PURE__ */ React.createElement(Select, {
|
|
111
111
|
id: "outlined-select",
|
|
112
112
|
onChange: (e) => {
|
|
113
113
|
var _a;
|
|
@@ -116,22 +116,22 @@ const Filters$1 = ({
|
|
|
116
116
|
variant: "outlined",
|
|
117
117
|
className: classes.dropdown,
|
|
118
118
|
value: filters.selected
|
|
119
|
-
}, filterOptions.kind.map((filter) => /* @__PURE__ */
|
|
119
|
+
}, filterOptions.kind.map((filter) => /* @__PURE__ */ React.createElement(MenuItem, {
|
|
120
120
|
selected: filter === "",
|
|
121
121
|
dense: true,
|
|
122
122
|
key: filter,
|
|
123
123
|
value: filter
|
|
124
|
-
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */
|
|
124
|
+
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
125
125
|
variant: "subtitle2"
|
|
126
|
-
}, "Lifecycle"), /* @__PURE__ */
|
|
126
|
+
}, "Lifecycle"), /* @__PURE__ */ React.createElement(List, {
|
|
127
127
|
disablePadding: true,
|
|
128
128
|
dense: true
|
|
129
|
-
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */
|
|
129
|
+
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */ React.createElement(ListItem, {
|
|
130
130
|
key: filter,
|
|
131
131
|
dense: true,
|
|
132
132
|
button: true,
|
|
133
133
|
onClick: () => updateChecked(filter)
|
|
134
|
-
}, /* @__PURE__ */
|
|
134
|
+
}, /* @__PURE__ */ React.createElement(Checkbox, {
|
|
135
135
|
edge: "start",
|
|
136
136
|
disableRipple: true,
|
|
137
137
|
className: classes.checkbox,
|
|
@@ -140,7 +140,7 @@ const Filters$1 = ({
|
|
|
140
140
|
tabIndex: -1,
|
|
141
141
|
value: filter,
|
|
142
142
|
name: filter
|
|
143
|
-
}), /* @__PURE__ */
|
|
143
|
+
}), /* @__PURE__ */ React.createElement(ListItemText, {
|
|
144
144
|
id: filter,
|
|
145
145
|
primary: filter
|
|
146
146
|
}))))));
|
|
@@ -201,9 +201,9 @@ const SearchContextProvider = ({
|
|
|
201
201
|
fetchNextPage: hasNextPage ? fetchNextPage : void 0,
|
|
202
202
|
fetchPreviousPage: hasPreviousPage ? fetchPreviousPage : void 0
|
|
203
203
|
};
|
|
204
|
-
return /* @__PURE__ */
|
|
204
|
+
return /* @__PURE__ */ React.createElement(AnalyticsContext, {
|
|
205
205
|
attributes: { searchTypes: types.sort().join(",") }
|
|
206
|
-
}, /* @__PURE__ */
|
|
206
|
+
}, /* @__PURE__ */ React.createElement(SearchContext.Provider, {
|
|
207
207
|
value,
|
|
208
208
|
children
|
|
209
209
|
}));
|
|
@@ -224,7 +224,7 @@ const TrackSearch = ({ children }) => {
|
|
|
224
224
|
analytics.captureEvent("search", term);
|
|
225
225
|
}
|
|
226
226
|
}, [analytics, term]);
|
|
227
|
-
return /* @__PURE__ */
|
|
227
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
228
228
|
};
|
|
229
229
|
|
|
230
230
|
const useSearchContextCheck = () => {
|
|
@@ -264,19 +264,19 @@ const SearchBarBase = ({
|
|
|
264
264
|
onChange("");
|
|
265
265
|
}, [onChange]);
|
|
266
266
|
const placeholder = `Search in ${configApi.getOptionalString("app.title") || "Backstage"}`;
|
|
267
|
-
const startAdornment = /* @__PURE__ */
|
|
267
|
+
const startAdornment = /* @__PURE__ */ React.createElement(InputAdornment, {
|
|
268
268
|
position: "start"
|
|
269
|
-
}, /* @__PURE__ */
|
|
269
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
270
270
|
"aria-label": "Query",
|
|
271
271
|
disabled: true
|
|
272
|
-
}, /* @__PURE__ */
|
|
273
|
-
const endAdornment = /* @__PURE__ */
|
|
272
|
+
}, /* @__PURE__ */ React.createElement(SearchIcon, null)));
|
|
273
|
+
const endAdornment = /* @__PURE__ */ React.createElement(InputAdornment, {
|
|
274
274
|
position: "end"
|
|
275
|
-
}, /* @__PURE__ */
|
|
275
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
276
276
|
"aria-label": "Clear",
|
|
277
277
|
onClick: handleClear
|
|
278
|
-
}, /* @__PURE__ */
|
|
279
|
-
const searchBar = /* @__PURE__ */
|
|
278
|
+
}, /* @__PURE__ */ React.createElement(ClearButton, null)));
|
|
279
|
+
const searchBar = /* @__PURE__ */ React.createElement(TrackSearch, null, /* @__PURE__ */ React.createElement(InputBase, {
|
|
280
280
|
"data-testid": "search-bar-next",
|
|
281
281
|
value,
|
|
282
282
|
placeholder,
|
|
@@ -288,7 +288,7 @@ const SearchBarBase = ({
|
|
|
288
288
|
onKeyDown: handleKeyDown,
|
|
289
289
|
...props
|
|
290
290
|
}));
|
|
291
|
-
return hasSearchContext ? searchBar : /* @__PURE__ */
|
|
291
|
+
return hasSearchContext ? searchBar : /* @__PURE__ */ React.createElement(SearchContextProvider, null, searchBar);
|
|
292
292
|
};
|
|
293
293
|
const SearchBar$1 = ({ onChange, ...props }) => {
|
|
294
294
|
const { term, setTerm } = useSearch();
|
|
@@ -299,34 +299,130 @@ const SearchBar$1 = ({ onChange, ...props }) => {
|
|
|
299
299
|
setTerm(newValue);
|
|
300
300
|
}
|
|
301
301
|
};
|
|
302
|
-
return /* @__PURE__ */
|
|
302
|
+
return /* @__PURE__ */ React.createElement(SearchBarBase, {
|
|
303
303
|
value: term,
|
|
304
304
|
onChange: handleChange,
|
|
305
305
|
...props
|
|
306
306
|
});
|
|
307
307
|
};
|
|
308
308
|
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
309
|
+
const useAsyncFilterValues = (fn, inputValue, defaultValues = [], debounce = 250) => {
|
|
310
|
+
const valuesMemo = useRef({});
|
|
311
|
+
const definiteFn = fn || (() => Promise.resolve([]));
|
|
312
|
+
const [state, callback] = useAsyncFn(definiteFn, [inputValue], {
|
|
313
|
+
loading: true
|
|
314
|
+
});
|
|
315
|
+
useDebounce(() => {
|
|
316
|
+
if (valuesMemo.current[inputValue] === void 0) {
|
|
317
|
+
valuesMemo.current[inputValue] = callback(inputValue).then((values) => {
|
|
318
|
+
valuesMemo.current[inputValue] = values;
|
|
319
|
+
return values;
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}, debounce, [callback, inputValue]);
|
|
323
|
+
if (defaultValues.length) {
|
|
324
|
+
return {
|
|
325
|
+
loading: false,
|
|
326
|
+
value: defaultValues
|
|
327
|
+
};
|
|
312
328
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
|
|
329
|
+
const possibleValue = valuesMemo.current[inputValue];
|
|
330
|
+
if (Array.isArray(possibleValue)) {
|
|
331
|
+
return {
|
|
332
|
+
loading: false,
|
|
333
|
+
value: possibleValue
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
return state;
|
|
337
|
+
};
|
|
338
|
+
const useDefaultFilterValue = (name, defaultValue) => {
|
|
339
|
+
const { setFilters } = useSearch();
|
|
322
340
|
useEffect(() => {
|
|
323
|
-
if (
|
|
341
|
+
if (defaultValue && [defaultValue].flat().length > 0) {
|
|
324
342
|
setFilters((prevFilters) => ({
|
|
325
343
|
...prevFilters,
|
|
326
344
|
[name]: defaultValue
|
|
327
345
|
}));
|
|
328
346
|
}
|
|
329
347
|
}, []);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
const AutocompleteFilter = (props) => {
|
|
351
|
+
const {
|
|
352
|
+
className,
|
|
353
|
+
defaultValue,
|
|
354
|
+
name,
|
|
355
|
+
values: givenValues,
|
|
356
|
+
valuesDebounceMs,
|
|
357
|
+
label,
|
|
358
|
+
filterSelectedOptions,
|
|
359
|
+
limitTags,
|
|
360
|
+
multiple
|
|
361
|
+
} = props;
|
|
362
|
+
const [inputValue, setInputValue] = useState("");
|
|
363
|
+
useDefaultFilterValue(name, defaultValue);
|
|
364
|
+
const asyncValues = typeof givenValues === "function" ? givenValues : void 0;
|
|
365
|
+
const defaultValues = typeof givenValues === "function" ? void 0 : givenValues;
|
|
366
|
+
const { value: values, loading } = useAsyncFilterValues(asyncValues, inputValue, defaultValues, valuesDebounceMs);
|
|
367
|
+
const { filters, setFilters } = useSearch();
|
|
368
|
+
const filterValue = filters[name] || (multiple ? [] : null);
|
|
369
|
+
const handleChange = (_, newValue) => {
|
|
370
|
+
setFilters((prevState) => {
|
|
371
|
+
const { [name]: filter, ...others } = prevState;
|
|
372
|
+
if (newValue) {
|
|
373
|
+
return { ...others, [name]: newValue };
|
|
374
|
+
}
|
|
375
|
+
return { ...others };
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
const renderInput = (params) => /* @__PURE__ */ React.createElement(TextField, {
|
|
379
|
+
...params,
|
|
380
|
+
name: "search",
|
|
381
|
+
variant: "outlined",
|
|
382
|
+
label,
|
|
383
|
+
fullWidth: true
|
|
384
|
+
});
|
|
385
|
+
const renderTags = (tagValue, getTagProps) => tagValue.map((option, index) => /* @__PURE__ */ React.createElement(Chip, {
|
|
386
|
+
label: option,
|
|
387
|
+
color: "primary",
|
|
388
|
+
...getTagProps({ index })
|
|
389
|
+
}));
|
|
390
|
+
return /* @__PURE__ */ React.createElement(Autocomplete, {
|
|
391
|
+
filterSelectedOptions,
|
|
392
|
+
limitTags,
|
|
393
|
+
multiple,
|
|
394
|
+
className,
|
|
395
|
+
id: `${multiple ? "multi-" : ""}select-filter-${name}--select`,
|
|
396
|
+
options: values || [],
|
|
397
|
+
loading,
|
|
398
|
+
value: filterValue,
|
|
399
|
+
onChange: handleChange,
|
|
400
|
+
onInputChange: (_, newValue) => setInputValue(newValue),
|
|
401
|
+
renderInput,
|
|
402
|
+
renderTags
|
|
403
|
+
});
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
const useStyles$9 = makeStyles({
|
|
407
|
+
label: {
|
|
408
|
+
textTransform: "capitalize"
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
const CheckboxFilter = (props) => {
|
|
412
|
+
const {
|
|
413
|
+
className,
|
|
414
|
+
defaultValue,
|
|
415
|
+
label,
|
|
416
|
+
name,
|
|
417
|
+
values: givenValues = [],
|
|
418
|
+
valuesDebounceMs
|
|
419
|
+
} = props;
|
|
420
|
+
const classes = useStyles$9();
|
|
421
|
+
const { filters, setFilters } = useSearch();
|
|
422
|
+
useDefaultFilterValue(name, defaultValue);
|
|
423
|
+
const asyncValues = typeof givenValues === "function" ? givenValues : void 0;
|
|
424
|
+
const defaultValues = typeof givenValues === "function" ? void 0 : givenValues;
|
|
425
|
+
const { value: values = [], loading } = useAsyncFilterValues(asyncValues, "", defaultValues, valuesDebounceMs);
|
|
330
426
|
const handleChange = (e) => {
|
|
331
427
|
const {
|
|
332
428
|
target: { value, checked }
|
|
@@ -338,17 +434,18 @@ const CheckboxFilter = ({
|
|
|
338
434
|
return items.length ? { ...others, [name]: items } : others;
|
|
339
435
|
});
|
|
340
436
|
};
|
|
341
|
-
return /* @__PURE__ */
|
|
437
|
+
return /* @__PURE__ */ React.createElement(FormControl, {
|
|
342
438
|
className,
|
|
439
|
+
disabled: loading,
|
|
343
440
|
fullWidth: true,
|
|
344
441
|
"data-testid": "search-checkboxfilter-next"
|
|
345
|
-
}, /* @__PURE__ */
|
|
442
|
+
}, label ? /* @__PURE__ */ React.createElement(FormLabel, {
|
|
346
443
|
className: classes.label
|
|
347
|
-
},
|
|
444
|
+
}, label) : null, values.map((value) => {
|
|
348
445
|
var _a;
|
|
349
|
-
return /* @__PURE__ */
|
|
446
|
+
return /* @__PURE__ */ React.createElement(FormControlLabel, {
|
|
350
447
|
key: value,
|
|
351
|
-
control: /* @__PURE__ */
|
|
448
|
+
control: /* @__PURE__ */ React.createElement(Checkbox, {
|
|
352
449
|
color: "primary",
|
|
353
450
|
tabIndex: -1,
|
|
354
451
|
inputProps: { "aria-labelledby": value },
|
|
@@ -361,22 +458,21 @@ const CheckboxFilter = ({
|
|
|
361
458
|
});
|
|
362
459
|
}));
|
|
363
460
|
};
|
|
364
|
-
const SelectFilter = ({
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
461
|
+
const SelectFilter = (props) => {
|
|
462
|
+
const {
|
|
463
|
+
className,
|
|
464
|
+
defaultValue,
|
|
465
|
+
label,
|
|
466
|
+
name,
|
|
467
|
+
values: givenValues,
|
|
468
|
+
valuesDebounceMs
|
|
469
|
+
} = props;
|
|
370
470
|
const classes = useStyles$9();
|
|
471
|
+
useDefaultFilterValue(name, defaultValue);
|
|
472
|
+
const asyncValues = typeof givenValues === "function" ? givenValues : void 0;
|
|
473
|
+
const defaultValues = typeof givenValues === "function" ? void 0 : givenValues;
|
|
474
|
+
const { value: values = [], loading } = useAsyncFilterValues(asyncValues, "", defaultValues, valuesDebounceMs);
|
|
371
475
|
const { filters, setFilters } = useSearch();
|
|
372
|
-
useEffect(() => {
|
|
373
|
-
if (typeof defaultValue === "string") {
|
|
374
|
-
setFilters((prevFilters) => ({
|
|
375
|
-
...prevFilters,
|
|
376
|
-
[name]: defaultValue
|
|
377
|
-
}));
|
|
378
|
-
}
|
|
379
|
-
}, []);
|
|
380
476
|
const handleChange = (e) => {
|
|
381
477
|
const {
|
|
382
478
|
target: { value }
|
|
@@ -386,58 +482,62 @@ const SelectFilter = ({
|
|
|
386
482
|
return value ? { ...others, [name]: value } : others;
|
|
387
483
|
});
|
|
388
484
|
};
|
|
389
|
-
return /* @__PURE__ */
|
|
485
|
+
return /* @__PURE__ */ React.createElement(FormControl, {
|
|
486
|
+
disabled: loading,
|
|
390
487
|
className,
|
|
391
488
|
variant: "filled",
|
|
392
489
|
fullWidth: true,
|
|
393
490
|
"data-testid": "search-selectfilter-next"
|
|
394
|
-
}, /* @__PURE__ */
|
|
491
|
+
}, label ? /* @__PURE__ */ React.createElement(InputLabel, {
|
|
395
492
|
className: classes.label,
|
|
396
493
|
margin: "dense"
|
|
397
|
-
},
|
|
494
|
+
}, label) : null, /* @__PURE__ */ React.createElement(Select, {
|
|
398
495
|
variant: "outlined",
|
|
399
496
|
value: filters[name] || "",
|
|
400
497
|
onChange: handleChange
|
|
401
|
-
}, /* @__PURE__ */
|
|
498
|
+
}, /* @__PURE__ */ React.createElement(MenuItem, {
|
|
402
499
|
value: ""
|
|
403
|
-
}, /* @__PURE__ */
|
|
500
|
+
}, /* @__PURE__ */ React.createElement("em", null, "All")), values.map((value) => /* @__PURE__ */ React.createElement(MenuItem, {
|
|
404
501
|
key: value,
|
|
405
502
|
value
|
|
406
503
|
}, value))));
|
|
407
504
|
};
|
|
408
|
-
const SearchFilter = ({
|
|
505
|
+
const SearchFilter = ({
|
|
506
|
+
component: Element,
|
|
507
|
+
...props
|
|
508
|
+
}) => /* @__PURE__ */ React.createElement(Element, {
|
|
409
509
|
...props
|
|
410
510
|
});
|
|
411
|
-
SearchFilter.Checkbox = (props) => /* @__PURE__ */
|
|
511
|
+
SearchFilter.Checkbox = (props) => /* @__PURE__ */ React.createElement(SearchFilter, {
|
|
412
512
|
...props,
|
|
413
513
|
component: CheckboxFilter
|
|
414
514
|
});
|
|
415
|
-
SearchFilter.Select = (props) => /* @__PURE__ */
|
|
515
|
+
SearchFilter.Select = (props) => /* @__PURE__ */ React.createElement(SearchFilter, {
|
|
416
516
|
...props,
|
|
417
517
|
component: SelectFilter
|
|
418
518
|
});
|
|
519
|
+
SearchFilter.Autocomplete = (props) => /* @__PURE__ */ React.createElement(SearchFilter, {
|
|
520
|
+
...props,
|
|
521
|
+
component: AutocompleteFilter
|
|
522
|
+
});
|
|
419
523
|
const SearchFilterNext = SearchFilter;
|
|
420
524
|
|
|
421
|
-
var Launch = createSvgIcon( /*#__PURE__*/React.createElement("path", {
|
|
422
|
-
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"
|
|
423
|
-
}), 'Launch');
|
|
424
|
-
|
|
425
525
|
const DefaultResultListItem$1 = ({
|
|
426
526
|
result,
|
|
427
527
|
icon,
|
|
428
528
|
secondaryAction
|
|
429
529
|
}) => {
|
|
430
|
-
return /* @__PURE__ */
|
|
530
|
+
return /* @__PURE__ */ React.createElement(Link, {
|
|
431
531
|
to: result.location
|
|
432
|
-
}, /* @__PURE__ */
|
|
532
|
+
}, /* @__PURE__ */ React.createElement(ListItem, {
|
|
433
533
|
alignItems: "center"
|
|
434
|
-
}, icon && /* @__PURE__ */
|
|
534
|
+
}, icon && /* @__PURE__ */ React.createElement(ListItemIcon, null, icon), /* @__PURE__ */ React.createElement(ListItemText, {
|
|
435
535
|
primaryTypographyProps: { variant: "h6" },
|
|
436
536
|
primary: result.title,
|
|
437
537
|
secondary: result.text
|
|
438
|
-
}), secondaryAction && /* @__PURE__ */
|
|
538
|
+
}), secondaryAction && /* @__PURE__ */ React.createElement(Box, {
|
|
439
539
|
alignItems: "flex-end"
|
|
440
|
-
}, secondaryAction)), /* @__PURE__ */
|
|
540
|
+
}, secondaryAction)), /* @__PURE__ */ React.createElement(Divider, null));
|
|
441
541
|
};
|
|
442
542
|
|
|
443
543
|
const SearchResultComponent = ({ children }) => {
|
|
@@ -445,21 +545,21 @@ const SearchResultComponent = ({ children }) => {
|
|
|
445
545
|
result: { loading, error, value }
|
|
446
546
|
} = useSearch();
|
|
447
547
|
if (loading) {
|
|
448
|
-
return /* @__PURE__ */
|
|
548
|
+
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
449
549
|
}
|
|
450
550
|
if (error) {
|
|
451
|
-
return /* @__PURE__ */
|
|
551
|
+
return /* @__PURE__ */ React.createElement(ResponseErrorPanel, {
|
|
452
552
|
title: "Error encountered while fetching search results",
|
|
453
553
|
error
|
|
454
554
|
});
|
|
455
555
|
}
|
|
456
556
|
if (!(value == null ? void 0 : value.results.length)) {
|
|
457
|
-
return /* @__PURE__ */
|
|
557
|
+
return /* @__PURE__ */ React.createElement(EmptyState, {
|
|
458
558
|
missing: "data",
|
|
459
559
|
title: "Sorry, no results were found"
|
|
460
560
|
});
|
|
461
561
|
}
|
|
462
|
-
return /* @__PURE__ */
|
|
562
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children({ results: value.results }));
|
|
463
563
|
};
|
|
464
564
|
|
|
465
565
|
const useStyles$8 = makeStyles((theme) => ({
|
|
@@ -474,21 +574,21 @@ const SearchResultPager = () => {
|
|
|
474
574
|
const { fetchNextPage, fetchPreviousPage } = useSearch();
|
|
475
575
|
const classes = useStyles$8();
|
|
476
576
|
if (!fetchNextPage && !fetchPreviousPage) {
|
|
477
|
-
return /* @__PURE__ */
|
|
577
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
478
578
|
}
|
|
479
|
-
return /* @__PURE__ */
|
|
579
|
+
return /* @__PURE__ */ React.createElement("nav", {
|
|
480
580
|
"arial-label": "pagination navigation",
|
|
481
581
|
className: classes.root
|
|
482
|
-
}, /* @__PURE__ */
|
|
582
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
483
583
|
"aria-label": "previous page",
|
|
484
584
|
disabled: !fetchPreviousPage,
|
|
485
585
|
onClick: fetchPreviousPage,
|
|
486
|
-
startIcon: /* @__PURE__ */
|
|
487
|
-
}, "Previous"), /* @__PURE__ */
|
|
586
|
+
startIcon: /* @__PURE__ */ React.createElement(ArrowBackIosIcon, null)
|
|
587
|
+
}, "Previous"), /* @__PURE__ */ React.createElement(Button, {
|
|
488
588
|
"aria-label": "next page",
|
|
489
589
|
disabled: !fetchNextPage,
|
|
490
590
|
onClick: fetchNextPage,
|
|
491
|
-
endIcon: /* @__PURE__ */
|
|
591
|
+
endIcon: /* @__PURE__ */ React.createElement(ArrowForwardIosIcon, null)
|
|
492
592
|
}, "Next"));
|
|
493
593
|
};
|
|
494
594
|
|
|
@@ -516,54 +616,54 @@ const searchPlugin = createPlugin({
|
|
|
516
616
|
});
|
|
517
617
|
const SearchPage$1 = searchPlugin.provide(createRoutableExtension({
|
|
518
618
|
name: "SearchPage",
|
|
519
|
-
component: () => import('./index-
|
|
619
|
+
component: () => import('./index-0cc5ccb8.esm.js').then((m) => m.SearchPage),
|
|
520
620
|
mountPoint: rootRouteRef
|
|
521
621
|
}));
|
|
522
622
|
const SearchPageNext = searchPlugin.provide(createRoutableExtension({
|
|
523
623
|
name: "SearchPageNext",
|
|
524
|
-
component: () => import('./index-
|
|
624
|
+
component: () => import('./index-0cc5ccb8.esm.js').then((m) => m.SearchPage),
|
|
525
625
|
mountPoint: rootNextRouteRef
|
|
526
626
|
}));
|
|
527
627
|
searchPlugin.provide(createComponentExtension({
|
|
528
628
|
name: "SearchBar",
|
|
529
629
|
component: {
|
|
530
|
-
lazy: () => import('./index-
|
|
630
|
+
lazy: () => import('./index-1d0bef15.esm.js').then((m) => m.SearchBar)
|
|
531
631
|
}
|
|
532
632
|
}));
|
|
533
633
|
const SearchBarNext = searchPlugin.provide(createComponentExtension({
|
|
534
634
|
name: "SearchBarNext",
|
|
535
635
|
component: {
|
|
536
|
-
lazy: () => import('./index-
|
|
636
|
+
lazy: () => import('./index-1d0bef15.esm.js').then((m) => m.SearchBar)
|
|
537
637
|
}
|
|
538
638
|
}));
|
|
539
639
|
const SearchResult$1 = searchPlugin.provide(createComponentExtension({
|
|
540
640
|
name: "SearchResult",
|
|
541
641
|
component: {
|
|
542
|
-
lazy: () => import('./index-
|
|
642
|
+
lazy: () => import('./index-eaf72cdc.esm.js').then((m) => m.SearchResult)
|
|
543
643
|
}
|
|
544
644
|
}));
|
|
545
645
|
searchPlugin.provide(createComponentExtension({
|
|
546
646
|
name: "SearchResultNext",
|
|
547
647
|
component: {
|
|
548
|
-
lazy: () => import('./index-
|
|
648
|
+
lazy: () => import('./index-eaf72cdc.esm.js').then((m) => m.SearchResult)
|
|
549
649
|
}
|
|
550
650
|
}));
|
|
551
651
|
const SidebarSearchModal = searchPlugin.provide(createComponentExtension({
|
|
552
652
|
name: "SidebarSearchModal",
|
|
553
653
|
component: {
|
|
554
|
-
lazy: () => import('./index-
|
|
654
|
+
lazy: () => import('./index-968bef26.esm.js').then((m) => m.SidebarSearchModal)
|
|
555
655
|
}
|
|
556
656
|
}));
|
|
557
657
|
const DefaultResultListItem = searchPlugin.provide(createComponentExtension({
|
|
558
658
|
name: "DefaultResultListItem",
|
|
559
659
|
component: {
|
|
560
|
-
lazy: () => import('./index-
|
|
660
|
+
lazy: () => import('./index-b4cc532f.esm.js').then((m) => m.DefaultResultListItem)
|
|
561
661
|
}
|
|
562
662
|
}));
|
|
563
663
|
const HomePageSearchBar = searchPlugin.provide(createComponentExtension({
|
|
564
664
|
name: "HomePageSearchBar",
|
|
565
665
|
component: {
|
|
566
|
-
lazy: () => import('./index-
|
|
666
|
+
lazy: () => import('./index-792f3072.esm.js').then((m) => m.HomePageSearchBar)
|
|
567
667
|
}
|
|
568
668
|
}));
|
|
569
669
|
|
|
@@ -584,13 +684,16 @@ const Modal = ({ open = true, toggleModal }) => {
|
|
|
584
684
|
const getSearchLink = useRouteRef(rootRouteRef);
|
|
585
685
|
const classes = useStyles$7();
|
|
586
686
|
const { term } = useSearch();
|
|
687
|
+
const { focusContent } = useContent();
|
|
688
|
+
const { transitions } = useTheme();
|
|
587
689
|
const handleResultClick = () => {
|
|
588
690
|
toggleModal();
|
|
691
|
+
setTimeout(focusContent, transitions.duration.leavingScreen);
|
|
589
692
|
};
|
|
590
693
|
const handleKeyPress = () => {
|
|
591
694
|
handleResultClick();
|
|
592
695
|
};
|
|
593
|
-
return /* @__PURE__ */
|
|
696
|
+
return /* @__PURE__ */ React.createElement(Dialog, {
|
|
594
697
|
classes: {
|
|
595
698
|
paperFullWidth: classes.paperFullWidth
|
|
596
699
|
},
|
|
@@ -599,45 +702,48 @@ const Modal = ({ open = true, toggleModal }) => {
|
|
|
599
702
|
open,
|
|
600
703
|
fullWidth: true,
|
|
601
704
|
maxWidth: "lg"
|
|
602
|
-
}, /* @__PURE__ */
|
|
705
|
+
}, /* @__PURE__ */ React.createElement(DialogTitle, null, /* @__PURE__ */ React.createElement(Paper, {
|
|
603
706
|
className: classes.container
|
|
604
|
-
}, /* @__PURE__ */
|
|
707
|
+
}, /* @__PURE__ */ React.createElement(SearchBar$1, {
|
|
605
708
|
className: classes.input
|
|
606
|
-
}))), /* @__PURE__ */
|
|
709
|
+
}))), /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Grid, {
|
|
607
710
|
container: true,
|
|
608
711
|
direction: "row-reverse",
|
|
609
712
|
justifyContent: "flex-start",
|
|
610
713
|
alignItems: "center"
|
|
611
|
-
}, /* @__PURE__ */
|
|
714
|
+
}, /* @__PURE__ */ React.createElement(Grid, {
|
|
612
715
|
item: true
|
|
613
|
-
}, /* @__PURE__ */
|
|
614
|
-
onClick:
|
|
716
|
+
}, /* @__PURE__ */ React.createElement(Link, {
|
|
717
|
+
onClick: () => {
|
|
718
|
+
toggleModal();
|
|
719
|
+
setTimeout(focusContent, transitions.duration.leavingScreen);
|
|
720
|
+
},
|
|
615
721
|
to: `${getSearchLink()}?query=${term}`
|
|
616
|
-
}, /* @__PURE__ */
|
|
722
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
617
723
|
className: classes.viewResultsLink
|
|
618
|
-
}, "View Full Results"), /* @__PURE__ */
|
|
724
|
+
}, "View Full Results"), /* @__PURE__ */ React.createElement(LaunchIcon, {
|
|
619
725
|
color: "primary"
|
|
620
|
-
})))), /* @__PURE__ */
|
|
726
|
+
})))), /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(SearchResultComponent, null, ({ results }) => /* @__PURE__ */ React.createElement(List, null, results.map(({ document }) => /* @__PURE__ */ React.createElement("div", {
|
|
621
727
|
role: "button",
|
|
622
728
|
tabIndex: 0,
|
|
623
729
|
key: `${document.location}-btn`,
|
|
624
730
|
onClick: handleResultClick,
|
|
625
731
|
onKeyPress: handleKeyPress
|
|
626
|
-
}, /* @__PURE__ */
|
|
732
|
+
}, /* @__PURE__ */ React.createElement(DefaultResultListItem$1, {
|
|
627
733
|
key: document.location,
|
|
628
734
|
result: document
|
|
629
|
-
})))))), /* @__PURE__ */
|
|
735
|
+
})))))), /* @__PURE__ */ React.createElement(DialogActions, {
|
|
630
736
|
className: classes.dialogActionsContainer
|
|
631
|
-
}, /* @__PURE__ */
|
|
737
|
+
}, /* @__PURE__ */ React.createElement(Grid, {
|
|
632
738
|
container: true,
|
|
633
739
|
direction: "row"
|
|
634
|
-
}, /* @__PURE__ */
|
|
740
|
+
}, /* @__PURE__ */ React.createElement(Grid, {
|
|
635
741
|
item: true,
|
|
636
742
|
xs: 12
|
|
637
|
-
}, /* @__PURE__ */
|
|
743
|
+
}, /* @__PURE__ */ React.createElement(SearchResultPager, null)))));
|
|
638
744
|
};
|
|
639
745
|
const SearchModal = ({ open = true, toggleModal }) => {
|
|
640
|
-
return /* @__PURE__ */
|
|
746
|
+
return /* @__PURE__ */ React.createElement(SearchContextProvider, null, /* @__PURE__ */ React.createElement(Modal, {
|
|
641
747
|
open,
|
|
642
748
|
toggleModal
|
|
643
749
|
}));
|
|
@@ -658,24 +764,24 @@ const SearchBar = ({
|
|
|
658
764
|
handleClearSearchBar
|
|
659
765
|
}) => {
|
|
660
766
|
const classes = useStyles$6();
|
|
661
|
-
return /* @__PURE__ */
|
|
767
|
+
return /* @__PURE__ */ React.createElement(Paper, {
|
|
662
768
|
component: "form",
|
|
663
769
|
onSubmit: (e) => handleSearch(e),
|
|
664
770
|
className: classes.root
|
|
665
|
-
}, /* @__PURE__ */
|
|
771
|
+
}, /* @__PURE__ */ React.createElement(IconButton$1, {
|
|
666
772
|
disabled: true,
|
|
667
773
|
type: "submit",
|
|
668
774
|
"aria-label": "search"
|
|
669
|
-
}, /* @__PURE__ */
|
|
775
|
+
}, /* @__PURE__ */ React.createElement(SearchIcon, null)), /* @__PURE__ */ React.createElement(InputBase$1, {
|
|
670
776
|
className: classes.input,
|
|
671
777
|
placeholder: "Search in Backstage",
|
|
672
778
|
value: searchQuery,
|
|
673
779
|
onChange: (e) => handleSearch(e),
|
|
674
780
|
inputProps: { "aria-label": "search backstage" }
|
|
675
|
-
}), /* @__PURE__ */
|
|
781
|
+
}), /* @__PURE__ */ React.createElement(IconButton$1, {
|
|
676
782
|
"aria-label": "search",
|
|
677
783
|
onClick: () => handleClearSearchBar()
|
|
678
|
-
}, /* @__PURE__ */
|
|
784
|
+
}, /* @__PURE__ */ React.createElement(ClearButton, null)));
|
|
679
785
|
};
|
|
680
786
|
|
|
681
787
|
const useStyles$5 = makeStyles((theme) => ({
|
|
@@ -692,13 +798,13 @@ const FiltersButton = ({
|
|
|
692
798
|
handleToggleFilters
|
|
693
799
|
}) => {
|
|
694
800
|
const classes = useStyles$5();
|
|
695
|
-
return /* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
696
802
|
className: classes.filters
|
|
697
|
-
}, /* @__PURE__ */
|
|
803
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
698
804
|
className: classes.icon,
|
|
699
805
|
"aria-label": "settings",
|
|
700
806
|
onClick: handleToggleFilters
|
|
701
|
-
}, /* @__PURE__ */
|
|
807
|
+
}, /* @__PURE__ */ React.createElement(FilterListIcon, null)), /* @__PURE__ */ React.createElement(Typography, {
|
|
702
808
|
variant: "h6"
|
|
703
809
|
}, "Filters (", numberOfSelectedFilters ? numberOfSelectedFilters : 0, ")"));
|
|
704
810
|
};
|
|
@@ -723,21 +829,21 @@ const Filters = ({
|
|
|
723
829
|
updateChecked
|
|
724
830
|
}) => {
|
|
725
831
|
const classes = useStyles$4();
|
|
726
|
-
return /* @__PURE__ */
|
|
832
|
+
return /* @__PURE__ */ React.createElement(Card, {
|
|
727
833
|
className: classes.filters
|
|
728
|
-
}, /* @__PURE__ */
|
|
729
|
-
title: /* @__PURE__ */
|
|
834
|
+
}, /* @__PURE__ */ React.createElement(CardHeader, {
|
|
835
|
+
title: /* @__PURE__ */ React.createElement(Typography, {
|
|
730
836
|
variant: "h6"
|
|
731
837
|
}, "Filters"),
|
|
732
|
-
action: /* @__PURE__ */
|
|
838
|
+
action: /* @__PURE__ */ React.createElement(Button, {
|
|
733
839
|
color: "primary",
|
|
734
840
|
onClick: () => resetFilters()
|
|
735
841
|
}, "CLEAR ALL")
|
|
736
|
-
}), /* @__PURE__ */
|
|
842
|
+
}), /* @__PURE__ */ React.createElement(Divider, null), filterOptions.kind.length === 0 && filterOptions.lifecycle.length === 0 && /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
737
843
|
variant: "subtitle2"
|
|
738
|
-
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */
|
|
844
|
+
}, "Filters cannot be applied to available results")), filterOptions.kind.length > 0 && /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
739
845
|
variant: "subtitle2"
|
|
740
|
-
}, "Kind"), /* @__PURE__ */
|
|
846
|
+
}, "Kind"), /* @__PURE__ */ React.createElement(Select, {
|
|
741
847
|
id: "outlined-select",
|
|
742
848
|
onChange: (e) => {
|
|
743
849
|
var _a;
|
|
@@ -746,22 +852,22 @@ const Filters = ({
|
|
|
746
852
|
variant: "outlined",
|
|
747
853
|
className: classes.dropdown,
|
|
748
854
|
value: filters.selected
|
|
749
|
-
}, filterOptions.kind.map((filter) => /* @__PURE__ */
|
|
855
|
+
}, filterOptions.kind.map((filter) => /* @__PURE__ */ React.createElement(MenuItem, {
|
|
750
856
|
selected: filter === "",
|
|
751
857
|
dense: true,
|
|
752
858
|
key: filter,
|
|
753
859
|
value: filter
|
|
754
|
-
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */
|
|
860
|
+
}, filter)))), filterOptions.lifecycle.length > 0 && /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Typography, {
|
|
755
861
|
variant: "subtitle2"
|
|
756
|
-
}, "Lifecycle"), /* @__PURE__ */
|
|
862
|
+
}, "Lifecycle"), /* @__PURE__ */ React.createElement(List, {
|
|
757
863
|
disablePadding: true,
|
|
758
864
|
dense: true
|
|
759
|
-
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */
|
|
865
|
+
}, filterOptions.lifecycle.map((filter) => /* @__PURE__ */ React.createElement(ListItem, {
|
|
760
866
|
key: filter,
|
|
761
867
|
dense: true,
|
|
762
868
|
button: true,
|
|
763
869
|
onClick: () => updateChecked(filter)
|
|
764
|
-
}, /* @__PURE__ */
|
|
870
|
+
}, /* @__PURE__ */ React.createElement(Checkbox, {
|
|
765
871
|
edge: "start",
|
|
766
872
|
disableRipple: true,
|
|
767
873
|
className: classes.checkbox,
|
|
@@ -770,7 +876,7 @@ const Filters = ({
|
|
|
770
876
|
tabIndex: -1,
|
|
771
877
|
value: filter,
|
|
772
878
|
name: filter
|
|
773
|
-
}), /* @__PURE__ */
|
|
879
|
+
}), /* @__PURE__ */ React.createElement(ListItemText, {
|
|
774
880
|
id: filter,
|
|
775
881
|
primary: filter
|
|
776
882
|
}))))));
|
|
@@ -797,7 +903,7 @@ const columns = [
|
|
|
797
903
|
title: "Name",
|
|
798
904
|
field: "name",
|
|
799
905
|
highlight: true,
|
|
800
|
-
render: (result) => /* @__PURE__ */
|
|
906
|
+
render: (result) => /* @__PURE__ */ React.createElement(Link, {
|
|
801
907
|
to: result.url || ""
|
|
802
908
|
}, result.name)
|
|
803
909
|
},
|
|
@@ -825,22 +931,22 @@ const TableHeader = ({
|
|
|
825
931
|
handleToggleFilters
|
|
826
932
|
}) => {
|
|
827
933
|
const classes = useStyles$3();
|
|
828
|
-
return /* @__PURE__ */
|
|
934
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
829
935
|
className: classes.tableHeader
|
|
830
|
-
}, /* @__PURE__ */
|
|
936
|
+
}, /* @__PURE__ */ React.createElement(FiltersButton, {
|
|
831
937
|
numberOfSelectedFilters,
|
|
832
938
|
handleToggleFilters
|
|
833
|
-
}), /* @__PURE__ */
|
|
939
|
+
}), /* @__PURE__ */ React.createElement(Divider, {
|
|
834
940
|
className: classes.divider,
|
|
835
941
|
orientation: "vertical"
|
|
836
|
-
}), /* @__PURE__ */
|
|
942
|
+
}), /* @__PURE__ */ React.createElement(Grid, {
|
|
837
943
|
item: true,
|
|
838
944
|
xs: 12
|
|
839
|
-
}, searchQuery ? /* @__PURE__ */
|
|
945
|
+
}, searchQuery ? /* @__PURE__ */ React.createElement(Typography, {
|
|
840
946
|
variant: "h6"
|
|
841
|
-
}, `${numberOfResults} `, numberOfResults > 1 ? `results for ` : `result for `, /* @__PURE__ */
|
|
947
|
+
}, `${numberOfResults} `, numberOfResults > 1 ? `results for ` : `result for `, /* @__PURE__ */ React.createElement("span", {
|
|
842
948
|
className: classes.searchQuery
|
|
843
|
-
}, '"', searchQuery, '"'), " ") : /* @__PURE__ */
|
|
949
|
+
}, '"', searchQuery, '"'), " ") : /* @__PURE__ */ React.createElement(Typography, {
|
|
844
950
|
variant: "h6"
|
|
845
951
|
}, `${numberOfResults} results`)));
|
|
846
952
|
};
|
|
@@ -889,15 +995,15 @@ const SearchResult = ({ searchQuery }) => {
|
|
|
889
995
|
}
|
|
890
996
|
}, [selectedFilters, searchQuery, results]);
|
|
891
997
|
if (loading) {
|
|
892
|
-
return /* @__PURE__ */
|
|
998
|
+
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
893
999
|
}
|
|
894
1000
|
if (error) {
|
|
895
|
-
return /* @__PURE__ */
|
|
1001
|
+
return /* @__PURE__ */ React.createElement(Alert, {
|
|
896
1002
|
severity: "error"
|
|
897
1003
|
}, "Error encountered while fetching search results. ", error.toString());
|
|
898
1004
|
}
|
|
899
1005
|
if (!results || results.length === 0) {
|
|
900
|
-
return /* @__PURE__ */
|
|
1006
|
+
return /* @__PURE__ */ React.createElement(EmptyState, {
|
|
901
1007
|
missing: "data",
|
|
902
1008
|
title: "Sorry, no results were found"
|
|
903
1009
|
});
|
|
@@ -939,25 +1045,25 @@ const SearchResult = ({ searchQuery }) => {
|
|
|
939
1045
|
kind: [],
|
|
940
1046
|
lifecycle: []
|
|
941
1047
|
});
|
|
942
|
-
return /* @__PURE__ */
|
|
1048
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Grid, {
|
|
943
1049
|
container: true
|
|
944
|
-
}, showFilters && /* @__PURE__ */
|
|
1050
|
+
}, showFilters && /* @__PURE__ */ React.createElement(Grid, {
|
|
945
1051
|
item: true,
|
|
946
1052
|
xs: 3
|
|
947
|
-
}, /* @__PURE__ */
|
|
1053
|
+
}, /* @__PURE__ */ React.createElement(Filters, {
|
|
948
1054
|
filters: selectedFilters,
|
|
949
1055
|
filterOptions,
|
|
950
1056
|
resetFilters,
|
|
951
1057
|
updateSelected,
|
|
952
1058
|
updateChecked
|
|
953
|
-
})), /* @__PURE__ */
|
|
1059
|
+
})), /* @__PURE__ */ React.createElement(Grid, {
|
|
954
1060
|
item: true,
|
|
955
1061
|
xs: showFilters ? 9 : 12
|
|
956
|
-
}, /* @__PURE__ */
|
|
1062
|
+
}, /* @__PURE__ */ React.createElement(Table, {
|
|
957
1063
|
options: { paging: true, pageSize: 20, search: false },
|
|
958
1064
|
data: filteredResults,
|
|
959
1065
|
columns,
|
|
960
|
-
title: /* @__PURE__ */
|
|
1066
|
+
title: /* @__PURE__ */ React.createElement(TableHeader, {
|
|
961
1067
|
searchQuery,
|
|
962
1068
|
numberOfResults: filteredResults.length,
|
|
963
1069
|
numberOfSelectedFilters: (selectedFilters.selected !== "" ? 1 : 0) + selectedFilters.checked.length,
|
|
@@ -980,24 +1086,24 @@ const LegacySearchPage = () => {
|
|
|
980
1086
|
const handleClearSearchBar = () => {
|
|
981
1087
|
setSearchQuery("");
|
|
982
1088
|
};
|
|
983
|
-
return /* @__PURE__ */
|
|
1089
|
+
return /* @__PURE__ */ React.createElement(Page, {
|
|
984
1090
|
themeId: "home"
|
|
985
|
-
}, /* @__PURE__ */
|
|
1091
|
+
}, /* @__PURE__ */ React.createElement(Header, {
|
|
986
1092
|
title: "Search"
|
|
987
|
-
}), /* @__PURE__ */
|
|
1093
|
+
}), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(Grid, {
|
|
988
1094
|
container: true,
|
|
989
1095
|
direction: "row"
|
|
990
|
-
}, /* @__PURE__ */
|
|
1096
|
+
}, /* @__PURE__ */ React.createElement(Grid, {
|
|
991
1097
|
item: true,
|
|
992
1098
|
xs: 12
|
|
993
|
-
}, /* @__PURE__ */
|
|
1099
|
+
}, /* @__PURE__ */ React.createElement(SearchBar, {
|
|
994
1100
|
handleSearch,
|
|
995
1101
|
handleClearSearchBar,
|
|
996
1102
|
searchQuery
|
|
997
|
-
})), /* @__PURE__ */
|
|
1103
|
+
})), /* @__PURE__ */ React.createElement(Grid, {
|
|
998
1104
|
item: true,
|
|
999
1105
|
xs: 12
|
|
1000
|
-
}, /* @__PURE__ */
|
|
1106
|
+
}, /* @__PURE__ */ React.createElement(SearchResult, {
|
|
1001
1107
|
searchQuery: (queryString != null ? queryString : "").toLocaleLowerCase("en-US")
|
|
1002
1108
|
})))));
|
|
1003
1109
|
};
|
|
@@ -1047,7 +1153,7 @@ const UrlUpdater = () => {
|
|
|
1047
1153
|
};
|
|
1048
1154
|
const SearchPage = () => {
|
|
1049
1155
|
const outlet = useOutlet();
|
|
1050
|
-
return /* @__PURE__ */
|
|
1156
|
+
return /* @__PURE__ */ React.createElement(SearchContextProvider, null, /* @__PURE__ */ React.createElement(UrlUpdater, null), outlet || /* @__PURE__ */ React.createElement(LegacySearchPage, null));
|
|
1051
1157
|
};
|
|
1052
1158
|
|
|
1053
1159
|
const useStyles$2 = makeStyles((theme) => ({
|
|
@@ -1108,48 +1214,48 @@ const SearchTypeAccordion = (props) => {
|
|
|
1108
1214
|
{
|
|
1109
1215
|
value: "",
|
|
1110
1216
|
name: "All",
|
|
1111
|
-
icon: /* @__PURE__ */
|
|
1217
|
+
icon: /* @__PURE__ */ React.createElement(AllIcon, null)
|
|
1112
1218
|
},
|
|
1113
1219
|
...givenTypes
|
|
1114
1220
|
];
|
|
1115
1221
|
const selected = types[0] || "";
|
|
1116
|
-
return /* @__PURE__ */
|
|
1222
|
+
return /* @__PURE__ */ React.createElement(Card, {
|
|
1117
1223
|
className: classes.card
|
|
1118
|
-
}, /* @__PURE__ */
|
|
1224
|
+
}, /* @__PURE__ */ React.createElement(CardHeader, {
|
|
1119
1225
|
title: name,
|
|
1120
1226
|
titleTypographyProps: { variant: "overline" }
|
|
1121
|
-
}), /* @__PURE__ */
|
|
1227
|
+
}), /* @__PURE__ */ React.createElement(CardContent, {
|
|
1122
1228
|
className: classes.cardContent
|
|
1123
|
-
}, /* @__PURE__ */
|
|
1229
|
+
}, /* @__PURE__ */ React.createElement(Accordion, {
|
|
1124
1230
|
className: classes.accordion,
|
|
1125
1231
|
expanded,
|
|
1126
1232
|
onChange: toggleExpanded
|
|
1127
|
-
}, /* @__PURE__ */
|
|
1233
|
+
}, /* @__PURE__ */ React.createElement(AccordionSummary, {
|
|
1128
1234
|
classes: {
|
|
1129
1235
|
root: classes.accordionSummary,
|
|
1130
1236
|
content: classes.accordionSummaryContent
|
|
1131
1237
|
},
|
|
1132
|
-
expandIcon: /* @__PURE__ */
|
|
1238
|
+
expandIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, {
|
|
1133
1239
|
className: classes.icon
|
|
1134
1240
|
}),
|
|
1135
1241
|
IconButtonProps: { size: "small" }
|
|
1136
|
-
}, expanded ? "Collapse" : definedTypes.filter((t) => t.value === selected)[0].name), /* @__PURE__ */
|
|
1242
|
+
}, expanded ? "Collapse" : definedTypes.filter((t) => t.value === selected)[0].name), /* @__PURE__ */ React.createElement(AccordionDetails, {
|
|
1137
1243
|
classes: { root: classes.accordionDetails }
|
|
1138
|
-
}, /* @__PURE__ */
|
|
1244
|
+
}, /* @__PURE__ */ React.createElement(List, {
|
|
1139
1245
|
className: classes.list,
|
|
1140
1246
|
component: "nav",
|
|
1141
1247
|
"aria-label": "filter by type",
|
|
1142
1248
|
disablePadding: true,
|
|
1143
1249
|
dense: true
|
|
1144
|
-
}, definedTypes.map((type) => /* @__PURE__ */
|
|
1250
|
+
}, definedTypes.map((type) => /* @__PURE__ */ React.createElement(Fragment, {
|
|
1145
1251
|
key: type.value
|
|
1146
|
-
}, /* @__PURE__ */
|
|
1252
|
+
}, /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(ListItem, {
|
|
1147
1253
|
selected: types[0] === type.value || types.length === 0 && type.value === "",
|
|
1148
1254
|
onClick: handleClick(type.value),
|
|
1149
1255
|
button: true
|
|
1150
|
-
}, /* @__PURE__ */
|
|
1256
|
+
}, /* @__PURE__ */ React.createElement(ListItemIcon, null, cloneElement(type.icon, {
|
|
1151
1257
|
className: classes.listItemIcon
|
|
1152
|
-
})), /* @__PURE__ */
|
|
1258
|
+
})), /* @__PURE__ */ React.createElement(ListItemText, {
|
|
1153
1259
|
primary: type.name
|
|
1154
1260
|
})))))))));
|
|
1155
1261
|
};
|
|
@@ -1187,12 +1293,12 @@ const SearchTypeTabs = (props) => {
|
|
|
1187
1293
|
},
|
|
1188
1294
|
...givenTypes
|
|
1189
1295
|
];
|
|
1190
|
-
return /* @__PURE__ */
|
|
1296
|
+
return /* @__PURE__ */ React.createElement(Tabs, {
|
|
1191
1297
|
className: classes.tabs,
|
|
1192
1298
|
indicatorColor: "primary",
|
|
1193
1299
|
value: types.length === 0 ? "" : types[0],
|
|
1194
1300
|
onChange: changeTab
|
|
1195
|
-
}, definedTypes.map((type) => /* @__PURE__ */
|
|
1301
|
+
}, definedTypes.map((type) => /* @__PURE__ */ React.createElement(Tab, {
|
|
1196
1302
|
className: classes.tab,
|
|
1197
1303
|
disableRipple: true,
|
|
1198
1304
|
label: type.name,
|
|
@@ -1230,56 +1336,58 @@ const SearchType = (props) => {
|
|
|
1230
1336
|
const value = e.target.value;
|
|
1231
1337
|
setTypes(value);
|
|
1232
1338
|
};
|
|
1233
|
-
return /* @__PURE__ */
|
|
1339
|
+
return /* @__PURE__ */ React.createElement(FormControl, {
|
|
1234
1340
|
className,
|
|
1235
1341
|
variant: "filled",
|
|
1236
1342
|
fullWidth: true,
|
|
1237
1343
|
"data-testid": "search-typefilter-next"
|
|
1238
|
-
}, /* @__PURE__ */
|
|
1344
|
+
}, /* @__PURE__ */ React.createElement(InputLabel, {
|
|
1239
1345
|
className: classes.label,
|
|
1240
1346
|
margin: "dense"
|
|
1241
|
-
}, name), /* @__PURE__ */
|
|
1347
|
+
}, name), /* @__PURE__ */ React.createElement(Select, {
|
|
1242
1348
|
multiple: true,
|
|
1243
1349
|
variant: "outlined",
|
|
1244
1350
|
value: types,
|
|
1245
1351
|
onChange: handleChange,
|
|
1246
1352
|
placeholder: "All Results",
|
|
1247
|
-
renderValue: (selected) => /* @__PURE__ */
|
|
1353
|
+
renderValue: (selected) => /* @__PURE__ */ React.createElement("div", {
|
|
1248
1354
|
className: classes.chips
|
|
1249
|
-
}, selected.map((value) => /* @__PURE__ */
|
|
1355
|
+
}, selected.map((value) => /* @__PURE__ */ React.createElement(Chip, {
|
|
1250
1356
|
key: value,
|
|
1251
1357
|
label: value,
|
|
1252
1358
|
className: classes.chip,
|
|
1253
1359
|
size: "small"
|
|
1254
1360
|
})))
|
|
1255
|
-
}, values.map((value) => /* @__PURE__ */
|
|
1361
|
+
}, values.map((value) => /* @__PURE__ */ React.createElement(MenuItem, {
|
|
1256
1362
|
key: value,
|
|
1257
1363
|
value
|
|
1258
|
-
}, /* @__PURE__ */
|
|
1364
|
+
}, /* @__PURE__ */ React.createElement(Checkbox, {
|
|
1259
1365
|
checked: types.indexOf(value) > -1
|
|
1260
|
-
}), /* @__PURE__ */
|
|
1366
|
+
}), /* @__PURE__ */ React.createElement(ListItemText, {
|
|
1261
1367
|
primary: value
|
|
1262
1368
|
})))));
|
|
1263
1369
|
};
|
|
1264
1370
|
SearchType.Accordion = (props) => {
|
|
1265
|
-
return /* @__PURE__ */
|
|
1371
|
+
return /* @__PURE__ */ React.createElement(SearchTypeAccordion, {
|
|
1266
1372
|
...props
|
|
1267
1373
|
});
|
|
1268
1374
|
};
|
|
1269
1375
|
SearchType.Tabs = (props) => {
|
|
1270
|
-
return /* @__PURE__ */
|
|
1376
|
+
return /* @__PURE__ */ React.createElement(SearchTypeTabs, {
|
|
1271
1377
|
...props
|
|
1272
1378
|
});
|
|
1273
1379
|
};
|
|
1274
1380
|
|
|
1275
1381
|
const SidebarSearch = (props) => {
|
|
1276
1382
|
const searchRoute = useRouteRef(rootRouteRef);
|
|
1383
|
+
const { focusContent } = useContent();
|
|
1277
1384
|
const navigate = useNavigate();
|
|
1278
1385
|
const handleSearch = useCallback((query) => {
|
|
1279
1386
|
const queryString = qs.stringify({ query }, { addQueryPrefix: true });
|
|
1387
|
+
focusContent();
|
|
1280
1388
|
navigate(`${searchRoute()}${queryString}`);
|
|
1281
|
-
}, [navigate, searchRoute]);
|
|
1282
|
-
return /* @__PURE__ */
|
|
1389
|
+
}, [focusContent, navigate, searchRoute]);
|
|
1390
|
+
return /* @__PURE__ */ React.createElement(SidebarSearchField, {
|
|
1283
1391
|
icon: props.icon,
|
|
1284
1392
|
onSearch: handleSearch,
|
|
1285
1393
|
to: "/search"
|
|
@@ -1287,4 +1395,4 @@ const SidebarSearch = (props) => {
|
|
|
1287
1395
|
};
|
|
1288
1396
|
|
|
1289
1397
|
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 };
|
|
1290
|
-
//# sourceMappingURL=index-
|
|
1398
|
+
//# sourceMappingURL=index-19c51c5a.esm.js.map
|