mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
fixed preloading bug for sorting null branches
This commit is contained in:
@@ -11,10 +11,14 @@ type Props = {
|
|||||||
export default class BranchRow extends React.Component<Props> {
|
export default class BranchRow extends React.Component<Props> {
|
||||||
renderLink(to: string, label: string, defaultBranch: boolean) {
|
renderLink(to: string, label: string, defaultBranch: boolean) {
|
||||||
let showLabel = null;
|
let showLabel = null;
|
||||||
if(defaultBranch) {
|
if (defaultBranch) {
|
||||||
showLabel = <span className="tag is-dark">Default</span>;
|
showLabel = <span className="tag is-dark">Default</span>;
|
||||||
}
|
}
|
||||||
return <Link to={to}>{label} {showLabel}</Link>;
|
return (
|
||||||
|
<Link to={to}>
|
||||||
|
{label} {showLabel}
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ type Props = {
|
|||||||
// followed by develop the rest should be ordered by its name
|
// followed by develop the rest should be ordered by its name
|
||||||
export function orderBranches(branches: Branch[]) {
|
export function orderBranches(branches: Branch[]) {
|
||||||
branches.sort((a, b) => {
|
branches.sort((a, b) => {
|
||||||
if (a.defaultBranch && !b.defaultBranch ) {
|
if (a.defaultBranch && !b.defaultBranch) {
|
||||||
return -20;
|
return -20;
|
||||||
} else if (!a.defaultBranch && b.defaultBranch ) {
|
} else if (!a.defaultBranch && b.defaultBranch) {
|
||||||
return 20;
|
return 20;
|
||||||
} else if (a.name === "master" && b.name !== "master") {
|
} else if (a.name === "master" && b.name !== "master") {
|
||||||
return -10;
|
return -10;
|
||||||
@@ -74,16 +74,16 @@ class BranchesOverview extends React.Component<Props> {
|
|||||||
render() {
|
render() {
|
||||||
const { baseUrl, loading, error, branches, t } = this.props;
|
const { baseUrl, loading, error, branches, t } = this.props;
|
||||||
|
|
||||||
orderBranches(branches);
|
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return <ErrorNotification error={error} />;
|
return <ErrorNotification error={error} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loading) {
|
if (!branches || loading) {
|
||||||
return <Loading />;
|
return <Loading />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
orderBranches(branches);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Subtitle subtitle={t("branches.overview.title")} />
|
<Subtitle subtitle={t("branches.overview.title")} />
|
||||||
|
|||||||
Reference in New Issue
Block a user