Skip to content
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

Feature/add jplag frontend #873

Open
wants to merge 6 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/app/api/models/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,12 @@ export class Task extends Entity {
}/task_def_id/${this.definition.id}/submission${asAttachment ? '?as_attachment=true' : ''}`;
}

public jplagReportUrl(): string {
return `${AppInjector.get(DoubtfireConstants).API_URL}/units/${
this._unit.id
}/task_definitions/${this.definition.id}/jplag_report`;
}

public testSubmissionUrl(): string {
return `${AppInjector.get(DoubtfireConstants).API_URL}/units/${this.unit.id}/task_definitions/${
this.definition.id
Expand Down
4 changes: 4 additions & 0 deletions src/app/common/footer/footer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@
<mat-icon matListItemIcon aria-label="View Similarities">crisis_alert</mat-icon>
View similarities
</button>
<button mat-menu-item (click)="downloadJPLAGReport()">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide this if there is no code similarity checks for the task definition

<mat-icon matListItemIcon aria-label="Download JPLAG Report">download</mat-icon>
Download JPLAG report
</button>
<mat-divider></mat-divider>
<button mat-menu-item (click)="selectedTask?.updateTaskStatus('feedback_exceeded')">
<mat-icon matListItemIcon aria-label="Switch to Feedback Exceeded">running_with_errors</mat-icon>
Expand Down
8 changes: 8 additions & 0 deletions src/app/common/footer/footer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ export class FooterComponent implements OnInit {
);
}

downloadJPLAGReport() {
this.fileDownloader.downloadFile(
this.selectedTask.jplagReportUrl(),
`${this.selectedTask.definition.name}-jplag-report.zip`,
);
}

viewTaskSheet() {
this.selectedTaskService.showTaskSheet();
}
Expand All @@ -78,4 +85,5 @@ export class FooterComponent implements OnInit {
viewSimilarity() {
this.selectedTaskService.showSimilarity();
}

}
5 changes: 5 additions & 0 deletions src/app/projects/states/dashboard/selected-task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum DashboardViews {
submission,
task,
similarity,
jplag,
}

@Injectable({
Expand Down Expand Up @@ -61,6 +62,10 @@ export class SelectedTaskService {
this.currentView$.next(DashboardViews.similarity);
}

public showJPLAGReport() {
this.currentView$.next(DashboardViews.jplag);
}

public showSubmission() {
if (!this.task$.value) return;
this.currentPdfUrl$.next(this.task$.value.submissionUrl(false));
Expand Down
Loading