Skip to content

Commit

Permalink
Initial pr-triage
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed May 27, 2016
1 parent 61e73ec commit f68b48c
Show file tree
Hide file tree
Showing 19 changed files with 605 additions and 72 deletions.
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.DS_Store": true,
"dist": true,
"tmp": true
}
}
24 changes: 24 additions & 0 deletions design_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## FireBase Schema

### `/github_webhook_events`

This is a list of webhook posts from the github which needs to be synced into FireBase

### `/github/prs/:number`

Full details of a particular PR.

### `/digest/prs/[open|closed]/:number`

```
{
number: number,
title: string
assigned: string,
author: string,
created_at: number,
updated_at: number,
labels: string[],
comments: number
}
```
34 changes: 28 additions & 6 deletions src/app/+sync/sync.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
<ul>
<li *ngFor="let pr of prs | async">
<a href="{{pr.html_url}}" target="_blank">#{{pr.number}}</a>
</li>
</ul>
<h1>WebHook Queue</h1>
<table>
<tr>
<th>key</th>
<th>action</th>
<th>issue</th>
<th>PR</th>
<th>comment</th>
<th>label</th>
</tr>
<tr *ngFor="let event of events | async">
<td>
<a href="https://ngperiscope.firebaseio.com/github_webhook_events/{{event.$key}}.json">{{event.$key}}</a>
</td>
<td>{{event?.action}}</td>
<td>{{!!event?.issue}}</td>
<td>{{!!event?.pull_request}}</td>
<td>{{!!event?.comment}}</td>
<td>{{!!event?.label}}</td>
</tr>
</table>
<h1>All Prs</h1>
<span *ngFor="let pr of prs | async">
<a href="{{pr.html_url}}" target="_blank">#{{pr.number}}</a>
</span>
<hr>
<input type="text" #prNumberInput>
<button (click)="sync(prNumberInput.value)">sync</button>
<button (click)="syncPr(prNumberInput.value)">sync PR</button><br>
<button (click)="syncAllPRs()">sync All PRs</button><br>
22 changes: 13 additions & 9 deletions src/app/+sync/sync.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { PullRequest, Issue, BaseIssue } from '../github/v3';
import { GithubStore } from '../github/store';
import { PullRequest, Issue, BaseIssue, Event } from '../github/v3';
import { GithubStore, Digest } from '../github/store';
import { Observable } from 'rxjs/Observable';
import { FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2';

Expand All @@ -11,17 +11,21 @@ import { FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2';
templateUrl: 'sync.component.html',
styleUrls: ['sync.component.css']
})
export class SyncComponent implements OnInit {
prs: FirebaseListObservable<PullRequest[]>;
export class SyncComponent {
prs: FirebaseListObservable<Digest[]>;
events: FirebaseListObservable<Event[]>;

constructor(private store: GithubStore) {
this.prs = store.getPrs();
}

ngOnInit() {
this.events = store.getWebhookEvents();
this.prs = store.getOpenPrDigests();
}

sync(prNumber: string) {
syncPr(number: string) {
this.store.updatePr(Number.parseInt(number));
}

syncAllPRs() {
this.store.updatePrs();
}

}
11 changes: 11 additions & 0 deletions src/app/+triage-pr/triage-pr.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
table {
border: 1px solid black;
border-collapse: collapse;
}

td,th {
vertical-align: top;
border: 1px solid black;
border-collapse: collapse;
padding: 0.3em;
}
82 changes: 79 additions & 3 deletions src/app/+triage-pr/triage-pr.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
<p>
triage-pr works!
</p>
<table>
<tr>
<th></th>
<th>Hour</th>
<th>Hours</th>
<th>Day</th>
<th>Days</th>
<th>Week</th>
<th>Weeks</th>
<th>Month</th>
<th>Months</th>
<tr>
<tr>
<th>Untriaged {{state.untriaged.length}}</th>
<td><app-pr *ngFor="let pr of state.untriaged.hour" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.untriaged.hours" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.untriaged.day" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.untriaged.days" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.untriaged.week" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.untriaged.weeks" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.untriaged.month" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.untriaged.months" [pr]="pr"></app-pr></td>
<tr>
<tr>
<th>Assigned {{state.assigned.length}}</th>
<td><app-pr *ngFor="let pr of state.assigned.hour" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.assigned.hours" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.assigned.day" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.assigned.days" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.assigned.week" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.assigned.weeks" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.assigned.month" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.assigned.months" [pr]="pr"></app-pr></td>
<tr>
<tr>
<th>CleanUp {{state.cleanup.length}}</th>
<td><app-pr *ngFor="let pr of state.cleanup.hour" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.cleanup.hours" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.cleanup.day" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.cleanup.days" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.cleanup.week" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.cleanup.weeks" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.cleanup.month" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.cleanup.months" [pr]="pr"></app-pr></td>
<tr>
<tr>
<th>Reviewed {{state.reviewed.length}}</th>
<td><app-pr *ngFor="let pr of state.reviewed.hour" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.reviewed.hours" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.reviewed.day" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.reviewed.days" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.reviewed.week" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.reviewed.weeks" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.reviewed.month" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.reviewed.months" [pr]="pr"></app-pr></td>
<tr>
<tr>
<th>Ready {{state.ready.length}}</th>
<td><app-pr *ngFor="let pr of state.ready.hour" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.ready.hours" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.ready.day" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.ready.days" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.ready.week" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.ready.weeks" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.ready.month" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.ready.months" [pr]="pr"></app-pr></td>
<tr>
<tr>
<th>Other {{state.other.length}}</th>
<td><app-pr *ngFor="let pr of state.other.hour" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.other.hours" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.other.day" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.other.days" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.other.week" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.other.weeks" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.other.month" [pr]="pr"></app-pr></td>
<td><app-pr *ngFor="let pr of state.other.months" [pr]="pr"></app-pr></td>
<tr>
</table>
22 changes: 15 additions & 7 deletions src/app/+triage-pr/triage-pr.component.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import { Component, OnInit } from '@angular/core';
import { Component, Injectable, forwardRef } from '@angular/core';
import { PrComponent } from '../pr/pr.component';
import { PrBoardService, Staleness } from '../pr-board.service';


@Component({
moduleId: module.id,
selector: 'app-triage-pr',
templateUrl: 'triage-pr.component.html',
styleUrls: ['triage-pr.component.css']
styleUrls: ['triage-pr.component.css'],
directives: [PrComponent]
})
export class TriagePrComponent implements OnInit {

constructor() {}
export class TriagePrComponent {
state: PrBoardService;

ngOnInit() {
constructor(prState: PrBoardService) {
console.log('Triage');
this.state = prState;
}

sum(s: Staleness) {
return s.length;
}

}
Loading

0 comments on commit f68b48c

Please sign in to comment.