@@ -37,6 +37,8 @@ import { Loading } from '../../components/Loading';
3737import { UnitedReportsComponents } from './UnitedReportsComponents' ;
3838import { BlankListComponent } from '../../components/CommonComponents/BlankListcomponent/BlankListComponent' ;
3939import PageHeader from '../../components/PageHeader/index' ;
40+ import Spinner from '../../components/Spinner' ;
41+
4042// Actions
4143import reportsPageAction from '../../actions/ReportsPageAction' ;
4244import { getClientsAction } from '../../actions/ClientsActions' ;
@@ -62,6 +64,7 @@ const localeMap = {
6264class ReportsPage extends Component {
6365 state = {
6466 isInitialFetching : true ,
67+ isFetching : false ,
6568 toggleBar : false ,
6669 toggleChar : false ,
6770 projectsArr : [ ] ,
@@ -168,7 +171,7 @@ class ReportsPage extends Component {
168171 lang,
169172 } = vocabulary ;
170173
171- const { isInitialFetching } = this . state ;
174+ const { isInitialFetching, isFetching } = this . state ;
172175
173176 const customLocale = localeMap [ lang . short ] ;
174177 customLocale . options . weekStartsOn = firstDayOfWeek ;
@@ -222,36 +225,39 @@ class ReportsPage extends Component {
222225 ) }
223226 </ div >
224227 </ PageHeader >
225- { checkIsAdminByRole ( currentTeam . data . role ) && (
226- < ReportsSearchBar
227- applySearch = { e => this . applySearch ( ) }
228- inputProjectData = { this . props . inputProjectData }
229- inputUserData = { this . props . inputUserData }
230- reportsPageAction = { this . props . reportsPageAction }
231- inputClientData = { this . props . clientsList }
232- />
233- ) }
234- { this . props . projectsArr . length > 0 ? (
235- < UnitedReportsComponents
236- toggleBar = { this . state . toggleBar }
237- toggleChar = { this . state . toggleChar }
238- v_total = { v_total }
239- totalUpChartTime = { this . state . totalUpChartTime }
240- getTimeDurationByGivenTimestamp = { getTimeDurationByGivenTimestamp }
241- durationTimeFormat = { durationTimeFormat }
242- export = { this . export . bind ( this ) }
243- v_export = { v_export }
244- data = { this . props . dataBarChat }
245- height = { isMobile ? 150 : 50 }
246- lineChartOption = { this . lineChartOption }
247- selectionRange = { this . props . timeRange }
248- usersArr = { this . props . inputUserData }
249- projectsArr = { this . props . projectsArr }
250- dataDoughnutChat = { this . props . dataDoughnutChat }
251- />
252- ) : (
253- BlankListComponent ( this . props . vocabulary . v_no_report , null , { bottom : '-70px' } )
254- ) }
228+ < div className = { 'content_wrapper' } >
229+ { isFetching && < Spinner withLogo = { false } mode = { 'overlay' } /> }
230+ { checkIsAdminByRole ( currentTeam . data . role ) && (
231+ < ReportsSearchBar
232+ applySearch = { e => this . applySearch ( ) }
233+ inputProjectData = { this . props . inputProjectData }
234+ inputUserData = { this . props . inputUserData }
235+ reportsPageAction = { this . props . reportsPageAction }
236+ inputClientData = { this . props . clientsList }
237+ />
238+ ) }
239+ { this . props . projectsArr . length > 0 ? (
240+ < UnitedReportsComponents
241+ toggleBar = { this . state . toggleBar }
242+ toggleChar = { this . state . toggleChar }
243+ v_total = { v_total }
244+ totalUpChartTime = { this . state . totalUpChartTime }
245+ getTimeDurationByGivenTimestamp = { getTimeDurationByGivenTimestamp }
246+ durationTimeFormat = { durationTimeFormat }
247+ export = { this . export . bind ( this ) }
248+ v_export = { v_export }
249+ data = { this . props . dataBarChat }
250+ height = { isMobile ? 150 : 50 }
251+ lineChartOption = { this . lineChartOption }
252+ selectionRange = { this . props . timeRange }
253+ usersArr = { this . props . inputUserData }
254+ projectsArr = { this . props . projectsArr }
255+ dataDoughnutChat = { this . props . dataDoughnutChat }
256+ />
257+ ) : (
258+ BlankListComponent ( this . props . vocabulary . v_no_report , null , { bottom : '-70px' } )
259+ ) }
260+ </ div >
255261 </ div >
256262 </ div >
257263 </ Loading >
@@ -515,7 +521,7 @@ class ReportsPage extends Component {
515521 }
516522 }
517523 ) ;
518- this . setState ( { isInitialFetching : true } ) ;
524+ this . setState ( { isFetching : true } ) ;
519525 apiCall (
520526 AppConfig . apiURL +
521527 `timer/reports-list?startDate=${ convertDateToISOString (
@@ -546,7 +552,7 @@ class ReportsPage extends Component {
546552 this . setDataToGraph ( this . props . dataBarChat , this . getLablesAndTime ( datePeriod , sumTimeEntriesByDay ) )
547553 ) ;
548554 this . setState ( { toggleBar : true } ) ;
549- this . setState ( { isInitialFetching : false } ) ;
555+ this . setState ( { isFetching : false } ) ;
550556 } ,
551557 err => {
552558 if ( err instanceof Response ) {
0 commit comments