feature(code/frontend): breadcrumb links to code root and project root (#34252) (#37059)

This commit is contained in:
WangQianliang 2019-05-25 09:17:40 +08:00 committed by GitHub
parent 981b9f18e6
commit bd19868e00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,17 +29,22 @@ class CodeMain extends React.Component<Props> {
}
public componentDidUpdate() {
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.set([
{ text: 'Code', href: '#/' },
{
text: `${org}${repo}`,
href: `#/${resource}/${org}/${repo}`,
},
]);
}
public componentWillUnmount() {
chrome.breadcrumbs.pop();
chrome.breadcrumbs.set([{ text: 'Code', href: '#/' }]);
}
public render() {