Skip to content

Commit

Permalink
Merge pull request openshift#2262 from ggreer/logs-404
Browse files Browse the repository at this point in the history
Fix 404 error on logs page.
  • Loading branch information
ggreer authored Apr 25, 2018
2 parents 3009408 + d20efe7 commit eb40178
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions frontend/public/components/pod-logs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,34 @@ export class PodLogs extends SafetyFirst {
}

componentWillReceiveProps(nextProps) {
this.setState(this._initialState(nextProps));
this.setState(this._initialState(nextProps.obj));
}

componentWillUnmount() {
super.componentWillUnmount();
this._endStreaming();
}

_initialState(props = this.props.obj) {
_initialState(obj = this.props.obj) {
const newState = {};

const containers = _.get(props, 'spec.containers', []);
const containers = _.get(obj, 'spec.containers', []);
newState.containerNames = _.map(containers, 'name');

if (!this.state.currentContainer && newState.containerNames.length > 0) {
newState.currentContainer = newState.containerNames[0];
}

const currentContainer = newState.currentContainer || this.state.currentContainer;
newState.logURL = this._logURL(props, currentContainer);
newState.logURL = this._logURL(obj, currentContainer);

return newState;
}

_logURL(props, currentContainer) {
_logURL(obj, currentContainer) {
return resourceURL(k8sKinds.Pod, {
ns: _.get(props, 'metadata.namespace'),
name: _.get(props, 'metadata.name'),
ns: _.get(obj, 'metadata.namespace'),
name: _.get(obj, 'metadata.name'),
path: 'log',
queryParams: {
container: currentContainer,
Expand Down

0 comments on commit eb40178

Please sign in to comment.