-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a column to display the overall pull request status
- Loading branch information
1 parent
2a9fe46
commit a5dd094
Showing
6 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
apps/prs/src/app/pr-table/columns/status/status.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<mat-header-cell *matHeaderCellDef>Status</mat-header-cell> | ||
<mat-cell *matCellDef="let pr"> | ||
<mat-icon class="{{pr.status}}">{{getStatusIconForStatus(pr.status)}}</mat-icon> | ||
</mat-cell> |
19 changes: 19 additions & 0 deletions
19
apps/prs/src/app/pr-table/columns/status/status.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.mat-column-status { | ||
&.mat-header-cell { | ||
} | ||
|
||
&.mat-cell { | ||
.pending { | ||
color: rgba(229, 196, 12, 0.44); | ||
} | ||
|
||
.success { | ||
color: rgba(0, 128, 0, 0.44); | ||
} | ||
|
||
.error, | ||
.failure { | ||
color: rgba(255, 23, 23, 0.44); | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
apps/prs/src/app/pr-table/columns/status/status.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {ChangeDetectionStrategy, Component} from '@angular/core'; | ||
import {StatusEvent} from '@octokit/webhooks-types'; | ||
import {BaseColumn} from '../base'; | ||
|
||
@Component({ | ||
selector: 'status-column', | ||
templateUrl: './status.component.html', | ||
styleUrls: ['./status.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class StatusColumn extends BaseColumn { | ||
name = 'status'; | ||
|
||
getStatusIconForStatus(state: StatusEvent['state']) { | ||
switch (state) { | ||
case 'pending': | ||
return 'pending'; | ||
case 'success': | ||
return 'check_circle'; | ||
case 'failure': | ||
return 'error'; | ||
case 'error': | ||
return 'error'; | ||
} | ||
throw Error('An invalid state was provided for retrieving the icon.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters