fixed sources and changeset view for svn repos

This commit is contained in:
Florian Scholdei
2019-04-20 15:42:35 +02:00
parent ba3557fbb6
commit c7b7b3f73b
3 changed files with 37 additions and 30 deletions

View File

@@ -304,17 +304,22 @@ const reduceByBranchesSuccess = (state, payload) => {
const byName = repoState.byName || {}; const byName = repoState.byName || {};
repoState.byName = byName; repoState.byName = byName;
const branches = response._embedded.branches; if(response._embedded) {
const names = branches.map(b => b.name); const branches = response._embedded.branches;
response._embedded.branches = names; const names = branches.map(b => b.name);
for (let branch of branches) { response._embedded.branches = names;
byName[branch.name] = branch; for (let branch of branches) {
byName[branch.name] = branch;
}
return {
[key]: {
list: response,
byName
}
};
} }
return { return {
[key]: { [key]: []
list: response,
byName
}
}; };
}; };

View File

@@ -80,19 +80,17 @@ class ChangesetsRoot extends React.Component<Props> {
return <Loading />; return <Loading />;
} }
if (!repository || !branches) { if (!repository) {
return null; return null;
} }
const url = this.stripEndingSlash(match.url); const url = this.stripEndingSlash(match.url);
const branch = this.findSelectedBranch(); const branch = branches ? this.findSelectedBranch() : null;
const changesets = <Changesets repository={repository} branch={branch} />; const changesets = <Changesets repository={repository} branch={branch} />;
return ( return (
<div className="panel"> <div className="panel">
<div className="panel-heading">
{this.renderBranchSelector()} {this.renderBranchSelector()}
</div>
<Route path={`${url}/:page?`} component={() => changesets} /> <Route path={`${url}/:page?`} component={() => changesets} />
</div> </div>
); );
@@ -102,14 +100,16 @@ class ChangesetsRoot extends React.Component<Props> {
const { repository, branches, selected, t } = this.props; const { repository, branches, selected, t } = this.props;
if (repository._links.branches) { if (repository._links.branches) {
return ( return (
<BranchSelector <div className="panel-heading">
label={t("changesets.branchSelectorLabel")} <BranchSelector
branches={branches} label={t("changesets.branchSelectorLabel")}
selectedBranch={selected} branches={branches}
selected={(b: Branch) => { selectedBranch={selected}
this.branchSelected(b); selected={(b: Branch) => {
}} this.branchSelected(b);
/> }}
/>
</div>
); );
} }
return null; return null;

View File

@@ -94,7 +94,7 @@ class Sources extends React.Component<Props> {
if (currentFileIsDirectory) { if (currentFileIsDirectory) {
return ( return (
<div className="panel"> <div className="panel">
<div className="panel-heading">{this.renderBranchSelector()}</div> {this.renderBranchSelector()}
<FileTree <FileTree
repository={repository} repository={repository}
revision={revision} revision={revision}
@@ -115,14 +115,16 @@ class Sources extends React.Component<Props> {
if (branches) { if (branches) {
return ( return (
<BranchSelector <div className="panel-heading">
branches={branches} <BranchSelector
selectedBranch={revision} branches={branches}
label={t("changesets.branchSelectorLabel")} selectedBranch={revision}
selected={(b: Branch) => { label={t("changesets.branchSelectorLabel")}
this.branchSelected(b); selected={(b: Branch) => {
}} this.branchSelected(b);
/> }}
/>
</div>
); );
} }
return null; return null;