Skip to content

Commit

Permalink
fix(code/frontend): button group url should have previous query string (
Browse files Browse the repository at this point in the history
  • Loading branch information
WangQianliang authored Aug 18, 2019
1 parent 7b507ee commit 161f3d5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions x-pack/legacy/plugins/code/public/components/main/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,26 +135,31 @@ class CodeContent extends React.PureComponent<Props, State> {

public switchButton = (id: string) => {
const { path, resource, org, repo, revision } = this.props.match.params;
const queryString = this.props.location.search;
const repoUri = `${resource}/${org}/${repo}`;
switch (id) {
case ButtonOption.Code:
history.push(
`/${repoUri}/${PathTypes.blob}/${encodeRevisionString(revision)}/${path || ''}`
`/${repoUri}/${PathTypes.blob}/${encodeRevisionString(revision)}/${path ||
''}${queryString}`
);
break;
case ButtonOption.Folder:
history.push(
`/${repoUri}/${PathTypes.tree}/${encodeRevisionString(revision)}/${path || ''}`
`/${repoUri}/${PathTypes.tree}/${encodeRevisionString(revision)}/${path ||
''}${queryString}`
);
break;
case ButtonOption.Blame:
history.push(
`/${repoUri}/${PathTypes.blame}/${encodeRevisionString(revision)}/${path || ''}`
`/${repoUri}/${PathTypes.blame}/${encodeRevisionString(revision)}/${path ||
''}${queryString}`
);
break;
case ButtonOption.History:
history.push(
`/${repoUri}/${PathTypes.commits}/${encodeRevisionString(revision)}/${path || ''}`
`/${repoUri}/${PathTypes.commits}/${encodeRevisionString(revision)}/${path ||
''}${queryString}`
);
break;
}
Expand Down

0 comments on commit 161f3d5

Please sign in to comment.