Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SingularityUI/app/actions/ui/taskDetail.es6
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ export const refresh = (taskId, splat) => (dispatch, getState) => {
};

export const onLoad = (taskId) => (dispatch) => {
return dispatch(FetchTaskS3Logs.trigger(taskId, [404]));
return dispatch(FetchTaskS3Logs.trigger(taskId, [404, 500]));
};
9 changes: 7 additions & 2 deletions SingularityUI/app/components/common/Section.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import React, { PropTypes } from 'react';

const Section = ({id, title, children}) => (
const Section = ({id, title, subtitle, children}) => (
<div id={id}>
<div className="page-header">
<h2>{title}</h2>
<h2>
{title}
<small>{subtitle}</small>
</h2>

</div>
{children}
</div>
Expand All @@ -16,6 +20,7 @@ Section.propTypes = {
PropTypes.arrayOf(PropTypes.node),
PropTypes.string
]).isRequired,
subtitle: PropTypes.string,
children: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node)
Expand Down
8 changes: 4 additions & 4 deletions SingularityUI/app/components/taskDetail/TaskDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class TaskDetail extends Component {
}).isRequired
})).isRequired,
router: PropTypes.object.isRequired,
s3Logs: PropTypes.array,
s3Logs: PropTypes.object,
deploy: PropTypes.object,
pendingDeploys: PropTypes.array,
shellCommandResponse: PropTypes.object,
Expand Down Expand Up @@ -457,7 +457,7 @@ class TaskDetail extends Component {
<TaskHistory taskUpdates={this.props.task.taskUpdates} />
<TaskLatestLog taskId={this.props.taskId} status={this.props.task.status} files={filesToDisplay} available={filesAvailable} />
{this.renderFiles(filesToDisplay)}
{_.isEmpty(this.props.s3Logs) || <TaskS3Logs taskId={this.props.task.task.taskId.id} s3Files={this.props.s3Logs} taskStartedAt={this.props.task.task.taskId.startedAt} />}
<TaskS3Logs taskId={this.props.task.task.taskId.id} s3Files={this.props.s3Logs} taskStartedAt={this.props.task.task.taskId.startedAt} />
{_.isEmpty(this.props.task.loadBalancerUpdates) || <TaskLbUpdates loadBalancerUpdates={this.props.task.loadBalancerUpdates} />}
<TaskInfo task={this.props.task.task} ports={this.props.task.ports} directory={this.props.task.directory} />
{this.renderResourceUsage()}
Expand Down Expand Up @@ -540,7 +540,7 @@ function mapStateToProps(state, ownProps) {
resourceUsageNotFound: state.api.taskResourceUsage.statusCode === 404,
resourceUsage: state.api.taskResourceUsage.data,
cpuTimestamp: state.api.taskResourceUsage.data.timestamp,
s3Logs: state.api.taskS3Logs.data,
s3Logs: state.api.taskS3Logs,
deploy: state.api.deploy.data,
pendingDeploys: state.api.deploys.data,
shellCommandResponse: state.api.taskShellCommandResponse.data,
Expand All @@ -557,7 +557,7 @@ function mapDispatchToProps(dispatch) {
fetchDeployForRequest: (taskId, deployId) => dispatch(FetchDeployForRequest.trigger(taskId, deployId)),
fetchTaskCleanups: () => dispatch(FetchTaskCleanups.trigger()),
fetchPendingDeploys: () => dispatch(FetchPendingDeploys.trigger()),
fechS3Logs: (taskId) => dispatch(FetchTaskS3Logs.trigger(taskId, [404])),
fecthS3Logs: (taskId) => dispatch(FetchTaskS3Logs.trigger(taskId, [404, 500])),
};
}

Expand Down
44 changes: 27 additions & 17 deletions SingularityUI/app/components/taskDetail/TaskS3Logs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,28 +102,38 @@ class TaskS3Logs extends Component {

render() {
const { s3Files } = this.props;
const groupedFiles = groupBy(s3Files, this.getFileType);
if (s3Files.data && !_.isEmpty(s3Files.data)) {
const groupedFiles = groupBy(s3Files.data, this.getFileType);

return (
<Section title="S3 Logs">
{this.state.viewingGroup
? this.renderTable(groupedFiles[this.state.viewingGroup])
: this.renderFolders(Object.keys(groupedFiles))
}
</Section>
);
return (
<Section title="S3 Logs">
{this.state.viewingGroup
? this.renderTable(groupedFiles[this.state.viewingGroup])
: this.renderFolders(Object.keys(groupedFiles))
}
</Section>
);
} else if (s3Files.error || s3Files.statusCode == 500) {
return (
<Section title="S3 Logs" subtitle="Error Fetching Logs from S3"></Section>
);
} else {
return null;
}
}
}

TaskS3Logs.propTypes = {
s3Files: PropTypes.arrayOf(PropTypes.shape({
getUrl: PropTypes.string.isRequired,
key: PropTypes.string.isRequired,
size: PropTypes.number.isRequired,
lastModified: PropTypes.number.isRequired,
startTime: PropTypes.number,
endTime: PropTypes.number
})).isRequired,
s3Files: PropTypes.shape({
data: PropTypes.arrayOf(PropTypes.shape({
getUrl: PropTypes.string.isRequired,
key: PropTypes.string.isRequired,
size: PropTypes.number.isRequired,
lastModified: PropTypes.number.isRequired,
startTime: PropTypes.number,
endTime: PropTypes.number
}))
}).isRequired,
taskId: PropTypes.string.isRequired,
taskStartedAt: PropTypes.number.isRequired
};
Expand Down