Skip to content

Commit

Permalink
Show filters
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Feb 10, 2023
1 parent b955e23 commit 78bab2c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 18 deletions.
38 changes: 21 additions & 17 deletions searchlib/components/SearchView/FilterAsideContentView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,33 +70,37 @@ export const FilterAsideContentView = (props) => {
const loadingAtom = loadingFamily(appConfig.appName);
const isLoading = useAtomValue(loadingAtom);

const { showFilters, showFacets, showClusters, showSorting } = appConfig;

return (
<>
{appConfig.mode === 'edit' && (
<div>Active filters are always shown in edit mode</div>
)}
{(appConfig.showFilters || appConfig.mode === 'edit') && (
<ActiveFilterList />
)}
{appConfig.showFilters && <SectionTabs />}
{(showFilters || appConfig.mode === 'edit') && <ActiveFilterList />}
{showClusters && <SectionTabs />}
<div className={`results-layout ${layoutMode}`}>
{appConfig.showFilters && (
{(showFacets || showSorting) && (
<div className="above-results">
<div className="above-left">
<DropdownFacetsList />
{showFacets && <DropdownFacetsList />}
</div>
<div className="above-right">
<Component factoryName="SecondaryFacetsList" {...props} />
<Sorting
label={''}
sortOptions={sortOptions}
view={SortingDropdownWithLabel}
/>
{/* <ViewSelectorWithLabel */}
{/* views={availableResultViews} */}
{/* active={activeViewId} */}
{/* onSetView={setActiveViewId} */}
{/* /> */}
{showSorting && (
<>
<Component factoryName="SecondaryFacetsList" {...props} />
<Sorting
label={''}
sortOptions={sortOptions}
view={SortingDropdownWithLabel}
/>
{/* <ViewSelectorWithLabel */}
{/* views={availableResultViews} */}
{/* active={activeViewId} */}
{/* onSetView={setActiveViewId} */}
{/* /> */}
</>
)}
</div>
</div>
)}
Expand Down
5 changes: 5 additions & 0 deletions searchlib/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,12 @@ const config = {
defaultPromptQueries: [], // offered as possible queries, in a prompt below text input. One per line
promptQueryInterval: 20000,
alwaysSearchOnInitialLoad: false, // used in elastic search driver

showFilters: true, // enables the filters interface, to allow falling back to just a simple results list
showClusters: true, // enables the tab clusters
showSorting: true, // show the sorting controls
showFacets: true, // show the facets dropdowns and sidebar facets

getActiveFilters: 'defaultGetActiveFilters',

// highlight: {
Expand Down
22 changes: 21 additions & 1 deletion src/SearchBlock/templates/SearchResultsView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ SearchResultsView.schemaEnhancer = ({ schema, formData }) => {
'defaultResultView',
'alwaysSearchOnInitialLoad',
'showFilters',
'showFacets',
'showSorting',
'availableFacets',
'defaultFacets',
'defaultFilters',
Expand All @@ -95,11 +97,29 @@ SearchResultsView.schemaEnhancer = ({ schema, formData }) => {
configPath: 'alwaysSearchOnInitialLoad',
},
showFilters: {
title: 'Show filters?',
title: 'Show active filters?',
type: 'boolean',
default: true,
configPath: 'showFilters',
},
showFacets: {
title: 'Show facets?',
type: 'boolean',
default: true,
configPath: 'showFacets',
},
showClusters: {
title: 'Show tab clusters?',
type: 'boolean',
default: true,
configPath: 'showClusters',
},
showSorting: {
title: 'Show sorting?',
type: 'boolean',
default: true,
configPath: 'showSorting',
},
defaultFilters: {
title: 'Pre-applied filters',
widget: 'object_list',
Expand Down

0 comments on commit 78bab2c

Please sign in to comment.