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 || {};
repoState.byName = byName;
const branches = response._embedded.branches;
const names = branches.map(b => b.name);
response._embedded.branches = names;
for (let branch of branches) {
byName[branch.name] = branch;
if(response._embedded) {
const branches = response._embedded.branches;
const names = branches.map(b => b.name);
response._embedded.branches = names;
for (let branch of branches) {
byName[branch.name] = branch;
}
return {
[key]: {
list: response,
byName
}
};
}
return {
[key]: {
list: response,
byName
}
[key]: []
};
};

View File

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

View File

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