@backstage/plugin-search 0.4.18 → 0.5.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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # @backstage/plugin-search
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c5b6045f36: Search Modal now relies on the Search Context to access state and state setter. If you use the SidebarSearchModal as described in the [getting started documentation](https://backstage.io/docs/features/search/getting-started#using-the-search-modal), make sure to update your code with the SearchContextProvider.
8
+
9
+ ```diff
10
+ export const Root = ({ children }: PropsWithChildren<{}>) => (
11
+ <SidebarPage>
12
+ <Sidebar>
13
+ <SidebarLogo />
14
+ - <SidebarSearchModal />
15
+ + <SearchContextProvider>
16
+ + <SidebarSearchModal />
17
+ + </SearchContextProvider>
18
+ <SidebarDivider />
19
+ ...
20
+ ```
21
+
22
+ ### Patch Changes
23
+
24
+ - f06ecd09a7: Add optional icon and secondaryAction properties for DefaultResultListItem component
25
+ - c5941d5c30: Add a new optional clearButton property to the SearchBar component. The default value for this new property is true.
26
+ - Updated dependencies
27
+ - @backstage/core-components@0.7.6
28
+ - @backstage/theme@0.2.14
29
+ - @backstage/core-plugin-api@0.2.2
30
+
3
31
  ## 0.4.18
4
32
 
5
33
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- export { S as SearchPage } from './index-cdccd881.esm.js';
1
+ export { S as SearchPage } from './index-8e7d7ce9.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'qs';
@@ -20,4 +20,4 @@ import '@material-ui/lab';
20
20
  import '@backstage/plugin-catalog-react';
21
21
  import '@backstage/catalog-model';
22
22
  import 'react-router-dom';
23
- //# sourceMappingURL=index-77205085.esm.js.map
23
+ //# sourceMappingURL=index-09bfa46d.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-09bfa46d.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- export { a as SearchBar, b as SearchBarBase } from './index-cdccd881.esm.js';
1
+ export { a as SearchBar, b as SearchBarBase } from './index-8e7d7ce9.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'qs';
@@ -20,4 +20,4 @@ import '@material-ui/lab';
20
20
  import '@backstage/plugin-catalog-react';
21
21
  import '@backstage/catalog-model';
22
22
  import 'react-router-dom';
23
- //# sourceMappingURL=index-b929d40d.esm.js.map
23
+ //# sourceMappingURL=index-1f69649c.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-1f69649c.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- export { c as SearchResult } from './index-cdccd881.esm.js';
1
+ export { c as SearchResult } from './index-8e7d7ce9.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'qs';
@@ -20,4 +20,4 @@ import '@material-ui/lab';
20
20
  import '@backstage/plugin-catalog-react';
21
21
  import '@backstage/catalog-model';
22
22
  import 'react-router-dom';
23
- //# sourceMappingURL=index-766e727c.esm.js.map
23
+ //# sourceMappingURL=index-49a2f5d1.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-49a2f5d1.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import React__default, { useCallback } from 'react';
2
2
  import { makeStyles } from '@material-ui/core/styles';
3
- import { r as rootRouteRef, b as SearchBarBase } from './index-cdccd881.esm.js';
3
+ import { r as rootRouteRef, b as SearchBarBase } from './index-8e7d7ce9.esm.js';
4
4
  import qs from 'qs';
5
5
  import { useNavigate } from 'react-router-dom';
6
6
  import { useRouteRef } from '@backstage/core-plugin-api';
@@ -57,4 +57,4 @@ const HomePageSearchBar = ({placeholder}) => {
57
57
  };
58
58
 
59
59
  export { HomePageSearchBar };
60
- //# sourceMappingURL=index-b9474e70.esm.js.map
60
+ //# sourceMappingURL=index-58cc0fcf.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-b9474e70.esm.js","sources":["../../src/components/util.ts","../../src/components/HomePageComponent/HomePageSearchBar.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport qs from 'qs';\nimport { useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { rootRouteRef } from '../plugin';\n\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nexport const useNavigateToQuery = () => {\n const searchRoute = useRouteRef(rootRouteRef);\n const navigate = useNavigate();\n return useCallback(\n ({ query }: { query: string }): void => {\n const queryString = qs.stringify({ query }, { addQueryPrefix: true });\n\n navigate(`${searchRoute()}${queryString}`);\n },\n [navigate, searchRoute],\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\n\nimport { SearchBarBase } from '../SearchBar';\nimport { useNavigateToQuery } from '../util';\n\nconst useStyles = makeStyles({\n searchBar: {\n border: '1px solid #555',\n borderRadius: '6px',\n fontSize: '1.5em',\n },\n});\n\ntype Props = {\n placeholder?: string;\n};\n\nexport const HomePageSearchBar = ({ placeholder }: Props) => {\n const [query, setQuery] = React.useState('');\n const handleSearch = useNavigateToQuery();\n const classes = useStyles();\n\n const handleSubmit = () => {\n handleSearch({ query });\n };\n\n const handleChange = React.useCallback(\n value => {\n setQuery(value);\n },\n [setQuery],\n );\n\n return (\n <SearchBarBase\n onSubmit={handleSubmit}\n onChange={handleChange}\n value={query}\n className={classes.searchBar}\n placeholder={placeholder}\n />\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAsBa,qBAAqB,MAAM;AACtC,QAAM,cAAc,YAAY;AAChC,QAAM,WAAW;AACjB,SAAO,YACL,CAAC,CAAE,WAAqC;AACtC,UAAM,cAAc,GAAG,UAAU,CAAE,QAAS,CAAE,gBAAgB;AAE9D,aAAS,GAAG,gBAAgB;AAAA,KAE9B,CAAC,UAAU;AAAA;;ACTf,MAAM,YAAY,WAAW;AAAA,EAC3B,WAAW;AAAA,IACT,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,UAAU;AAAA;AAAA;MAQD,oBAAoB,CAAC,CAAE,iBAAyB;AAC3D,QAAM,CAAC,OAAO,YAAYA,eAAM,SAAS;AACzC,QAAM,eAAe;AACrB,QAAM,UAAU;AAEhB,QAAM,eAAe,MAAM;AACzB,iBAAa,CAAE;AAAA;AAGjB,QAAM,eAAeA,eAAM,YACzB,WAAS;AACP,aAAS;AAAA,KAEX,CAAC;AAGH,sDACG,eAAD;AAAA,IACE,UAAU;AAAA,IACV,UAAU;AAAA,IACV,OAAO;AAAA,IACP,WAAW,QAAQ;AAAA,IACnB;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"index-58cc0fcf.esm.js","sources":["../../src/components/util.ts","../../src/components/HomePageComponent/HomePageSearchBar.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport qs from 'qs';\nimport { useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { rootRouteRef } from '../plugin';\n\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nexport const useNavigateToQuery = () => {\n const searchRoute = useRouteRef(rootRouteRef);\n const navigate = useNavigate();\n return useCallback(\n ({ query }: { query: string }): void => {\n const queryString = qs.stringify({ query }, { addQueryPrefix: true });\n\n navigate(`${searchRoute()}${queryString}`);\n },\n [navigate, searchRoute],\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\n\nimport { SearchBarBase } from '../SearchBar';\nimport { useNavigateToQuery } from '../util';\n\nconst useStyles = makeStyles({\n searchBar: {\n border: '1px solid #555',\n borderRadius: '6px',\n fontSize: '1.5em',\n },\n});\n\ntype Props = {\n placeholder?: string;\n};\n\nexport const HomePageSearchBar = ({ placeholder }: Props) => {\n const [query, setQuery] = React.useState('');\n const handleSearch = useNavigateToQuery();\n const classes = useStyles();\n\n const handleSubmit = () => {\n handleSearch({ query });\n };\n\n const handleChange = React.useCallback(\n value => {\n setQuery(value);\n },\n [setQuery],\n );\n\n return (\n <SearchBarBase\n onSubmit={handleSubmit}\n onChange={handleChange}\n value={query}\n className={classes.searchBar}\n placeholder={placeholder}\n />\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAsBa,qBAAqB,MAAM;AACtC,QAAM,cAAc,YAAY;AAChC,QAAM,WAAW;AACjB,SAAO,YACL,CAAC,CAAE,WAAqC;AACtC,UAAM,cAAc,GAAG,UAAU,CAAE,QAAS,CAAE,gBAAgB;AAE9D,aAAS,GAAG,gBAAgB;AAAA,KAE9B,CAAC,UAAU;AAAA;;ACTf,MAAM,YAAY,WAAW;AAAA,EAC3B,WAAW;AAAA,IACT,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,UAAU;AAAA;AAAA;MAQD,oBAAoB,CAAC,CAAE,iBAAyB;AAC3D,QAAM,CAAC,OAAO,YAAYA,eAAM,SAAS;AACzC,QAAM,eAAe;AACrB,QAAM,UAAU;AAEhB,QAAM,eAAe,MAAM;AACzB,iBAAa,CAAE;AAAA;AAGjB,QAAM,eAAeA,eAAM,YACzB,WAAS;AACP,aAAS;AAAA,KAEX,CAAC;AAGH,sDACG,eAAD;AAAA,IACE,UAAU;AAAA,IACV,UAAU;AAAA,IACV,OAAO;AAAA,IACP,WAAW,QAAQ;AAAA,IACnB;AAAA;AAAA;;;;"}
@@ -1,7 +1,7 @@
1
- import React__default, { useState } from 'react';
1
+ import React__default from 'react';
2
2
  import SearchIcon from '@material-ui/icons/Search';
3
- import { d as SearchModal } from './index-cdccd881.esm.js';
4
3
  import { SidebarItem } from '@backstage/core-components';
4
+ import { u as useSearch, d as SearchModal } from './index-8e7d7ce9.esm.js';
5
5
  import '@backstage/core-plugin-api';
6
6
  import '@backstage/errors';
7
7
  import 'qs';
@@ -22,8 +22,7 @@ import '@backstage/catalog-model';
22
22
  import 'react-router-dom';
23
23
 
24
24
  const SidebarSearchModal = () => {
25
- const [open, setOpen] = useState(false);
26
- const toggleModal = () => setOpen((prevState) => !prevState);
25
+ const {open, toggleModal} = useSearch();
27
26
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(SidebarItem, {
28
27
  className: "search-icon",
29
28
  icon: SearchIcon,
@@ -36,4 +35,4 @@ const SidebarSearchModal = () => {
36
35
  };
37
36
 
38
37
  export { SidebarSearchModal };
39
- //# sourceMappingURL=index-01b40466.esm.js.map
38
+ //# sourceMappingURL=index-859ff534.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-859ff534.esm.js","sources":["../../src/components/SidebarSearchModal/SidebarSearchModal.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport SearchIcon from '@material-ui/icons/Search';\nimport { SidebarItem } from '@backstage/core-components';\nimport { SearchModal } from '../SearchModal';\nimport { useSearch } from '../SearchContext';\n\nexport const SidebarSearchModal = () => {\n const { open, toggleModal } = useSearch();\n\n return (\n <>\n <SidebarItem\n className=\"search-icon\"\n icon={SearchIcon}\n text=\"Search\"\n onClick={toggleModal}\n />\n <SearchModal open={open} toggleModal={toggleModal} />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAqBa,qBAAqB,MAAM;AACtC,QAAM,CAAE,MAAM,eAAgB;AAE9B,kIAEK,aAAD;AAAA,IACE,WAAU;AAAA,IACV,MAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAS;AAAA,mDAEV,aAAD;AAAA,IAAa;AAAA,IAAY;AAAA;AAAA;;;;"}
@@ -3,7 +3,7 @@ import { ResponseError } from '@backstage/errors';
3
3
  import qs from 'qs';
4
4
  import * as React from 'react';
5
5
  import React__default, { createContext, useState, useCallback, useEffect, useContext } from 'react';
6
- import { ListItem, ListItemText, Divider, makeStyles, IconButton, Typography, Card, CardHeader, Button, CardContent, Select, MenuItem, List, Checkbox, InputBase, InputAdornment, FormControl, FormLabel, FormControlLabel, InputLabel, Dialog, DialogTitle, Paper, DialogContent, Grid, DialogActions, Chip } from '@material-ui/core';
6
+ import { ListItem, ListItemIcon, ListItemText, Box, Divider, makeStyles, IconButton, Typography, Card, CardHeader, Button, CardContent, Select, MenuItem, List, Checkbox, InputBase, InputAdornment, FormControl, FormLabel, FormControlLabel, InputLabel, Dialog, DialogTitle, Paper, DialogContent, Grid, DialogActions, Chip } from '@material-ui/core';
7
7
  import { Link, Progress, ResponseErrorPanel, EmptyState, Table, useQueryParamState, Page, Header, Content, SidebarSearchField } from '@backstage/core-components';
8
8
  import FilterListIcon from '@material-ui/icons/FilterList';
9
9
  import { usePrevious, useAsync, useDebounce, useEffectOnce } from 'react-use';
@@ -44,16 +44,22 @@ class SearchClient {
44
44
  }
45
45
  }
46
46
 
47
- const DefaultResultListItem$1 = ({result}) => {
47
+ const DefaultResultListItem$1 = ({
48
+ result,
49
+ icon,
50
+ secondaryAction
51
+ }) => {
48
52
  return /* @__PURE__ */ React__default.createElement(Link, {
49
53
  to: result.location
50
54
  }, /* @__PURE__ */ React__default.createElement(ListItem, {
51
- alignItems: "flex-start"
52
- }, /* @__PURE__ */ React__default.createElement(ListItemText, {
55
+ alignItems: "center"
56
+ }, icon && /* @__PURE__ */ React__default.createElement(ListItemIcon, null, icon), /* @__PURE__ */ React__default.createElement(ListItemText, {
53
57
  primaryTypographyProps: {variant: "h6"},
54
58
  primary: result.title,
55
59
  secondary: result.text
56
- })), /* @__PURE__ */ React__default.createElement(Divider, null));
60
+ }), secondaryAction && /* @__PURE__ */ React__default.createElement(Box, {
61
+ alignItems: "flex-end"
62
+ }, secondaryAction)), /* @__PURE__ */ React__default.createElement(Divider, null));
57
63
  };
58
64
 
59
65
  const useStyles$9 = makeStyles((theme) => ({
@@ -170,6 +176,8 @@ const SearchContextProvider = ({
170
176
  const [filters, setFilters] = useState(initialState.filters);
171
177
  const [term, setTerm] = useState(initialState.term);
172
178
  const [types, setTypes] = useState(initialState.types);
179
+ const [open, setOpen] = useState(false);
180
+ const toggleModal = useCallback(() => setOpen((prevState) => !prevState), []);
173
181
  const prevTerm = usePrevious(term);
174
182
  const result = useAsync(() => searchApi.query({
175
183
  term,
@@ -196,6 +204,8 @@ const SearchContextProvider = ({
196
204
  result,
197
205
  filters,
198
206
  setFilters,
207
+ open,
208
+ toggleModal,
199
209
  term,
200
210
  setTerm,
201
211
  types,
@@ -224,7 +234,8 @@ const SearchBarBase = ({
224
234
  onChange,
225
235
  onSubmit,
226
236
  className,
227
- placeholder: overridePlaceholder
237
+ placeholder: overridePlaceholder,
238
+ clearButton = true
228
239
  }) => {
229
240
  const configApi = useApi(configApiRef);
230
241
  const onKeyDown = React__default.useCallback((e) => {
@@ -250,7 +261,7 @@ const SearchBarBase = ({
250
261
  "aria-label": "Query",
251
262
  disabled: true
252
263
  }, /* @__PURE__ */ React__default.createElement(SearchIcon, null))),
253
- endAdornment: /* @__PURE__ */ React__default.createElement(InputAdornment, {
264
+ endAdornment: clearButton && /* @__PURE__ */ React__default.createElement(InputAdornment, {
254
265
  position: "end"
255
266
  }, /* @__PURE__ */ React__default.createElement(IconButton, {
256
267
  "aria-label": "Clear",
@@ -264,7 +275,8 @@ const SearchBar$1 = ({
264
275
  autoFocus,
265
276
  className,
266
277
  debounceTime = 0,
267
- placeholder
278
+ placeholder,
279
+ clearButton = true
268
280
  }) => {
269
281
  const {term, setTerm} = useSearch();
270
282
  const [value, setValue] = useState(term);
@@ -282,7 +294,8 @@ const SearchBar$1 = ({
282
294
  value,
283
295
  onChange: handleQuery,
284
296
  onClear: handleClear,
285
- placeholder
297
+ placeholder,
298
+ clearButton
286
299
  });
287
300
  };
288
301
 
@@ -478,54 +491,54 @@ const searchPlugin = createPlugin({
478
491
  });
479
492
  const SearchPage$1 = searchPlugin.provide(createRoutableExtension({
480
493
  name: "SearchPage",
481
- component: () => import('./index-77205085.esm.js').then((m) => m.SearchPage),
494
+ component: () => import('./index-09bfa46d.esm.js').then((m) => m.SearchPage),
482
495
  mountPoint: rootRouteRef
483
496
  }));
484
497
  const SearchPageNext = searchPlugin.provide(createRoutableExtension({
485
498
  name: "SearchPageNext",
486
- component: () => import('./index-77205085.esm.js').then((m) => m.SearchPage),
499
+ component: () => import('./index-09bfa46d.esm.js').then((m) => m.SearchPage),
487
500
  mountPoint: rootNextRouteRef
488
501
  }));
489
502
  searchPlugin.provide(createComponentExtension({
490
503
  name: "SearchBar",
491
504
  component: {
492
- lazy: () => import('./index-b929d40d.esm.js').then((m) => m.SearchBar)
505
+ lazy: () => import('./index-1f69649c.esm.js').then((m) => m.SearchBar)
493
506
  }
494
507
  }));
495
508
  const SearchBarNext = searchPlugin.provide(createComponentExtension({
496
509
  name: "SearchBarNext",
497
510
  component: {
498
- lazy: () => import('./index-b929d40d.esm.js').then((m) => m.SearchBar)
511
+ lazy: () => import('./index-1f69649c.esm.js').then((m) => m.SearchBar)
499
512
  }
500
513
  }));
501
514
  const SearchResult$1 = searchPlugin.provide(createComponentExtension({
502
515
  name: "SearchResult",
503
516
  component: {
504
- lazy: () => import('./index-766e727c.esm.js').then((m) => m.SearchResult)
517
+ lazy: () => import('./index-49a2f5d1.esm.js').then((m) => m.SearchResult)
505
518
  }
506
519
  }));
507
520
  searchPlugin.provide(createComponentExtension({
508
521
  name: "SearchResultNext",
509
522
  component: {
510
- lazy: () => import('./index-766e727c.esm.js').then((m) => m.SearchResult)
523
+ lazy: () => import('./index-49a2f5d1.esm.js').then((m) => m.SearchResult)
511
524
  }
512
525
  }));
513
526
  const SidebarSearchModal = searchPlugin.provide(createComponentExtension({
514
527
  name: "SidebarSearchModal",
515
528
  component: {
516
- lazy: () => import('./index-01b40466.esm.js').then((m) => m.SidebarSearchModal)
529
+ lazy: () => import('./index-859ff534.esm.js').then((m) => m.SidebarSearchModal)
517
530
  }
518
531
  }));
519
532
  const DefaultResultListItem = searchPlugin.provide(createComponentExtension({
520
533
  name: "DefaultResultListItem",
521
534
  component: {
522
- lazy: () => import('./index-207637ef.esm.js').then((m) => m.DefaultResultListItem)
535
+ lazy: () => import('./index-b647c19e.esm.js').then((m) => m.DefaultResultListItem)
523
536
  }
524
537
  }));
525
538
  const HomePageSearchBar = searchPlugin.provide(createComponentExtension({
526
539
  name: "HomePageSearchBar",
527
540
  component: {
528
- lazy: () => import('./index-b9474e70.esm.js').then((m) => m.HomePageSearchBar)
541
+ lazy: () => import('./index-58cc0fcf.esm.js').then((m) => m.HomePageSearchBar)
529
542
  }
530
543
  }));
531
544
 
@@ -1105,4 +1118,4 @@ const SidebarSearch = () => {
1105
1118
  };
1106
1119
 
1107
1120
  export { DefaultResultListItem$1 as D, Filters$1 as F, HomePageSearchBar as H, SearchPage as S, SearchBar$1 as a, SearchBarBase as b, SearchResultComponent as c, SearchModal as d, FiltersButton$1 as e, SearchContextProvider as f, SearchFilter as g, SearchFilterNext as h, SearchResultPager as i, SearchType as j, SidebarSearch as k, DefaultResultListItem as l, SearchBarNext as m, SearchPage$1 as n, SearchPageNext as o, searchPlugin as p, SearchResult$1 as q, rootRouteRef as r, searchApiRef as s, SidebarSearchModal as t, useSearch as u };
1108
- //# sourceMappingURL=index-cdccd881.esm.js.map
1121
+ //# sourceMappingURL=index-8e7d7ce9.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-8e7d7ce9.esm.js","sources":["../../src/apis.ts","../../src/components/DefaultResultListItem/DefaultResultListItem.tsx","../../src/components/Filters/FiltersButton.tsx","../../src/components/Filters/Filters.tsx","../../src/components/SearchContext/SearchContext.tsx","../../src/components/SearchBar/SearchBar.tsx","../../src/components/SearchFilter/SearchFilter.tsx","../../../../node_modules/@material-ui/icons/esm/Launch.js","../../src/components/SearchResult/SearchResult.tsx","../../src/components/SearchResultPager/SearchResultPager.tsx","../../src/plugin.ts","../../src/components/SearchModal/SearchModal.tsx","../../src/components/LegacySearchPage/LegacySearchBar.tsx","../../src/components/LegacySearchPage/Filters/FiltersButton.tsx","../../src/components/LegacySearchPage/Filters/Filters.tsx","../../src/components/LegacySearchPage/LegacySearchResult.tsx","../../src/components/LegacySearchPage/LegacySearchPage.tsx","../../src/components/SearchPage/SearchPage.tsx","../../src/components/SearchType/SearchType.tsx","../../src/components/SidebarSearch/SidebarSearch.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createApiRef,\n DiscoveryApi,\n IdentityApi,\n} from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { SearchQuery, SearchResultSet } from '@backstage/search-common';\nimport qs from 'qs';\n\nexport const searchApiRef = createApiRef<SearchApi>({\n id: 'plugin.search.queryservice',\n description: 'Used to make requests against the search API',\n});\n\nexport interface SearchApi {\n query(query: SearchQuery): Promise<SearchResultSet>;\n}\n\nexport class SearchClient implements SearchApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly identityApi: IdentityApi;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n identityApi: IdentityApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.identityApi = options.identityApi;\n }\n\n async query(query: SearchQuery): Promise<SearchResultSet> {\n const token = await this.identityApi.getIdToken();\n const queryString = qs.stringify(query);\n const url = `${await this.discoveryApi.getBaseUrl(\n 'search/query',\n )}?${queryString}`;\n const response = await fetch(url, {\n headers: token ? { Authorization: `Bearer ${token}` } : {},\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json();\n }\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactNode } from 'react';\nimport { IndexableDocument } from '@backstage/search-common';\nimport {\n ListItem,\n ListItemIcon,\n ListItemText,\n Box,\n Divider,\n} from '@material-ui/core';\nimport { Link } from '@backstage/core-components';\n\ntype Props = {\n icon?: ReactNode;\n secondaryAction?: ReactNode;\n result: IndexableDocument;\n};\n\nexport const DefaultResultListItem = ({\n result,\n icon,\n secondaryAction,\n}: Props) => {\n return (\n <Link to={result.location}>\n <ListItem alignItems=\"center\">\n {icon && <ListItemIcon>{icon}</ListItemIcon>}\n <ListItemText\n primaryTypographyProps={{ variant: 'h6' }}\n primary={result.title}\n secondary={result.text}\n />\n {secondaryAction && <Box alignItems=\"flex-end\">{secondaryAction}</Box>}\n </ListItem>\n <Divider />\n </Link>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport FilterListIcon from '@material-ui/icons/FilterList';\nimport { makeStyles, IconButton, Typography } from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n filters: {\n width: '250px',\n display: 'flex',\n },\n icon: {\n margin: theme.spacing(-1, 0, 0, 0),\n },\n}));\n\ntype FiltersButtonProps = {\n numberOfSelectedFilters: number;\n handleToggleFilters: () => void;\n};\n\nexport const FiltersButton = ({\n numberOfSelectedFilters,\n handleToggleFilters,\n}: FiltersButtonProps) => {\n const classes = useStyles();\n\n return (\n <div className={classes.filters}>\n <IconButton\n className={classes.icon}\n aria-label=\"settings\"\n onClick={handleToggleFilters}\n >\n <FilterListIcon />\n </IconButton>\n <Typography variant=\"h6\">\n Filters ({numberOfSelectedFilters ? numberOfSelectedFilters : 0})\n </Typography>\n </div>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport {\n makeStyles,\n Typography,\n Divider,\n Card,\n CardHeader,\n Button,\n CardContent,\n Select,\n Checkbox,\n List,\n ListItem,\n ListItemText,\n MenuItem,\n} from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n filters: {\n background: 'transparent',\n boxShadow: '0px 0px 0px 0px',\n },\n checkbox: {\n padding: theme.spacing(0, 1, 0, 1),\n },\n dropdown: {\n width: '100%',\n },\n}));\n\nexport type FiltersState = {\n selected: string;\n checked: Array<string>;\n};\n\nexport type FilterOptions = {\n kind: Array<string>;\n lifecycle: Array<string>;\n};\n\ntype FiltersProps = {\n filters: FiltersState;\n filterOptions: FilterOptions;\n resetFilters: () => void;\n updateSelected: (filter: string) => void;\n updateChecked: (filter: string) => void;\n};\n\nexport const Filters = ({\n filters,\n filterOptions,\n resetFilters,\n updateSelected,\n updateChecked,\n}: FiltersProps) => {\n const classes = useStyles();\n\n return (\n <Card className={classes.filters}>\n <CardHeader\n title={<Typography variant=\"h6\">Filters</Typography>}\n action={\n <Button color=\"primary\" onClick={() => resetFilters()}>\n CLEAR ALL\n </Button>\n }\n />\n <Divider />\n {filterOptions.kind.length === 0 && filterOptions.lifecycle.length === 0 && (\n <CardContent>\n <Typography variant=\"subtitle2\">\n Filters cannot be applied to available results\n </Typography>\n </CardContent>\n )}\n {filterOptions.kind.length > 0 && (\n <CardContent>\n <Typography variant=\"subtitle2\">Kind</Typography>\n <Select\n id=\"outlined-select\"\n onChange={(e: React.ChangeEvent<any>) =>\n updateSelected(e?.target?.value)\n }\n variant=\"outlined\"\n className={classes.dropdown}\n value={filters.selected}\n >\n {filterOptions.kind.map(filter => (\n <MenuItem\n selected={filter === ''}\n dense\n key={filter}\n value={filter}\n >\n {filter}\n </MenuItem>\n ))}\n </Select>\n </CardContent>\n )}\n {filterOptions.lifecycle.length > 0 && (\n <CardContent>\n <Typography variant=\"subtitle2\">Lifecycle</Typography>\n <List disablePadding dense>\n {filterOptions.lifecycle.map(filter => (\n <ListItem\n key={filter}\n dense\n button\n onClick={() => updateChecked(filter)}\n >\n <Checkbox\n edge=\"start\"\n disableRipple\n className={classes.checkbox}\n color=\"primary\"\n checked={filters.checked.includes(filter)}\n tabIndex={-1}\n value={filter}\n name={filter}\n />\n <ListItemText id={filter} primary={filter} />\n </ListItem>\n ))}\n </List>\n </CardContent>\n )}\n </Card>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject } from '@backstage/types';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { SearchResultSet } from '@backstage/search-common';\nimport React, {\n createContext,\n PropsWithChildren,\n useCallback,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport { useAsync, usePrevious } from 'react-use';\nimport { AsyncState } from 'react-use/lib/useAsync';\nimport { searchApiRef } from '../../apis';\n\ntype SearchContextValue = {\n result: AsyncState<SearchResultSet>;\n term: string;\n setTerm: React.Dispatch<React.SetStateAction<string>>;\n types: string[];\n setTypes: React.Dispatch<React.SetStateAction<string[]>>;\n filters: JsonObject;\n setFilters: React.Dispatch<React.SetStateAction<JsonObject>>;\n open?: boolean;\n toggleModal: () => void;\n pageCursor?: string;\n setPageCursor: React.Dispatch<React.SetStateAction<string | undefined>>;\n fetchNextPage?: React.DispatchWithoutAction;\n fetchPreviousPage?: React.DispatchWithoutAction;\n};\n\ntype SettableSearchContext = Omit<\n SearchContextValue,\n | 'result'\n | 'setTerm'\n | 'setTypes'\n | 'setFilters'\n | 'toggleModal'\n | 'setPageCursor'\n | 'fetchNextPage'\n | 'fetchPreviousPage'\n>;\n\nexport const SearchContext = createContext<SearchContextValue | undefined>(\n undefined,\n);\n\nexport const SearchContextProvider = ({\n initialState = {\n term: '',\n pageCursor: undefined,\n filters: {},\n types: [],\n },\n children,\n}: PropsWithChildren<{ initialState?: SettableSearchContext }>) => {\n const searchApi = useApi(searchApiRef);\n const [pageCursor, setPageCursor] = useState<string | undefined>(\n initialState.pageCursor,\n );\n const [filters, setFilters] = useState<JsonObject>(initialState.filters);\n const [term, setTerm] = useState<string>(initialState.term);\n const [types, setTypes] = useState<string[]>(initialState.types);\n const [open, setOpen] = useState<boolean>(false);\n const toggleModal = useCallback(\n (): void => setOpen(prevState => !prevState),\n [],\n );\n\n const prevTerm = usePrevious(term);\n\n const result = useAsync(\n () =>\n searchApi.query({\n term,\n filters,\n pageCursor: pageCursor,\n types,\n }),\n [term, filters, types, pageCursor],\n );\n\n const hasNextPage =\n !result.loading && !result.error && result.value?.nextPageCursor;\n const hasPreviousPage =\n !result.loading && !result.error && result.value?.previousPageCursor;\n const fetchNextPage = useCallback(() => {\n setPageCursor(result.value?.nextPageCursor);\n }, [result.value?.nextPageCursor]);\n const fetchPreviousPage = useCallback(() => {\n setPageCursor(result.value?.previousPageCursor);\n }, [result.value?.previousPageCursor]);\n\n useEffect(() => {\n // Any time a term is reset, we want to start from page 0.\n if (term && prevTerm && term !== prevTerm) {\n setPageCursor(undefined);\n }\n }, [term, prevTerm, initialState.pageCursor]);\n\n const value: SearchContextValue = {\n result,\n filters,\n setFilters,\n open,\n toggleModal,\n term,\n setTerm,\n types,\n setTypes,\n pageCursor,\n setPageCursor,\n fetchNextPage: hasNextPage ? fetchNextPage : undefined,\n fetchPreviousPage: hasPreviousPage ? fetchPreviousPage : undefined,\n };\n\n return <SearchContext.Provider value={value} children={children} />;\n};\n\nexport const useSearch = () => {\n const context = useContext(SearchContext);\n if (context === undefined) {\n throw new Error('useSearch must be used within a SearchContextProvider');\n }\n return context;\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, KeyboardEvent, useState } from 'react';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useDebounce } from 'react-use';\nimport { InputBase, InputAdornment, IconButton } from '@material-ui/core';\nimport SearchIcon from '@material-ui/icons/Search';\nimport ClearButton from '@material-ui/icons/Clear';\n\nimport { useSearch } from '../SearchContext';\n\ntype PresenterProps = {\n value: string;\n onChange: (value: string) => void;\n onClear?: () => void;\n onSubmit?: () => void;\n className?: string;\n placeholder?: string;\n autoFocus?: boolean;\n clearButton?: boolean;\n};\n\nexport const SearchBarBase = ({\n autoFocus,\n value,\n onChange,\n onSubmit,\n className,\n placeholder: overridePlaceholder,\n clearButton = true,\n}: PresenterProps) => {\n const configApi = useApi(configApiRef);\n\n const onKeyDown = React.useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n if (onSubmit && e.key === 'Enter') {\n onSubmit();\n }\n },\n [onSubmit],\n );\n\n const handleClear = React.useCallback(() => {\n onChange('');\n }, [onChange]);\n\n const placeholder =\n overridePlaceholder ??\n `Search in ${configApi.getOptionalString('app.title') || 'Backstage'}`;\n\n return (\n <InputBase\n // decision up to adopter, read https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md#no-autofocus\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n data-testid=\"search-bar-next\"\n fullWidth\n placeholder={placeholder}\n value={value}\n onChange={e => onChange(e.target.value)}\n inputProps={{ 'aria-label': 'Search' }}\n startAdornment={\n <InputAdornment position=\"start\">\n <IconButton aria-label=\"Query\" disabled>\n <SearchIcon />\n </IconButton>\n </InputAdornment>\n }\n endAdornment={\n clearButton && (\n <InputAdornment position=\"end\">\n <IconButton aria-label=\"Clear\" onClick={handleClear}>\n <ClearButton />\n </IconButton>\n </InputAdornment>\n )\n }\n {...(className && { className })}\n {...(onSubmit && { onKeyDown })}\n />\n );\n};\n\ntype Props = {\n autoFocus?: boolean;\n className?: string;\n debounceTime?: number;\n placeholder?: string;\n clearButton?: boolean;\n};\n\nexport const SearchBar = ({\n autoFocus,\n className,\n debounceTime = 0,\n placeholder,\n clearButton = true,\n}: Props) => {\n const { term, setTerm } = useSearch();\n const [value, setValue] = useState<string>(term);\n\n useEffect(() => {\n setValue(prevValue => (prevValue !== term ? term : prevValue));\n }, [term]);\n\n useDebounce(() => setTerm(value), debounceTime, [value]);\n\n const handleQuery = (newValue: string) => {\n setValue(newValue);\n };\n\n const handleClear = () => setValue('');\n\n return (\n <SearchBarBase\n // decision up to adopter, read https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md#no-autofocus\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n className={className}\n value={value}\n onChange={handleQuery}\n onClear={handleClear}\n placeholder={placeholder}\n clearButton={clearButton}\n />\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactElement, ChangeEvent, useEffect } from 'react';\nimport {\n makeStyles,\n FormControl,\n FormControlLabel,\n InputLabel,\n Checkbox,\n Select,\n MenuItem,\n FormLabel,\n} from '@material-ui/core';\n\nimport { useSearch } from '../SearchContext';\n\nconst useStyles = makeStyles({\n label: {\n textTransform: 'capitalize',\n },\n});\n\nexport type Component = {\n className?: string;\n name: string;\n values?: string[];\n defaultValue?: string[] | string | null;\n};\n\nexport type Props = Component & {\n component: (props: Component) => ReactElement;\n debug?: boolean;\n};\n\nconst CheckboxFilter = ({\n className,\n name,\n defaultValue,\n values = [],\n}: Component) => {\n const classes = useStyles();\n const { filters, setFilters } = useSearch();\n\n useEffect(() => {\n if (Array.isArray(defaultValue)) {\n setFilters(prevFilters => ({\n ...prevFilters,\n [name]: defaultValue,\n }));\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const {\n target: { value, checked },\n } = e;\n\n setFilters(prevFilters => {\n const { [name]: filter, ...others } = prevFilters;\n const rest = ((filter as string[]) || []).filter(i => i !== value);\n const items = checked ? [...rest, value] : rest;\n return items.length ? { ...others, [name]: items } : others;\n });\n };\n\n return (\n <FormControl\n className={className}\n fullWidth\n data-testid=\"search-checkboxfilter-next\"\n >\n <FormLabel className={classes.label}>{name}</FormLabel>\n {values.map((value: string) => (\n <FormControlLabel\n key={value}\n control={\n <Checkbox\n color=\"primary\"\n tabIndex={-1}\n inputProps={{ 'aria-labelledby': value }}\n value={value}\n name={value}\n onChange={handleChange}\n checked={((filters[name] as string[]) ?? []).includes(value)}\n />\n }\n label={value}\n />\n ))}\n </FormControl>\n );\n};\n\nconst SelectFilter = ({\n className,\n name,\n defaultValue,\n values = [],\n}: Component) => {\n const classes = useStyles();\n const { filters, setFilters } = useSearch();\n\n useEffect(() => {\n if (typeof defaultValue === 'string') {\n setFilters(prevFilters => ({\n ...prevFilters,\n [name]: defaultValue,\n }));\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleChange = (e: ChangeEvent<{ value: unknown }>) => {\n const {\n target: { value },\n } = e;\n\n setFilters(prevFilters => {\n const { [name]: filter, ...others } = prevFilters;\n return value ? { ...others, [name]: value as string } : others;\n });\n };\n\n return (\n <FormControl\n className={className}\n variant=\"filled\"\n fullWidth\n data-testid=\"search-selectfilter-next\"\n >\n <InputLabel className={classes.label} margin=\"dense\">\n {name}\n </InputLabel>\n <Select\n variant=\"outlined\"\n value={filters[name] || ''}\n onChange={handleChange}\n >\n <MenuItem value=\"\">\n <em>All</em>\n </MenuItem>\n {values.map((value: string) => (\n <MenuItem key={value} value={value}>\n {value}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n};\n\nconst SearchFilter = ({ component: Element, ...props }: Props) => (\n <Element {...props} />\n);\n\nSearchFilter.Checkbox = (props: Omit<Props, 'component'> & Component) => (\n <SearchFilter {...props} component={CheckboxFilter} />\n);\n\nSearchFilter.Select = (props: Omit<Props, 'component'> & Component) => (\n <SearchFilter {...props} component={SelectFilter} />\n);\n\n/**\n * @deprecated This component was used for rapid prototyping of the Backstage\n * Search platform. Now that the API has stabilized, you should use the\n * <SearchFilter /> component instead. This component will be removed in an\n * upcoming release.\n */\nconst SearchFilterNext = SearchFilter;\n\nexport { SearchFilter, SearchFilterNext };\n","import * as React from 'react';\nimport createSvgIcon from './utils/createSvgIcon';\nexport default createSvgIcon( /*#__PURE__*/React.createElement(\"path\", {\n 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\"\n}), 'Launch');","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n EmptyState,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport { SearchResult } from '@backstage/search-common';\nimport React from 'react';\nimport { useSearch } from '../SearchContext';\n\ntype Props = {\n children: (results: { results: SearchResult[] }) => JSX.Element;\n};\n\nexport const SearchResultComponent = ({ children }: Props) => {\n const {\n result: { loading, error, value },\n } = useSearch();\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return (\n <ResponseErrorPanel\n title=\"Error encountered while fetching search results\"\n error={error}\n />\n );\n }\n\n if (!value?.results.length) {\n return <EmptyState missing=\"data\" title=\"Sorry, no results were found\" />;\n }\n\n return <>{children({ results: value.results })}</>;\n};\n\nexport { SearchResultComponent as SearchResult };\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Button, makeStyles } from '@material-ui/core';\nimport ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';\nimport ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';\nimport React from 'react';\nimport { useSearch } from '../SearchContext';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n display: 'flex',\n justifyContent: 'space-between',\n gap: theme.spacing(2),\n margin: theme.spacing(2, 0),\n },\n}));\n\nexport const SearchResultPager = () => {\n const { fetchNextPage, fetchPreviousPage } = useSearch();\n const classes = useStyles();\n\n if (!fetchNextPage && !fetchPreviousPage) {\n return <></>;\n }\n\n return (\n <nav arial-label=\"pagination navigation\" className={classes.root}>\n <Button\n aria-label=\"previous page\"\n disabled={!fetchPreviousPage}\n onClick={fetchPreviousPage}\n startIcon={<ArrowBackIosIcon />}\n >\n Previous\n </Button>\n\n <Button\n aria-label=\"next page\"\n disabled={!fetchNextPage}\n onClick={fetchNextPage}\n endIcon={<ArrowForwardIosIcon />}\n >\n Next\n </Button>\n </nav>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SearchClient, searchApiRef } from './apis';\nimport {\n createApiFactory,\n createPlugin,\n createRouteRef,\n createRoutableExtension,\n discoveryApiRef,\n createComponentExtension,\n identityApiRef,\n} from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'search',\n});\n\nexport const rootNextRouteRef = createRouteRef({\n id: 'search:next',\n});\n\nexport const searchPlugin = createPlugin({\n id: 'search',\n apis: [\n createApiFactory({\n api: searchApiRef,\n deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },\n factory: ({ discoveryApi, identityApi }) => {\n return new SearchClient({ discoveryApi, identityApi });\n },\n }),\n ],\n routes: {\n root: rootRouteRef,\n nextRoot: rootNextRouteRef,\n },\n});\n\nexport const SearchPage = searchPlugin.provide(\n createRoutableExtension({\n name: 'SearchPage',\n component: () => import('./components/SearchPage').then(m => m.SearchPage),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @deprecated This component was used for rapid prototyping of the Backstage\n * Search platform. Now that the API has stabilized, you should use the\n * <SearchPage /> component instead. This component will be removed in an\n * upcoming release.\n */\nexport const SearchPageNext = searchPlugin.provide(\n createRoutableExtension({\n name: 'SearchPageNext',\n component: () => import('./components/SearchPage').then(m => m.SearchPage),\n mountPoint: rootNextRouteRef,\n }),\n);\n\nexport const SearchBar = searchPlugin.provide(\n createComponentExtension({\n name: 'SearchBar',\n component: {\n lazy: () => import('./components/SearchBar').then(m => m.SearchBar),\n },\n }),\n);\n\n/**\n * @deprecated This component was used for rapid prototyping of the Backstage\n * Search platform. Now that the API has stabilized, you should use the\n * <SearchBar /> component instead. This component will be removed in an\n * upcoming release.\n */\nexport const SearchBarNext = searchPlugin.provide(\n createComponentExtension({\n name: 'SearchBarNext',\n component: {\n lazy: () => import('./components/SearchBar').then(m => m.SearchBar),\n },\n }),\n);\n\nexport const SearchResult = searchPlugin.provide(\n createComponentExtension({\n name: 'SearchResult',\n component: {\n lazy: () => import('./components/SearchResult').then(m => m.SearchResult),\n },\n }),\n);\n\n/**\n * @deprecated This component was used for rapid prototyping of the Backstage\n * Search platform. Now that the API has stabilized, you should use the\n * <SearchResult /> component instead. This component will be removed in an\n * upcoming release.\n */\nexport const SearchResultNext = searchPlugin.provide(\n createComponentExtension({\n name: 'SearchResultNext',\n component: {\n lazy: () => import('./components/SearchResult').then(m => m.SearchResult),\n },\n }),\n);\n\nexport const SidebarSearchModal = searchPlugin.provide(\n createComponentExtension({\n name: 'SidebarSearchModal',\n component: {\n lazy: () =>\n import('./components/SidebarSearchModal').then(\n m => m.SidebarSearchModal,\n ),\n },\n }),\n);\n\nexport const DefaultResultListItem = searchPlugin.provide(\n createComponentExtension({\n name: 'DefaultResultListItem',\n component: {\n lazy: () =>\n import('./components/DefaultResultListItem').then(\n m => m.DefaultResultListItem,\n ),\n },\n }),\n);\n\nexport const HomePageSearchBar = searchPlugin.provide(\n createComponentExtension({\n name: 'HomePageSearchBar',\n component: {\n lazy: () =>\n import('./components/HomePageComponent').then(m => m.HomePageSearchBar),\n },\n }),\n);\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useState } from 'react';\nimport {\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Divider,\n Grid,\n List,\n Paper,\n} from '@material-ui/core';\nimport { Launch } from '@material-ui/icons/';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { SearchBarBase } from '../SearchBar';\nimport { DefaultResultListItem } from '../DefaultResultListItem';\nimport { SearchResult } from '../SearchResult';\nimport { SearchContextProvider, useSearch } from '../SearchContext';\nimport { SearchResultPager } from '../SearchResultPager';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { Link } from '@backstage/core-components';\nimport { rootRouteRef } from '../../plugin';\n\nimport { useDebounce } from 'react-use';\n\nexport interface SearchModalProps {\n open?: boolean;\n toggleModal: () => void;\n}\n\nconst useStyles = makeStyles(theme => ({\n container: {\n borderRadius: 30,\n display: 'flex',\n height: '2.4em',\n },\n input: {\n flex: 1,\n },\n // Reduces default height of the modal, keeping a gap of 128px between the top and bottom of the page.\n paperFullWidth: { height: 'calc(100% - 128px)' },\n dialogActionsContainer: { padding: theme.spacing(1, 3) },\n viewResultsLink: { verticalAlign: '0.5em' },\n}));\n\nexport const Modal = ({ open = true, toggleModal }: SearchModalProps) => {\n const getSearchLink = useRouteRef(rootRouteRef);\n const classes = useStyles();\n\n const { term, setTerm } = useSearch();\n const [value, setValue] = useState<string>(term);\n\n useEffect(() => {\n setValue(prevValue => (prevValue !== term ? term : prevValue));\n }, [term]);\n\n useDebounce(() => setTerm(value), 500, [value]);\n\n const handleQuery = (newValue: string) => {\n setValue(newValue);\n };\n\n const handleClear = () => setValue('');\n\n const handleResultClick = () => {\n toggleModal();\n handleClear();\n };\n\n const handleKeyPress = () => {\n handleResultClick();\n };\n\n return (\n <Dialog\n classes={{\n paperFullWidth: classes.paperFullWidth,\n }}\n onClose={toggleModal}\n aria-labelledby=\"search-modal-title\"\n open={open}\n fullWidth\n maxWidth=\"lg\"\n >\n <DialogTitle>\n <Paper className={classes.container}>\n <SearchBarBase\n className={classes.input}\n value={value}\n onChange={handleQuery}\n onClear={handleClear}\n />\n </Paper>\n </DialogTitle>\n <DialogContent>\n <Grid\n container\n direction=\"row-reverse\"\n justifyContent=\"flex-start\"\n alignItems=\"center\"\n >\n <Grid item>\n <Link\n onClick={toggleModal}\n to={`${getSearchLink()}?query=${value}`}\n >\n <span className={classes.viewResultsLink}>View Full Results</span>\n <Launch color=\"primary\" />\n </Link>\n </Grid>\n </Grid>\n <Divider />\n <SearchResult>\n {({ results }) => (\n <List>\n {results.map(({ document }) => (\n <div\n role=\"button\"\n tabIndex={0}\n key={`${document.location}-btn`}\n onClick={handleResultClick}\n onKeyPress={handleKeyPress}\n >\n <DefaultResultListItem\n key={document.location}\n result={document}\n />\n </div>\n ))}\n </List>\n )}\n </SearchResult>\n </DialogContent>\n <DialogActions className={classes.dialogActionsContainer}>\n <Grid container direction=\"row\">\n <Grid item xs={12}>\n <SearchResultPager />\n </Grid>\n </Grid>\n </DialogActions>\n </Dialog>\n );\n};\n\nexport const SearchModal = ({ open = true, toggleModal }: SearchModalProps) => {\n return (\n <SearchContextProvider>\n <Modal open={open} toggleModal={toggleModal} />\n </SearchContextProvider>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Paper } from '@material-ui/core';\nimport InputBase from '@material-ui/core/InputBase';\nimport IconButton from '@material-ui/core/IconButton';\nimport SearchIcon from '@material-ui/icons/Search';\nimport ClearButton from '@material-ui/icons/Clear';\n\nconst useStyles = makeStyles(() => ({\n root: {\n display: 'flex',\n alignItems: 'center',\n },\n input: {\n flex: 1,\n },\n}));\n\ntype SearchBarProps = {\n searchQuery: string;\n handleSearch: any;\n handleClearSearchBar: any;\n};\n\nexport const SearchBar = ({\n searchQuery,\n handleSearch,\n handleClearSearchBar,\n}: SearchBarProps) => {\n const classes = useStyles();\n\n return (\n <Paper\n component=\"form\"\n onSubmit={e => handleSearch(e)}\n className={classes.root}\n >\n <IconButton disabled type=\"submit\" aria-label=\"search\">\n <SearchIcon />\n </IconButton>\n <InputBase\n className={classes.input}\n placeholder=\"Search in Backstage\"\n value={searchQuery}\n onChange={e => handleSearch(e)}\n inputProps={{ 'aria-label': 'search backstage' }}\n />\n <IconButton aria-label=\"search\" onClick={() => handleClearSearchBar()}>\n <ClearButton />\n </IconButton>\n </Paper>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport FilterListIcon from '@material-ui/icons/FilterList';\nimport { makeStyles, IconButton, Typography } from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n filters: {\n width: '250px',\n display: 'flex',\n },\n icon: {\n margin: theme.spacing(-1, 0, 0, 0),\n },\n}));\n\ntype FiltersButtonProps = {\n numberOfSelectedFilters: number;\n handleToggleFilters: () => void;\n};\n\nexport const FiltersButton = ({\n numberOfSelectedFilters,\n handleToggleFilters,\n}: FiltersButtonProps) => {\n const classes = useStyles();\n\n return (\n <div className={classes.filters}>\n <IconButton\n className={classes.icon}\n aria-label=\"settings\"\n onClick={handleToggleFilters}\n >\n <FilterListIcon />\n </IconButton>\n <Typography variant=\"h6\">\n Filters ({numberOfSelectedFilters ? numberOfSelectedFilters : 0})\n </Typography>\n </div>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport {\n makeStyles,\n Typography,\n Divider,\n Card,\n CardHeader,\n Button,\n CardContent,\n Select,\n Checkbox,\n List,\n ListItem,\n ListItemText,\n MenuItem,\n} from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n filters: {\n background: 'transparent',\n boxShadow: '0px 0px 0px 0px',\n },\n checkbox: {\n padding: theme.spacing(0, 1, 0, 1),\n },\n dropdown: {\n width: '100%',\n },\n}));\n\nexport type FiltersState = {\n selected: string;\n checked: Array<string>;\n};\n\nexport type FilterOptions = {\n kind: Array<string>;\n lifecycle: Array<string>;\n};\n\ntype FiltersProps = {\n filters: FiltersState;\n filterOptions: FilterOptions;\n resetFilters: () => void;\n updateSelected: (filter: string) => void;\n updateChecked: (filter: string) => void;\n};\n\nexport const Filters = ({\n filters,\n filterOptions,\n resetFilters,\n updateSelected,\n updateChecked,\n}: FiltersProps) => {\n const classes = useStyles();\n\n return (\n <Card className={classes.filters}>\n <CardHeader\n title={<Typography variant=\"h6\">Filters</Typography>}\n action={\n <Button color=\"primary\" onClick={() => resetFilters()}>\n CLEAR ALL\n </Button>\n }\n />\n <Divider />\n {filterOptions.kind.length === 0 && filterOptions.lifecycle.length === 0 && (\n <CardContent>\n <Typography variant=\"subtitle2\">\n Filters cannot be applied to available results\n </Typography>\n </CardContent>\n )}\n {filterOptions.kind.length > 0 && (\n <CardContent>\n <Typography variant=\"subtitle2\">Kind</Typography>\n <Select\n id=\"outlined-select\"\n onChange={(e: React.ChangeEvent<any>) =>\n updateSelected(e?.target?.value)\n }\n variant=\"outlined\"\n className={classes.dropdown}\n value={filters.selected}\n >\n {filterOptions.kind.map(filter => (\n <MenuItem\n selected={filter === ''}\n dense\n key={filter}\n value={filter}\n >\n {filter}\n </MenuItem>\n ))}\n </Select>\n </CardContent>\n )}\n {filterOptions.lifecycle.length > 0 && (\n <CardContent>\n <Typography variant=\"subtitle2\">Lifecycle</Typography>\n <List disablePadding dense>\n {filterOptions.lifecycle.map(filter => (\n <ListItem\n key={filter}\n dense\n button\n onClick={() => updateChecked(filter)}\n >\n <Checkbox\n edge=\"start\"\n disableRipple\n className={classes.checkbox}\n color=\"primary\"\n checked={filters.checked.includes(filter)}\n tabIndex={-1}\n value={filter}\n name={filter}\n />\n <ListItemText id={filter} primary={filter} />\n </ListItem>\n ))}\n </List>\n </CardContent>\n )}\n </Card>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Divider, Grid, makeStyles, Typography } from '@material-ui/core';\nimport { Alert } from '@material-ui/lab';\nimport React, { useEffect, useState } from 'react';\nimport { useAsync } from 'react-use';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\n\nimport { Filters, FiltersButton, FiltersState } from './Filters';\nimport { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';\n\nimport {\n EmptyState,\n Link,\n Progress,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\ntype Result = {\n name: string;\n description: string | undefined;\n owner: string | undefined;\n kind: string;\n lifecycle: string | undefined;\n url: string;\n};\ntype SearchResults = Array<Result>;\n\nconst useStyles = makeStyles(theme => ({\n searchQuery: {\n color: theme.palette.text.primary,\n background: theme.palette.background.default,\n borderRadius: '10%',\n },\n tableHeader: {\n margin: theme.spacing(1, 0, 0, 0),\n display: 'flex',\n },\n divider: {\n width: '1px',\n margin: theme.spacing(0, 2),\n padding: theme.spacing(2, 0),\n },\n}));\n\ntype SearchResultProps = {\n searchQuery?: string;\n};\n\ntype TableHeaderProps = {\n searchQuery?: string;\n numberOfSelectedFilters: number;\n numberOfResults: number;\n handleToggleFilters: () => void;\n};\n\n// TODO: move out column to make the search result component more generic\nconst columns: TableColumn[] = [\n {\n title: 'Name',\n field: 'name',\n highlight: true,\n render: (result: Partial<Result>) => (\n <Link to={result.url || ''}>{result.name}</Link>\n ),\n },\n {\n title: 'Description',\n field: 'description',\n },\n {\n title: 'Owner',\n field: 'owner',\n },\n {\n title: 'Kind',\n field: 'kind',\n },\n {\n title: 'LifeCycle',\n field: 'lifecycle',\n },\n];\n\nconst TableHeader = ({\n searchQuery,\n numberOfSelectedFilters,\n numberOfResults,\n handleToggleFilters,\n}: TableHeaderProps) => {\n const classes = useStyles();\n\n return (\n <div className={classes.tableHeader}>\n <FiltersButton\n numberOfSelectedFilters={numberOfSelectedFilters}\n handleToggleFilters={handleToggleFilters}\n />\n <Divider className={classes.divider} orientation=\"vertical\" />\n <Grid item xs={12}>\n {searchQuery ? (\n <Typography variant=\"h6\">\n {`${numberOfResults} `}\n {numberOfResults > 1 ? `results for ` : `result for `}\n <span className={classes.searchQuery}>\"{searchQuery}\"</span>{' '}\n </Typography>\n ) : (\n <Typography variant=\"h6\">{`${numberOfResults} results`}</Typography>\n )}\n </Grid>\n </div>\n );\n};\n\nexport const SearchResult = ({ searchQuery }: SearchResultProps) => {\n const catalogApi = useApi(catalogApiRef);\n\n const [showFilters, toggleFilters] = useState(false);\n const [selectedFilters, setSelectedFilters] = useState<FiltersState>({\n selected: '',\n checked: [],\n });\n\n const [filteredResults, setFilteredResults] = useState<SearchResults>([]);\n\n const {\n loading,\n error,\n value: results,\n } = useAsync(async () => {\n const entities = await catalogApi.getEntities();\n return entities.items.map((entity: Entity) => ({\n name: entity.metadata.name,\n description: entity.metadata.description,\n owner:\n typeof entity.spec?.owner === 'string' ? entity.spec?.owner : undefined,\n kind: entity.kind,\n lifecycle:\n typeof entity.spec?.lifecycle === 'string'\n ? entity.spec?.lifecycle\n : undefined,\n url: `/catalog/${\n entity.metadata.namespace?.toLocaleLowerCase('en-US') ||\n ENTITY_DEFAULT_NAMESPACE\n }/${entity.kind.toLocaleLowerCase('en-US')}/${entity.metadata.name}`,\n }));\n }, []);\n\n useEffect(() => {\n if (results) {\n let withFilters = results;\n\n // apply filters\n\n // filter on selected\n if (selectedFilters.selected !== '') {\n withFilters = results.filter((result: Result) =>\n selectedFilters.selected.includes(result.kind),\n );\n }\n\n // filter on checked\n if (selectedFilters.checked.length > 0) {\n withFilters = withFilters.filter(\n (result: Result) =>\n result.lifecycle &&\n selectedFilters.checked.includes(result.lifecycle),\n );\n }\n\n // filter on searchQuery\n if (searchQuery) {\n withFilters = withFilters.filter(\n (result: Result) =>\n result.name?.toLocaleLowerCase('en-US').includes(searchQuery) ||\n result.name\n ?.toLocaleLowerCase('en-US')\n .includes(searchQuery.split(' ').join('-')) ||\n result.description\n ?.toLocaleLowerCase('en-US')\n .includes(searchQuery),\n );\n }\n\n setFilteredResults(withFilters);\n }\n }, [selectedFilters, searchQuery, results]);\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return (\n <Alert severity=\"error\">\n Error encountered while fetching search results. {error.toString()}\n </Alert>\n );\n }\n if (!results || results.length === 0) {\n return <EmptyState missing=\"data\" title=\"Sorry, no results were found\" />;\n }\n\n const resetFilters = () => {\n setSelectedFilters({\n selected: '',\n checked: [],\n });\n };\n\n const updateSelected = (filter: string) => {\n setSelectedFilters(prevState => ({\n ...prevState,\n selected: filter,\n }));\n };\n\n const updateChecked = (filter: string) => {\n if (selectedFilters.checked.includes(filter)) {\n setSelectedFilters(prevState => ({\n ...prevState,\n checked: prevState.checked.filter(item => item !== filter),\n }));\n return;\n }\n\n setSelectedFilters(prevState => ({\n ...prevState,\n checked: [...prevState.checked, filter],\n }));\n };\n\n const filterOptions = results.reduce(\n (acc, curr) => {\n if (curr.kind && acc.kind.indexOf(curr.kind) < 0) {\n acc.kind.push(curr.kind);\n }\n if (curr.lifecycle && acc.lifecycle.indexOf(curr.lifecycle) < 0) {\n acc.lifecycle.push(curr.lifecycle);\n }\n return acc;\n },\n {\n kind: [] as Array<string>,\n lifecycle: [] as Array<string>,\n },\n );\n\n return (\n <>\n <Grid container>\n {showFilters && (\n <Grid item xs={3}>\n <Filters\n filters={selectedFilters}\n filterOptions={filterOptions}\n resetFilters={resetFilters}\n updateSelected={updateSelected}\n updateChecked={updateChecked}\n />\n </Grid>\n )}\n <Grid item xs={showFilters ? 9 : 12}>\n <Table\n options={{ paging: true, pageSize: 20, search: false }}\n data={filteredResults}\n columns={columns}\n title={\n <TableHeader\n searchQuery={searchQuery}\n numberOfResults={filteredResults.length}\n numberOfSelectedFilters={\n (selectedFilters.selected !== '' ? 1 : 0) +\n selectedFilters.checked.length\n }\n handleToggleFilters={() => toggleFilters(!showFilters)}\n />\n }\n />\n </Grid>\n </Grid>\n </>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Grid } from '@material-ui/core';\nimport React, { useEffect, useState } from 'react';\nimport { useDebounce } from 'react-use';\nimport { SearchBar } from './LegacySearchBar';\nimport { SearchResult } from './LegacySearchResult';\nimport {\n Content,\n Header,\n Page,\n useQueryParamState,\n} from '@backstage/core-components';\n\n/**\n * @deprecated This SearchPage, powered directly by the Catalog API, will be\n * removed from a future release of this plugin.\n */\nexport const LegacySearchPage = () => {\n const [queryString, setQueryString] = useQueryParamState<string>('query');\n const [searchQuery, setSearchQuery] = useState(queryString ?? '');\n\n const handleSearch = (event: React.ChangeEvent<HTMLInputElement>) => {\n event.preventDefault();\n setSearchQuery(event.target.value);\n };\n\n useEffect(() => setSearchQuery(queryString ?? ''), [queryString]);\n\n useDebounce(\n () => {\n setQueryString(searchQuery);\n },\n 200,\n [searchQuery],\n );\n\n const handleClearSearchBar = () => {\n setSearchQuery('');\n };\n\n return (\n <Page themeId=\"home\">\n <Header title=\"Search\" />\n <Content>\n <Grid container direction=\"row\">\n <Grid item xs={12}>\n <SearchBar\n handleSearch={handleSearch}\n handleClearSearchBar={handleClearSearchBar}\n searchQuery={searchQuery}\n />\n </Grid>\n <Grid item xs={12}>\n <SearchResult\n searchQuery={(queryString ?? '').toLocaleLowerCase('en-US')}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect } from 'react';\nimport { usePrevious } from 'react-use';\nimport qs from 'qs';\nimport { useLocation, useOutlet } from 'react-router';\nimport { SearchContextProvider, useSearch } from '../SearchContext';\nimport { JsonObject } from '@backstage/types';\nimport { LegacySearchPage } from '../LegacySearchPage';\n\nexport const UrlUpdater = () => {\n const location = useLocation();\n const {\n term,\n setTerm,\n types,\n setTypes,\n pageCursor,\n setPageCursor,\n filters,\n setFilters,\n } = useSearch();\n\n const prevQueryParams = usePrevious(location.search);\n useEffect(() => {\n // Only respond to changes to url query params\n if (location.search === prevQueryParams) {\n return;\n }\n\n const query =\n qs.parse(location.search.substring(1), { arrayLimit: 0 }) || {};\n\n if (query.filters) {\n setFilters(query.filters as JsonObject);\n }\n\n if (query.query) {\n setTerm(query.query as string);\n }\n\n if (query.pageCursor) {\n setPageCursor(query.pageCursor as string);\n }\n\n if (query.types) {\n setTypes(query.types as string[]);\n }\n }, [prevQueryParams, location, setTerm, setTypes, setPageCursor, setFilters]);\n\n useEffect(() => {\n const newParams = qs.stringify(\n {\n query: term,\n types,\n pageCursor,\n filters,\n },\n { arrayFormat: 'brackets' },\n );\n const newUrl = `${window.location.pathname}?${newParams}`;\n\n // We directly manipulate window history here in order to not re-render\n // infinitely (state => location => state => etc). The intention of this\n // code is just to ensure the right query/filters are loaded when a user\n // clicks the \"back\" button after clicking a result.\n window.history.replaceState(null, document.title, newUrl);\n }, [term, types, pageCursor, filters]);\n\n return null;\n};\n\nexport const SearchPage = () => {\n const outlet = useOutlet();\n\n return (\n <SearchContextProvider>\n <UrlUpdater />\n {outlet || <LegacySearchPage />}\n </SearchContextProvider>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Checkbox,\n Chip,\n FormControl,\n InputLabel,\n ListItemText,\n makeStyles,\n MenuItem,\n Select,\n} from '@material-ui/core';\nimport React, { ChangeEvent } from 'react';\nimport { useEffectOnce } from 'react-use';\nimport { useSearch } from '../SearchContext';\n\nconst useStyles = makeStyles(theme => ({\n label: {\n textTransform: 'capitalize',\n },\n chips: {\n display: 'flex',\n flexWrap: 'wrap',\n marginTop: theme.spacing(1),\n },\n chip: {\n margin: 2,\n },\n}));\n\nexport type SearchTypeProps = {\n className?: string;\n name: string;\n values?: string[];\n defaultValue?: string[] | string | null;\n};\n\nconst SearchType = ({\n values = [],\n className,\n name,\n defaultValue,\n}: SearchTypeProps) => {\n const classes = useStyles();\n const { types, setTypes } = useSearch();\n\n useEffectOnce(() => {\n if (!types.length) {\n if (defaultValue && Array.isArray(defaultValue)) {\n setTypes(defaultValue);\n } else if (defaultValue) {\n setTypes([defaultValue]);\n }\n }\n });\n\n const handleChange = (e: ChangeEvent<{ value: unknown }>) => {\n const value = e.target.value as string[];\n setTypes(value as string[]);\n };\n\n return (\n <FormControl\n className={className}\n variant=\"filled\"\n fullWidth\n data-testid=\"search-typefilter-next\"\n >\n <InputLabel className={classes.label} margin=\"dense\">\n {name}\n </InputLabel>\n <Select\n multiple\n variant=\"outlined\"\n value={types}\n onChange={handleChange}\n placeholder=\"All Results\"\n renderValue={selected => (\n <div className={classes.chips}>\n {(selected as string[]).map(value => (\n <Chip\n key={value}\n label={value}\n className={classes.chip}\n size=\"small\"\n />\n ))}\n </div>\n )}\n >\n {values.map((value: string) => (\n <MenuItem key={value} value={value}>\n <Checkbox checked={types.indexOf(value) > -1} />\n <ListItemText primary={value} />\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n};\n\nexport { SearchType };\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport qs from 'qs';\nimport React, { useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { rootRouteRef } from '../../plugin';\n\nimport { SidebarSearchField } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nexport const SidebarSearch = () => {\n const searchRoute = useRouteRef(rootRouteRef);\n const navigate = useNavigate();\n const handleSearch = useCallback(\n (query: string): void => {\n const queryString = qs.stringify({ query }, { addQueryPrefix: true });\n\n navigate(`${searchRoute()}${queryString}`);\n },\n [navigate, searchRoute],\n );\n\n return <SidebarSearchField onSearch={handleSearch} to=\"/search\" />;\n};\n"],"names":["DefaultResultListItem","useStyles","FiltersButton","Filters","React","SearchBar","SearchPage","SearchResult","makeStyles","IconButton","InputBase"],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G;AAAA;AAAA;;;;"}
@@ -1,4 +1,4 @@
1
- export { D as DefaultResultListItem } from './index-cdccd881.esm.js';
1
+ export { D as DefaultResultListItem } from './index-8e7d7ce9.esm.js';
2
2
  import '@backstage/core-plugin-api';
3
3
  import '@backstage/errors';
4
4
  import 'qs';
@@ -20,4 +20,4 @@ import '@material-ui/lab';
20
20
  import '@backstage/plugin-catalog-react';
21
21
  import '@backstage/catalog-model';
22
22
  import 'react-router-dom';
23
- //# sourceMappingURL=index-207637ef.esm.js.map
23
+ //# sourceMappingURL=index-b647c19e.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-b647c19e.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -3,7 +3,8 @@ import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
3
3
  import * as _backstage_search_common from '@backstage/search-common';
4
4
  import { SearchQuery, SearchResultSet } from '@backstage/search-common';
5
5
  import { JsonObject } from '@backstage/types';
6
- import React, { ReactElement } from 'react';
6
+ import * as React from 'react';
7
+ import React__default, { ReactElement } from 'react';
7
8
  import { AsyncState } from 'react-use/lib/useAsync';
8
9
 
9
10
  declare const searchApiRef: _backstage_core_plugin_api.ApiRef<SearchApi>;
@@ -39,24 +40,27 @@ declare type Props$1 = {
39
40
  className?: string;
40
41
  debounceTime?: number;
41
42
  placeholder?: string;
43
+ clearButton?: boolean;
42
44
  };
43
- declare const SearchBar: ({ autoFocus, className, debounceTime, placeholder, }: Props$1) => JSX.Element;
45
+ declare const SearchBar: ({ autoFocus, className, debounceTime, placeholder, clearButton, }: Props$1) => JSX.Element;
44
46
 
45
47
  declare type SearchContextValue = {
46
48
  result: AsyncState<SearchResultSet>;
47
49
  term: string;
48
- setTerm: React.Dispatch<React.SetStateAction<string>>;
50
+ setTerm: React__default.Dispatch<React__default.SetStateAction<string>>;
49
51
  types: string[];
50
- setTypes: React.Dispatch<React.SetStateAction<string[]>>;
52
+ setTypes: React__default.Dispatch<React__default.SetStateAction<string[]>>;
51
53
  filters: JsonObject;
52
- setFilters: React.Dispatch<React.SetStateAction<JsonObject>>;
54
+ setFilters: React__default.Dispatch<React__default.SetStateAction<JsonObject>>;
55
+ open?: boolean;
56
+ toggleModal: () => void;
53
57
  pageCursor?: string;
54
- setPageCursor: React.Dispatch<React.SetStateAction<string | undefined>>;
55
- fetchNextPage?: React.DispatchWithoutAction;
56
- fetchPreviousPage?: React.DispatchWithoutAction;
58
+ setPageCursor: React__default.Dispatch<React__default.SetStateAction<string | undefined>>;
59
+ fetchNextPage?: React__default.DispatchWithoutAction;
60
+ fetchPreviousPage?: React__default.DispatchWithoutAction;
57
61
  };
58
- declare type SettableSearchContext = Omit<SearchContextValue, 'result' | 'setTerm' | 'setTypes' | 'setFilters' | 'setPageCursor' | 'fetchNextPage' | 'fetchPreviousPage'>;
59
- declare const SearchContextProvider: ({ initialState, children, }: React.PropsWithChildren<{
62
+ declare type SettableSearchContext = Omit<SearchContextValue, 'result' | 'setTerm' | 'setTypes' | 'setFilters' | 'toggleModal' | 'setPageCursor' | 'fetchNextPage' | 'fetchPreviousPage'>;
63
+ declare const SearchContextProvider: ({ initialState, children, }: React__default.PropsWithChildren<{
60
64
  initialState?: SettableSearchContext | undefined;
61
65
  }>) => JSX.Element;
62
66
  declare const useSearch: () => SearchContextValue;
@@ -126,11 +130,12 @@ declare const SearchPageNext: () => JSX.Element;
126
130
  * <SearchBar /> component instead. This component will be removed in an
127
131
  * upcoming release.
128
132
  */
129
- declare const SearchBarNext: ({ autoFocus, className, debounceTime, placeholder, }: {
133
+ declare const SearchBarNext: ({ autoFocus, className, debounceTime, placeholder, clearButton, }: {
130
134
  autoFocus?: boolean | undefined;
131
135
  className?: string | undefined;
132
136
  debounceTime?: number | undefined;
133
137
  placeholder?: string | undefined;
138
+ clearButton?: boolean | undefined;
134
139
  }) => JSX.Element;
135
140
  declare const SearchResult: ({ children }: {
136
141
  children: (results: {
@@ -138,11 +143,13 @@ declare const SearchResult: ({ children }: {
138
143
  }) => JSX.Element;
139
144
  }) => JSX.Element;
140
145
  declare const SidebarSearchModal: () => JSX.Element;
141
- declare const DefaultResultListItem: ({ result }: {
146
+ declare const DefaultResultListItem: ({ result, icon, secondaryAction, }: {
147
+ icon?: React.ReactNode;
148
+ secondaryAction?: React.ReactNode;
142
149
  result: _backstage_search_common.IndexableDocument;
143
150
  }) => JSX.Element;
144
151
  declare const HomePageSearchBar: ({ placeholder }: {
145
152
  placeholder?: string | undefined;
146
153
  }) => JSX.Element;
147
154
 
148
- export { DefaultResultListItem, Filters, FiltersButton, FiltersState, HomePageSearchBar, SearchPage$1 as Router, SearchBar, SearchBarNext, SearchContextProvider, SearchFilter, SearchFilterNext, SearchModal, SearchModalProps, SearchPage, SearchPageNext, SearchResult, SearchResultPager, SearchType, SidebarSearch, SidebarSearchModal, searchPlugin as plugin, searchApiRef, searchPlugin, useSearch };
155
+ export { DefaultResultListItem, Filters, FiltersButton, FiltersState, HomePageSearchBar, SearchPage$1 as Router, SearchApi, SearchBar, SearchBarNext, SearchContextProvider, SearchFilter, SearchFilterNext, SearchModal, SearchModalProps, SearchPage, SearchPageNext, SearchResult, SearchResultPager, SearchType, SidebarSearch, SidebarSearchModal, searchPlugin as plugin, searchApiRef, searchPlugin, useSearch };
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- export { l as DefaultResultListItem, F as Filters, e as FiltersButton, H as HomePageSearchBar, S as Router, a as SearchBar, m as SearchBarNext, f as SearchContextProvider, g as SearchFilter, h as SearchFilterNext, d as SearchModal, n as SearchPage, o as SearchPageNext, q as SearchResult, i as SearchResultPager, j as SearchType, k as SidebarSearch, t as SidebarSearchModal, p as plugin, s as searchApiRef, p as searchPlugin, u as useSearch } from './esm/index-cdccd881.esm.js';
1
+ export { l as DefaultResultListItem, F as Filters, e as FiltersButton, H as HomePageSearchBar, S as Router, a as SearchBar, m as SearchBarNext, f as SearchContextProvider, g as SearchFilter, h as SearchFilterNext, d as SearchModal, n as SearchPage, o as SearchPageNext, q as SearchResult, i as SearchResultPager, j as SearchType, k as SidebarSearch, t as SidebarSearchModal, p as plugin, s as searchApiRef, p as searchPlugin, u as useSearch } from './esm/index-8e7d7ce9.esm.js';
2
2
  import 'react';
3
3
  import '@material-ui/core';
4
4
  import '@backstage/core-components';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search",
3
3
  "description": "The Backstage plugin that provides your backstage app with search",
4
- "version": "0.4.18",
4
+ "version": "0.5.0",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -32,12 +32,12 @@
32
32
  "dependencies": {
33
33
  "@backstage/catalog-model": "^0.9.7",
34
34
  "@backstage/config": "^0.1.11",
35
- "@backstage/core-components": "^0.7.4",
36
- "@backstage/core-plugin-api": "^0.2.0",
35
+ "@backstage/core-components": "^0.7.6",
36
+ "@backstage/core-plugin-api": "^0.2.2",
37
37
  "@backstage/errors": "^0.1.4",
38
38
  "@backstage/plugin-catalog-react": "^0.6.4",
39
39
  "@backstage/search-common": "^0.2.1",
40
- "@backstage/theme": "^0.2.13",
40
+ "@backstage/theme": "^0.2.14",
41
41
  "@backstage/types": "^0.1.1",
42
42
  "@material-ui/core": "^4.12.2",
43
43
  "@material-ui/icons": "^4.9.1",
@@ -51,10 +51,10 @@
51
51
  "react-use": "^17.2.4"
52
52
  },
53
53
  "devDependencies": {
54
- "@backstage/cli": "^0.9.0",
55
- "@backstage/core-app-api": "^0.1.21",
54
+ "@backstage/cli": "^0.10.0",
55
+ "@backstage/core-app-api": "^0.1.24",
56
56
  "@backstage/dev-utils": "^0.2.13",
57
- "@backstage/test-utils": "^0.1.22",
57
+ "@backstage/test-utils": "^0.1.23",
58
58
  "@testing-library/jest-dom": "^5.10.1",
59
59
  "@testing-library/react": "^11.2.5",
60
60
  "@testing-library/react-hooks": "^7.0.2",
@@ -67,5 +67,5 @@
67
67
  "files": [
68
68
  "dist"
69
69
  ],
70
- "gitHead": "ddfdcd2b44dc9848cf550cea5346d5f9916a36d9"
70
+ "gitHead": "a05e7081b805006e3f0b2960a08a7753357f532f"
71
71
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-01b40466.esm.js","sources":["../../src/components/SidebarSearchModal/SidebarSearchModal.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState } from 'react';\nimport SearchIcon from '@material-ui/icons/Search';\nimport { SearchModal } from '../SearchModal';\nimport { SidebarItem } from '@backstage/core-components';\n\nexport const SidebarSearchModal = () => {\n const [open, setOpen] = useState<boolean>(false);\n const toggleModal = (): void => setOpen(prevState => !prevState);\n\n return (\n <>\n <SidebarItem\n className=\"search-icon\"\n icon={SearchIcon}\n text=\"Search\"\n onClick={toggleModal}\n />\n <SearchModal open={open} toggleModal={toggleModal} />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAoBa,qBAAqB,MAAM;AACtC,QAAM,CAAC,MAAM,WAAW,SAAkB;AAC1C,QAAM,cAAc,MAAY,QAAQ,eAAa,CAAC;AAEtD,kIAEK,aAAD;AAAA,IACE,WAAU;AAAA,IACV,MAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAS;AAAA,mDAEV,aAAD;AAAA,IAAa;AAAA,IAAY;AAAA;AAAA;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-207637ef.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-766e727c.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-77205085.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-b929d40d.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-cdccd881.esm.js","sources":["../../src/apis.ts","../../src/components/DefaultResultListItem/DefaultResultListItem.tsx","../../src/components/Filters/FiltersButton.tsx","../../src/components/Filters/Filters.tsx","../../src/components/SearchContext/SearchContext.tsx","../../src/components/SearchBar/SearchBar.tsx","../../src/components/SearchFilter/SearchFilter.tsx","../../../../node_modules/@material-ui/icons/esm/Launch.js","../../src/components/SearchResult/SearchResult.tsx","../../src/components/SearchResultPager/SearchResultPager.tsx","../../src/plugin.ts","../../src/components/SearchModal/SearchModal.tsx","../../src/components/LegacySearchPage/LegacySearchBar.tsx","../../src/components/LegacySearchPage/Filters/FiltersButton.tsx","../../src/components/LegacySearchPage/Filters/Filters.tsx","../../src/components/LegacySearchPage/LegacySearchResult.tsx","../../src/components/LegacySearchPage/LegacySearchPage.tsx","../../src/components/SearchPage/SearchPage.tsx","../../src/components/SearchType/SearchType.tsx","../../src/components/SidebarSearch/SidebarSearch.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createApiRef,\n DiscoveryApi,\n IdentityApi,\n} from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { SearchQuery, SearchResultSet } from '@backstage/search-common';\nimport qs from 'qs';\n\nexport const searchApiRef = createApiRef<SearchApi>({\n id: 'plugin.search.queryservice',\n description: 'Used to make requests against the search API',\n});\n\nexport interface SearchApi {\n query(query: SearchQuery): Promise<SearchResultSet>;\n}\n\nexport class SearchClient implements SearchApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly identityApi: IdentityApi;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n identityApi: IdentityApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.identityApi = options.identityApi;\n }\n\n async query(query: SearchQuery): Promise<SearchResultSet> {\n const token = await this.identityApi.getIdToken();\n const queryString = qs.stringify(query);\n const url = `${await this.discoveryApi.getBaseUrl(\n 'search/query',\n )}?${queryString}`;\n const response = await fetch(url, {\n headers: token ? { Authorization: `Bearer ${token}` } : {},\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json();\n }\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { IndexableDocument } from '@backstage/search-common';\nimport { ListItem, ListItemText, Divider } from '@material-ui/core';\nimport { Link } from '@backstage/core-components';\n\ntype Props = {\n result: IndexableDocument;\n};\n\nexport const DefaultResultListItem = ({ result }: Props) => {\n return (\n <Link to={result.location}>\n <ListItem alignItems=\"flex-start\">\n <ListItemText\n primaryTypographyProps={{ variant: 'h6' }}\n primary={result.title}\n secondary={result.text}\n />\n </ListItem>\n <Divider />\n </Link>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport FilterListIcon from '@material-ui/icons/FilterList';\nimport { makeStyles, IconButton, Typography } from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n filters: {\n width: '250px',\n display: 'flex',\n },\n icon: {\n margin: theme.spacing(-1, 0, 0, 0),\n },\n}));\n\ntype FiltersButtonProps = {\n numberOfSelectedFilters: number;\n handleToggleFilters: () => void;\n};\n\nexport const FiltersButton = ({\n numberOfSelectedFilters,\n handleToggleFilters,\n}: FiltersButtonProps) => {\n const classes = useStyles();\n\n return (\n <div className={classes.filters}>\n <IconButton\n className={classes.icon}\n aria-label=\"settings\"\n onClick={handleToggleFilters}\n >\n <FilterListIcon />\n </IconButton>\n <Typography variant=\"h6\">\n Filters ({numberOfSelectedFilters ? numberOfSelectedFilters : 0})\n </Typography>\n </div>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport {\n makeStyles,\n Typography,\n Divider,\n Card,\n CardHeader,\n Button,\n CardContent,\n Select,\n Checkbox,\n List,\n ListItem,\n ListItemText,\n MenuItem,\n} from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n filters: {\n background: 'transparent',\n boxShadow: '0px 0px 0px 0px',\n },\n checkbox: {\n padding: theme.spacing(0, 1, 0, 1),\n },\n dropdown: {\n width: '100%',\n },\n}));\n\nexport type FiltersState = {\n selected: string;\n checked: Array<string>;\n};\n\nexport type FilterOptions = {\n kind: Array<string>;\n lifecycle: Array<string>;\n};\n\ntype FiltersProps = {\n filters: FiltersState;\n filterOptions: FilterOptions;\n resetFilters: () => void;\n updateSelected: (filter: string) => void;\n updateChecked: (filter: string) => void;\n};\n\nexport const Filters = ({\n filters,\n filterOptions,\n resetFilters,\n updateSelected,\n updateChecked,\n}: FiltersProps) => {\n const classes = useStyles();\n\n return (\n <Card className={classes.filters}>\n <CardHeader\n title={<Typography variant=\"h6\">Filters</Typography>}\n action={\n <Button color=\"primary\" onClick={() => resetFilters()}>\n CLEAR ALL\n </Button>\n }\n />\n <Divider />\n {filterOptions.kind.length === 0 && filterOptions.lifecycle.length === 0 && (\n <CardContent>\n <Typography variant=\"subtitle2\">\n Filters cannot be applied to available results\n </Typography>\n </CardContent>\n )}\n {filterOptions.kind.length > 0 && (\n <CardContent>\n <Typography variant=\"subtitle2\">Kind</Typography>\n <Select\n id=\"outlined-select\"\n onChange={(e: React.ChangeEvent<any>) =>\n updateSelected(e?.target?.value)\n }\n variant=\"outlined\"\n className={classes.dropdown}\n value={filters.selected}\n >\n {filterOptions.kind.map(filter => (\n <MenuItem\n selected={filter === ''}\n dense\n key={filter}\n value={filter}\n >\n {filter}\n </MenuItem>\n ))}\n </Select>\n </CardContent>\n )}\n {filterOptions.lifecycle.length > 0 && (\n <CardContent>\n <Typography variant=\"subtitle2\">Lifecycle</Typography>\n <List disablePadding dense>\n {filterOptions.lifecycle.map(filter => (\n <ListItem\n key={filter}\n dense\n button\n onClick={() => updateChecked(filter)}\n >\n <Checkbox\n edge=\"start\"\n disableRipple\n className={classes.checkbox}\n color=\"primary\"\n checked={filters.checked.includes(filter)}\n tabIndex={-1}\n value={filter}\n name={filter}\n />\n <ListItemText id={filter} primary={filter} />\n </ListItem>\n ))}\n </List>\n </CardContent>\n )}\n </Card>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject } from '@backstage/types';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { SearchResultSet } from '@backstage/search-common';\nimport React, {\n createContext,\n PropsWithChildren,\n useCallback,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport { useAsync, usePrevious } from 'react-use';\nimport { AsyncState } from 'react-use/lib/useAsync';\nimport { searchApiRef } from '../../apis';\n\ntype SearchContextValue = {\n result: AsyncState<SearchResultSet>;\n term: string;\n setTerm: React.Dispatch<React.SetStateAction<string>>;\n types: string[];\n setTypes: React.Dispatch<React.SetStateAction<string[]>>;\n filters: JsonObject;\n setFilters: React.Dispatch<React.SetStateAction<JsonObject>>;\n pageCursor?: string;\n setPageCursor: React.Dispatch<React.SetStateAction<string | undefined>>;\n fetchNextPage?: React.DispatchWithoutAction;\n fetchPreviousPage?: React.DispatchWithoutAction;\n};\n\ntype SettableSearchContext = Omit<\n SearchContextValue,\n | 'result'\n | 'setTerm'\n | 'setTypes'\n | 'setFilters'\n | 'setPageCursor'\n | 'fetchNextPage'\n | 'fetchPreviousPage'\n>;\n\nexport const SearchContext = createContext<SearchContextValue | undefined>(\n undefined,\n);\n\nexport const SearchContextProvider = ({\n initialState = {\n term: '',\n pageCursor: undefined,\n filters: {},\n types: [],\n },\n children,\n}: PropsWithChildren<{ initialState?: SettableSearchContext }>) => {\n const searchApi = useApi(searchApiRef);\n const [pageCursor, setPageCursor] = useState<string | undefined>(\n initialState.pageCursor,\n );\n const [filters, setFilters] = useState<JsonObject>(initialState.filters);\n const [term, setTerm] = useState<string>(initialState.term);\n const [types, setTypes] = useState<string[]>(initialState.types);\n const prevTerm = usePrevious(term);\n\n const result = useAsync(\n () =>\n searchApi.query({\n term,\n filters,\n pageCursor: pageCursor,\n types,\n }),\n [term, filters, types, pageCursor],\n );\n\n const hasNextPage =\n !result.loading && !result.error && result.value?.nextPageCursor;\n const hasPreviousPage =\n !result.loading && !result.error && result.value?.previousPageCursor;\n const fetchNextPage = useCallback(() => {\n setPageCursor(result.value?.nextPageCursor);\n }, [result.value?.nextPageCursor]);\n const fetchPreviousPage = useCallback(() => {\n setPageCursor(result.value?.previousPageCursor);\n }, [result.value?.previousPageCursor]);\n\n useEffect(() => {\n // Any time a term is reset, we want to start from page 0.\n if (term && prevTerm && term !== prevTerm) {\n setPageCursor(undefined);\n }\n }, [term, prevTerm, initialState.pageCursor]);\n\n const value: SearchContextValue = {\n result,\n filters,\n setFilters,\n term,\n setTerm,\n types,\n setTypes,\n pageCursor,\n setPageCursor,\n fetchNextPage: hasNextPage ? fetchNextPage : undefined,\n fetchPreviousPage: hasPreviousPage ? fetchPreviousPage : undefined,\n };\n\n return <SearchContext.Provider value={value} children={children} />;\n};\n\nexport const useSearch = () => {\n const context = useContext(SearchContext);\n if (context === undefined) {\n throw new Error('useSearch must be used within a SearchContextProvider');\n }\n return context;\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect, KeyboardEvent, useState } from 'react';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useDebounce } from 'react-use';\nimport { InputBase, InputAdornment, IconButton } from '@material-ui/core';\nimport SearchIcon from '@material-ui/icons/Search';\nimport ClearButton from '@material-ui/icons/Clear';\n\nimport { useSearch } from '../SearchContext';\n\ntype PresenterProps = {\n value: string;\n onChange: (value: string) => void;\n onClear?: () => void;\n onSubmit?: () => void;\n className?: string;\n placeholder?: string;\n autoFocus?: boolean;\n};\n\nexport const SearchBarBase = ({\n autoFocus,\n value,\n onChange,\n onSubmit,\n className,\n placeholder: overridePlaceholder,\n}: PresenterProps) => {\n const configApi = useApi(configApiRef);\n\n const onKeyDown = React.useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n if (onSubmit && e.key === 'Enter') {\n onSubmit();\n }\n },\n [onSubmit],\n );\n\n const handleClear = React.useCallback(() => {\n onChange('');\n }, [onChange]);\n\n const placeholder =\n overridePlaceholder ??\n `Search in ${configApi.getOptionalString('app.title') || 'Backstage'}`;\n\n return (\n <InputBase\n // decision up to adopter, read https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md#no-autofocus\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n data-testid=\"search-bar-next\"\n fullWidth\n placeholder={placeholder}\n value={value}\n onChange={e => onChange(e.target.value)}\n inputProps={{ 'aria-label': 'Search' }}\n startAdornment={\n <InputAdornment position=\"start\">\n <IconButton aria-label=\"Query\" disabled>\n <SearchIcon />\n </IconButton>\n </InputAdornment>\n }\n endAdornment={\n <InputAdornment position=\"end\">\n <IconButton aria-label=\"Clear\" onClick={handleClear}>\n <ClearButton />\n </IconButton>\n </InputAdornment>\n }\n {...(className && { className })}\n {...(onSubmit && { onKeyDown })}\n />\n );\n};\n\ntype Props = {\n autoFocus?: boolean;\n className?: string;\n debounceTime?: number;\n placeholder?: string;\n};\n\nexport const SearchBar = ({\n autoFocus,\n className,\n debounceTime = 0,\n placeholder,\n}: Props) => {\n const { term, setTerm } = useSearch();\n const [value, setValue] = useState<string>(term);\n\n useEffect(() => {\n setValue(prevValue => (prevValue !== term ? term : prevValue));\n }, [term]);\n\n useDebounce(() => setTerm(value), debounceTime, [value]);\n\n const handleQuery = (newValue: string) => {\n setValue(newValue);\n };\n\n const handleClear = () => setValue('');\n\n return (\n <SearchBarBase\n // decision up to adopter, read https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md#no-autofocus\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n className={className}\n value={value}\n onChange={handleQuery}\n onClear={handleClear}\n placeholder={placeholder}\n />\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ReactElement, ChangeEvent, useEffect } from 'react';\nimport {\n makeStyles,\n FormControl,\n FormControlLabel,\n InputLabel,\n Checkbox,\n Select,\n MenuItem,\n FormLabel,\n} from '@material-ui/core';\n\nimport { useSearch } from '../SearchContext';\n\nconst useStyles = makeStyles({\n label: {\n textTransform: 'capitalize',\n },\n});\n\nexport type Component = {\n className?: string;\n name: string;\n values?: string[];\n defaultValue?: string[] | string | null;\n};\n\nexport type Props = Component & {\n component: (props: Component) => ReactElement;\n debug?: boolean;\n};\n\nconst CheckboxFilter = ({\n className,\n name,\n defaultValue,\n values = [],\n}: Component) => {\n const classes = useStyles();\n const { filters, setFilters } = useSearch();\n\n useEffect(() => {\n if (Array.isArray(defaultValue)) {\n setFilters(prevFilters => ({\n ...prevFilters,\n [name]: defaultValue,\n }));\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n const {\n target: { value, checked },\n } = e;\n\n setFilters(prevFilters => {\n const { [name]: filter, ...others } = prevFilters;\n const rest = ((filter as string[]) || []).filter(i => i !== value);\n const items = checked ? [...rest, value] : rest;\n return items.length ? { ...others, [name]: items } : others;\n });\n };\n\n return (\n <FormControl\n className={className}\n fullWidth\n data-testid=\"search-checkboxfilter-next\"\n >\n <FormLabel className={classes.label}>{name}</FormLabel>\n {values.map((value: string) => (\n <FormControlLabel\n key={value}\n control={\n <Checkbox\n color=\"primary\"\n tabIndex={-1}\n inputProps={{ 'aria-labelledby': value }}\n value={value}\n name={value}\n onChange={handleChange}\n checked={((filters[name] as string[]) ?? []).includes(value)}\n />\n }\n label={value}\n />\n ))}\n </FormControl>\n );\n};\n\nconst SelectFilter = ({\n className,\n name,\n defaultValue,\n values = [],\n}: Component) => {\n const classes = useStyles();\n const { filters, setFilters } = useSearch();\n\n useEffect(() => {\n if (typeof defaultValue === 'string') {\n setFilters(prevFilters => ({\n ...prevFilters,\n [name]: defaultValue,\n }));\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleChange = (e: ChangeEvent<{ value: unknown }>) => {\n const {\n target: { value },\n } = e;\n\n setFilters(prevFilters => {\n const { [name]: filter, ...others } = prevFilters;\n return value ? { ...others, [name]: value as string } : others;\n });\n };\n\n return (\n <FormControl\n className={className}\n variant=\"filled\"\n fullWidth\n data-testid=\"search-selectfilter-next\"\n >\n <InputLabel className={classes.label} margin=\"dense\">\n {name}\n </InputLabel>\n <Select\n variant=\"outlined\"\n value={filters[name] || ''}\n onChange={handleChange}\n >\n <MenuItem value=\"\">\n <em>All</em>\n </MenuItem>\n {values.map((value: string) => (\n <MenuItem key={value} value={value}>\n {value}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n};\n\nconst SearchFilter = ({ component: Element, ...props }: Props) => (\n <Element {...props} />\n);\n\nSearchFilter.Checkbox = (props: Omit<Props, 'component'> & Component) => (\n <SearchFilter {...props} component={CheckboxFilter} />\n);\n\nSearchFilter.Select = (props: Omit<Props, 'component'> & Component) => (\n <SearchFilter {...props} component={SelectFilter} />\n);\n\n/**\n * @deprecated This component was used for rapid prototyping of the Backstage\n * Search platform. Now that the API has stabilized, you should use the\n * <SearchFilter /> component instead. This component will be removed in an\n * upcoming release.\n */\nconst SearchFilterNext = SearchFilter;\n\nexport { SearchFilter, SearchFilterNext };\n","import * as React from 'react';\nimport createSvgIcon from './utils/createSvgIcon';\nexport default createSvgIcon( /*#__PURE__*/React.createElement(\"path\", {\n 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\"\n}), 'Launch');","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n EmptyState,\n Progress,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport { SearchResult } from '@backstage/search-common';\nimport React from 'react';\nimport { useSearch } from '../SearchContext';\n\ntype Props = {\n children: (results: { results: SearchResult[] }) => JSX.Element;\n};\n\nexport const SearchResultComponent = ({ children }: Props) => {\n const {\n result: { loading, error, value },\n } = useSearch();\n\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return (\n <ResponseErrorPanel\n title=\"Error encountered while fetching search results\"\n error={error}\n />\n );\n }\n\n if (!value?.results.length) {\n return <EmptyState missing=\"data\" title=\"Sorry, no results were found\" />;\n }\n\n return <>{children({ results: value.results })}</>;\n};\n\nexport { SearchResultComponent as SearchResult };\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Button, makeStyles } from '@material-ui/core';\nimport ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';\nimport ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';\nimport React from 'react';\nimport { useSearch } from '../SearchContext';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n display: 'flex',\n justifyContent: 'space-between',\n gap: theme.spacing(2),\n margin: theme.spacing(2, 0),\n },\n}));\n\nexport const SearchResultPager = () => {\n const { fetchNextPage, fetchPreviousPage } = useSearch();\n const classes = useStyles();\n\n if (!fetchNextPage && !fetchPreviousPage) {\n return <></>;\n }\n\n return (\n <nav arial-label=\"pagination navigation\" className={classes.root}>\n <Button\n aria-label=\"previous page\"\n disabled={!fetchPreviousPage}\n onClick={fetchPreviousPage}\n startIcon={<ArrowBackIosIcon />}\n >\n Previous\n </Button>\n\n <Button\n aria-label=\"next page\"\n disabled={!fetchNextPage}\n onClick={fetchNextPage}\n endIcon={<ArrowForwardIosIcon />}\n >\n Next\n </Button>\n </nav>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SearchClient, searchApiRef } from './apis';\nimport {\n createApiFactory,\n createPlugin,\n createRouteRef,\n createRoutableExtension,\n discoveryApiRef,\n createComponentExtension,\n identityApiRef,\n} from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'search',\n});\n\nexport const rootNextRouteRef = createRouteRef({\n id: 'search:next',\n});\n\nexport const searchPlugin = createPlugin({\n id: 'search',\n apis: [\n createApiFactory({\n api: searchApiRef,\n deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },\n factory: ({ discoveryApi, identityApi }) => {\n return new SearchClient({ discoveryApi, identityApi });\n },\n }),\n ],\n routes: {\n root: rootRouteRef,\n nextRoot: rootNextRouteRef,\n },\n});\n\nexport const SearchPage = searchPlugin.provide(\n createRoutableExtension({\n name: 'SearchPage',\n component: () => import('./components/SearchPage').then(m => m.SearchPage),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * @deprecated This component was used for rapid prototyping of the Backstage\n * Search platform. Now that the API has stabilized, you should use the\n * <SearchPage /> component instead. This component will be removed in an\n * upcoming release.\n */\nexport const SearchPageNext = searchPlugin.provide(\n createRoutableExtension({\n name: 'SearchPageNext',\n component: () => import('./components/SearchPage').then(m => m.SearchPage),\n mountPoint: rootNextRouteRef,\n }),\n);\n\nexport const SearchBar = searchPlugin.provide(\n createComponentExtension({\n name: 'SearchBar',\n component: {\n lazy: () => import('./components/SearchBar').then(m => m.SearchBar),\n },\n }),\n);\n\n/**\n * @deprecated This component was used for rapid prototyping of the Backstage\n * Search platform. Now that the API has stabilized, you should use the\n * <SearchBar /> component instead. This component will be removed in an\n * upcoming release.\n */\nexport const SearchBarNext = searchPlugin.provide(\n createComponentExtension({\n name: 'SearchBarNext',\n component: {\n lazy: () => import('./components/SearchBar').then(m => m.SearchBar),\n },\n }),\n);\n\nexport const SearchResult = searchPlugin.provide(\n createComponentExtension({\n name: 'SearchResult',\n component: {\n lazy: () => import('./components/SearchResult').then(m => m.SearchResult),\n },\n }),\n);\n\n/**\n * @deprecated This component was used for rapid prototyping of the Backstage\n * Search platform. Now that the API has stabilized, you should use the\n * <SearchResult /> component instead. This component will be removed in an\n * upcoming release.\n */\nexport const SearchResultNext = searchPlugin.provide(\n createComponentExtension({\n name: 'SearchResultNext',\n component: {\n lazy: () => import('./components/SearchResult').then(m => m.SearchResult),\n },\n }),\n);\n\nexport const SidebarSearchModal = searchPlugin.provide(\n createComponentExtension({\n name: 'SidebarSearchModal',\n component: {\n lazy: () =>\n import('./components/SidebarSearchModal').then(\n m => m.SidebarSearchModal,\n ),\n },\n }),\n);\n\nexport const DefaultResultListItem = searchPlugin.provide(\n createComponentExtension({\n name: 'DefaultResultListItem',\n component: {\n lazy: () =>\n import('./components/DefaultResultListItem').then(\n m => m.DefaultResultListItem,\n ),\n },\n }),\n);\n\nexport const HomePageSearchBar = searchPlugin.provide(\n createComponentExtension({\n name: 'HomePageSearchBar',\n component: {\n lazy: () =>\n import('./components/HomePageComponent').then(m => m.HomePageSearchBar),\n },\n }),\n);\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useEffect, useState } from 'react';\nimport {\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Divider,\n Grid,\n List,\n Paper,\n} from '@material-ui/core';\nimport { Launch } from '@material-ui/icons/';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { SearchBarBase } from '../SearchBar';\nimport { DefaultResultListItem } from '../DefaultResultListItem';\nimport { SearchResult } from '../SearchResult';\nimport { SearchContextProvider, useSearch } from '../SearchContext';\nimport { SearchResultPager } from '../SearchResultPager';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { Link } from '@backstage/core-components';\nimport { rootRouteRef } from '../../plugin';\n\nimport { useDebounce } from 'react-use';\n\nexport interface SearchModalProps {\n open?: boolean;\n toggleModal: () => void;\n}\n\nconst useStyles = makeStyles(theme => ({\n container: {\n borderRadius: 30,\n display: 'flex',\n height: '2.4em',\n },\n input: {\n flex: 1,\n },\n // Reduces default height of the modal, keeping a gap of 128px between the top and bottom of the page.\n paperFullWidth: { height: 'calc(100% - 128px)' },\n dialogActionsContainer: { padding: theme.spacing(1, 3) },\n viewResultsLink: { verticalAlign: '0.5em' },\n}));\n\nexport const Modal = ({ open = true, toggleModal }: SearchModalProps) => {\n const getSearchLink = useRouteRef(rootRouteRef);\n const classes = useStyles();\n\n const { term, setTerm } = useSearch();\n const [value, setValue] = useState<string>(term);\n\n useEffect(() => {\n setValue(prevValue => (prevValue !== term ? term : prevValue));\n }, [term]);\n\n useDebounce(() => setTerm(value), 500, [value]);\n\n const handleQuery = (newValue: string) => {\n setValue(newValue);\n };\n\n const handleClear = () => setValue('');\n\n const handleResultClick = () => {\n toggleModal();\n handleClear();\n };\n\n const handleKeyPress = () => {\n handleResultClick();\n };\n\n return (\n <Dialog\n classes={{\n paperFullWidth: classes.paperFullWidth,\n }}\n onClose={toggleModal}\n aria-labelledby=\"search-modal-title\"\n open={open}\n fullWidth\n maxWidth=\"lg\"\n >\n <DialogTitle>\n <Paper className={classes.container}>\n <SearchBarBase\n className={classes.input}\n value={value}\n onChange={handleQuery}\n onClear={handleClear}\n />\n </Paper>\n </DialogTitle>\n <DialogContent>\n <Grid\n container\n direction=\"row-reverse\"\n justifyContent=\"flex-start\"\n alignItems=\"center\"\n >\n <Grid item>\n <Link\n onClick={toggleModal}\n to={`${getSearchLink()}?query=${value}`}\n >\n <span className={classes.viewResultsLink}>View Full Results</span>\n <Launch color=\"primary\" />\n </Link>\n </Grid>\n </Grid>\n <Divider />\n <SearchResult>\n {({ results }) => (\n <List>\n {results.map(({ document }) => (\n <div\n role=\"button\"\n tabIndex={0}\n key={`${document.location}-btn`}\n onClick={handleResultClick}\n onKeyPress={handleKeyPress}\n >\n <DefaultResultListItem\n key={document.location}\n result={document}\n />\n </div>\n ))}\n </List>\n )}\n </SearchResult>\n </DialogContent>\n <DialogActions className={classes.dialogActionsContainer}>\n <Grid container direction=\"row\">\n <Grid item xs={12}>\n <SearchResultPager />\n </Grid>\n </Grid>\n </DialogActions>\n </Dialog>\n );\n};\n\nexport const SearchModal = ({ open = true, toggleModal }: SearchModalProps) => {\n return (\n <SearchContextProvider>\n <Modal open={open} toggleModal={toggleModal} />\n </SearchContextProvider>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Paper } from '@material-ui/core';\nimport InputBase from '@material-ui/core/InputBase';\nimport IconButton from '@material-ui/core/IconButton';\nimport SearchIcon from '@material-ui/icons/Search';\nimport ClearButton from '@material-ui/icons/Clear';\n\nconst useStyles = makeStyles(() => ({\n root: {\n display: 'flex',\n alignItems: 'center',\n },\n input: {\n flex: 1,\n },\n}));\n\ntype SearchBarProps = {\n searchQuery: string;\n handleSearch: any;\n handleClearSearchBar: any;\n};\n\nexport const SearchBar = ({\n searchQuery,\n handleSearch,\n handleClearSearchBar,\n}: SearchBarProps) => {\n const classes = useStyles();\n\n return (\n <Paper\n component=\"form\"\n onSubmit={e => handleSearch(e)}\n className={classes.root}\n >\n <IconButton disabled type=\"submit\" aria-label=\"search\">\n <SearchIcon />\n </IconButton>\n <InputBase\n className={classes.input}\n placeholder=\"Search in Backstage\"\n value={searchQuery}\n onChange={e => handleSearch(e)}\n inputProps={{ 'aria-label': 'search backstage' }}\n />\n <IconButton aria-label=\"search\" onClick={() => handleClearSearchBar()}>\n <ClearButton />\n </IconButton>\n </Paper>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport FilterListIcon from '@material-ui/icons/FilterList';\nimport { makeStyles, IconButton, Typography } from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n filters: {\n width: '250px',\n display: 'flex',\n },\n icon: {\n margin: theme.spacing(-1, 0, 0, 0),\n },\n}));\n\ntype FiltersButtonProps = {\n numberOfSelectedFilters: number;\n handleToggleFilters: () => void;\n};\n\nexport const FiltersButton = ({\n numberOfSelectedFilters,\n handleToggleFilters,\n}: FiltersButtonProps) => {\n const classes = useStyles();\n\n return (\n <div className={classes.filters}>\n <IconButton\n className={classes.icon}\n aria-label=\"settings\"\n onClick={handleToggleFilters}\n >\n <FilterListIcon />\n </IconButton>\n <Typography variant=\"h6\">\n Filters ({numberOfSelectedFilters ? numberOfSelectedFilters : 0})\n </Typography>\n </div>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport {\n makeStyles,\n Typography,\n Divider,\n Card,\n CardHeader,\n Button,\n CardContent,\n Select,\n Checkbox,\n List,\n ListItem,\n ListItemText,\n MenuItem,\n} from '@material-ui/core';\n\nconst useStyles = makeStyles(theme => ({\n filters: {\n background: 'transparent',\n boxShadow: '0px 0px 0px 0px',\n },\n checkbox: {\n padding: theme.spacing(0, 1, 0, 1),\n },\n dropdown: {\n width: '100%',\n },\n}));\n\nexport type FiltersState = {\n selected: string;\n checked: Array<string>;\n};\n\nexport type FilterOptions = {\n kind: Array<string>;\n lifecycle: Array<string>;\n};\n\ntype FiltersProps = {\n filters: FiltersState;\n filterOptions: FilterOptions;\n resetFilters: () => void;\n updateSelected: (filter: string) => void;\n updateChecked: (filter: string) => void;\n};\n\nexport const Filters = ({\n filters,\n filterOptions,\n resetFilters,\n updateSelected,\n updateChecked,\n}: FiltersProps) => {\n const classes = useStyles();\n\n return (\n <Card className={classes.filters}>\n <CardHeader\n title={<Typography variant=\"h6\">Filters</Typography>}\n action={\n <Button color=\"primary\" onClick={() => resetFilters()}>\n CLEAR ALL\n </Button>\n }\n />\n <Divider />\n {filterOptions.kind.length === 0 && filterOptions.lifecycle.length === 0 && (\n <CardContent>\n <Typography variant=\"subtitle2\">\n Filters cannot be applied to available results\n </Typography>\n </CardContent>\n )}\n {filterOptions.kind.length > 0 && (\n <CardContent>\n <Typography variant=\"subtitle2\">Kind</Typography>\n <Select\n id=\"outlined-select\"\n onChange={(e: React.ChangeEvent<any>) =>\n updateSelected(e?.target?.value)\n }\n variant=\"outlined\"\n className={classes.dropdown}\n value={filters.selected}\n >\n {filterOptions.kind.map(filter => (\n <MenuItem\n selected={filter === ''}\n dense\n key={filter}\n value={filter}\n >\n {filter}\n </MenuItem>\n ))}\n </Select>\n </CardContent>\n )}\n {filterOptions.lifecycle.length > 0 && (\n <CardContent>\n <Typography variant=\"subtitle2\">Lifecycle</Typography>\n <List disablePadding dense>\n {filterOptions.lifecycle.map(filter => (\n <ListItem\n key={filter}\n dense\n button\n onClick={() => updateChecked(filter)}\n >\n <Checkbox\n edge=\"start\"\n disableRipple\n className={classes.checkbox}\n color=\"primary\"\n checked={filters.checked.includes(filter)}\n tabIndex={-1}\n value={filter}\n name={filter}\n />\n <ListItemText id={filter} primary={filter} />\n </ListItem>\n ))}\n </List>\n </CardContent>\n )}\n </Card>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Divider, Grid, makeStyles, Typography } from '@material-ui/core';\nimport { Alert } from '@material-ui/lab';\nimport React, { useEffect, useState } from 'react';\nimport { useAsync } from 'react-use';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\n\nimport { Filters, FiltersButton, FiltersState } from './Filters';\nimport { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';\n\nimport {\n EmptyState,\n Link,\n Progress,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\ntype Result = {\n name: string;\n description: string | undefined;\n owner: string | undefined;\n kind: string;\n lifecycle: string | undefined;\n url: string;\n};\ntype SearchResults = Array<Result>;\n\nconst useStyles = makeStyles(theme => ({\n searchQuery: {\n color: theme.palette.text.primary,\n background: theme.palette.background.default,\n borderRadius: '10%',\n },\n tableHeader: {\n margin: theme.spacing(1, 0, 0, 0),\n display: 'flex',\n },\n divider: {\n width: '1px',\n margin: theme.spacing(0, 2),\n padding: theme.spacing(2, 0),\n },\n}));\n\ntype SearchResultProps = {\n searchQuery?: string;\n};\n\ntype TableHeaderProps = {\n searchQuery?: string;\n numberOfSelectedFilters: number;\n numberOfResults: number;\n handleToggleFilters: () => void;\n};\n\n// TODO: move out column to make the search result component more generic\nconst columns: TableColumn[] = [\n {\n title: 'Name',\n field: 'name',\n highlight: true,\n render: (result: Partial<Result>) => (\n <Link to={result.url || ''}>{result.name}</Link>\n ),\n },\n {\n title: 'Description',\n field: 'description',\n },\n {\n title: 'Owner',\n field: 'owner',\n },\n {\n title: 'Kind',\n field: 'kind',\n },\n {\n title: 'LifeCycle',\n field: 'lifecycle',\n },\n];\n\nconst TableHeader = ({\n searchQuery,\n numberOfSelectedFilters,\n numberOfResults,\n handleToggleFilters,\n}: TableHeaderProps) => {\n const classes = useStyles();\n\n return (\n <div className={classes.tableHeader}>\n <FiltersButton\n numberOfSelectedFilters={numberOfSelectedFilters}\n handleToggleFilters={handleToggleFilters}\n />\n <Divider className={classes.divider} orientation=\"vertical\" />\n <Grid item xs={12}>\n {searchQuery ? (\n <Typography variant=\"h6\">\n {`${numberOfResults} `}\n {numberOfResults > 1 ? `results for ` : `result for `}\n <span className={classes.searchQuery}>\"{searchQuery}\"</span>{' '}\n </Typography>\n ) : (\n <Typography variant=\"h6\">{`${numberOfResults} results`}</Typography>\n )}\n </Grid>\n </div>\n );\n};\n\nexport const SearchResult = ({ searchQuery }: SearchResultProps) => {\n const catalogApi = useApi(catalogApiRef);\n\n const [showFilters, toggleFilters] = useState(false);\n const [selectedFilters, setSelectedFilters] = useState<FiltersState>({\n selected: '',\n checked: [],\n });\n\n const [filteredResults, setFilteredResults] = useState<SearchResults>([]);\n\n const {\n loading,\n error,\n value: results,\n } = useAsync(async () => {\n const entities = await catalogApi.getEntities();\n return entities.items.map((entity: Entity) => ({\n name: entity.metadata.name,\n description: entity.metadata.description,\n owner:\n typeof entity.spec?.owner === 'string' ? entity.spec?.owner : undefined,\n kind: entity.kind,\n lifecycle:\n typeof entity.spec?.lifecycle === 'string'\n ? entity.spec?.lifecycle\n : undefined,\n url: `/catalog/${\n entity.metadata.namespace?.toLocaleLowerCase('en-US') ||\n ENTITY_DEFAULT_NAMESPACE\n }/${entity.kind.toLocaleLowerCase('en-US')}/${entity.metadata.name}`,\n }));\n }, []);\n\n useEffect(() => {\n if (results) {\n let withFilters = results;\n\n // apply filters\n\n // filter on selected\n if (selectedFilters.selected !== '') {\n withFilters = results.filter((result: Result) =>\n selectedFilters.selected.includes(result.kind),\n );\n }\n\n // filter on checked\n if (selectedFilters.checked.length > 0) {\n withFilters = withFilters.filter(\n (result: Result) =>\n result.lifecycle &&\n selectedFilters.checked.includes(result.lifecycle),\n );\n }\n\n // filter on searchQuery\n if (searchQuery) {\n withFilters = withFilters.filter(\n (result: Result) =>\n result.name?.toLocaleLowerCase('en-US').includes(searchQuery) ||\n result.name\n ?.toLocaleLowerCase('en-US')\n .includes(searchQuery.split(' ').join('-')) ||\n result.description\n ?.toLocaleLowerCase('en-US')\n .includes(searchQuery),\n );\n }\n\n setFilteredResults(withFilters);\n }\n }, [selectedFilters, searchQuery, results]);\n if (loading) {\n return <Progress />;\n }\n if (error) {\n return (\n <Alert severity=\"error\">\n Error encountered while fetching search results. {error.toString()}\n </Alert>\n );\n }\n if (!results || results.length === 0) {\n return <EmptyState missing=\"data\" title=\"Sorry, no results were found\" />;\n }\n\n const resetFilters = () => {\n setSelectedFilters({\n selected: '',\n checked: [],\n });\n };\n\n const updateSelected = (filter: string) => {\n setSelectedFilters(prevState => ({\n ...prevState,\n selected: filter,\n }));\n };\n\n const updateChecked = (filter: string) => {\n if (selectedFilters.checked.includes(filter)) {\n setSelectedFilters(prevState => ({\n ...prevState,\n checked: prevState.checked.filter(item => item !== filter),\n }));\n return;\n }\n\n setSelectedFilters(prevState => ({\n ...prevState,\n checked: [...prevState.checked, filter],\n }));\n };\n\n const filterOptions = results.reduce(\n (acc, curr) => {\n if (curr.kind && acc.kind.indexOf(curr.kind) < 0) {\n acc.kind.push(curr.kind);\n }\n if (curr.lifecycle && acc.lifecycle.indexOf(curr.lifecycle) < 0) {\n acc.lifecycle.push(curr.lifecycle);\n }\n return acc;\n },\n {\n kind: [] as Array<string>,\n lifecycle: [] as Array<string>,\n },\n );\n\n return (\n <>\n <Grid container>\n {showFilters && (\n <Grid item xs={3}>\n <Filters\n filters={selectedFilters}\n filterOptions={filterOptions}\n resetFilters={resetFilters}\n updateSelected={updateSelected}\n updateChecked={updateChecked}\n />\n </Grid>\n )}\n <Grid item xs={showFilters ? 9 : 12}>\n <Table\n options={{ paging: true, pageSize: 20, search: false }}\n data={filteredResults}\n columns={columns}\n title={\n <TableHeader\n searchQuery={searchQuery}\n numberOfResults={filteredResults.length}\n numberOfSelectedFilters={\n (selectedFilters.selected !== '' ? 1 : 0) +\n selectedFilters.checked.length\n }\n handleToggleFilters={() => toggleFilters(!showFilters)}\n />\n }\n />\n </Grid>\n </Grid>\n </>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Grid } from '@material-ui/core';\nimport React, { useEffect, useState } from 'react';\nimport { useDebounce } from 'react-use';\nimport { SearchBar } from './LegacySearchBar';\nimport { SearchResult } from './LegacySearchResult';\nimport {\n Content,\n Header,\n Page,\n useQueryParamState,\n} from '@backstage/core-components';\n\n/**\n * @deprecated This SearchPage, powered directly by the Catalog API, will be\n * removed from a future release of this plugin.\n */\nexport const LegacySearchPage = () => {\n const [queryString, setQueryString] = useQueryParamState<string>('query');\n const [searchQuery, setSearchQuery] = useState(queryString ?? '');\n\n const handleSearch = (event: React.ChangeEvent<HTMLInputElement>) => {\n event.preventDefault();\n setSearchQuery(event.target.value);\n };\n\n useEffect(() => setSearchQuery(queryString ?? ''), [queryString]);\n\n useDebounce(\n () => {\n setQueryString(searchQuery);\n },\n 200,\n [searchQuery],\n );\n\n const handleClearSearchBar = () => {\n setSearchQuery('');\n };\n\n return (\n <Page themeId=\"home\">\n <Header title=\"Search\" />\n <Content>\n <Grid container direction=\"row\">\n <Grid item xs={12}>\n <SearchBar\n handleSearch={handleSearch}\n handleClearSearchBar={handleClearSearchBar}\n searchQuery={searchQuery}\n />\n </Grid>\n <Grid item xs={12}>\n <SearchResult\n searchQuery={(queryString ?? '').toLocaleLowerCase('en-US')}\n />\n </Grid>\n </Grid>\n </Content>\n </Page>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useEffect } from 'react';\nimport { usePrevious } from 'react-use';\nimport qs from 'qs';\nimport { useLocation, useOutlet } from 'react-router';\nimport { SearchContextProvider, useSearch } from '../SearchContext';\nimport { JsonObject } from '@backstage/types';\nimport { LegacySearchPage } from '../LegacySearchPage';\n\nexport const UrlUpdater = () => {\n const location = useLocation();\n const {\n term,\n setTerm,\n types,\n setTypes,\n pageCursor,\n setPageCursor,\n filters,\n setFilters,\n } = useSearch();\n\n const prevQueryParams = usePrevious(location.search);\n useEffect(() => {\n // Only respond to changes to url query params\n if (location.search === prevQueryParams) {\n return;\n }\n\n const query =\n qs.parse(location.search.substring(1), { arrayLimit: 0 }) || {};\n\n if (query.filters) {\n setFilters(query.filters as JsonObject);\n }\n\n if (query.query) {\n setTerm(query.query as string);\n }\n\n if (query.pageCursor) {\n setPageCursor(query.pageCursor as string);\n }\n\n if (query.types) {\n setTypes(query.types as string[]);\n }\n }, [prevQueryParams, location, setTerm, setTypes, setPageCursor, setFilters]);\n\n useEffect(() => {\n const newParams = qs.stringify(\n {\n query: term,\n types,\n pageCursor,\n filters,\n },\n { arrayFormat: 'brackets' },\n );\n const newUrl = `${window.location.pathname}?${newParams}`;\n\n // We directly manipulate window history here in order to not re-render\n // infinitely (state => location => state => etc). The intention of this\n // code is just to ensure the right query/filters are loaded when a user\n // clicks the \"back\" button after clicking a result.\n window.history.replaceState(null, document.title, newUrl);\n }, [term, types, pageCursor, filters]);\n\n return null;\n};\n\nexport const SearchPage = () => {\n const outlet = useOutlet();\n\n return (\n <SearchContextProvider>\n <UrlUpdater />\n {outlet || <LegacySearchPage />}\n </SearchContextProvider>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Checkbox,\n Chip,\n FormControl,\n InputLabel,\n ListItemText,\n makeStyles,\n MenuItem,\n Select,\n} from '@material-ui/core';\nimport React, { ChangeEvent } from 'react';\nimport { useEffectOnce } from 'react-use';\nimport { useSearch } from '../SearchContext';\n\nconst useStyles = makeStyles(theme => ({\n label: {\n textTransform: 'capitalize',\n },\n chips: {\n display: 'flex',\n flexWrap: 'wrap',\n marginTop: theme.spacing(1),\n },\n chip: {\n margin: 2,\n },\n}));\n\nexport type SearchTypeProps = {\n className?: string;\n name: string;\n values?: string[];\n defaultValue?: string[] | string | null;\n};\n\nconst SearchType = ({\n values = [],\n className,\n name,\n defaultValue,\n}: SearchTypeProps) => {\n const classes = useStyles();\n const { types, setTypes } = useSearch();\n\n useEffectOnce(() => {\n if (!types.length) {\n if (defaultValue && Array.isArray(defaultValue)) {\n setTypes(defaultValue);\n } else if (defaultValue) {\n setTypes([defaultValue]);\n }\n }\n });\n\n const handleChange = (e: ChangeEvent<{ value: unknown }>) => {\n const value = e.target.value as string[];\n setTypes(value as string[]);\n };\n\n return (\n <FormControl\n className={className}\n variant=\"filled\"\n fullWidth\n data-testid=\"search-typefilter-next\"\n >\n <InputLabel className={classes.label} margin=\"dense\">\n {name}\n </InputLabel>\n <Select\n multiple\n variant=\"outlined\"\n value={types}\n onChange={handleChange}\n placeholder=\"All Results\"\n renderValue={selected => (\n <div className={classes.chips}>\n {(selected as string[]).map(value => (\n <Chip\n key={value}\n label={value}\n className={classes.chip}\n size=\"small\"\n />\n ))}\n </div>\n )}\n >\n {values.map((value: string) => (\n <MenuItem key={value} value={value}>\n <Checkbox checked={types.indexOf(value) > -1} />\n <ListItemText primary={value} />\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n );\n};\n\nexport { SearchType };\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport qs from 'qs';\nimport React, { useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { rootRouteRef } from '../../plugin';\n\nimport { SidebarSearchField } from '@backstage/core-components';\nimport { useRouteRef } from '@backstage/core-plugin-api';\n\nexport const SidebarSearch = () => {\n const searchRoute = useRouteRef(rootRouteRef);\n const navigate = useNavigate();\n const handleSearch = useCallback(\n (query: string): void => {\n const queryString = qs.stringify({ query }, { addQueryPrefix: true });\n\n navigate(`${searchRoute()}${queryString}`);\n },\n [navigate, searchRoute],\n );\n\n return <SidebarSearchField onSearch={handleSearch} to=\"/search\" />;\n};\n"],"names":["DefaultResultListItem","useStyles","FiltersButton","Filters","React","SearchBar","SearchPage","SearchResult","makeStyles","IconButton","InputBase"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAyBa,eAAe,aAAwB;AAAA,EAClD,IAAI;AAAA,EACJ,aAAa;AAAA;mBAOgC;AAAA,EAI7C,YAAY,SAGT;AACD,SAAK,eAAe,QAAQ;AAC5B,SAAK,cAAc,QAAQ;AAAA;AAAA,QAGvB,MAAM,OAA8C;AACxD,UAAM,QAAQ,MAAM,KAAK,YAAY;AACrC,UAAM,cAAc,GAAG,UAAU;AACjC,UAAM,MAAM,GAAG,MAAM,KAAK,aAAa,WACrC,mBACG;AACL,UAAM,WAAW,MAAM,MAAM,KAAK;AAAA,MAChC,SAAS,QAAQ,CAAE,eAAe,UAAU,WAAY;AAAA;AAG1D,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,MAAM,cAAc,aAAa;AAAA;AAGzC,WAAO,SAAS;AAAA;AAAA;;MCnCPA,0BAAwB,CAAC,CAAE,YAAoB;AAC1D,sDACG,MAAD;AAAA,IAAM,IAAI,OAAO;AAAA,kDACd,UAAD;AAAA,IAAU,YAAW;AAAA,kDAClB,cAAD;AAAA,IACE,wBAAwB,CAAE,SAAS;AAAA,IACnC,SAAS,OAAO;AAAA,IAChB,WAAW,OAAO;AAAA,oDAGrB,SAAD;AAAA;;ACfN,MAAMC,cAAY,WAAW;AAAU,EACrC,SAAS;AAAA,IACP,OAAO;AAAA,IACP,SAAS;AAAA;AAAA,EAEX,MAAM;AAAA,IACJ,QAAQ,MAAM,QAAQ,IAAI,GAAG,GAAG;AAAA;AAAA;MASvBC,kBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,MACwB;AACxB,QAAM,UAAUD;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