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
Expand Up @@ -85,7 +85,7 @@ <h1>Dashboard</h1>
</span> </span>
</div> </div>
</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> <button class="button" (click)="showPreviousBuilds($event)">Show Previous Builds</button>
</div> </div>
</div> </div>
Expand Down
15 changes: 13 additions & 2 deletions src/app/components/app-builds/app-builds.component.ts
Expand Up @@ -28,7 +28,6 @@ export class AppBuildsComponent implements OnInit, OnDestroy {


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


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


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


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


fetch(): void { 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.apiService.getBuilds(this.show, this.offset).subscribe(builds => {
this.builds = this.builds.concat(builds); this.builds = this.builds.concat(builds);
this.updateJobs(); this.updateJobs();
Expand Down Expand Up @@ -158,7 +169,7 @@ export class AppBuildsComponent implements OnInit, OnDestroy {
showPreviousBuilds(e: MouseEvent) { showPreviousBuilds(e: MouseEvent) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.fetch(); this.fetchAndConcat();
this.show = this.show * 2; this.show = this.show * 2;
this.offset = this.show; this.offset = this.show;
} }
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/app-terminal/app-terminal.component.ts
Expand Up @@ -77,7 +77,7 @@ export class AppTerminalComponent implements OnInit {
}); });
}, this.commands); }, this.commands);
} else { } 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) => { this.commands = this.commands.map((cmd, i) => {
Expand Down
3 changes: 3 additions & 0 deletions src/app/styles/content.sass
Expand Up @@ -257,3 +257,6 @@
height: 16px height: 16px
right: 10px right: 10px
top: 11px top: 11px

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


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


img img
width: 24px width: 24px
Expand Down

0 comments on commit 866d959

Please sign in to comment.