-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Connect PR data in client #68
base: main
Are you sure you want to change the base?
Changes from all commits
f8a0237
4c72de2
d4ec45f
a9da1f0
5a93bde
51981ce
8bcd05a
3d6a4f1
271a36a
0e9069b
9650199
7fc5aed
1a77297
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
{ | ||
"java.debug.settings.hotCodeReplace": "auto", | ||
"java.configuration.updateBuildConfiguration": "interactive" | ||
"java.configuration.updateBuildConfiguration": "interactive", | ||
"sqltools.connections": [ | ||
{ | ||
"previewLimit": 50, | ||
"server": "localhost", | ||
"port": 5432, | ||
"driver": "PostgreSQL", | ||
"name": "application-service-dev", | ||
"password": "helios", | ||
"username": "helios", | ||
"database": "helios" | ||
} | ||
] | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<p-table [value]="pullRequests()" [loading]="isLoading()" styleClass="p-datatable-sm"> | ||
<ng-template pTemplate="header"> | ||
<tr> | ||
<th>Title</th> | ||
<th>Draft</th> | ||
<th>Status</th> | ||
<th>Author</th> | ||
<th>Assignee</th> | ||
<th>Created</th> | ||
</tr> | ||
</ng-template> | ||
<ng-template pTemplate="body" let-pr> | ||
<tr> | ||
<td> | ||
<div class="flex align-items-center gap-2"> | ||
<span class="font-bold">{{ pr.title }}</span> | ||
<button pButton class="p-button-text p-button-sm" (click)="openPR(pr.htmlUrl)"><i-tabler name="external-link"></i-tabler></button> | ||
</div> | ||
</td> | ||
<td> | ||
<p-tag *ngIf="pr.isDraft" value="Draft" severity="secondary"> </p-tag> | ||
</td> | ||
<td> | ||
<p-tag [value]="getStatus(pr)" [severity]="getStatusSeverity(pr)"> </p-tag> | ||
</td> | ||
<td> | ||
<div class="flex align-items-center gap-2"> | ||
<p-avatar [image]="pr.author.avatarUrl" shape="circle" size="normal"> </p-avatar> | ||
<span>{{ pr.author.name }}</span> | ||
</div> | ||
</td> | ||
<td> | ||
<div class="flex align-items-center gap-2" *ngIf="pr.assignees?.length"> | ||
<p-avatar *ngFor="let assignee of pr.assignees" [image]="assignee.avatarUrl" shape="circle" size="normal"> </p-avatar> | ||
</div> | ||
</td> | ||
<td> | ||
{{ formatDate(pr.createdAt) }} | ||
</td> | ||
</tr> | ||
</ng-template> | ||
</p-table> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { PullRequestTableComponent } from './pull-request-table.component'; | ||
|
||
describe('PullRequestTableComponent', () => { | ||
let component: PullRequestTableComponent; | ||
let fixture: ComponentFixture<PullRequestTableComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [PullRequestTableComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(PullRequestTableComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { Component, inject, signal } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { TableModule } from 'primeng/table'; | ||
import { AvatarModule } from 'primeng/avatar'; | ||
import { TagModule } from 'primeng/tag'; | ||
import { injectQuery } from '@tanstack/angular-query-experimental'; | ||
import { tap } from 'rxjs'; | ||
import { IconsModule } from 'icons.module'; | ||
import { PullRequestControllerService, PullRequestInfoDTO } from '@app/core/modules/openapi'; | ||
|
||
|
||
@Component({ | ||
selector: 'app-pull-request-table', | ||
imports: [CommonModule, TableModule, AvatarModule, TagModule, IconsModule], | ||
templateUrl: './pull-request-table.component.html', | ||
styles: [` | ||
:host ::ng-deep { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not an expert on this but is it ok to use |
||
.p-avatar { | ||
img { | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
} | ||
} | ||
} | ||
`] | ||
}) | ||
export class PullRequestTableComponent { | ||
pullRequestService = inject(PullRequestControllerService); | ||
|
||
|
||
pullRequests = signal<PullRequestInfoDTO[]>([]); | ||
isLoading = signal(true); | ||
|
||
query = injectQuery(() => ({ | ||
queryKey: ['pullRequests'], | ||
queryFn: () => this.pullRequestService.getAllPullRequests() | ||
.pipe( | ||
tap(data => { | ||
this.pullRequests.set(data); | ||
this.isLoading.set(false); | ||
}) | ||
).subscribe(), | ||
})); | ||
|
||
getStatus(pr: PullRequestInfoDTO): string { | ||
if (pr.isMerged) return 'Merged'; | ||
return pr.state === 'OPEN' ? 'Open' : 'Closed'; | ||
} | ||
|
||
getStatusSeverity(pr: PullRequestInfoDTO): ('success' | 'danger' | 'info') { | ||
if (pr.isMerged) return 'info'; | ||
return pr.state === 'OPEN' ? 'success' : 'danger'; | ||
} | ||
|
||
formatDate(date: string): string { | ||
return new Date(date).toLocaleDateString('en-US', { | ||
year: 'numeric', | ||
month: 'short', | ||
day: 'numeric' | ||
}); | ||
} | ||
|
||
openPR(url: string): void { | ||
window.open(url, '_blank'); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<p-tabView> | ||
<p-tabPanel header="Pull Requests"> | ||
<app-pull-request-table></app-pull-request-table> | ||
</p-tabPanel> | ||
<p-tabPanel header="Branches"> Branch List view goes here </p-tabPanel> | ||
</p-tabView> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Component } from '@angular/core'; | ||
import { PullRequestTableComponent } from '@app/components/pull-request-table/pull-request-table.component'; | ||
import { TabViewModule } from 'primeng/tabview'; | ||
@Component({ | ||
selector: 'app-ci-cd', | ||
imports: [PullRequestTableComponent, TabViewModule], | ||
templateUrl: './ci-cd.component.html', | ||
styleUrl: './ci-cd.component.css' | ||
}) | ||
export class CiCdComponent {} |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export const environment = { | ||
clientUrl: 'http://localhost:4200', | ||
production: false, | ||
serverUrl: 'http://localhost:8080', | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export const environment = { | ||
clientUrl: 'http://localhost:4200', | ||
serverUrl: 'http://localhost:8080', | ||
production: true, | ||
serverUrl: 'https://helios.artemis.cit.tum.de', | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export const environment = { | ||
clientUrl: 'http://localhost:4200', | ||
production: false, | ||
serverUrl: 'http://localhost:8080', | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I increased those limits but we need to have a Github action (in the future) to check if the build passes or not. Because when I was trying, the build step was failing due to the limits.