Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/app/pages/sbom-list/sbom-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface ISbomSearchContext {
| "labels"
| "vulnerabilities",
"name" | "published",
"" | "published" | "labels" | "license",
"name" | "published" | "labels" | "license",
string
>;

Expand Down
2 changes: 1 addition & 1 deletion client/src/app/pages/sbom-list/sbom-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const SbomSearchProvider: React.FunctionComponent<ISbomProvider> = ({
isFilterEnabled: true,
filterCategories: [
{
categoryKey: FILTER_TEXT_CATEGORY_KEY,
categoryKey: "name",
title: "Filter text",
placeholderText: "Search",
type: FilterType.search,
Expand Down
10 changes: 7 additions & 3 deletions client/src/app/pages/search/components/SearchMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ function useAllEntities(filterText: string, disableSearch: boolean) {
page: { pageNumber: 1, itemsPerPage: 5 },
};

const sbomParams: HubRequestParams = {
filters: [{ field: "name", operator: "~", value: filterText }],
page: { pageNumber: 1, itemsPerPage: 5 },
};

const {
isFetching: isFetchingAdvisories,
result: { data: advisories },
Expand All @@ -76,7 +81,7 @@ function useAllEntities(filterText: string, disableSearch: boolean) {
const {
isFetching: isFetchingSBOMs,
result: { data: sboms },
} = useFetchSBOMs(null, { ...params }, [], disableSearch);
} = useFetchSBOMs(null, { ...sbomParams }, [], disableSearch);

const {
isFetching: isFetchingVulnerabilities,
Expand Down Expand Up @@ -170,8 +175,7 @@ export const SearchMenu: React.FC<ISearchMenu> = ({ onChangeSearch }) => {
// (no useMemo in the useUrlParams → useFilterState → context chain), but the
// extracted string only changes when the URL filter param actually changes.
const appliedSearchValue =
sbomTableControls.filterState.filterValues[FILTER_TEXT_CATEGORY_KEY]?.[0] ??
"";
sbomTableControls.filterState.filterValues["name"]?.[0] ?? "";

const [searchValue, setSearchValue] = React.useState("");
const [isSearchValueDirty, setIsSearchValueDirty] = React.useState(false);
Expand Down
4 changes: 2 additions & 2 deletions client/src/app/pages/search/components/SearchTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface SearchTabsProps {
>;
sbomFilterPanelProps: IFilterPanelProps<
SbomSummary,
"" | "published" | "labels" | "license"
"name" | "published" | "labels" | "license"
>;
vulnerabilityFilterPanelProps: IFilterPanelProps<
VulnerabilitySummary,
Expand Down Expand Up @@ -117,7 +117,7 @@ export const SearchTabs: React.FC<SearchTabsProps> = ({
<CardBody style={{ width: 241 }}>
{isTabActive("sboms") ? (
<FilterPanel
omitFilterCategoryKeys={[""]}
omitFilterCategoryKeys={["name"]}
{...sbomFilterPanelProps}
/>
) : isTabActive("packages") ? (
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/pages/search/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const Search: React.FC<SearchPageProps> = ({ searchBodyOverride }) => {
if (searchValue === undefined) return;
sbomTableControls.filterState.setFilterValues({
...sbomTableControls.filterState.filterValues,
[FILTER_TEXT_CATEGORY_KEY]: [searchValue],
["name"]: [searchValue],
});
packageTableControls.filterState.setFilterValues({
...packageTableControls.filterState.filterValues,
Expand Down
Loading