Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit e1e9b32

Browse files
Merge pull request #349 from unitaryfund/348_link_to_child_tasks
#348: Link to child tasks
2 parents 1449e18 + aee5b53 commit e1e9b32

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

src/views/Task.js

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Task extends React.Component {
2222
requestFailedMessage: '',
2323
showEditModal: false,
2424
task: { description: '' },
25-
item: { submissions: [] },
25+
item: { submissions: [], childTasks: [] },
2626
results: [],
2727
chartData: {},
2828
chartKey: '',
@@ -87,6 +87,7 @@ class Task extends React.Component {
8787
axios.get(methodRoute)
8888
.then(res => {
8989
const task = res.data.data
90+
console.log(task)
9091
this.setState({ isRequestFailed: false, requestFailedMessage: '', item: task })
9192

9293
const results = task.results
@@ -224,20 +225,50 @@ class Task extends React.Component {
224225
</div>
225226
</div>
226227
</div>
228+
<div className='row'>
229+
<div className='col-md-12'>
230+
<button className='submission-button btn btn-secondary' onClick={this.handleShowEditModal}><FontAwesomeIcon icon='edit' /></button>
231+
</div>
232+
</div>
233+
<br />
227234
{this.state.item.parentTask &&
228235
<div className='row'>
229236
<div className='col-md-12'>
230237
<div className='submission-description'>
231238
<b>Parent task:</b> <a href={'/Task/' + this.state.item.parentTask.id}>{this.state.item.parentTask.name}</a>
232239
</div>
233240
</div>
241+
<br />
242+
</div>}
243+
{(this.state.item.childTasks && (this.state.item.childTasks.length > 0)) &&
244+
<div>
245+
<h2>Child Tasks</h2>
246+
<div className='row'>
247+
<div className='col-md-12'>
248+
<Table
249+
className='detail-table'
250+
columns={[{
251+
title: 'Name',
252+
dataIndex: 'name',
253+
key: 'name',
254+
width: 700
255+
}]}
256+
data={this.state.item.childTasks
257+
? this.state.item.childTasks.map(row => ({
258+
key: row.id,
259+
name: row.name
260+
}))
261+
: []}
262+
onRow={(record) => ({
263+
onClick () { window.location.href = '/Task/' + record.key }
264+
})}
265+
tableLayout='auto'
266+
rowClassName='link'
267+
/>
268+
</div>
269+
</div>
270+
<br />
234271
</div>}
235-
<div className='row'>
236-
<div className='col-md-12'>
237-
<button className='submission-button btn btn-secondary' onClick={this.handleShowEditModal}><FontAwesomeIcon icon='edit' /></button>
238-
</div>
239-
</div>
240-
<br />
241272
{(this.state.item.submissions.length > 0) &&
242273
<div>
243274
<h2>Submissions</h2>

0 commit comments

Comments
 (0)