11<template >
22
3-   <DataTable  :value =" testcases " scrollable  :scrollHeight =" tableHeight" showGridlines  selectionMode =" single" 
3+   <DataTable  :value =" testcasesFiltered " scrollable  :scrollHeight =" tableHeight" showGridlines  selectionMode =" single" 
44    v-model:selection =" selectedTest" v-model:filters =" selected.text" :multiSortMeta =" selected.sorts" 
55    @update:multiSortMeta =" sortsChanged" sortMode =" multiple" removableSort  paginator  :rows =" 10" 
66    :rowsPerPageOptions =" [5, 10, 20, 50, 100, 200, 1000]" 
99    <template  #empty ><b > No testcases found. </b ></template >
1010    <template  #header >
1111      <div  style =" display flex ; justify-content space-between ;" 
12-         <div  style =" display flex ; gap 10px  ;" 
13-           <!--  <MultiSelect v-model="selected.categories" display="chip" :options="categories" filter :maxSelectedLabels="4" --> 
14-           <!--    placeholder="Select Categories" /> --> 
12+         <div  style =" display flex ; align-items center ;" 
13+           <DropDownSimple  tag =" user" :options =" options.val.user" v-model =" selected.user" showClear  />
14+           <DropDownSimple  tag =" repo" :options =" options.val.repo" v-model =" selected.repo" showClear  />
15+           <DropDownSimple  tag =" pkg" :options =" options.val.pkg" v-model =" selected.pkg" showClear  />
16+           <DropDownSimple  tag =" test_pass" :options =" options.val.test_pass" v-model =" selected.test_pass" showClear  />
17+           <DropDownSimple  tag =" miri_pass" :options =" options.val.miri_pass" v-model =" selected.miri_pass" showClear  />
18+           <DropDownSimple  tag =" miri_timeout" :options =" options.val.miri_timeout" v-model =" selected.miri_timeout" 
19+             showClear  />
1520        </div >
1621
1722        <div >
1823          <IconField >
1924            <InputIcon > <i  class =" pi pi-search" InputIcon >
20-             <InputText  style =" width 300 px " v-model =" selected.text['global'].value" placeholder =" Search" 
25+             <InputText  style =" width 200 px " v-model =" selected.text['global'].value" placeholder =" Search" 
2126          </IconField >
2227        </div >
2328
9398import  type  { DataTableSortMeta  } from  ' primevue/datatable' 
9499import  { FilterMatchMode  } from  ' @primevue/core/api' 
95100import  type  { PkgInfo  } from  ' ~/shared/info' 
101+ import  { cloneDeep , uniq  } from  ' es-toolkit/compat' 
102+ 
103+ useHead ({ title: ' Test Cases' 
96104
97105//  styling
98106const =  storeToRefs (useStyleStore ());
@@ -108,6 +116,7 @@ const ptColumnRight = ref({
108116highlightRust ();
109117
110118const =  ref <TestResult []>([]);
119+ const =  ref <TestResult []>([]);
111120const =  ref <TestResult  |  null >(null );
112121
113122//  pop up details
@@ -118,6 +127,7 @@ githubFetch<PkgInfo[]>({
118127  path: " plugin/cargo/info/summaries.json"  
119128}).then (val  =>  { 
120129  testcases .value  =  summariesToTestResult (val ); 
130+   testcasesFiltered .value  =  cloneDeep (testcases .value ); 
121131}); 
122132
123133type  TestResult  =  {
@@ -174,12 +184,94 @@ function sortsChanged(meta?: DataTableSortMeta[] | null) {
174184} 
175185
176186const =  reactive <{
187+   user:  string  |  null , 
188+   repo:  string  |  null , 
189+   pkg:  string  |  null , 
190+   kind:  string  |  null , 
191+   test_pass:  string  |  null , 
192+   miri_pass:  string  |  null , 
193+   miri_timeout:  string  |  null , 
177194  text:  any , 
178195  sorts:  DataTableSortMeta [], 
179196}>({ 
197+   user: null , 
198+   repo: null , 
199+   pkg: null , 
200+   kind: null , 
201+   test_pass: null , 
202+   miri_pass: null , 
203+   miri_timeout: null , 
180204  text: { global: { value: null , matchMode: FilterMatchMode .CONTAINS  }, }, 
181205  sorts: [], 
182206}); 
183207
184- useHead ({ title: ' Test Cases' 
208+ type  Options  =  {
209+   user:  string [], 
210+   repo:  string [], 
211+   pkg:  string [], 
212+   kind:  string [], 
213+   test_pass:  string [], 
214+   miri_pass:  string [], 
215+   miri_timeout:  string [], 
216+ }; 
217+ function  defaultOptions():  Options  {
218+   return  { 
219+     user: [], 
220+     repo: [], 
221+     pkg: [], 
222+     kind: [], 
223+     test_pass: [], 
224+     miri_pass: [], 
225+     miri_timeout: [], 
226+   }; 
227+ } 
228+ const =  reactive <{ val:  Options  }>({ val: defaultOptions () });
229+ 
230+ //  init options
231+ watch (testcases , tc  =>  options .val  =  testcasesToOptions (tc ));
232+ 
233+ //  update table when filter selection changes
234+ watch (
235+   selected , 
236+   ({ user , repo , pkg , kind , test_pass , miri_pass , miri_timeout  }) =>  { 
237+     //  for simplicity, the data of testcases are supposed to remain unchanged 
238+     const =  testcases .value .filter (test  =>  { 
239+       let  chosen =  true ; 
240+       if  (user ) chosen  && =  test .user  ===  user ; 
241+       if  (repo ) chosen  && =  test .repo  ===  repo ; 
242+       if  (pkg ) chosen  && =  test .pkg  ===  pkg ; 
243+       if  (kind ) chosen  && =  test .kind  ===  repo ; 
244+       if  (test_pass ) chosen  && =  test .test_pass  ===  test_pass ; 
245+       if  (miri_pass ) chosen  && =  test .miri_pass  ===  miri_pass ; 
246+       if  (miri_timeout  ||  miri_timeout  ===  " " chosen  && =  test .miri_timeout  ===  miri_timeout ; 
247+       return  chosen ; 
248+     }); 
249+     testcasesFiltered .value  =  chosen_testcases .map ((tc , idx ) =>  { 
250+       tc .idx  =  idx ; 
251+       return  tc ; 
252+     }); 
253+     //  options.val = testcasesToOptions(chosen_testcases); 
254+   }); 
255+ 
256+ function  testcasesToOptions(tc :  TestResult []):  Options  {
257+   let  opts =  defaultOptions (); 
258+   for  (const of  tc ) { 
259+     opts .user .push (test .user ); 
260+     opts .repo .push (test .repo ); 
261+     opts .pkg .push (test .pkg ); 
262+     opts .kind .push (test .kind ); 
263+     opts .test_pass .push (test .test_pass ); 
264+     opts .miri_pass .push (test .miri_pass ); 
265+     opts .miri_timeout .push (test .miri_timeout ); 
266+   } 
267+ 
268+   opts .user  =  uniq (opts .user ).sort (); 
269+   opts .repo  =  uniq (opts .repo ).sort (); 
270+   opts .pkg  =  uniq (opts .pkg ).sort (); 
271+   opts .kind  =  uniq (opts .kind ).sort (); 
272+   opts .test_pass  =  uniq (opts .test_pass ).sort (); 
273+   opts .miri_pass  =  uniq (opts .miri_pass ).sort (); 
274+   opts .miri_timeout  =  uniq (opts .miri_timeout ).sort (); 
275+   return  opts ; 
276+ } 
185277script >
0 commit comments