@@ -19,6 +19,7 @@ interface IProps {
1919 browserState : [ string , React . Dispatch < React . SetStateAction < string > > ] ;
2020 viewportState : [ string , React . Dispatch < React . SetStateAction < string > > ] ;
2121 testStatusState ?: [ string , React . Dispatch < React . SetStateAction < string > > ] ;
22+ branchNameState ?: [ string , React . Dispatch < React . SetStateAction < string > > ] ;
2223}
2324
2425const Filters : React . FunctionComponent < IProps > = ( {
@@ -29,6 +30,7 @@ const Filters: React.FunctionComponent<IProps> = ({
2930 browserState,
3031 viewportState,
3132 testStatusState,
33+ branchNameState,
3234} ) => {
3335 const [ query , setQuery ] = queryState ;
3436 const [ os , setOs ] = osState ;
@@ -38,6 +40,9 @@ const Filters: React.FunctionComponent<IProps> = ({
3840 const [ testStatus , setTestStatus ] = testStatusState
3941 ? testStatusState
4042 : [ null , ( ) => { } ] ;
43+ const [ branchName , setBranchName ] = branchNameState
44+ ? branchNameState
45+ : [ null , ( ) => { } ] ;
4146
4247 const osList = items
4348 . map ( ( t ) => t . os )
@@ -56,11 +61,18 @@ const Filters: React.FunctionComponent<IProps> = ({
5661 . filter ( ( v , i , array ) => v && array . indexOf ( v ) === i ) ;
5762
5863 const testStatusList =
64+ testStatusState &&
5965 items . some ( ( i ) => ( i as TestRun ) . status ) &&
6066 ( items as TestRun [ ] )
6167 . map ( ( t ) => t . status )
6268 . filter ( ( v , i , array ) => v && array . indexOf ( v ) === i ) ;
6369
70+ const branchNameList =
71+ branchNameState &&
72+ items
73+ . map ( ( t ) => t . branchName )
74+ . filter ( ( v , i , array ) => v && array . indexOf ( v ) === i ) ;
75+
6476 return (
6577 < React . Fragment >
6678 < Grid container spacing = { 2 } alignItems = "flex-end" >
@@ -197,6 +209,32 @@ const Filters: React.FunctionComponent<IProps> = ({
197209 </ FormControl >
198210 </ Grid >
199211 ) }
212+ { branchNameList && branchNameList . length > 0 && (
213+ < Grid item xs >
214+ < FormControl fullWidth >
215+ < InputLabel shrink id = "filter_branchName" >
216+ Branch
217+ </ InputLabel >
218+ < Select
219+ id = "filter_branchName"
220+ value = { branchName }
221+ displayEmpty
222+ onChange = { ( event ) =>
223+ setBranchName ( event . target . value as string )
224+ }
225+ >
226+ < MenuItem value = "" >
227+ < em > All</ em >
228+ </ MenuItem >
229+ { branchNameList . map ( ( item ) => (
230+ < MenuItem key = { item } value = { item } >
231+ { item }
232+ </ MenuItem >
233+ ) ) }
234+ </ Select >
235+ </ FormControl >
236+ </ Grid >
237+ ) }
200238 < Grid item >
201239 < Button
202240 variant = "contained"
0 commit comments