Skip to content

Commit ce6e6de

Browse files
Merge pull request #4570 from appirio-tech/dev
Remove looker reports
2 parents fd19f8d + 7461f82 commit ce6e6de

File tree

13 files changed

+108
-498
lines changed

13 files changed

+108
-498
lines changed

src/api/projectReports.js

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/config/constants.js

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -462,19 +462,6 @@ export const UPDATE_PROJECT_ATTACHMENT_FAILURE = 'UPDATE_PROJECT_ATTACHMENT_FAIL
462462
export const REMOVE_PENDING_ATTACHMENT = 'REMOVE_PENDING_ATTACHMENT'
463463
export const UPDATE_PENDING_ATTACHMENT = 'UPDATE_PENDING_ATTACHMENT'
464464

465-
// Project summary
466-
export const LOAD_PROJECT_SUMMARY = 'LOAD_PROJECT_SUMMARY'
467-
export const LOAD_PROJECT_SUMMARY_PENDING = 'LOAD_PROJECT_SUMMARY_PENDING'
468-
export const LOAD_PROJECT_SUMMARY_SUCCESS = 'LOAD_PROJECT_SUMMARY_SUCCESS'
469-
export const LOAD_PROJECT_SUMMARY_FAILURE = 'LOAD_PROJECT_SUMMARY_FAILURE'
470-
export const SET_LOOKER_SESSION_EXPIRED = 'SET_LOOKER_SESSION_EXPIRED'
471-
472-
// User Reports
473-
export const LOAD_USER_REPORTS = 'LOAD_USER_REPORTS'
474-
export const LOAD_USER_REPORTS_PENDING = 'LOAD_USER_REPORTS_PENDING'
475-
export const LOAD_USER_REPORTS_SUCCESS = 'LOAD_USER_REPORTS_SUCCESS'
476-
export const LOAD_USER_REPORTS_FAILURE = 'LOAD_USER_REPORTS_FAILURE'
477-
478465
// Product attachments
479466
export const ADD_PRODUCT_ATTACHMENT = 'ADD_PRODUCT_ATTACHMENT'
480467
export const ADD_PRODUCT_ATTACHMENT_PENDING = 'ADD_PRODUCT_ATTACHMENT_PENDING'
@@ -1055,21 +1042,6 @@ export const PROJECT_ASSETS_SHARED_WITH_TOPCODER_MEMBERS = 'Only Topcoder Member
10551042
export const PROJECT_ASSETS_SHARED_WITH_ADMIN = 'Only Admins'
10561043

10571044

1058-
1059-
/**
1060-
* REPORTS
1061-
*/
1062-
export const PROJECT_REPORTS = {
1063-
PROJECT_SUMMARY : 'summary',
1064-
TAAS_MEMBERS : 'taas_members',
1065-
}
1066-
1067-
/**
1068-
* Report session length in seconds
1069-
*/
1070-
export const REPORT_SESSION_LENGTH = 25 * 60 // 25 minutes (5 minutes less than the report session)
1071-
1072-
10731045
/**
10741046
* Contentful Content Ids
10751047
*/

src/projects/actions/projectReports.js

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 22 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,25 @@
1-
import _ from 'lodash'
21
import React from 'react'
32
import PT from 'prop-types'
43
import { connect } from 'react-redux'
54
import { withRouter } from 'react-router-dom'
65
import MediaQuery from 'react-responsive'
7-
import Modal from 'react-modal'
86

97
import {
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'
1612
import TwoColsLayout from '../../../components/TwoColsLayout'
1713
import Sticky from '../../../components/Sticky'
1814
import ProjectInfoContainer from './ProjectInfoContainer'
1915
import { PERMISSIONS } from '../../../config/permissions'
2016
import { hasPermission } from '../../../helpers/permissions'
21-
import { loadProjectReportsUrls, setLookerSessionExpired } from '../../actions/projectReports'
22-
import spinnerWhileLoading from '../../../components/LoadingSpinner'
2317

2418
import './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-
3420
class 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))
Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1-
iframe {
2-
height: calc(100vh - 60px);
3-
}
1+
@import '~tc-ui/src/styles/tc-includes';
2+
@import '../../../styles/includes';
3+
4+
.container {
5+
@include stand-alone-item-shadow;
6+
background-color: $tc-white;
7+
border-radius: $card-border-radius;
8+
margin-top: 4 * $base-unit;
9+
padding: 4 * $base-unit;
10+
margin: 0 auto;
11+
max-width: 760px;
12+
13+
@media screen and (min-width: $screen-md) {
14+
margin-top: 30px;
15+
}
16+
17+
@media screen and (max-width: $screen-md - 1px) {
18+
border-radius: 0;
19+
}
20+
21+
p {
22+
@include roboto;
23+
font-size: 15px;
24+
line-height: 25px;
25+
26+
a {
27+
color: $tc-dark-blue;
28+
29+
&:hover {
30+
text-decoration: underline;
31+
}
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)