Skip to content

Commit

Permalink
fix(code): add project root link to kibana breadcrumb (#33297)
Browse files Browse the repository at this point in the history
  • Loading branch information
WangQianliang authored Mar 18, 2019
1 parent 8d5e844 commit e206b71
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions x-pack/plugins/code/public/components/main/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,7 @@
.code-no-min-width {
min-width: unset !important;
}

.code-no-max-width {
max-width: unset !important;
}
13 changes: 11 additions & 2 deletions x-pack/plugins/code/public/components/main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,26 @@ class CodeMain extends React.Component<Props> {
}

public componentDidUpdate() {
chrome.breadcrumbs.pop();
chrome.breadcrumbs.pop();
this.setBreadcrumbs();
}

public setBreadcrumbs() {
const { org, repo } = this.props.match.params;
chrome.breadcrumbs.push({ text: `${org}${repo}` });
const { resource, org, repo } = this.props.match.params;
chrome.breadcrumbs.push({
text: `${org}${repo}`,
href: `#/${resource}/${org}/${repo}`,
// @ts-ignore
className: 'code-no-max-width',
});
chrome.breadcrumbs.push({ text: '' });
}

public componentWillUnmount() {
chrome.breadcrumbs.pop();
chrome.breadcrumbs.pop();
chrome.breadcrumbs.push({ text: '' });
}

public render() {
Expand Down

0 comments on commit e206b71

Please sign in to comment.