diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Search/find.object.result.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Search/find.object.result.js index d341e5e30893b8fee51cdd2e253028804c5949a8..9e53ed4164285bdfa7125c78e8f5bcaa05a3cd56 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Search/find.object.result.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Search/find.object.result.js @@ -82,7 +82,12 @@ export class FindObjectResult extends Component{ <span className="find-obj-tree-view"> <a href={subtaskDetails.url} target='_blank' title=" View SubTask API"><i className="fa fa-link" /></a></span></>; subtask['icon'] = 'fas fa-tasks'; - subtask['children'] = await this.findTask('blueprint', subtaskDetails.task_blueprint_id); + let tasks = []; + for (const taskId of subtaskDetails.task_blueprints_ids) { + let taskMap = await this.findTask('blueprint', taskId); + tasks.push(taskMap[0]); + } + subtask['children'] = tasks; return [subtask]; } return ''; @@ -188,12 +193,14 @@ export class FindObjectResult extends Component{ } - expandNode(node, expandedKeys) { + expandNode(node, expandedKeys, expand) { if (node.children && node.children.length) { - expandedKeys[node.key] = true; - + expandedKeys[node.key] = expand; + if(node.key.startsWith('subtask') && node.children.length > 1) { + expand = false; + } for (let child of node.children) { - this.expandNode(child, expandedKeys); + this.expandNode(child, expandedKeys, expand); } } } @@ -201,7 +208,7 @@ export class FindObjectResult extends Component{ expandAll() { let expandedKeys = {}; for (let node of this.state.objNodes) { - this.expandNode(node, expandedKeys); + this.expandNode(node, expandedKeys, true); } this.setState({expandedKeys: expandedKeys }); }