mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 18:26:16 +01:00
Fixed hiding of branch drop down when there are no branches
This commit is contained in:
@@ -10,18 +10,20 @@ class ChangesetTable extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const {changesets} = this.props;
|
||||
return <table className="table is-hoverable is-fullwidth is-striped is-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Changesets</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{changesets.map((changeset, index) => {
|
||||
return <ChangesetRow key={index} changeset={changeset}/>;
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
return <div>
|
||||
<table className="table is-hoverable is-fullwidth is-striped is-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Changesets</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{changesets.map((changeset, index) => {
|
||||
return <ChangesetRow key={index} changeset={changeset}/>;
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,18 +30,19 @@ class Changesets extends React.Component<State, Props> {
|
||||
componentDidMount() {
|
||||
const {namespace, name} = this.props.repository;
|
||||
const branchName = this.props.match.params.branch;
|
||||
const {fetchChangesetsByNamespaceNameAndBranch, fetchChangesetsByNamespaceAndName, fetchBranchesByNamespaceAndName} = this.props;
|
||||
if (branchName) {
|
||||
this.props.fetchChangesetsByNamespaceNameAndBranch(namespace, name, branchName);
|
||||
fetchChangesetsByNamespaceNameAndBranch(namespace, name, branchName);
|
||||
} else {
|
||||
this.props.fetchChangesetsByNamespaceAndName(namespace, name);
|
||||
fetchChangesetsByNamespaceAndName(namespace, name);
|
||||
}
|
||||
this.props.fetchBranchesByNamespaceAndName(namespace, name);
|
||||
fetchBranchesByNamespaceAndName(namespace, name);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {changesets, loading, error} = this.props;
|
||||
if (loading || !changesets) {
|
||||
return <Loading/>
|
||||
return <Loading />
|
||||
}
|
||||
return <div>
|
||||
<ErrorNotification error={error}/>
|
||||
@@ -54,9 +55,9 @@ class Changesets extends React.Component<State, Props> {
|
||||
const branch = this.props.match.params.branch;
|
||||
const {changesets, branchNames} = this.props;
|
||||
|
||||
if (branchNames) {
|
||||
if (branchNames && branchNames.length > 0) {
|
||||
return <div>
|
||||
<DropDown options={branchNames} preselectedOption={branch}
|
||||
<label className="label">Branch: </label><DropDown options={branchNames} preselectedOption={branch}
|
||||
optionSelected={branch => this.branchChanged(branch)}/>
|
||||
<ChangesetTable changesets={changesets}/>
|
||||
</div>;
|
||||
|
||||
@@ -95,7 +95,7 @@ export function getBranchesForNamespaceAndNameFromState(namespace: string, name:
|
||||
|
||||
export function getBranchNames(namespace: string, name: string, state: Object) {
|
||||
const key = namespace + "/" + name;
|
||||
if (!state.branches[key]) {
|
||||
if (!state.branches[key] || !state.branches[key].byNames) {
|
||||
return null;
|
||||
}
|
||||
return Object.keys(state.branches[key].byNames);
|
||||
|
||||
Reference in New Issue
Block a user