Skip to content

Commit

Permalink
separate less route, with fallback redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
William Hou committed Feb 21, 2020
1 parent 57c20d7 commit 9ca8bb2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions SingularityUI/app/components/logs/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ 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}`}>
return (<Link to={`/task/${this.props.firstTaskId}/less/${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}`}>
return (<Link to={`/request/${this.props.requestId}/less/${this.props.path}`}>
<button type="button" className="btn btn-sm btn-default">Switch to new tailer</button>
</Link>);
}
Expand Down
2 changes: 2 additions & 0 deletions SingularityUI/app/components/logs/NewHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ NewHeader.propTypes = {
switchViewMode: React.PropTypes.func.isRequired,
jumpAllToTop: React.PropTypes.func.isRequired,
jumpAllToBottom: React.PropTypes.func.isRequired,

route: React.PropTypes.object,
};

export default connect((state) => ({
Expand Down
9 changes: 7 additions & 2 deletions SingularityUI/app/router.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Provider } from 'react-redux';
import { Router, Route, IndexRedirect, IndexRoute } from 'react-router';
import { Router, Route, IndexRedirect, IndexRoute, Redirect } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';

import Application from './components/common/Application';
Expand Down Expand Up @@ -49,6 +49,9 @@ const routes = (
<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)}`} />
{window.config.lessTerminalPort
? <Route path=":requestId/less/**" component={TaskLogTailerContainer} title={(params) => `Tail of ${getFilenameFromSplat(params.splat)}`} />
: <Redirect from=":requestId/less/**" to=":requestId/tail/**" />}
<Route path=":requestId/instance/:instanceNo" component={TaskInstanceRedirect} />
<IndexRoute component={NotFound} title="Not Found" />
</Route>
Expand All @@ -57,7 +60,9 @@ const routes = (
<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)}`} />
<Route path=":taskId/less/**" component={TaskLogTailerContainer} title={(params) => `Tail of ${getFilenameFromSplat(params.splat)}`} />
{window.config.lessTerminalPort
? <Route path=":taskId/less/**" component={TaskLogTailerContainer} title={(params) => `Tail of ${getFilenameFromSplat(params.splat)}`} />
: <Redirect from=":taskId/less/**" to=":taskId/tail/**" />}
<IndexRoute component={NotFound} title="Not Found" />
</Route>
<Route path="tail/**" component={CustomLogTailerContainer} title="Tailer" />
Expand Down

0 comments on commit 9ca8bb2

Please sign in to comment.