Repository: aurora Updated Branches: refs/heads/master 6182bbfd2 -> 53fda6092
Don't show host data when task is Throttled. PENDING and THROTTLED tasks are considered active and they dont have hosts. This manifests in having "null" host links. Reviewed at https://reviews.apache.org/r/63648/ Project: http://git-wip-us.apache.org/repos/asf/aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/53fda609 Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/53fda609 Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/53fda609 Branch: refs/heads/master Commit: 53fda609227f6cff084b7db1842f0813a7ac395f Parents: 6182bbf Author: David McLaughlin <[email protected]> Authored: Tue Nov 7 16:13:02 2017 -0800 Committer: David McLaughlin <[email protected]> Committed: Tue Nov 7 16:13:02 2017 -0800 ---------------------------------------------------------------------- ui/src/main/js/components/TaskDetails.js | 4 ++-- .../js/components/__tests__/TaskDetails-test.js | 24 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aurora/blob/53fda609/ui/src/main/js/components/TaskDetails.js ---------------------------------------------------------------------- diff --git a/ui/src/main/js/components/TaskDetails.js b/ui/src/main/js/components/TaskDetails.js index e3a6c9c..6e56995 100644 --- a/ui/src/main/js/components/TaskDetails.js +++ b/ui/src/main/js/components/TaskDetails.js @@ -7,12 +7,12 @@ export default function TaskDetails({ task }) { <span className='debug-data'>{task.assignedTask.taskId}</span> <a href={`/structdump/task/${task.assignedTask.taskId}`}>view raw config</a> </div> - <div> + {task.assignedTask.slaveHost ? <div className='active-task-details-host'> <h5>Host</h5> <span className='debug-data'>{task.assignedTask.slaveHost}</span> <a href={`http://${task.assignedTask.slaveHost}:1338/task/${task.assignedTask.taskId}`}> view sandbox </a> - </div> + </div> : null} </div>); } http://git-wip-us.apache.org/repos/asf/aurora/blob/53fda609/ui/src/main/js/components/__tests__/TaskDetails-test.js ---------------------------------------------------------------------- diff --git a/ui/src/main/js/components/__tests__/TaskDetails-test.js b/ui/src/main/js/components/__tests__/TaskDetails-test.js new file mode 100644 index 0000000..d1ff0b5 --- /dev/null +++ b/ui/src/main/js/components/__tests__/TaskDetails-test.js @@ -0,0 +1,24 @@ +import React from 'react'; +import { shallow } from 'enzyme'; + +import TaskDetails from '../TaskDetails'; + +import { AssignedTaskBuilder, ScheduledTaskBuilder } from 'test-utils/TaskBuilders'; + +describe('TaskDetails', () => { + it('Does not show host when slaveHost is null', () => { + const task = ScheduledTaskBuilder.assignedTask( + AssignedTaskBuilder.slaveHost(null).build()).build(); + const el = shallow(<TaskDetails task={task} />); + + expect(el.find('div.active-task-details-host').length).toBe(0); + }); + + it('Shows host link when slaveHost is present', () => { + const task = ScheduledTaskBuilder.assignedTask( + AssignedTaskBuilder.slaveHost('test').build()).build(); + const el = shallow(<TaskDetails task={task} />); + + expect(el.find('div.active-task-details-host').length).toBe(1); + }); +});
