Skip to content

Commit

Permalink
fix(tests): fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuri committed Aug 8, 2017
1 parent 547203b commit 866d959
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/app/components/app-builds/app-builds.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <h1>Dashboard</h1>
</span>
</div>
</div>
<div layout-align="center" *ngIf="builds.length === show" align="center">
<div layout-align="center" *ngIf="builds.length" align="center" class="more-button-container">
<button class="button" (click)="showPreviousBuilds($event)">Show Previous Builds</button>
</div>
</div>
Expand Down
15 changes: 13 additions & 2 deletions src/app/components/app-builds/app-builds.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export class AppBuildsComponent implements OnInit, OnDestroy {

ngOnInit() {
this.fetch();
this.offset = this.show;

this.sub = this.socketService.outputEvents
.filter(x => x.type !== 'data')
Expand All @@ -43,6 +42,8 @@ export class AppBuildsComponent implements OnInit, OnDestroy {
}

if (event.data === 'jobAdded') {
this.show = 5;
this.offset = 0;
this.fetch();
}

Expand Down Expand Up @@ -83,6 +84,16 @@ export class AppBuildsComponent implements OnInit, OnDestroy {
}

fetch(): void {
this.apiService.getBuilds(this.show, this.offset).subscribe(builds => {
this.builds = builds;
this.updateJobs();
setInterval(() => this.updateJobs(), 1000);
this.loading = false;
this.offset = this.show;
});
}

fetchAndConcat(): void {
this.apiService.getBuilds(this.show, this.offset).subscribe(builds => {
this.builds = this.builds.concat(builds);
this.updateJobs();
Expand Down Expand Up @@ -158,7 +169,7 @@ export class AppBuildsComponent implements OnInit, OnDestroy {
showPreviousBuilds(e: MouseEvent) {
e.preventDefault();
e.stopPropagation();
this.fetch();
this.fetchAndConcat();
this.show = this.show * 2;
this.offset = this.show;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/app-terminal/app-terminal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class AppTerminalComponent implements OnInit {
});
}, this.commands);
} else {
this.commands[this.commands.length - 1].output += output.trim();
this.commands[this.commands.length - 1].output += output;
}

this.commands = this.commands.map((cmd, i) => {
Expand Down
3 changes: 3 additions & 0 deletions src/app/styles/content.sass
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,6 @@
height: 16px
right: 10px
top: 11px

.more-button-container
margin: 20px 0
9 changes: 5 additions & 4 deletions src/app/styles/terminal.sass
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
.command-line
display: flex
align-items: center
background: #282a36
background: #1F2326
margin: 2px 5px
padding: 1px 5px
border-radius: 10px
padding: 0px
border-radius: 2px
cursor: pointer
line-height: 10px

.icon
margin-top: 8px
margin-top: 6px

img
width: 24px
Expand Down

0 comments on commit 866d959

Please sign in to comment.