Skip to content

Commit d7defa3

Browse files
author
Parth Shah
committed
fixes a bug with project dashboard load when directproject is not created, fixes #486
1 parent f0e4f81 commit d7defa3

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

src/components/FileList/FileListItem.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default class FileListItem extends React.Component {
102102
}
103103

104104
renderReadOnly() {
105-
const {title, description, size, isEditable} = this.props
105+
const {title, downloadUrl, description, size, isEditable} = this.props
106106
const { showDeletionDialog } = this.state
107107
return (
108108
<div>
@@ -118,7 +118,7 @@ export default class FileListItem extends React.Component {
118118
</div>
119119
</Modal>
120120
<div className="title">
121-
<h4>{title}</h4>
121+
<h4><a href={downloadUrl} target="_blank" rel="noopener noreferrer">{title}</a></h4>
122122
<div className="size">
123123
{filesize(size)}
124124
</div>
@@ -131,7 +131,7 @@ export default class FileListItem extends React.Component {
131131
</div>
132132
)
133133
}
134-
134+
135135
render() {
136136
const {isEditing} = this.state
137137
let iconPath

src/projects/actions/projectDashboard.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ const getDashboardData = (dispatch, projectId) => {
1818
// this is to remove any nulls from the list (dev had some bad data)
1919
_.remove(userIds, i => !i)
2020
// load additional data in parallel
21+
const promises = [
22+
dispatch(loadMembers(userIds))
23+
]
24+
if (value.directProjectId)
25+
promises.push(dispatch(loadDirectProjectData(value.directProjectId)))
2126
return resolve(dispatch({
2227
type: LOAD_ADDITIONAL_PROJECT_DATA,
23-
payload: Promise.all([
24-
dispatch(loadMembers(userIds)),
25-
dispatch(loadDirectProjectData(value.directProjectId))
26-
])
28+
payload: Promise.all(promises)
2729
}))
2830

2931
})

src/projects/actions/projectMember.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { addProjectMember as addMember,
33
updateProjectMember as updateMember,
44
loadMemberSuggestions as loadMemberSuggestionsAPI
55
} from '../../api/projectMembers'
6+
import { loadMembers } from '../../actions/members'
67

78
import {ADD_PROJECT_MEMBER, REMOVE_PROJECT_MEMBER, UPDATE_PROJECT_MEMBER,
89
LOAD_MEMBER_SUGGESTIONS
@@ -18,12 +19,25 @@ export function loadMemberSuggestions(value) {
1819
}
1920
}
2021

21-
export function addProjectMember(projectId, member) {
22-
return (dispatch) => {
22+
function addProjectMemberWithData(dispatch, projectId, member) {
23+
return new Promise((resolve, reject) => {
2324
return dispatch({
2425
type: ADD_PROJECT_MEMBER,
2526
payload: addMember(projectId, member)
2627
})
28+
.then((/*{value, action}*/) => {
29+
return resolve(dispatch(loadMembers([member.userId])))
30+
})
31+
.catch(err => reject(err))
32+
})
33+
}
34+
35+
export function addProjectMember(projectId, member) {
36+
return (dispatch) => {
37+
return dispatch({
38+
type: 'ADD_PROJECT_MEMBER_INIT',
39+
payload: addProjectMemberWithData(dispatch, projectId, member)
40+
})
2741
}
2842
}
2943

src/projects/detail/components/SpecQuestions.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ const SpecQuestions = ({questions, project, resetFeatures, showFeaturesDialog})
3636
label: q.label,
3737
value: _.get(project, q.fieldName, undefined)
3838
}
39-
if (elemProps.value) {
40-
console.log({name: q.fieldName, value: JSON.stringify(elemProps.value)})
41-
}
4239
let ChildElem = ''
4340
switch (q.type) {
4441
case 'see-attached-textbox':

0 commit comments

Comments
 (0)