Skip to content

Commit

Permalink
Add diff mode toggle and counter
Browse files Browse the repository at this point in the history
  • Loading branch information
tommysitu committed Mar 19, 2018
1 parent 5271ba4 commit 7ab6af9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/app/shared/models/usage.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface Usage {
export interface ModeCounter {
simulate: number;
spy: number;
diff: number;
capture: number;
modify: number;
synthesize: number;
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/services/hoverfly.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe('Service: Hoverfly', () => {
usage: {
counters: {
capture: 0,
diff: 0,
modify: 0,
simulate: 0,
spy: 0,
Expand Down
3 changes: 3 additions & 0 deletions src/app/views/dashboard/dashboard.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<a (click)="setMode($event)" name="capture" [class.btn-primary]="hoverfly.mode === 'capture'" class="btn btn-xs btn-default btn-mode">Capture</a>
<a (click)="setMode($event)" name="simulate" [class.btn-primary]="hoverfly.mode ==='simulate'" class="btn btn-default btn-xs btn-mode">Simulate</a>
<a (click)="setMode($event)" name="spy" [class.btn-primary]="hoverfly.mode ==='spy'" class="btn btn-default btn-xs btn-mode">Spy</a>
<a (click)="setMode($event)" name="diff" [class.btn-primary]="hoverfly.mode ==='diff'" class="btn btn-default btn-xs btn-mode">Diff</a>
<a (click)="setMode($event)" name="modify" [class.btn-primary]="hoverfly.mode ==='modify'" class="btn btn-default btn-xs btn-mode">Modify</a>
<a (click)="setMode($event)" name="synthesize" [class.btn-primary]="hoverfly.mode ==='synthesize'" class="btn btn-default btn-xs btn-mode">Synthesize</a>
</div>
Expand All @@ -52,13 +53,15 @@
<th>Captured</th>
<th>Simulated</th>
<th>Spied</th>
<th>Diffed</th>
<th>Modified</th>
<th>Synthesized</th>
</tr>
<tr id="hoverfly-counters">
<td><span class="label label-default">{{ hoverfly?.usage?.counters?.capture || 0 }}</span></td>
<td><span class="label label-default">{{ hoverfly?.usage?.counters?.simulate || 0 }}</span></td>
<td><span class="label label-default">{{ hoverfly?.usage?.counters?.spy || 0 }}</span></td>
<td><span class="label label-default">{{ hoverfly?.usage?.counters?.diff || 0 }}</span></td>
<td><span class="label label-default">{{ hoverfly?.usage?.counters?.modify || 0 }}</span></td>
<td><span class="label label-default">{{ hoverfly?.usage?.counters?.synthesize || 0 }}</span></td>
</tr>
Expand Down
6 changes: 4 additions & 2 deletions src/app/views/dashboard/dashboard.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ describe('Component: Dashboard', () => {
capture: 100,
simulate: 200,
spy: 300,
modify: 400,
synthesize: 500
diff: 400,
modify: 500,
synthesize: 600
}
}
});
Expand All @@ -143,6 +144,7 @@ describe('Component: Dashboard', () => {
expect(counters.children[2].nativeElement.textContent).toBe('300');
expect(counters.children[3].nativeElement.textContent).toBe('400');
expect(counters.children[4].nativeElement.textContent).toBe('500');
expect(counters.children[5].nativeElement.textContent).toBe('600');
});
}));

Expand Down

0 comments on commit 7ab6af9

Please sign in to comment.