Skip to content

Commit

Permalink
Show suspended plugins in search
Browse files Browse the repository at this point in the history
  • Loading branch information
zbynek committed Sep 18, 2021
1 parent 41d9381 commit f6ca983
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/templates/search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import forceArray from '../utils/forceArray';
import useFilterHooks from '../components/FiltersHooks';
import SEO from '../components/SEO';
import Footer from '../components/Footer';
import SuspendedPlugins from '../components/SuspendedPlugins';
import Views from '../components/Views';
import SearchResults from '../components/SearchResults';
import SearchBox from '../components/SearchBox';
Expand Down Expand Up @@ -94,7 +95,7 @@ const doSearch = (data, setResults, categoriesMap) => {
function SearchPage({location}) {
const [showFilter, setShowFilter] = React.useState(true);
const [results, setResults] = React.useState(null);
const categoriesMap = groupBy(useStaticQuery(graphql`
const graphqlData = useStaticQuery(graphql`
query {
categories: allJenkinsPluginCategory {
edges {
Expand All @@ -105,8 +106,18 @@ function SearchPage({location}) {
}
}
}
suspendedPlugins: allSuspendedPlugin {
edges {
node {
id
url
}
}
`).categories.edges.map(edge => edge.node), 'id');
}
}
`);
const categoriesMap = groupBy(graphqlData.categories.edges.map(edge => edge.node), 'id');
const suspendedPlugins = graphqlData.suspendedPlugins.edges.map(edge => edge.node.id);
const {
sort, setSort,
clearCriteria,
Expand Down Expand Up @@ -159,7 +170,7 @@ function SearchPage({location}) {
<SearchBox
showFilter={showFilter}
setShowFilter={setShowFilter}
query={query}
query={query || ''}
setQuery={setQuerySilent}
handleOnSubmit={handleOnSubmit}
/>
Expand Down Expand Up @@ -196,6 +207,7 @@ function SearchPage({location}) {
setPage={setPage}
results={results}
/>
<SuspendedPlugins pluginIds={suspendedPlugins.filter(e => query && e.includes(query))}/>
</div>
</div>
</div>
Expand Down

0 comments on commit f6ca983

Please sign in to comment.