@@ -35,34 +35,37 @@ const modes = {
3535 waiting : 1 ,
3636} ;
3737
38- export default function noDataView (
39- model , dataPointer ,
40- ) {
38+ export default function noDataView ( model , dataPointer , anyFiltersActive ) {
4139 const [ mode , setMode ] = useState ( modes . waiting ) ;
40+
4241 const goBackBtn = h ( 'button.btn.btn-primary.m3' , {
4342 onclick : ( ) => model . removeCurrentData ( ) ,
4443 } , 'Go back' ) ;
44+
4545 const reloadBtn = h ( 'button.btn.btn-primary.m3' , {
4646 onclick : async ( ) => {
4747 if ( mode ( ) === modes . waiting ) {
4848 await model . sync ( ) ;
49-
50- /*
51- * Await model.fetchedData.reqForData(true);
52- * model.notify();
53- * document.location.reload(true);
54- */
5549 } else {
5650 model . fetchedData . reqForData ( true ) ;
5751 }
5852 setMode ( modes . requested ) ;
5953 } ,
6054 } , 'Reload' ) ;
61- const noDataMessage = h ( 'h3' , 'No data found' ) ;
55+
56+ const clearFiltersBtn = h ( 'button.btn.btn-secondary.m3' , {
57+ onclick : ( ) => {
58+ model . goToDefaultPageUrl ( dataPointer . page ) ;
59+ } ,
60+ } , 'Clear filters' ) ;
61+
62+ const noDataMessage = h ( 'h3' , 'Nothing found' ) ;
6263 const noDataExplanation = h ( 'h5' , `${
63- dataPointer . page === pageNames . periods
64- ? 'Please synchronize with outer services'
65- : 'There is no data to be displayed here'
64+ anyFiltersActive
65+ ? 'There is no data that matches your request'
66+ : dataPointer . page === pageNames . periods
67+ ? 'Please synchronize with outer services'
68+ : 'There is no data to be displayed here'
6669 } `) ;
6770
6871 const noPeriodsView = h ( '.loginDiv.top-100' , [
@@ -79,9 +82,20 @@ export default function noDataView(
7982 goBackBtn ,
8083 ] ) ;
8184
82- return dataPointer . page === pageNames . periods
83- ? mode ( ) === modes . requested
84- ? 'loading'
85- : noPeriodsView
86- : noDataView ;
85+ const noMatchingDataView = h ( '.loginDiv.top-100' , [
86+ h ( '.nothing-found-90' ) ,
87+ noDataMessage ,
88+ noDataExplanation ,
89+ h ( '.flex-row' ,
90+ clearFiltersBtn ,
91+ goBackBtn ) ,
92+ ] ) ;
93+
94+ return anyFiltersActive
95+ ? noMatchingDataView
96+ : dataPointer . page === pageNames . periods
97+ ? mode ( ) === modes . requested
98+ ? 'loading'
99+ : noPeriodsView
100+ : noDataView ;
87101}
0 commit comments