Skip to content

Commit

Permalink
fix(server): handle base and compare both master
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Oct 24, 2019
1 parent cf77f86 commit 91a4c7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@

.build-hash-selector__links {
display: none;
white-space: nowrap;
}

.build-hash-selector__list li:hover .build-hash-selector__links {
Expand Down
20 changes: 10 additions & 10 deletions packages/server/src/ui/routes/build-view/build-hash-selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ import {AsyncLoader, combineLoadingStates, combineAsyncData} from '../../compone
import {Pill} from '../../components/pill';
import {useEffect} from 'preact/hooks';

/** @param {{branch: string, withDevLine: boolean, withNode: boolean, withDevBranchOff: boolean}} props */
/** @param {{branch: string, withDevLine: boolean, withNode: boolean, withDevBranchArc: boolean}} props */
const GitViz = props => {
const {branch, withDevLine, withNode, withDevBranchOff} = props;
const {branch, withDevLine, withNode, withDevBranchArc} = props;

return (
<span className="build-hash-selector__git-viz git-viz">
<span className="git-viz__master-line" />
{withDevLine ? <span className="git-viz__dev-line" /> : <Fragment />}
{withNode && branch === 'master' ? <span className="git-viz__master-node" /> : <Fragment />}
{withNode && branch !== 'master' ? <span className="git-viz__dev-node" /> : <Fragment />}
{withDevBranchOff ? <span className="git-viz__dev-branch-off" /> : <Fragment />}
{withDevBranchArc ? <span className="git-viz__dev-branch-off" /> : <Fragment />}
</span>
);
};
Expand All @@ -36,7 +36,7 @@ const LabelLineItem = props => {
<GitViz
branch={props.branch}
withNode={false}
withDevBranchOff={false}
withDevBranchArc={false}
withDevLine={props.withDevLine}
/>
<span
Expand All @@ -48,7 +48,7 @@ const LabelLineItem = props => {
);
};

/** @param {{build: LHCI.ServerCommand.Build, compareBuild: LHCI.ServerCommand.Build, baseBuild: LHCI.ServerCommand.Build | null | undefined, selector: 'base'|'compare', withDevBranchOff: boolean, withDevLine: boolean, key: string}} props */
/** @param {{build: LHCI.ServerCommand.Build, compareBuild: LHCI.ServerCommand.Build, baseBuild: LHCI.ServerCommand.Build | null | undefined, selector: 'base'|'compare', withDevBranchArc: boolean, withDevLine: boolean, key: string}} props */
const BuildLineItem = props => {
const {build, compareBuild, baseBuild, selector} = props;
const isCompareBranch = build.id === compareBuild.id;
Expand Down Expand Up @@ -90,7 +90,7 @@ const BuildLineItem = props => {
<GitViz
branch={build.branch}
withNode
withDevBranchOff={props.withDevBranchOff}
withDevBranchArc={props.withDevBranchArc}
withDevLine={props.withDevLine}
/>
<Pill variant={variant}>
Expand All @@ -99,7 +99,7 @@ const BuildLineItem = props => {
<img className="build-hash-selector__avatar" alt={build.author} src={build.avatarUrl} />
<span className="build-hash-selector__commit">{build.commitMessage}</span>
<span className="build-hash-selector__links">
{build.externalBuildUrl ? <a href={build.externalBuildUrl}>Travis</a> : <Fragment />}
{build.externalBuildUrl ? <a href={build.externalBuildUrl}>View Build</a> : <Fragment />}
</span>
</li>
);
Expand Down Expand Up @@ -153,10 +153,10 @@ const BuildHashSelector_ = props => {
compareBuild={props.build}
baseBuild={props.ancestorBuild}
selector={props.selector}
withDevLine={index <= indexOfFirstDev}
withDevBranchOff={index === indexOfFirstDev + 1}
withDevLine={index <= indexOfFirstDev && build.branch !== 'master'}
withDevBranchArc={index === indexOfFirstDev + 1}
/>
{index === indexOfFirstDev ? (
{index === indexOfFirstDev && build.branch !== 'master' ? (
<LabelLineItem branch={build.branch} withDevLine={true} />
) : null}
{index === builds.length - 1 ? (
Expand Down

0 comments on commit 91a4c7a

Please sign in to comment.