Skip to content

Commit

Permalink
Merge branch 'feature/programming-exercises/code-hint-monaco' into fe…
Browse files Browse the repository at this point in the history
…ature/programming-exercises/testwise-coverage-monaco
  • Loading branch information
pzdr7 authored Aug 10, 2024
2 parents cee6610 + f82502a commit 70df865
Show file tree
Hide file tree
Showing 97 changed files with 917 additions and 848 deletions.
932 changes: 407 additions & 525 deletions package-lock.json

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
"node_modules"
],
"dependencies": {
"@angular/animations": "18.1.3",
"@angular/cdk": "18.1.3",
"@angular/common": "18.1.3",
"@angular/compiler": "18.1.3",
"@angular/core": "18.1.3",
"@angular/forms": "18.1.3",
"@angular/localize": "18.1.3",
"@angular/material": "18.1.3",
"@angular/platform-browser-dynamic": "18.1.3",
"@angular/platform-browser": "18.1.3",
"@angular/router": "18.1.3",
"@angular/service-worker": "18.1.3",
"@angular/animations": "18.1.4",
"@angular/cdk": "18.1.4",
"@angular/common": "18.1.4",
"@angular/compiler": "18.1.4",
"@angular/core": "18.1.4",
"@angular/forms": "18.1.4",
"@angular/localize": "18.1.4",
"@angular/material": "18.1.4",
"@angular/platform-browser-dynamic": "18.1.4",
"@angular/platform-browser": "18.1.4",
"@angular/router": "18.1.4",
"@angular/service-worker": "18.1.4",
"@ctrl/ngx-emoji-mart": "9.2.0",
"@danielmoncada/angular-datetime-picker": "18.0.0",
"@fingerprintjs/fingerprintjs": "4.4.3",
Expand All @@ -37,15 +37,15 @@
"@ng-bootstrap/ng-bootstrap": "17.0.0",
"@ngx-translate/core": "15.0.0",
"@ngx-translate/http-loader": "8.0.0",
"@sentry/angular": "8.22.0",
"@sentry/angular": "8.24.0",
"@swimlane/ngx-charts": "20.5.0",
"@swimlane/ngx-graph": "8.4.0",
"@vscode/codicons": "0.0.36",
"ace-builds": "1.35.4",
"bootstrap": "5.3.3",
"brace": "0.11.1",
"compare-versions": "6.1.1",
"core-js": "3.37.1",
"core-js": "3.38.0",
"crypto-js": "4.2.0",
"dayjs": "1.11.12",
"diff-match-patch-typescript": "1.0.8",
Expand All @@ -64,7 +64,7 @@
"ngx-infinite-scroll": "18.0.0",
"ngx-webstorage": "18.0.0",
"papaparse": "5.4.1",
"posthog-js": "1.154.2",
"posthog-js": "1.154.5",
"rxjs": "7.8.1",
"showdown": "2.1.0",
"showdown-highlight": "3.1.0",
Expand All @@ -78,7 +78,7 @@
"uuid": "10.0.0",
"webstomp-client": "1.2.6",
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
"zone.js": "0.14.8"
"zone.js": "0.14.10"
},
"overrides": {
"@swimlane/ngx-graph": {
Expand Down Expand Up @@ -118,16 +118,16 @@
},
"devDependencies": {
"@angular-builders/jest": "18.0.0",
"@angular-devkit/build-angular": "18.1.3",
"@angular-devkit/build-angular": "18.1.4",
"@angular-eslint/builder": "18.2.0",
"@angular-eslint/eslint-plugin": "18.2.0",
"@angular-eslint/eslint-plugin-template": "18.2.0",
"@angular-eslint/schematics": "18.2.0",
"@angular-eslint/template-parser": "18.2.0",
"@angular/cli": "18.1.3",
"@angular/compiler-cli": "18.1.3",
"@angular/language-service": "18.1.3",
"@sentry/types": "8.22.0",
"@angular/cli": "18.1.4",
"@angular/compiler-cli": "18.1.4",
"@angular/language-service": "18.1.4",
"@sentry/types": "8.24.0",
"@types/crypto-js": "4.2.2",
"@types/d3-shape": "3.1.6",
"@types/dompurify": "3.0.5",
Expand All @@ -139,12 +139,12 @@
"@types/smoothscroll-polyfill": "0.3.4",
"@types/sockjs-client": "1.5.4",
"@types/uuid": "10.0.0",
"@typescript-eslint/eslint-plugin": "8.0.0",
"@typescript-eslint/parser": "8.0.0",
"@typescript-eslint/eslint-plugin": "8.0.1",
"@typescript-eslint/parser": "8.0.1",
"eslint": "9.8.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-deprecation": "3.0.0",
"eslint-plugin-jest": "28.6.0",
"eslint-plugin-jest": "28.8.0",
"eslint-plugin-jest-extended": "2.4.0",
"eslint-plugin-prettier": "5.2.1",
"folder-hash": "4.0.4",
Expand All @@ -161,7 +161,7 @@
"prettier": "3.3.3",
"sass": "1.77.8",
"ts-jest": "29.2.4",
"typescript": "5.4.5",
"typescript": "5.5.4",
"weak-napi": "2.0.2"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export class PasswordResetInitComponent implements OnInit, AfterViewInit {
this.externalCredentialProvider = profileInfo.externalCredentialProvider;
const lang = this.translateService.currentLang;
const linkMap = profileInfo.externalPasswordResetLinkMap;
if (linkMap[lang]) {
this.externalPasswordResetLink = linkMap[lang];
if (linkMap.get(lang)) {
this.externalPasswordResetLink = linkMap.get(lang);
} else {
this.externalPasswordResetLink = linkMap['en'];
this.externalPasswordResetLink = linkMap.get('en');
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class MetricsModalThreadsComponent implements OnInit {
const filteredAttributes = ['threadName', 'threadId', 'blockedTime', 'blockedCount', 'waitedTime', 'waitedCount', 'lockName'];
return Object.keys(thread)
.filter((key) => filteredAttributes.includes(key))
.some((key) => thread[key]?.toString().toLowerCase().includes(this.threadFilter!.toLowerCase()));
.some((key) => thread[key as keyof Thread]?.toString().toLowerCase().includes(this.threadFilter!.toLowerCase()));
}

private isMatchingSelectedThreadState(thread: Thread): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class UserManagementComponent implements OnInit, OnDestroy {
const tempInStorage = temp
? temp
.split(',')
.map((filter: string) => type[filter])
.map((filter: keyof Filter) => type[filter])
.filter(Boolean)
: new Set();
return new Set(tempInStorage);
Expand Down Expand Up @@ -291,36 +291,29 @@ export class UserManagementComponent implements OnInit, OnDestroy {
}
}

/**
* Generic method to return all possible filter values per category.
*/
getFilter(type: Filter) {
return Object.keys(type).map((value) => type[value]);
}

/**
* Get all filter options for authorities.
*/
get authorityFilters() {
return this.getFilter(AuthorityFilter);
return Object.values<AuthorityFilter>(AuthorityFilter);
}

/**
* Get all filter options for origin.
*/
get originFilters() {
return this.getFilter(OriginFilter);
return Object.values<OriginFilter>(OriginFilter);
}

/**
* Get all filter options for status.
*/
get statusFilters() {
return this.getFilter(StatusFilter);
return Object.values<StatusFilter>(StatusFilter);
}

get registrationNumberFilters() {
return this.getFilter(RegistrationNumberFilter);
return Object.values<RegistrationNumberFilter>(RegistrationNumberFilter);
}

/**
Expand Down
8 changes: 0 additions & 8 deletions src/main/webapp/app/app.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ import { ArtemisAppModule } from './app.module';
import { MonacoConfig } from 'app/core/config/monaco.config';

ProdConfig();

if (module['hot']) {
module['hot'].accept();
if ('production' !== process.env.NODE_ENV) {
console.clear();
}
}

MonacoConfig();

platformBrowserDynamic()
Expand Down
7 changes: 1 addition & 6 deletions src/main/webapp/app/core/theme/theme-switch.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,8 @@ export class ThemeSwitchComponent implements OnInit {
});
}

/**
* Open the popover if this is not a cypress test
*/
openPopover() {
if (!window['Cypress']) {
this.popover?.open();
}
this.popover?.open();
clearTimeout(this.closeTimeout);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export abstract class ImportCourseCompetenciesComponent implements OnInit, Compo
//Other constants
protected readonly ButtonType = ButtonType;
//used for sorting of the selected course competencies
protected readonly columnMapping = {
protected readonly columnMapping: { [key: string]: string } = {
ID: 'id',
TITLE: 'title',
DESCRIPTION: 'description',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class CourseAccessStorageService {

if (Object.keys(courseAccessMap).length > maxAccessedCourses) {
const oldestEntry = Object.entries(courseAccessMap).reduce((prev, curr) => (prev[1] < curr[1] ? prev : curr));
delete courseAccessMap[oldestEntry[0]];
delete courseAccessMap[Number(oldestEntry[0])];
}

this.localStorage.store(storageKey, courseAccessMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ export class CourseScoresComponent implements OnInit, OnDestroy {
}

private createStudentPlagiarismMap(plagiarismCases?: PlagiarismCase[]): { [id: number]: boolean } {
const plagiarismMap = {};
const plagiarismMap: { [id: number]: boolean } = {};
plagiarismCases?.forEach((plagiarismCase) => {
if (plagiarismCase.verdict === PlagiarismVerdict.PLAGIARISM && plagiarismCase.student?.id) {
plagiarismMap[plagiarismCase.student.id] = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ <h4 class="fw-medium" id="course-page-heading" jhiTranslate="artemisApp.course.h
<jhi-course-management-card
class="col-md-8"
[course]="course"
[courseStatistics]="statistics[course.id!]"
[courseWithExercises]="coursesWithExercises[course.id!]"
[courseWithUsers]="coursesWithUsers[course.id!]"
[courseStatistics]="statistics.get(course.id!)"
[courseWithExercises]="coursesWithExercises.get(course.id!)"
[courseWithUsers]="coursesWithUsers.get(course.id!)"
[isGuidedTour]="course === courseForGuidedTour"
/>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export class CourseManagementComponent implements OnInit, OnDestroy, AfterViewIn
// We use this extra map of courses to improve performance by allowing us to use OnPush change detection
result.body!.forEach((course) => {
if (course.id) {
this.coursesWithExercises[course.id] = course;
this.coursesWithExercises.set(course.id, course);
}
});
},
Expand All @@ -199,7 +199,7 @@ export class CourseManagementComponent implements OnInit, OnDestroy, AfterViewIn
next: (result: HttpResponse<CourseManagementOverviewStatisticsDto[]>) => {
result.body!.forEach((statisticsDTO) => {
if (statisticsDTO.courseId) {
this.statistics[statisticsDTO.courseId] = statisticsDTO;
this.statistics.set(statisticsDTO.courseId, statisticsDTO);
}
});
},
Expand All @@ -216,7 +216,7 @@ export class CourseManagementComponent implements OnInit, OnDestroy, AfterViewIn
// We use this extra map of courses to improve performance by allowing us to use OnPush change detection
result.body!.forEach((course) => {
if (course.id) {
this.coursesWithUsers[course.id] = course;
this.coursesWithUsers.set(course.id, course);
}
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ export class CourseDetailLineChartComponent extends ActiveStudentsChart implemen

data: any[];
// Data changes will be stored in the copy first, to trigger change detection when ready
dataCopy = [
dataCopy: { name: string; series: { name?: string; value?: number }[] }[] = [
{
name: '',
series: [{}],
},
];
// Used for storing absolute values to display in tooltip
absoluteSeries = [{}];
absoluteSeries: { absoluteValue?: number; name?: string }[] = [{}];
curve: any = shape.curveMonotoneX;
average = { name: 'Mean', value: 0 };
startDateDisplayed = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ <h3 class="card-title text-center fw-medium course-title">{{ course.title }} ({{
[course]="course"
[rowType]="exerciseRowType.FUTURE"
[details]="exercise"
[statistic]="statisticsPerExercise[exercise.id!]"
[statistic]="statisticsPerExercise.get(exercise.id!)"
/>
}
</div>
Expand All @@ -148,7 +148,7 @@ <h3 class="card-title text-center fw-medium course-title">{{ course.title }} ({{
[course]="course"
[rowType]="exerciseRowType.CURRENT"
[details]="exercise"
[statistic]="statisticsPerExercise[exercise.id!]"
[statistic]="statisticsPerExercise.get(exercise.id!)"
/>
}
</div>
Expand All @@ -171,7 +171,7 @@ <h3 class="card-title text-center fw-medium course-title">{{ course.title }} ({{
[course]="course"
[rowType]="exerciseRowType.ASSESSING"
[details]="exercise"
[statistic]="statisticsPerExercise[exercise.id!]"
[statistic]="statisticsPerExercise.get(exercise.id!)"
/>
}
</div>
Expand All @@ -194,7 +194,7 @@ <h3 class="card-title text-center fw-medium course-title">{{ course.title }} ({{
[course]="course"
[rowType]="exerciseRowType.PAST"
[details]="exercise"
[statistic]="statisticsPerExercise[exercise.id!]"
[statistic]="statisticsPerExercise.get(exercise.id!)"
/>
}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
faAngleUp,
faChartBar,
faClipboard,
faComment,
faComments,
faFilePdf,
faFlag,
Expand All @@ -38,9 +37,9 @@ export class CourseManagementCardComponent implements OnChanges {
CachingStrategy = CachingStrategy;
// TODO: can we merge the 3 courses here?
@Input() course: Course;
@Input() courseStatistics: CourseManagementOverviewStatisticsDto;
@Input() courseWithExercises: Course;
@Input() courseWithUsers: Course;
@Input() courseStatistics?: CourseManagementOverviewStatisticsDto;
@Input() courseWithExercises: Course | undefined;
@Input() courseWithUsers: Course | undefined;
@Input() isGuidedTour: boolean;

statisticsPerExercise = new Map<number, CourseManagementOverviewExerciseStatisticsDTO>();
Expand Down Expand Up @@ -71,7 +70,6 @@ export class CourseManagementCardComponent implements OnChanges {
faListAlt = faListAlt;
faChartBar = faChartBar;
faFilePdf = faFilePdf;
faComment = faComment;
faComments = faComments;
faClipboard = faClipboard;
faGraduationCap = faGraduationCap;
Expand All @@ -96,7 +94,11 @@ export class CourseManagementCardComponent implements OnChanges {
// Only sort one time once loaded
if (!this.statisticsSorted && this.courseStatistics && this.courseStatistics.exerciseDTOS?.length > 0) {
this.statisticsSorted = true;
this.courseStatistics.exerciseDTOS.forEach((dto) => (this.statisticsPerExercise[dto.exerciseId!] = dto));
this.courseStatistics.exerciseDTOS.forEach((dto) => {
if (dto.exerciseId !== undefined) {
this.statisticsPerExercise.set(dto.exerciseId, dto);
}
});
}

// Only sort one time once loaded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export enum ExerciseRowType {
export class CourseManagementExerciseRowComponent implements OnChanges {
@Input() course: Course;
@Input() details: Exercise;
@Input() statistic: CourseManagementOverviewExerciseStatisticsDTO;
@Input() statistic?: CourseManagementOverviewExerciseStatisticsDTO;
@Input() rowType: ExerciseRowType;

// Expose enums to the template
Expand Down
Loading

0 comments on commit 70df865

Please sign in to comment.