@@ -54,7 +54,14 @@ const multipleChoiseKeys: RequestParamsKeys[] = [
5454 'actors' ,
5555] ;
5656
57- const targetTypes = [ 'project' , 'user' , 'fleet' , 'instance' , 'run' , 'job' ] ;
57+ const targetTypes = [
58+ { label : 'Project' , value : 'project' } ,
59+ { label : 'User' , value : 'user' } ,
60+ { label : 'Fleet' , value : 'fleet' } ,
61+ { label : 'Instance' , value : 'instance' } ,
62+ { label : 'Run' , value : 'run' } ,
63+ { label : 'Job' , value : 'job' } ,
64+ ] ;
5865
5966export const useFilters = ( ) => {
6067 const [ searchParams , setSearchParams ] = useSearchParams ( ) ;
@@ -100,7 +107,7 @@ export const useFilters = () => {
100107 targetTypes ?. forEach ( ( targetType ) => {
101108 options . push ( {
102109 propertyKey : filterKeys . INCLUDE_TARGET_TYPES ,
103- value : targetType ,
110+ value : targetType . label ,
104111 } ) ;
105112 } ) ;
106113
@@ -117,53 +124,53 @@ export const useFilters = () => {
117124 {
118125 key : filterKeys . TARGET_PROJECTS ,
119126 operators : [ '=' ] ,
120- propertyLabel : 'Target Projects ' ,
127+ propertyLabel : 'Target projects ' ,
121128 groupValuesLabel : 'Project ids' ,
122129 } ,
123130 {
124131 key : filterKeys . TARGET_USERS ,
125132 operators : [ '=' ] ,
126- propertyLabel : 'Target Users ' ,
133+ propertyLabel : 'Target users ' ,
127134 groupValuesLabel : 'Project ids' ,
128135 } ,
129136 {
130137 key : filterKeys . TARGET_FLEETS ,
131138 operators : [ '=' ] ,
132- propertyLabel : 'Target Fleets ' ,
139+ propertyLabel : 'Target fleets ' ,
133140 } ,
134141 {
135142 key : filterKeys . TARGET_INSTANCES ,
136143 operators : [ '=' ] ,
137- propertyLabel : 'Target Instances ' ,
144+ propertyLabel : 'Target instances ' ,
138145 } ,
139146 {
140147 key : filterKeys . TARGET_RUNS ,
141148 operators : [ '=' ] ,
142- propertyLabel : 'Target Runs ' ,
149+ propertyLabel : 'Target runs ' ,
143150 } ,
144151 {
145152 key : filterKeys . TARGET_JOBS ,
146153 operators : [ '=' ] ,
147- propertyLabel : 'Target Jobs ' ,
154+ propertyLabel : 'Target jobs ' ,
148155 } ,
149156
150157 {
151158 key : filterKeys . WITHIN_PROJECTS ,
152159 operators : [ '=' ] ,
153- propertyLabel : 'Within Projects ' ,
160+ propertyLabel : 'Within projects ' ,
154161 groupValuesLabel : 'Project ids' ,
155162 } ,
156163
157164 {
158165 key : filterKeys . WITHIN_FLEETS ,
159166 operators : [ '=' ] ,
160- propertyLabel : 'Within Fleets ' ,
167+ propertyLabel : 'Within fleets ' ,
161168 } ,
162169
163170 {
164171 key : filterKeys . WITHIN_RUNS ,
165172 operators : [ '=' ] ,
166- propertyLabel : 'Within Runs ' ,
173+ propertyLabel : 'Within runs ' ,
167174 } ,
168175
169176 {
@@ -240,6 +247,14 @@ export const useFilters = () => {
240247 ) ,
241248 }
242249 : { } ) ,
250+
251+ ...( params [ filterKeys . INCLUDE_TARGET_TYPES ] && Array . isArray ( params [ filterKeys . INCLUDE_TARGET_TYPES ] )
252+ ? {
253+ [ filterKeys . INCLUDE_TARGET_TYPES ] : params [ filterKeys . INCLUDE_TARGET_TYPES ] ?. map (
254+ ( selectedLabel : string ) => targetTypes ?. find ( ( { label } ) => label === selectedLabel ) ?. [ 'value' ] ,
255+ ) ,
256+ }
257+ : { } ) ,
243258 } ;
244259
245260 return {
0 commit comments