Skip to content

Commit

Permalink
🐛 Allow filtering issues & dependencies by archetype
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 committed Nov 15, 2023
1 parent 44e6eeb commit 52ac2a9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions client/src/app/pages/issues/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { IssueFilterGroups } from "./issues";
import { useFetchBusinessServices } from "@app/queries/businessservices";
import { useFetchTagsWithTagItems } from "@app/queries/tags";
import { useTranslation } from "react-i18next";
import { useFetchArchetypes } from "@app/queries/archetypes";

// Certain filters are shared between the Issues page and the Affected Applications Page.
// We carry these filter values between the two pages when determining the URLs to navigate between them.
Expand All @@ -38,6 +39,7 @@ export const useSharedAffectedApplicationFilterCategories = <
const { t } = useTranslation();
const { businessServices } = useFetchBusinessServices();
const { tagCategories, tags, tagItems } = useFetchTagsWithTagItems();
const { archetypes } = useFetchArchetypes();

return [
{
Expand All @@ -51,6 +53,26 @@ export const useSharedAffectedApplicationFilterCategories = <
}) + "...",
getServerFilterValue: (value) => (value ? [`*${value[0]}*`] : []),
},
{
key: "application.id",
title: t("terms.archetypes"),
filterGroup: IssueFilterGroups.ApplicationInventory,
type: FilterType.multiselect,
placeholderText:
t("actions.filterBy", {
what: t("terms.archetype").toLowerCase(),
}) + "...",
selectOptions: archetypes.map(({ name }) => ({ key: name, value: name })),
getServerFilterValue: (selectedOptions) =>
selectedOptions
?.map((option) => archetypes.find((item) => item.name === option))
.filter(Boolean)
.flatMap(
({ applications }) =>
applications?.map(({ id }) => String(id)) ?? []
)
.filter(Boolean),
},
{
key: "businessService.name",
title: t("terms.businessService"),
Expand Down

0 comments on commit 52ac2a9

Please sign in to comment.