@@ -22,6 +22,9 @@ import { useFetchBusinessServices } from "@app/queries/businessservices";
22
22
import { useFetchTagsWithTagItems } from "@app/queries/tags" ;
23
23
import { useTranslation } from "react-i18next" ;
24
24
import { useFetchArchetypes } from "@app/queries/archetypes" ;
25
+ import { useFetchApplications } from "@app/queries/applications" ;
26
+ import { localeNumericCompare } from "@app/utils/utils" ;
27
+ import i18n from "@app/i18n" ;
25
28
26
29
// Certain filters are shared between the Issues page and the Affected Applications Page.
27
30
// We carry these filter values between the two pages when determining the URLs to navigate between them.
@@ -41,18 +44,27 @@ export const useSharedAffectedApplicationFilterCategories = <
41
44
const { businessServices } = useFetchBusinessServices ( ) ;
42
45
const { tagCategories, tags, tagItems } = useFetchTagsWithTagItems ( ) ;
43
46
const { archetypes } = useFetchArchetypes ( ) ;
47
+ const { data : applications } = useFetchApplications ( ) ;
44
48
45
49
return [
46
50
{
47
51
key : "application.name" ,
48
52
title : t ( "terms.applicationName" ) ,
49
53
filterGroup : IssueFilterGroups . ApplicationInventory ,
50
- type : FilterType . search ,
54
+ type : FilterType . multiselect ,
51
55
placeholderText :
52
56
t ( "actions.filterBy" , {
53
57
what : t ( "terms.applicationName" ) . toLowerCase ( ) ,
54
58
} ) + "..." ,
55
- getServerFilterValue : ( value ) => ( value ? [ `*${ value [ 0 ] } *` ] : [ ] ) ,
59
+ selectOptions : applications
60
+ . map ( ( { name } ) => name )
61
+ . sort ( ( a , b ) => localeNumericCompare ( a , b , i18n . language ) )
62
+ . map ( ( name ) => ( {
63
+ key : name ,
64
+ value : name ,
65
+ } ) ) ,
66
+ getServerFilterValue : ( selectedOptions ) =>
67
+ selectedOptions ?. filter ( Boolean ) ?? [ ] ,
56
68
} ,
57
69
{
58
70
key : "application.id" ,
0 commit comments