Skip to content

Commit

Permalink
#144: add reviews to dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
iam-flo committed Nov 25, 2024
1 parent 65e8476 commit 1d03f2b
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.ArrayList;
import java.util.List;

import de.tum.in.www1.hephaestus.activitydashboard.ActivityDTO;
import de.tum.in.www1.hephaestus.activitydashboard.ReviewActivityDto;
import org.hibernate.integrator.spi.Integrator;
import org.hibernate.jpa.boot.spi.IntegratorProvider;

Expand Down Expand Up @@ -33,6 +35,8 @@ public List<Integrator> getIntegrators() {
classes.add(IssueCommentInfoDTO.class);
classes.add(PullRequestReviewInfoDTO.class);
classes.add(RepositoryInfoDTO.class);
classes.add(ActivityDTO.class);
classes.add(ReviewActivityDto.class);

return List.of(new ClassImportIntegrator(classes));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.tum.in.www1.hephaestus.activitydashboard;

import java.time.OffsetDateTime;
import org.springframework.lang.NonNull;
import com.fasterxml.jackson.annotation.JsonInclude;

Expand Down
5 changes: 5 additions & 0 deletions webapp/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import { ImprintComponent } from '@app/legal/imprint.component';
import { PrivacyComponent } from '@app/legal/privacy.component';
import { AdminGuard } from '@app/core/security/admin.guard';
import { AuthGuard } from '@app/core/security/auth.guard';
import {
ActivityDashboardComponent
} from '@app/home/activity-dashboard/activity-dashboard/activity-dashboard.component';

export const routes: Routes = [
// Public routes
Expand Down Expand Up @@ -50,4 +53,6 @@ export const routes: Routes = [
{ path: 'workspace', component: WorkspaceComponent, canActivate: [AdminGuard] }
]
}
{ path: 'user/:id', component: UserProfileComponent },
{ path: 'activity/:id', component: ActivityDashboardComponent }
];
20 changes: 11 additions & 9 deletions webapp/src/app/user/issue-card/issue-card.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
{{ repositoryName() }} #{{ number() }} on {{ displayCreated().format('MMM D') }}
}
</span>
<span class="flex items-center space-x-2">
@if (isLoading()) {
<hlm-skeleton class="h-4 w-8 bg-green-500/30"></hlm-skeleton>
<hlm-skeleton class="h-4 w-8 bg-destructive/20"></hlm-skeleton>
} @else {
<span class="text-github-success-foreground font-bold">+{{ additions() }}</span>
<span class="text-github-danger-foreground font-bold">-{{ deletions() }}</span>
}
</span>
@if (!isIssue()) {
<span class="flex items-center space-x-2">
@if (isLoading()) {
<hlm-skeleton class="h-4 w-8 bg-green-500/30"></hlm-skeleton>
<hlm-skeleton class="h-4 w-8 bg-destructive/20"></hlm-skeleton>
} @else {
<span class="text-github-success-foreground font-bold">+{{ additions() }}</span>
<span class="text-github-danger-foreground font-bold">-{{ deletions() }}</span>
}
</span>
}
</div>

<span class="containerSize flex justify-between font-medium mb-3">
Expand Down
40 changes: 31 additions & 9 deletions webapp/src/app/user/issue-card/issue-card.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import { Component, computed, input } from '@angular/core';
import { PullRequestInfo, LabelInfo } from '@app/core/modules/openapi';
import { NgIcon } from '@ng-icons/core';
import { octCheck, octComment, octFileDiff, octGitPullRequest, octGitPullRequestClosed, octGitPullRequestDraft, octGitMerge, octX } from '@ng-icons/octicons';
import {
octCheck,
octComment,
octFileDiff,
octGitPullRequest,
octGitPullRequestClosed,
octGitPullRequestDraft,
octGitMerge,
octX,
octIssueDraft,
octIssueOpened
} from '@ng-icons/octicons';
import { HlmCardModule } from '@spartan-ng/ui-card-helm';
import { HlmSkeletonComponent } from '@spartan-ng/ui-skeleton-helm';
import { GithubLabelComponent } from '@app/ui/github-label/github-label.component';
Expand Down Expand Up @@ -33,6 +44,7 @@ export class IssueCardComponent {
isDraft = input<boolean>();
isMerged = input<boolean>();
pullRequestLabels = input<Array<LabelInfo>>();
isIssue = input<boolean>();

displayCreated = computed(() => dayjs(this.createdAt()));
displayTitle = computed(() => (this.title() ?? '').replace(/`([^`]+)`/g, '<code class="textCode">$1</code>'));
Expand All @@ -42,21 +54,31 @@ export class IssueCardComponent {
var icon: string;
var color: string;

if (this.state() === PullRequestInfo.StateEnum.Open) {
if (this.isIssue()) {
if (this.isDraft()) {
icon = octGitPullRequestDraft;
icon = octIssueDraft;
color = 'text-github-muted-foreground';
} else {
icon = octGitPullRequest;
icon = octIssueOpened;
color = 'text-github-open-foreground';
}
} else {
if (this.isMerged()) {
icon = octGitMerge;
color = 'text-github-done-foreground';
if (this.state() === PullRequestInfo.StateEnum.Open) {
if (this.isDraft()) {
icon = octGitPullRequestDraft;
color = 'text-github-muted-foreground';
} else {
icon = octGitPullRequest;
color = 'text-github-open-foreground';
}
} else {
icon = octGitPullRequestClosed;
color = 'text-github-closed-foreground';
if (this.isMerged()) {
icon = octGitMerge;
color = 'text-github-done-foreground';
} else {
icon = octGitPullRequestClosed;
color = 'text-github-closed-foreground';
}
}
}

Expand Down

0 comments on commit 1d03f2b

Please sign in to comment.