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

Iris: Rework settings system #7424

Merged
merged 47 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0e7eda1
Save work
Hialus Oct 14, 2023
ea86088
Merge branch 'develop' into refactor/iris-settings-rework
Hialus Oct 16, 2023
e7cc8dd
Save work
Hialus Oct 16, 2023
bfaa51a
Save work
Hialus Oct 19, 2023
8033773
Merge branch 'develop' into refactor/iris-settings-rework
Hialus Oct 19, 2023
0b58287
Improve migration
Hialus Oct 19, 2023
7317a14
Client side
Hialus Oct 20, 2023
b7a02ba
Small fixes
Hialus Oct 20, 2023
6971eb6
Merge branch 'develop' into refactor/iris-settings-rework
Hialus Oct 20, 2023
f825508
Fix CodeHintResource
Hialus Oct 20, 2023
f819ebe
Merge remote-tracking branch 'origin/refactor/iris-settings-rework' i…
Hialus Oct 20, 2023
0792f09
Fix IrisSettingsResource
Hialus Oct 23, 2023
ab3ebaf
Merge branch 'develop' into refactor/iris-settings-rework
Hialus Oct 23, 2023
6ec2983
Fix server tests
Hialus Oct 23, 2023
443c6de
Fix migration
Hialus Oct 25, 2023
86ed8cf
Add JavaDocs
Hialus Oct 25, 2023
cbf619b
Add JavaDocs 2: The revenge of the generics
Hialus Oct 25, 2023
a642960
Merge branch 'develop' into refactor/iris-settings-rework
Hialus Oct 25, 2023
29476c0
Improve UI Nr 1.
Hialus Oct 28, 2023
983a126
Improve the UI Nr 2.
Hialus Oct 31, 2023
1f79059
Merge branch 'develop' into refactor/iris-settings-rework
Oct 31, 2023
be5a61a
Fix server tests
Hialus Oct 31, 2023
8a4b578
Fix client tests
Hialus Oct 31, 2023
f5f9ac4
Fix client tests II
Hialus Oct 31, 2023
d147dea
Improve client tests
Hialus Nov 5, 2023
571ecfb
Add code editor sub settings in UI
Hialus Nov 5, 2023
41baa32
Merge branch 'develop' into refactor/iris-settings-rework
Nov 5, 2023
f9dd37f
Fix client tests
Hialus Nov 5, 2023
e576d2c
Merge branch 'develop' into refactor/iris-settings-rework
Hialus Nov 5, 2023
adae0fd
Improve client test coverage
Hialus Nov 5, 2023
5696fb7
Merge remote-tracking branch 'origin/refactor/iris-settings-rework' i…
Nov 5, 2023
c81d21b
Merge branch 'develop' into refactor/iris-settings-rework
Hialus Nov 5, 2023
f980e83
Fix client tests
Hialus Nov 5, 2023
23d4bdb
Fix client tests II
Hialus Nov 5, 2023
67db379
Fix client tests III
Hialus Nov 5, 2023
f73d45f
Work around weird Angular stuff
Hialus Nov 6, 2023
35adfc1
Merge branch 'develop' into refactor/iris-settings-rework
Hialus Nov 12, 2023
a46bd9d
2 small fixes
Hialus Nov 12, 2023
8486e1a
Merge remote-tracking branch 'origin/refactor/iris-settings-rework' i…
Hialus Nov 12, 2023
953bd07
2 small UI fixes
Hialus Nov 12, 2023
70e5ffa
Merge branch 'develop' into refactor/iris-settings-rework
Hialus Nov 15, 2023
b699ab5
Merge branch 'develop' into refactor/iris-settings-rework
Hialus Nov 20, 2023
3578158
Fix deletion of courses and exercises that have Iris settings defined
Hialus Nov 20, 2023
33fae33
Fix if Iris profile is not present
Hialus Nov 22, 2023
19b5c93
Merge branch 'develop' into refactor/iris-settings-rework
Hialus Nov 22, 2023
f720a4d
Add specific buttons to enable/disable Iris features on the course an…
Hialus Nov 22, 2023
2be70c8
Merge branch 'develop' into refactor/iris-settings-rework
Hialus Nov 22, 2023
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
13 changes: 0 additions & 13 deletions src/main/java/de/tum/in/www1/artemis/domain/Course.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import de.tum.in.www1.artemis.domain.enumeration.Language;
import de.tum.in.www1.artemis.domain.enumeration.ProgrammingLanguage;
import de.tum.in.www1.artemis.domain.exam.Exam;
import de.tum.in.www1.artemis.domain.iris.settings.IrisSettings;
import de.tum.in.www1.artemis.domain.metis.Post;
import de.tum.in.www1.artemis.domain.tutorialgroups.TutorialGroup;
import de.tum.in.www1.artemis.domain.tutorialgroups.TutorialGroupsConfiguration;
Expand Down Expand Up @@ -255,10 +254,6 @@ public class Course extends DomainObject {
@JsonIgnoreProperties("course")
private TutorialGroupsConfiguration tutorialGroupsConfiguration;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
@JoinColumn(name = "iris_settings_id")
private IrisSettings irisSettings;

// NOTE: Helpers variable names must be different from Getter name, so that Jackson ignores the @Transient annotation, but Hibernate still respects it
@Transient
private Long numberOfInstructorsTransient;
Expand Down Expand Up @@ -1030,12 +1025,4 @@ public String getCourseInformationSharingMessagingCodeOfConduct() {
public void setCourseInformationSharingMessagingCodeOfConduct(String courseInformationSharingMessagingCodeOfConduct) {
this.courseInformationSharingMessagingCodeOfConduct = courseInformationSharingMessagingCodeOfConduct;
}

public IrisSettings getIrisSettings() {
return irisSettings;
}

public void setIrisSettings(IrisSettings irisSettings) {
this.irisSettings = irisSettings;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import de.tum.in.www1.artemis.domain.enumeration.*;
import de.tum.in.www1.artemis.domain.hestia.ExerciseHint;
import de.tum.in.www1.artemis.domain.hestia.ProgrammingExerciseTask;
import de.tum.in.www1.artemis.domain.iris.settings.IrisSettings;
import de.tum.in.www1.artemis.domain.participation.Participation;
import de.tum.in.www1.artemis.domain.participation.SolutionProgrammingExerciseParticipation;
import de.tum.in.www1.artemis.domain.participation.StudentParticipation;
Expand Down Expand Up @@ -143,10 +142,6 @@ public String getType() {
@Column(name = "release_tests_with_example_solution", table = "programming_exercise_details")
private boolean releaseTestsWithExampleSolution;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
@JoinColumn(name = "iris_settings_id", table = "programming_exercise_details")
private IrisSettings irisSettings;

/**
* This boolean flag determines whether the solution repository should be checked out during the build (additional to the student's submission).
* This property is only used when creating the exercise (the client sets this value when POSTing the new exercise to the server).
Expand Down Expand Up @@ -855,10 +850,6 @@ public void generateAndSetBuildPlanAccessSecret() {
buildPlanAccessSecret = UUID.randomUUID().toString();
}

public IrisSettings getIrisSettings() {
return irisSettings;
}

/**
* {@inheritDoc}
*/
Expand All @@ -868,8 +859,4 @@ public void disconnectRelatedEntities() {

super.disconnectRelatedEntities();
}

public void setIrisSettings(IrisSettings irisSettings) {
this.irisSettings = irisSettings;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package de.tum.in.www1.artemis.domain.iris.settings;

import javax.annotation.Nullable;
import javax.persistence.*;

Check warning on line 4 in src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisChatSubSettings.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisChatSubSettings.java#L4

Star import of `javax.persistence.*` should not be used https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=refactor%2Firis-settings-rework%3AHEAD&id=DD29377F3A4E853D007A20FF15609A6A

import com.fasterxml.jackson.annotation.JsonInclude;

import de.tum.in.www1.artemis.domain.iris.IrisTemplate;

/**
* An {@link IrisSubSettings} implementation for chat settings.
* Chat settings notably provide settings for the rate limit.
* Chat settings provide a single {@link IrisTemplate} for the chat messages.
*/
@Entity
@DiscriminatorValue("CHAT")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class IrisChatSubSettings extends IrisSubSettings {

@Nullable
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
private IrisTemplate template;

@Nullable
@Column(name = "rate_limit")
private Integer rateLimit;

@Nullable
@Column(name = "rate_limit_timeframe_hours")
private Integer rateLimitTimeframeHours;

@Nullable
public IrisTemplate getTemplate() {
return template;
}

public void setTemplate(@Nullable IrisTemplate template) {
this.template = template;
}

@Nullable
public Integer getRateLimit() {
return rateLimit;
}

public void setRateLimit(@Nullable Integer rateLimit) {
this.rateLimit = rateLimit;
}

@Nullable
public Integer getRateLimitTimeframeHours() {
return rateLimitTimeframeHours;
}

public void setRateLimitTimeframeHours(@Nullable Integer rateLimitTimeframeHours) {
this.rateLimitTimeframeHours = rateLimitTimeframeHours;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package de.tum.in.www1.artemis.domain.iris.settings;

import javax.annotation.Nullable;
import javax.persistence.*;

Check warning on line 4 in src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisCodeEditorSubSettings.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisCodeEditorSubSettings.java#L4

Star import of `javax.persistence.*` should not be used https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=refactor%2Firis-settings-rework%3AHEAD&id=AF15C1FDE4ADF2CA9E8632CBE8AA1E96

import com.fasterxml.jackson.annotation.JsonInclude;

import de.tum.in.www1.artemis.domain.iris.IrisTemplate;

/**
* An {@link IrisSubSettings} implementation for code editor settings.
* Code editor settings notably provide multiple {@link IrisTemplate}s for the different steps in the code generation.
*/
@Entity
@DiscriminatorValue("CODE_EDITOR")
@SecondaryTable(name = "iris_code_editor_sub_settings")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class IrisCodeEditorSubSettings extends IrisSubSettings {

@Nullable
@JoinColumn(table = "iris_code_editor_sub_settings")
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
private IrisTemplate chatTemplate;

@Nullable
@JoinColumn(table = "iris_code_editor_sub_settings")
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
private IrisTemplate problemStatementGenerationTemplate;

@Nullable
@JoinColumn(table = "iris_code_editor_sub_settings")
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
private IrisTemplate templateRepoGenerationTemplate;

@Nullable
@JoinColumn(table = "iris_code_editor_sub_settings")
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
private IrisTemplate solutionRepoGenerationTemplate;

@Nullable
@JoinColumn(table = "iris_code_editor_sub_settings")
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
private IrisTemplate testRepoGenerationTemplate;

@Nullable
public IrisTemplate getChatTemplate() {
return chatTemplate;
}

public void setChatTemplate(@Nullable IrisTemplate chatTemplate) {
this.chatTemplate = chatTemplate;
}

@Nullable
public IrisTemplate getProblemStatementGenerationTemplate() {
return problemStatementGenerationTemplate;
}

public void setProblemStatementGenerationTemplate(@Nullable IrisTemplate problemStatementGenerationTemplate) {
this.problemStatementGenerationTemplate = problemStatementGenerationTemplate;
}

@Nullable
public IrisTemplate getTemplateRepoGenerationTemplate() {
return templateRepoGenerationTemplate;
}

public void setTemplateRepoGenerationTemplate(@Nullable IrisTemplate templateRepoGenerationTemplate) {
this.templateRepoGenerationTemplate = templateRepoGenerationTemplate;
}

@Nullable
public IrisTemplate getSolutionRepoGenerationTemplate() {
return solutionRepoGenerationTemplate;
}

public void setSolutionRepoGenerationTemplate(@Nullable IrisTemplate solutionRepoGenerationTemplate) {
this.solutionRepoGenerationTemplate = solutionRepoGenerationTemplate;
}

@Nullable
public IrisTemplate getTestRepoGenerationTemplate() {
return testRepoGenerationTemplate;
}

public void setTestRepoGenerationTemplate(@Nullable IrisTemplate testRepoGenerationTemplate) {
this.testRepoGenerationTemplate = testRepoGenerationTemplate;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package de.tum.in.www1.artemis.domain.iris.settings;

import javax.persistence.*;

Check warning on line 3 in src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisCourseSettings.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisCourseSettings.java#L3

Star import of `javax.persistence.*` should not be used https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=refactor%2Firis-settings-rework%3AHEAD&id=CA6F02C84630F6D34994E64C4762121E

import com.fasterxml.jackson.annotation.JsonInclude;

import de.tum.in.www1.artemis.domain.Course;

/**
* An {@link IrisSettings} implementation for course specific settings.
* Course settings are used to override global settings and allows all sub setting types.
*/
@Entity
@DiscriminatorValue("COURSE")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class IrisCourseSettings extends IrisSettings {

@OneToOne(optional = false)
@JoinColumn(name = "course_id", unique = true, nullable = false)
private Course course;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "iris_chat_settings_id")
private IrisChatSubSettings irisChatSettings;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "iris_hestia_settings_id")
private IrisHestiaSubSettings irisHestiaSettings;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "iris_code_editor_settings_id")
private IrisCodeEditorSubSettings irisCodeEditorSettings;

@Override
public boolean isValid() {
return course != null;
}

public Course getCourse() {
return course;
}

public void setCourse(Course course) {
this.course = course;
}

public IrisChatSubSettings getIrisChatSettings() {
return irisChatSettings;
}

public void setIrisChatSettings(IrisChatSubSettings irisChatSettings) {
this.irisChatSettings = irisChatSettings;
}

public IrisHestiaSubSettings getIrisHestiaSettings() {
return irisHestiaSettings;
}

public void setIrisHestiaSettings(IrisHestiaSubSettings irisHestiaSettings) {
this.irisHestiaSettings = irisHestiaSettings;
}

@Override
public IrisCodeEditorSubSettings getIrisCodeEditorSettings() {
return irisCodeEditorSettings;
}

@Override
public void setIrisCodeEditorSettings(IrisCodeEditorSubSettings irisCodeEditorSettings) {
this.irisCodeEditorSettings = irisCodeEditorSettings;
}

Check warning on line 71 in src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisCourseSettings.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisCourseSettings.java#L47-L71

Clone with 2 instances of length 12 https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=refactor%2Firis-settings-rework%3AHEAD&id=5645F3668E48522319646CC347EEFB61
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package de.tum.in.www1.artemis.domain.iris.settings;

import javax.persistence.*;

Check warning on line 3 in src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisExerciseSettings.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisExerciseSettings.java#L3

Star import of `javax.persistence.*` should not be used https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=refactor%2Firis-settings-rework%3AHEAD&id=A2FD20EE72394AA37053B05340BFAAB1

import com.fasterxml.jackson.annotation.JsonInclude;

import de.tum.in.www1.artemis.domain.Exercise;

/**
* An {@link IrisSettings} implementation for exercise specific settings.
* Exercise settings are used to override course settings and currently only allow setting the {@link IrisChatSubSettings}.
*/
@Entity
@DiscriminatorValue("EXERCISE")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class IrisExerciseSettings extends IrisSettings {

@OneToOne(optional = false)
@JoinColumn(name = "exercise_id", unique = true, nullable = false)
private Exercise exercise;

@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "iris_chat_settings_id")
private IrisChatSubSettings irisChatSettings;

@Override
public boolean isValid() {
return exercise != null;
}

public Exercise getExercise() {
return exercise;
}

public void setExercise(Exercise exercise) {
this.exercise = exercise;
}

public IrisChatSubSettings getIrisChatSettings() {
return irisChatSettings;
}

public void setIrisChatSettings(IrisChatSubSettings irisChatSettings) {
this.irisChatSettings = irisChatSettings;
}

@Override
public IrisHestiaSubSettings getIrisHestiaSettings() {
return null;
}

@Override
public void setIrisHestiaSettings(IrisHestiaSubSettings irisHestiaSettings) {

}

Check warning on line 55 in src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisExerciseSettings.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisExerciseSettings.java#L53-L55

Empty block: method https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=refactor%2Firis-settings-rework%3AHEAD&id=BDFC1B8C68E4857AF5C5CF392E8DAA7F

@Override
public IrisCodeEditorSubSettings getIrisCodeEditorSettings() {
return null;
}

@Override
public void setIrisCodeEditorSettings(IrisCodeEditorSubSettings irisCodeEditorSettings) {

}

Check warning on line 65 in src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisExerciseSettings.java

View check run for this annotation

Teamscale / teamscale-findings

src/main/java/de/tum/in/www1/artemis/domain/iris/settings/IrisExerciseSettings.java#L63-L65

Empty block: method https://teamscale.io/findings.html#details/GitHub-ls1intum-Artemis?t=refactor%2Firis-settings-rework%3AHEAD&id=929BC85EF1A0FFCA59FF495D80C90885
}
Loading
Loading