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: Load default templates from resource folder #7418

Merged
merged 12 commits into from
Dec 4, 2023

Conversation

MichaelOwenDyer
Copy link
Contributor

@MichaelOwenDyer MichaelOwenDyer commented Oct 18, 2023

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I followed the coding and design guidelines.
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).
  • I documented the Java code using JavaDoc style.

Client

No client changes

Motivation and Context

The current solution for default Iris templates is to put them all into a single static utility class, IrisConstants.java. This is not scalable, offers no syntax highlighting, and forces the system to be recompiled every time a default template is changed.

Description

Each default Iris template now gets its own .hbs (handlebars) file in the resources/templates/iris folder. The files are loaded using the IrisDefaultTemplateService, which uses the ResourceLoaderService to access the file with the requested filename in the folder. The IrisSettingsService then uses this service to load the default templates into the global settings at application startup.
The global template version used to be a static int field in IrisConstants, and this has also gotten its own file next to the templates. The content of this file is supposed to be just a single int and incremented every time one of the templates is adapted to trigger a reload from the files on application startup.

Please let me know if I have followed all best practices here!

Steps for Testing

Prerequisites:

  • 1 Administrator
  1. Log in to Artemis
  2. Navigate to Server Administration -> Global Iris Settings
  3. Ensure that the contents of each template file have been loaded into their corresponding text areas in the settings, e.g. chat.hbs -> chat settings, hestia.hbs -> hestia settings, and the same for all code editor files.

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked







@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) template labels Oct 18, 2023
@MichaelOwenDyer MichaelOwenDyer marked this pull request as ready for review October 19, 2023 12:25
@MichaelOwenDyer MichaelOwenDyer requested a review from a team as a code owner October 19, 2023 12:25
@xHadie
Copy link

xHadie commented Oct 19, 2023

LS11_LEGACY
I don't see the "Global Iris Settings" Option under Server Administration:
image

Is some step required to make it appear?

@dearjasmina
Copy link
Contributor

LS11_LEGACY I don't see the "Global Iris Settings" Option under Server Administration: image

Is some step required to make it appear?

I also don't see it. :/
Also, the E2E tests on Bamboo fail, take a look at that please:)

@MichaelOwenDyer MichaelOwenDyer added the deploy:artemis-test9 Testserver for Project Theia label Oct 20, 2023
@MichaelOwenDyer MichaelOwenDyer temporarily deployed to artemis-test9.artemis.cit.tum.de October 20, 2023 10:42 — with GitHub Actions Inactive
@github-actions github-actions bot added lock:artemis-test9 and removed deploy:artemis-test9 Testserver for Project Theia labels Oct 20, 2023
@MichaelOwenDyer
Copy link
Contributor Author

@xHadie @dearjasmina Sorry! The iris settings are available only on TS9, I forgot to mention that. It is deployed there right now if you want to have a look. I will also take a look at why the tests are failing 🤔

@github-actions github-actions bot mentioned this pull request Oct 20, 2023
27 tasks
reschandreas
reschandreas previously approved these changes Oct 30, 2023
Copy link
Contributor

@reschandreas reschandreas left a comment

Choose a reason for hiding this comment

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

lgtm, one small suggestion in a comment

src/main/resources/templates/iris/chat.hbs Show resolved Hide resolved
laurenzfb
laurenzfb previously approved these changes Nov 2, 2023
Copy link
Contributor

@laurenzfb laurenzfb left a comment

Choose a reason for hiding this comment

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

code lgtm! also tested on ts9. Worked as described

RY997
RY997 previously approved these changes Nov 5, 2023
Copy link
Contributor

@RY997 RY997 left a comment

Choose a reason for hiding this comment

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

LGTM

Hialus
Hialus previously approved these changes Nov 5, 2023
Copy link
Member

@Hialus Hialus left a comment

Choose a reason for hiding this comment

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

Code changes look good 👍🏻

Copy link

There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 13, 2023
@krusche krusche added this to the 6.7.0 milestone Nov 21, 2023
@krusche krusche added maintainer-approved The feature maintainer has approved the PR and removed ready to merge labels Nov 21, 2023
# Conflicts:
#	src/main/java/de/tum/in/www1/artemis/service/iris/IrisConstants.java
#	src/main/java/de/tum/in/www1/artemis/service/iris/IrisSettingsService.java
@krusche krusche modified the milestones: 6.7.0, 6.7.1 Nov 26, 2023
@krusche krusche removed the maintainer-approved The feature maintainer has approved the PR label Nov 26, 2023
@LenaKahle LenaKahle added deploy:artemis-test9 Testserver for Project Theia and removed deploy:artemis-test9 Testserver for Project Theia labels Nov 28, 2023
@MaximilianJG MaximilianJG added the deploy:artemis-test9 Testserver for Project Theia label Nov 29, 2023
@MaximilianJG MaximilianJG temporarily deployed to artemis-test9.artemis.cit.tum.de November 29, 2023 15:08 — with GitHub Actions Inactive
@github-actions github-actions bot added lock:artemis-test9 and removed deploy:artemis-test9 Testserver for Project Theia labels Nov 29, 2023
@krusche krusche merged commit 91d27ba into develop Dec 4, 2023
22 of 26 checks passed
@krusche krusche deleted the development/move-iris-default-templates branch December 4, 2023 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:Iris ready for review server Pull requests that update Java code. (Added Automatically!)
Projects
None yet
Development

Successfully merging this pull request may close these issues.