-
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 which displays the current target of the pull request
- Loading branch information
1 parent
e3386cc
commit 6390a7e
Showing
7 changed files
with
72 additions
and
4 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/target/target.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>Target</mat-header-cell> | ||
<mat-cell *matCellDef="let row"> | ||
{{getTargetText(row.target)}} | ||
</mat-cell> |
11 changes: 11 additions & 0 deletions
11
apps/prs/src/app/pr-table/columns/target/target.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,11 @@ | ||
.mat-column-target { | ||
max-width: 80px; | ||
|
||
&.mat-header-cell { | ||
justify-content: center; | ||
} | ||
|
||
&.mat-cell { | ||
justify-content: center; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
apps/prs/src/app/pr-table/columns/target/target.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,44 @@ | ||
import {ChangeDetectionStrategy, Component} from '@angular/core'; | ||
import {BaseColumn} from '../base'; | ||
|
||
/** The targets available, and the text to show in the UI. */ | ||
const Targets = [ | ||
{ | ||
label: 'target: patch', | ||
text: 'Patch', | ||
}, | ||
{ | ||
label: 'target: minor', | ||
text: 'Minor', | ||
}, | ||
{ | ||
label: 'target: major', | ||
text: 'Major', | ||
}, | ||
{ | ||
label: 'target: lts', | ||
text: 'LTS', | ||
}, | ||
{ | ||
label: 'target: rc', | ||
text: 'RC', | ||
}, | ||
{ | ||
label: 'target: feature branch', | ||
text: 'Feature Branch', | ||
}, | ||
]; | ||
|
||
@Component({ | ||
selector: 'target-column', | ||
templateUrl: './target.component.html', | ||
styleUrls: ['./target.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class TargetColumn extends BaseColumn { | ||
name = 'target'; | ||
|
||
getTargetText(target: string) { | ||
return Targets.find((t) => t.label === target)?.text ?? 'No Target'; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
import {PullRequest as SharedPullRequest} from '../../../shared/models/app-models'; | ||
import {FirestorePullRequest} from '../../../shared/models/pull-request'; | ||
|
||
export class PullRequest extends SharedPullRequest {} | ||
export class PullRequest extends SharedPullRequest { | ||
target: string | undefined; | ||
|
||
override async setData(data: FirestorePullRequest) { | ||
await super.setData(data); | ||
this.target = this.labels.find((l) => l?.name?.startsWith('target:'))?.name || ''; | ||
} | ||
} |
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