Skip to content

Commit

Permalink
Merge pull request #1466 from HubSpot/old_tail
Browse files Browse the repository at this point in the history
Add links between tailer versions
  • Loading branch information
ssalinas committed Mar 23, 2017
2 parents e2d5c5a + 2b5c638 commit de67f46
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
15 changes: 15 additions & 0 deletions SingularityUI/app/components/logs/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ class Header extends React.Component {
);
}

renderSwitchToNewTailer() {
if (!this.props.taskGroupHasMultipleTasks) {
if ((this.props.taskGroupCount === 1)) {
return (<Link to={`/task/${this.props.firstTaskId}/tail/${this.props.path}`}>
<button type="button" className="btn btn-sm btn-default">Switch to new tailer</button>
</Link>);
} else if ((this.props.taskGroupCount > 1)) {
return (<Link to={`/request/${this.props.requestId}/tail/${this.props.path}`}>
<button type="button" className="btn btn-sm btn-default">Switch to new tailer</button>
</Link>);
}
}
}

render() {
return (
<div className="tail-header">
Expand All @@ -60,6 +74,7 @@ class Header extends React.Component {
</ul>
</div>
<div className="col-md-3 hidden-xs tail-buttons">
{this.renderSwitchToNewTailer()}
<SearchDropdown />
<TasksDropdown />
<ColorDropdown />
Expand Down
13 changes: 13 additions & 0 deletions SingularityUI/app/components/logs/NewHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ class NewHeader extends React.Component {
}
}

renderSwitchToOldTailer() {
if ((this.props.tailerGroupCount === 1)) {
return (<Link to={`/task/${this.props.taskIds[0]}/old-tail/${this.props.paths[0]}`}>
<button type="button" className="btn btn-sm btn-default">Back to old tailer</button>
</Link>);
} else if ((this.props.tailerGroupCount > 1)) {
return (<Link to={`/request/${this.props.requestIds[0]}/old-tail/${this.props.paths[0]}`}>
<button type="button" className="btn btn-sm btn-default">Back to old tailer</button>
</Link>);
}
}

render() {
if (!this.props.ready) {
return (<div>Loading...</div>);
Expand All @@ -80,6 +92,7 @@ class NewHeader extends React.Component {
</ul>
</div>
<div className="col-md-3 hidden-xs tail-buttons">
{this.renderSwitchToOldTailer()}
{this.renderTasksDropdown()}
<NewColorDropdown activeColor={this.props.activeColor} onSetColor={this.props.setColor} />
{this.renderAnchorButtons()}
Expand Down
2 changes: 1 addition & 1 deletion SingularityUI/app/rootComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const rootComponent = (Wrapped, refresh = null, refreshInterval = true, pageMarg
}

componentDidMount() {
const onLoadPromise = onLoad(this.props);
const onLoadPromise = this.dispatchOnLoad();
if (onLoadPromise) {
onLoadPromise.catch((reason) => setTimeout(() => { throw new Error(reason); }));
}
Expand Down
3 changes: 3 additions & 0 deletions SingularityUI/app/router.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Disasters from './components/disasters/Disasters';
import TaskLogTailerContainer from './containers/TaskLogTailerContainer';
import RequestLogTailerContainer from './containers/RequestLogTailerContainer';
import CustomLogTailerContainer from './containers/CustomLogTailerContainer';
import { Tail, AggregateTail } from './components/logs/Tail';

const getFilenameFromSplat = (splat) => _.last(splat.split('/'));

Expand All @@ -42,13 +43,15 @@ const routes = (
<Route path=":requestId/task-search" component={TaskSearch} title="Task Search" />
<Route path=":requestId/deploy" component={NewDeployForm} title="New Deploy" />
<Route path=":requestId/deploy/:deployId" component={DeployDetail} title={(params) => `Deploy ${params.deployId}`} />
<Route path=":requestId/old-tail/**" component={AggregateTail} title={(params) => `Tail of ${getFilenameFromSplat(params.splat)}`} />
<Route path=":requestId/tail/**" component={RequestLogTailerContainer} title={(params) => `Tail of ${getFilenameFromSplat(params.splat)}`} />
<Route path=":requestId/instance/:instanceNo" component={TaskInstanceRedirect} />
<IndexRoute component={NotFound} title="Not Found" />
</Route>
<Route path="tasks(/:state)(/:requestsSubFilter)(/:searchFilter)" component={TasksPage} title="Tasks" />
<Route path="task">
<Route path=":taskId(/files**)" component={TaskDetail} title={(params) => params.taskId} />
<Route path=":taskId/old-tail/**" component={Tail} title={(params) => `Tail of ${getFilenameFromSplat(params.splat)}`} />
<Route path=":taskId/tail/**" component={TaskLogTailerContainer} title={(params) => `Tail of ${getFilenameFromSplat(params.splat)}`} />
<IndexRoute component={NotFound} title="Not Found" />
</Route>
Expand Down

0 comments on commit de67f46

Please sign in to comment.