Skip to content

Commit 87a85cd

Browse files
authored
Merge pull request #249 from wbbly/dev
FIX | reports page. fixed bug for selecting a range in the calendar
2 parents 6a5cd96 + a7c7078 commit 87a85cd

2 files changed

Lines changed: 46 additions & 33 deletions

File tree

project/application/src/pages/ReportsPage/index.js

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ import { Loading } from '../../components/Loading';
3737
import { UnitedReportsComponents } from './UnitedReportsComponents';
3838
import { BlankListComponent } from '../../components/CommonComponents/BlankListcomponent/BlankListComponent';
3939
import PageHeader from '../../components/PageHeader/index';
40+
import Spinner from '../../components/Spinner';
41+
4042
// Actions
4143
import reportsPageAction from '../../actions/ReportsPageAction';
4244
import { getClientsAction } from '../../actions/ClientsActions';
@@ -62,6 +64,7 @@ const localeMap = {
6264
class 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) {

project/application/src/pages/ReportsPage/style.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
overflow-y: auto;
66

77
.data_container_reports_page {
8+
display: flex;
9+
flex-direction: column;
810
height: 100%;
911
width: 100%;
1012
background-color: #333333;
@@ -25,6 +27,11 @@
2527
font-weight: bold;
2628
}
2729

30+
.content_wrapper {
31+
position: relative;
32+
flex-grow: 1;
33+
}
34+
2835
.line_chart_container {
2936
position: relative;
3037
top: 110px;

0 commit comments

Comments
 (0)