Permalink
Browse files

feat(ui): show proper branch

  • Loading branch information...
jkuri committed Sep 10, 2017
1 parent c73dc2b commit df0884f563501e8fdf50659fff8845b223db6761
@@ -83,7 +83,6 @@ export interface Repository {
export interface Config {
language?: Language;
os?: string;
// git: { repository_url: string, depth?: number, pr?: number, sha?: string };
stage?: JobStage;
cache?: { [key: string]: string }[] | null;
branches?: { test: string[], ignore: string[] };
@@ -109,12 +108,13 @@ export interface Config {
export function getRemoteParsedConfig(repository: any): Promise<JobsAndEnv[]> {
return new Promise((resolve, reject) => {
let cloneUrl = repository.clone_url;
let branch = repository.branch;
let cloneDir = null;
let fileTree: string[];

createGitTmpDir()
.then(dir => cloneDir = dir)
.then(() => spawnGit(['clone', cloneUrl, '--depth', '1', cloneDir]))
.then(() => spawnGit(['clone', cloneUrl, '-b', branch, '--depth', '1', cloneDir]))
.then(() => readGitDir(cloneDir))
.then(files => repository.file_tree = files)
.then(() => {
@@ -124,6 +124,7 @@ export function startBuild(data: any): Promise<any> {
})
.then(parsedConfig => config = parsedConfig)
.then(() => data.parsed_config = config)
.then(() => data = Object.assign(data, { branch: branch, pr: pr }))
.then(() => insertBuild(data))
.then(build => {
data = Object.assign(data, { build_id: build.id });
@@ -17,13 +17,19 @@
<h1 class="bold">
<span *ngIf="build?.data?.repository?.full_name"><a [routerLink]="['/repo', build?.data?.repository.id]">{{ build?.data?.repository.full_name }}</a></span>
<span *ngIf="!build?.data?.repository?.full_name && build?.data?.project?.path_with_namespace"><a [routerLink]="['/repo', build?.data?.repository.id]">{{ build?.data?.project?.path_with_namespace }}</a></span>
<span class="build-icon">
<img src="images/icons/clock.svg" *ngIf="status === 'queued'">
<img src="images/icons/flickr.svg" *ngIf="status === 'running'">
<img src="images/icons/check-true.svg" *ngIf="status === 'success'">
<img src="images/icons/check-false.svg" *ngIf="status === 'failed'">
</span>
</h1>
<div class="branch-container">
<span class="icon is-small">
<img src="images/icons/git-branch.svg">
</span>
<span *ngIf="build?.branch">{{ build?.branch }}</span>
</div>
<span class="build-icon">
<img src="images/icons/clock.svg" *ngIf="status === 'queued'">
<img src="images/icons/flickr.svg" *ngIf="status === 'running'">
<img src="images/icons/check-true.svg" *ngIf="status === 'success'">
<img src="images/icons/check-false.svg" *ngIf="status === 'failed'">
</span>
</div>
<div class="column is-2" [class.is-hidden]="status !== 'success' && status !== 'failed'"></div>
<div class="column is-2" *ngIf="userId && build?.hasPermission">
@@ -50,7 +56,7 @@ <h1 class="bold">
<hr/>

<div class="column is-1">
<p>
<p class="text-small">
<span class="icon">
<img src="images/icons/git-commit.svg">
</span>
@@ -61,10 +67,10 @@ <h1 class="bold">
</p>
</div>
<div class="column is-4">
<p *ngIf="build?.data?.pull_request && !tag">{{ build?.data?.pull_request?.title }}</p>
<p *ngIf="!build?.data?.pull_request && build?.data?.commits && !tag">{{ build?.data?.commits[0]?.message }}</p>
<p *ngIf="!build?.data?.pull_request && !build?.data?.commits && build?.data?.message && !tag">{{ build?.data?.message }}</p>
<p *ngIf="!build?.data?.pull_request && !build?.data?.commits && !build?.data?.message && build?.data?.object_attributes?.last_commit?.message !tag">{{ build?.data?.object_attributes?.last_commit?.message }}</p>
<p *ngIf="build?.data?.pull_request && !tag" class="text-small">{{ build?.data?.pull_request?.title }}</p>
<p *ngIf="!build?.data?.pull_request && build?.data?.commits && !tag" class="text-small">{{ build?.data?.commits[0]?.message }}</p>
<p *ngIf="!build?.data?.pull_request && !build?.data?.commits && build?.data?.message && !tag" class="text-small">{{ build?.data?.message }}</p>
<p *ngIf="!build?.data?.pull_request && !build?.data?.commits && !build?.data?.message && build?.data?.object_attributes?.last_commit?.message !tag" class="text-small">{{ build?.data?.object_attributes?.last_commit?.message }}</p>
<p *ngIf="tag">{{ build?.data?.head_commit?.message }}</p>
</div>
<div class="column is-4">
@@ -12,8 +12,15 @@
<span *ngIf="tag" class="bold larger">{{ tag }}</span>
</div>
<div class="column is-2">
<span class="larger" *ngIf="build?.repository?.full_name">{{ build?.repository?.full_name }}</span>
<span class="larger" *ngIf="!build?.repository?.full_name">{{ build?.data?.repository?.full_name }}</span>
<div class="repo-branch-column">
<span class="larger bold" *ngIf="build?.repository?.full_name">{{ build?.repository?.full_name }}</span>
<span class="larger bold" *ngIf="!build?.repository?.full_name">{{ build?.data?.repository?.full_name }}</span>

<span *ngIf="build?.branch" class="span-branch">
<img src="images/icons/git-branch.svg">
{{ build?.branch }}
</span>
</div>
</div>
<div class="column is-4 commit-column">
<span class="icon">
@@ -17,13 +17,19 @@
<h1 class="bold">
<span *ngIf="job?.build?.data?.repository?.full_name"><a [routerLink]="['/repo', job?.build?.repository?.id]">{{ job?.build?.data?.repository?.full_name }}</a></span>
<span *ngIf="!job?.build?.data?.repository?.full_name && job?.build?.data?.project?.path_with_namespace"><a [routerLink]="['/repo', job?.build?.repository?.id]">{{ job?.build?.data?.project?.path_with_namespace }}</a></span>
<span class="build-icon">
<img src="images/icons/clock.svg" *ngIf="jobRun?.status === 'queued'">
<img src="images/icons/flickr.svg" *ngIf="jobRun?.status === 'running'">
<img src="images/icons/check-true.svg" *ngIf="jobRun?.status === 'success'">
<img src="images/icons/check-false.svg" *ngIf="jobRun?.status === 'failed'">
</span>
</h1>
<div class="branch-container">
<span class="icon is-small">
<img src="images/icons/git-branch.svg">
</span>
<span *ngIf="job?.build?.branch">{{ job?.build?.branch }}</span>
</div>
<span class="build-icon">
<img src="images/icons/clock.svg" *ngIf="jobRun?.status === 'queued'">
<img src="images/icons/flickr.svg" *ngIf="jobRun?.status === 'running'">
<img src="images/icons/check-true.svg" *ngIf="jobRun?.status === 'success'">
<img src="images/icons/check-false.svg" *ngIf="jobRun?.status === 'failed'">
</span>
</div>
<div class="column is-5 justify-end right-buttons-top" *ngIf="userId && job?.hasPermission">
<button class="button is-fullwidth" name="btn-restart-ssh" type="button" (click)="restartJobWithSSH($event)" [disabled]="processing">
@@ -145,3 +145,9 @@

&.hide
background: linear-gradient(to bottom, #F95359, #DD151C)

.branch-container
display: flex
align-items: center
padding-top: 5px
margin: 0 20px 0 10px
@@ -50,7 +50,7 @@
font-family: $font-family-bold

&.larger
font-size: 15px
font-size: 17px

&.smaller
font-size: 12px
@@ -127,6 +127,21 @@
width: 16px
height: 16px

.repo-branch-column

span

&.span-branch
font-size: 12px
display: inline-block

img
display: block
float: left
margin: 3px 5px 0 0
width: 12px
height: 12px

&.is-success
border-left: 10px solid $green

Oops, something went wrong.

0 comments on commit df0884f

Please sign in to comment.