1- import _ from 'lodash'
21import React from 'react'
32import PT from 'prop-types'
43import { connect } from 'react-redux'
54import { withRouter } from 'react-router-dom'
65import MediaQuery from 'react-responsive'
7- import Modal from 'react-modal'
86
97import {
108 SCREEN_BREAKPOINT_MD ,
119 PROJECT_FEED_TYPE_PRIMARY ,
1210 PROJECT_FEED_TYPE_MESSAGES ,
13- PROJECT_REPORTS ,
14- REPORT_SESSION_LENGTH ,
1511} from '../../../config/constants'
1612import TwoColsLayout from '../../../components/TwoColsLayout'
1713import Sticky from '../../../components/Sticky'
1814import ProjectInfoContainer from './ProjectInfoContainer'
1915import { PERMISSIONS } from '../../../config/permissions'
2016import { hasPermission } from '../../../helpers/permissions'
21- import { loadProjectReportsUrls , setLookerSessionExpired } from '../../actions/projectReports'
22- import spinnerWhileLoading from '../../../components/LoadingSpinner'
2317
2418import './ProjectSummaryReportContainer.scss'
2519
26- const LookerEmbedReport = ( props ) => {
27- return ( < iframe width = "100%" src = { props . projectSummaryEmbedUrl } onLoad = { props . onLoad } /> )
28- }
29-
30- const EnhancedLookerEmbedReport = spinnerWhileLoading ( props => {
31- return ! props . isLoading
32- } ) ( LookerEmbedReport )
33-
3420class ProjectSummaryReportContainer extends React . Component {
35-
3621 constructor ( props ) {
3722 super ( props )
38-
39- this . timer = null
40- this . setLookerSessionTimer = this . setLookerSessionTimer . bind ( this )
41- this . reloadProjectReport = this . reloadProjectReport . bind ( this )
42- }
43-
44- reloadProjectReport ( ) {
45- this . props . loadProjectReportsUrls ( _ . get ( this . props , 'project.id' ) , PROJECT_REPORTS . PROJECT_SUMMARY )
46- // don't have to set session expire timer here, it would be set of iframe load
47- }
48-
49- componentWillMount ( ) {
50- this . reloadProjectReport ( )
51- // don't have to set session expire timer here, it would be set of iframe load
52- }
53-
54- componentWillUnmount ( ) {
55- if ( this . timer ) {
56- clearTimeout ( this . timer )
57- }
58- }
59-
60- componentWillUpdate ( nextProps ) {
61- const nextReportProjectId = _ . get ( nextProps , 'reportsProjectId' )
62- const nextProjectId = _ . get ( nextProps , 'project.id' )
63-
64- if ( nextProjectId && nextReportProjectId !== nextProjectId ) {
65- this . props . loadProjectReportsUrls ( nextProjectId , PROJECT_REPORTS . PROJECT_SUMMARY )
66- // don't have to set session expire timer here, it would be set of iframe load
67- }
68- }
69-
70- setLookerSessionTimer ( ) {
71- console . log ( 'Setting Looker Session Timer' )
72-
73- if ( this . timer ) {
74- clearTimeout ( this . timer )
75- }
76-
77- // set timeout for raising alert to refresh the token when session expires
78- this . timer = setTimeout ( ( ) => {
79- console . log ( 'Looker Session is expired by timer' )
80- this . props . setLookerSessionExpired ( true )
81- window . analytics && window . analytics . track ( 'Looker Session Expired' )
82- } , REPORT_SESSION_LENGTH * 1000 )
8323 }
8424
8525 render ( ) {
@@ -92,8 +32,6 @@ class ProjectSummaryReportContainer extends React.Component {
9232 phasesTopics,
9333 isLoading,
9434 location,
95- projectSummaryEmbedUrl,
96- lookerSessionExpired,
9735 } = this . props
9836
9937 const leftArea = (
@@ -116,37 +54,25 @@ class ProjectSummaryReportContainer extends React.Component {
11654 < MediaQuery minWidth = { SCREEN_BREAKPOINT_MD } >
11755 { ( matches ) => {
11856 if ( matches ) {
119- return < Sticky top = { 60 } bottomBoundary = "#wrapper-main" > { leftArea } </ Sticky >
57+ return (
58+ < Sticky top = { 60 } bottomBoundary = "#wrapper-main" >
59+ { leftArea }
60+ </ Sticky >
61+ )
12062 } else {
12163 return leftArea
12264 }
12365 } }
12466 </ MediaQuery >
12567 </ TwoColsLayout . Sidebar >
12668 < TwoColsLayout . Content >
127- < Modal
128- isOpen = { lookerSessionExpired && ! isLoading }
129- className = "delete-post-dialog"
130- overlayClassName = "delete-post-dialog-overlay"
131- contentLabel = ""
132- >
133- < div className = "modal-title" >
134- Report sessions expired
135- </ div >
136-
137- < div className = "modal-body" >
138- To keep the data up to date, please, hit "Refresh" button to reload the report.
139- </ div >
140-
141- < div className = "button-area flex center action-area" >
142- < button className = "tc-btn tc-btn-primary tc-btn-sm" onClick = { this . reloadProjectReport } > Refresh</ button >
143- </ div >
144- </ Modal >
145- < EnhancedLookerEmbedReport
146- isLoading = { isLoading }
147- projectSummaryEmbedUrl = { projectSummaryEmbedUrl }
148- onLoad = { this . setLookerSessionTimer }
149- />
69+ < div styleName = "container" >
70+ < p >
71+ This content has been moved. Please contact{ ' ' }
72+ < a href = "mailto:support@topcoder.com" > support@topcoder.com</ a > to
73+ receive an emailed copy of your report.
74+ </ p >
75+ </ div >
15076 </ TwoColsLayout . Content >
15177 </ TwoColsLayout >
15278 )
@@ -158,30 +84,28 @@ ProjectSummaryReportContainer.propTypes = {
15884 project : PT . object . isRequired ,
15985 phases : PT . array . isRequired ,
16086 productsTimelines : PT . object . isRequired ,
161- reportsProjectId : PT . number ,
16287}
16388
164- const mapStateToProps = ( { projectState, projectTopics, phasesTopics, projectReports } ) => {
89+ const mapStateToProps = ( { projectState, projectTopics, phasesTopics } ) => {
16590 // all feeds includes primary as well as private topics if user has access to private topics
16691 let allFeed = projectTopics . feeds [ PROJECT_FEED_TYPE_PRIMARY ] . topics
16792 if ( hasPermission ( PERMISSIONS . ACCESS_PRIVATE_POST ) ) {
168- allFeed = [ ...allFeed , ...projectTopics . feeds [ PROJECT_FEED_TYPE_MESSAGES ] . topics ]
93+ allFeed = [
94+ ...allFeed ,
95+ ...projectTopics . feeds [ PROJECT_FEED_TYPE_MESSAGES ] . topics ,
96+ ]
16997 }
17098
17199 return {
172100 phases : projectState . phases ,
173101 feeds : allFeed ,
174102 phasesTopics,
175- isLoading : projectReports . isLoading ,
176- reportsProjectId : projectReports . projectId ,
177- lookerSessionExpired : projectReports . lookerSessionExpired ,
178- projectSummaryEmbedUrl : projectReports . projectSummaryEmbedUrl ,
179103 }
180104}
181105
182- const mapDispatchToProps = {
183- loadProjectReportsUrls,
184- setLookerSessionExpired,
185- }
106+ const mapDispatchToProps = { }
186107
187- export default connect ( mapStateToProps , mapDispatchToProps ) ( withRouter ( ProjectSummaryReportContainer ) )
108+ export default connect (
109+ mapStateToProps ,
110+ mapDispatchToProps
111+ ) ( withRouter ( ProjectSummaryReportContainer ) )
0 commit comments