create new codeSection // add actionBar to codeSection // change routes for sources and changesets

This commit is contained in:
Eduard Heimbuch
2020-01-07 10:30:46 +01:00
parent 5405a2b3c8
commit 20c00e7222
13 changed files with 251 additions and 126 deletions

View File

@@ -13,7 +13,7 @@ import {
} from "../../branches/modules/branches";
import { compose } from "redux";
import Content from "./Content";
import {fetchSources, getSources, isDirectory} from "../modules/sources";
import { fetchSources, getSources, isDirectory } from "../modules/sources";
type Props = WithTranslation & {
repository: Repository;
@@ -63,8 +63,6 @@ class Sources extends React.Component<Props, State> {
if (prevProps.revision !== revision || prevProps.path !== path) {
fetchSources(repository, this.decodeRevision(revision), path);
}
this.redirectToDefaultBranch();
}
decodeRevision = (revision: string) => {
@@ -122,7 +120,6 @@ class Sources extends React.Component<Props, State> {
if (currentFileIsDirectory) {
return (
<div className="panel">
{this.renderBranchSelector()}
{this.renderBreadcrumb()}
<FileTree repository={repository} revision={revision} path={path} baseUrl={baseUrl} />
</div>
@@ -132,26 +129,6 @@ class Sources extends React.Component<Props, State> {
}
}
renderBranchSelector = () => {
const { branches, revision, t } = this.props;
if (branches) {
return (
<div className="panel-heading">
<BranchSelector
branches={branches}
selectedBranch={revision}
label={t("changesets.branchSelectorLabel")}
selected={(b: Branch) => {
this.branchSelected(b);
}}
/>
</div>
);
}
return null;
};
renderBreadcrumb = () => {
const { revision, path, baseUrl, branches, sources, repository } = this.props;
const { selectedBranch } = this.state;
@@ -163,9 +140,7 @@ class Sources extends React.Component<Props, State> {
path={path}
baseUrl={baseUrl}
branch={selectedBranch}
defaultBranch={
branches && branches.filter(b => b.defaultBranch === true)[0]
}
defaultBranch={branches && branches.filter(b => b.defaultBranch === true)[0]}
sources={sources}
/>
);
@@ -207,11 +182,4 @@ const mapDispatchToProps = dispatch => {
};
};
export default compose(
withTranslation("repos"),
withRouter,
connect(
mapStateToProps,
mapDispatchToProps
)
)(Sources);
export default compose(withTranslation("repos"), withRouter, connect(mapStateToProps, mapDispatchToProps))(Sources);