-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Programming exercises: Add online IDE settings (#8965)
- Loading branch information
Showing
36 changed files
with
823 additions
and
111 deletions.
There are no files selected for viewing
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
43 changes: 43 additions & 0 deletions
43
src/main/java/de/tum/in/www1/artemis/config/TheiaConfiguration.java
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,43 @@ | ||
package de.tum.in.www1.artemis.config; | ||
|
||
import static de.tum.in.www1.artemis.config.Constants.PROFILE_THEIA; | ||
|
||
import java.util.Map; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
|
||
import de.tum.in.www1.artemis.domain.enumeration.ProgrammingLanguage; | ||
|
||
@Profile(PROFILE_THEIA) | ||
@Configuration | ||
@ConfigurationProperties(prefix = "theia") | ||
public class TheiaConfiguration { | ||
|
||
private Map<ProgrammingLanguage, Map<String, String>> images; | ||
|
||
public void setImages(final Map<ProgrammingLanguage, Map<String, String>> images) { | ||
this.images = images; | ||
} | ||
|
||
/** | ||
* Get the images for all languages | ||
* | ||
* @return a map of language -> [flavor/name -> image-link] | ||
*/ | ||
public Map<ProgrammingLanguage, Map<String, String>> getImagesForAllLanguages() { | ||
return images; | ||
} | ||
|
||
/** | ||
* Get the images for a specific language | ||
* | ||
* @param language the language for which the images should be retrieved | ||
* @return a map of flavor/name -> image-link | ||
*/ | ||
public Map<String, String> getImagesForLanguage(ProgrammingLanguage language) { | ||
return images.get(language); | ||
} | ||
|
||
} |
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
41 changes: 41 additions & 0 deletions
41
src/main/java/de/tum/in/www1/artemis/web/rest/theia/TheiaConfigurationResource.java
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,41 @@ | ||
package de.tum.in.www1.artemis.web.rest.theia; | ||
|
||
import static de.tum.in.www1.artemis.config.Constants.PROFILE_THEIA; | ||
|
||
import java.util.Map; | ||
|
||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import de.tum.in.www1.artemis.config.TheiaConfiguration; | ||
import de.tum.in.www1.artemis.domain.enumeration.ProgrammingLanguage; | ||
import de.tum.in.www1.artemis.security.annotations.EnforceAtLeastInstructor; | ||
|
||
@Profile(PROFILE_THEIA) | ||
@RestController | ||
@RequestMapping("api/theia/") | ||
public class TheiaConfigurationResource { | ||
|
||
private final TheiaConfiguration theiaConfiguration; | ||
|
||
public TheiaConfigurationResource(TheiaConfiguration theiaConfiguration) { | ||
this.theiaConfiguration = theiaConfiguration; | ||
} | ||
|
||
/** | ||
* GET /api/theia/images?language=<language>: Get the images for a specific language | ||
* | ||
* @param language the language for which the images should be retrieved | ||
* @return a map of flavor/name -> image-link | ||
*/ | ||
@GetMapping("images") | ||
@EnforceAtLeastInstructor | ||
public ResponseEntity<Map<String, String>> getImagesForLanguage(@RequestParam("language") ProgrammingLanguage language) { | ||
return ResponseEntity.ok(this.theiaConfiguration.getImagesForLanguage(language)); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
theia: | ||
portal-url: https://your-theia-instance.com | ||
portal-url: https://your-theia-instance.com | ||
|
||
# Theia IDE images available for the different programming languages | ||
images: | ||
# Upper level key is the language category (must match the language key in the programming-exercise configuration) | ||
java: | ||
# Lower level key can be multiple flavors of the image, e.g. version, tag, or additional dependencies | ||
Java-17: "my-registry/my-image:my-tag" | ||
# Add more flavors here (e.g. Java-11, Java-8, etc.) | ||
# Add more languages here (e.g. c, python, etc.) | ||
c: | ||
C: "my-registry/my-image:my-tag" |
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.