-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Development: Use directive for programming test status details and di…
…ff report (#9259)
- Loading branch information
1 parent
f908cba
commit ccf278a
Showing
28 changed files
with
219 additions
and
137 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions
24
...t/components/programming-diff-report-detail/programming-diff-report-detail.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,24 @@ | ||
<span jhiTranslate="artemisApp.programmingExercise.diffReport.shortDescription"></span> | ||
<div class="fw-bold"> | ||
<jhi-git-diff-line-stat | ||
[addedLineCount]="detail.data.addedLineCount" | ||
[removedLineCount]="detail.data.removedLineCount" | ||
ngbTooltip="{{ 'artemisApp.programmingExercise.diffReport.lineStatTooltipDetailPage' | artemisTranslate }}" | ||
placement="right" | ||
/> | ||
</div> | ||
@if (detail.data.addedLineCount > 0 || detail.data.removedLineCount > 0) { | ||
<div class="mt-1"> | ||
<jhi-button | ||
[featureToggle]="FeatureToggle.ProgrammingExercises" | ||
[isLoading]="detail.data.isLoadingDiffReport ?? false" | ||
[btnSize]="ButtonSize.SMALL" | ||
[icon]="faCodeCompare" | ||
[title]="'artemisApp.programmingExercise.diffReport.button'" | ||
[tooltip]="'artemisApp.programmingExercise.diffReport.tooltip'" | ||
(onClick)="showGitDiff(detail.data.gitDiffReport)" | ||
[btnType]="WARNING" | ||
[tooltipPlacement]="TooltipPlacement.RIGHT" | ||
/> | ||
</div> | ||
} |
39 changes: 39 additions & 0 deletions
39
...ist/components/programming-diff-report-detail/programming-diff-report-detail.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,39 @@ | ||
import { Component, Input, inject } from '@angular/core'; | ||
import type { ProgrammingDiffReportDetail } from 'app/detail-overview-list/detail.model'; | ||
import { FeatureToggle } from 'app/shared/feature-toggle/feature-toggle.service'; | ||
import { ButtonSize, ButtonType, TooltipPlacement } from 'app/shared/components/button.component'; | ||
import { faCodeCompare } from '@fortawesome/free-solid-svg-icons'; | ||
import { ProgrammingExerciseGitDiffReport } from 'app/entities/hestia/programming-exercise-git-diff-report.model'; | ||
import { GitDiffReportModalComponent } from 'app/exercises/programming/hestia/git-diff-report/git-diff-report-modal.component'; | ||
import { GitDiffReportModule } from 'app/exercises/programming/hestia/git-diff-report/git-diff-report.module'; | ||
import { ArtemisSharedComponentModule } from 'app/shared/components/shared-component.module'; | ||
import { ArtemisSharedModule } from 'app/shared/shared.module'; | ||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
@Component({ | ||
selector: 'jhi-programming-diff-report-detail', | ||
templateUrl: 'programming-diff-report-detail.component.html', | ||
standalone: true, | ||
imports: [ArtemisSharedModule, ArtemisSharedComponentModule, GitDiffReportModule], | ||
}) | ||
export class ProgrammingDiffReportDetailComponent { | ||
protected readonly FeatureToggle = FeatureToggle; | ||
protected readonly ButtonSize = ButtonSize; | ||
protected readonly TooltipPlacement = TooltipPlacement; | ||
protected readonly WARNING = ButtonType.WARNING; | ||
|
||
protected readonly faCodeCompare = faCodeCompare; | ||
|
||
private readonly modalService = inject(NgbModal); | ||
|
||
@Input({ required: true }) detail: ProgrammingDiffReportDetail; | ||
|
||
showGitDiff(gitDiff?: ProgrammingExerciseGitDiffReport) { | ||
if (!gitDiff) { | ||
return; | ||
} | ||
|
||
const modalRef = this.modalService.open(GitDiffReportModalComponent, { windowClass: 'diff-view-modal' }); | ||
modalRef.componentInstance.report = gitDiff; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions
38
...t/components/programming-test-status-detail/programming-test-status-detail.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,38 @@ | ||
@if (detail.data.participation) { | ||
<div class="d-flex align-items-center"> | ||
@if (!detail.data.loading) { | ||
<jhi-updating-result | ||
[exercise]="detail.data.exercise" | ||
[participation]="detail.data.participation" | ||
[showUngradedResults]="true" | ||
[personalParticipation]="false" | ||
[short]="false" | ||
(onParticipationChange)="detail.data.onParticipationChange()" | ||
class="me-2" | ||
/> | ||
} | ||
@if (detail.data.participation.results?.length) { | ||
<jhi-programming-exercise-instructor-status | ||
class="repository-status-icon me-2" | ||
[participationType]="detail.data.type" | ||
[participation]="detail.data.participation" | ||
[exercise]="detail.data.exercise" | ||
/> | ||
@if (detail.data.exercise.isAtLeastEditor) { | ||
<jhi-programming-exercise-instructor-trigger-build-button [exercise]="detail.data.exercise" [participation]="detail.data.participation" /> | ||
} | ||
} | ||
@if (detail.data.exercise.isAtLeastEditor && detail.data.participation.id) { | ||
<a [routerLink]="detail.data.submissionRouterLink" [queryParams]="{ isTmpOrSolutionProgrParticipation: true }" class="ms-2"> | ||
@switch (detail.data.type) { | ||
@case (ProgrammingExerciseParticipationType.TEMPLATE) { | ||
<span jhiTranslate="artemisApp.programmingExercise.detail.showTemplateSubmissions"></span> | ||
} | ||
@case (ProgrammingExerciseParticipationType.SOLUTION) { | ||
<span jhiTranslate="artemisApp.programmingExercise.detail.showSolutionSubmissions"></span> | ||
} | ||
} | ||
</a> | ||
} | ||
</div> | ||
} |
20 changes: 20 additions & 0 deletions
20
...ist/components/programming-test-status-detail/programming-test-status-detail.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,20 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import type { ProgrammingTestStatusDetail } from 'app/detail-overview-list/detail.model'; | ||
import { RouterModule } from '@angular/router'; | ||
import { ArtemisProgrammingExerciseActionsModule } from 'app/exercises/programming/shared/actions/programming-exercise-actions.module'; | ||
import { SubmissionResultStatusModule } from 'app/overview/submission-result-status.module'; | ||
import { ArtemisProgrammingExerciseStatusModule } from 'app/exercises/programming/manage/status/programming-exercise-status.module'; | ||
import { TranslateDirective } from 'app/shared/language/translate.directive'; | ||
import { ProgrammingExerciseParticipationType } from 'app/entities/programming/programming-exercise-participation.model'; | ||
|
||
@Component({ | ||
selector: 'jhi-programming-test-status-detail', | ||
templateUrl: 'programming-test-status-detail.component.html', | ||
standalone: true, | ||
imports: [RouterModule, ArtemisProgrammingExerciseActionsModule, SubmissionResultStatusModule, ArtemisProgrammingExerciseStatusModule, TranslateDirective], | ||
}) | ||
export class ProgrammingTestStatusDetailComponent { | ||
protected readonly ProgrammingExerciseParticipationType = ProgrammingExerciseParticipationType; | ||
|
||
@Input({ required: true }) detail: ProgrammingTestStatusDetail; | ||
} |
File renamed without changes.
File renamed without changes.
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
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
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
Oops, something went wrong.