Commit Graph

833 Commits

Author SHA1 Message Date
e20ee45464 Prevent duplicate error handling for WebSocket events 2024-05-27 09:43:41 +02:00
c5b774f752 Convert errors captured with Sentry to JSON 2024-05-26 10:28:26 +02:00
0b1cb3affa Fix removal of event listeners for runSocket
The code previously used was only working with the patched Sentry method, not when Sentry was inactive. Since a Websocket is inheriting from EventTarget, the method signature usually requires two arguments.

See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener
2024-05-26 10:28:16 +02:00
94404370c4 Upgrade Sentry to v8 and remove custom Dependabot grouping
As part of the upgrade process, we need to rework the tracing instrumentation. Now, we are just wrapping all async functions in a new sentry transaction, which will automatically end once the function returns.

Further, the structure of the Sentry packages got reworked, so that we only need a single package by now. This removes the need to group dependabot updates.

Co-authored-by: Jan Graichen <jgraichen@altimos.de>
2024-05-24 14:52:14 +02:00
86c67f3c9a Refactor code execution to use async functions
This refactoring is required for Sentry tracing. It ensures that the respective functions only return as soon as a code execution finished. With this approach, we can then instrument the duration of the functions, so that Sentry spans are created as desired.

Co-authored-by: Jan Graichen <jgraichen@altimos.de>
2024-05-24 14:52:14 +02:00
c8609e5392 Remove leftovers from CommunitySubmission code
This code was unintentionally copied over and was never useful (since we won't execute code when submitting a community solution).

Co-authored-by: Jan Graichen <jgraichen@altimos.de>
2024-05-24 14:52:14 +02:00
61513cc5bc Revert "Fix race condition on JavaScript initializer"
This reverts commit 88c6be88, since it is no longer needed after fixing the root cause in a076da41.
2024-05-21 21:56:31 +02:00
619291c647 Specify the order of JavaScript assets loaded.
Previously, we could face (a rare) race condition with the wrong order. This was caused by Turbolinks and our usage of "components" (e.g., the CodeOceanEditor).

It could happen that Turbolinks fired the `turbolinks:load` event, as all XHR requests finished. In the event handler, we sometimes referred to other components. However, those components weren't initialized yet, potentially. This is due to Sprockets concatenating files in alphabetical order, ignoring our component dependencies.

With this commit, we try to specify the required order and thus aim to implement a permanent fix.

Fixes CODEOCEAN-FRONTEND-7W
Fixes CODEOCEAN-FRONTEND-7D
2024-05-21 21:56:31 +02:00
65416934ea Explicitly specify depend_on relationship between assets and config 2024-05-21 21:56:31 +02:00
336519b21d Refactor CodeOcean::Config class
The new architecture memorizes settings (which we mostly did after reading the config so far) and also exposes the resulting file path as well as further settings.

This change is a prerequisite to define a dependency with Sprockets.
2024-05-21 21:56:31 +02:00
dcaedfa9fe Remove url_helpers from editor.js.erb
- Rather than using a Rails helper, we rely on JsRoutes to provide the route.
- There is no need to remove the events_path if sending events is disabled, so we drop that.
2024-05-21 21:56:31 +02:00
e551c8a699 Reorder translations and add missing prefixes
- files should be prefixed with code_ocean/
- the markdown editor is part of the application (helper)
2024-05-21 19:42:26 +02:00
1589c9472b Fix missing and unused i18n translations 2024-05-21 19:42:26 +02:00
f42c56042c Enable Web Worker for ACE editor 2024-04-26 13:37:25 +02:00
4ba5f0d7d8 Enable Web Worker for JStree 2024-04-26 13:37:25 +02:00
da9add4a10 Fix ToastUI editor bug preventing manual codeblock insertion
Manually inserting a codeblock adding three backticks and hitting enter
is not functioning in the ToastUI editor due to an existing bug in the library.
This commit implements a workaround to address the issue.
2024-04-26 13:31:49 +02:00
749074fec0 Add functionality to expand the markdown editor
The editor will now have a default height of 300px but a button will let
the user expand the editor. It will expand it to fit all content (or up
to 400px if the content was not exceeding 300px). In the expanded mode
the editor will keep growing as the user types more content.
2024-04-26 13:31:49 +02:00
f10bcb96a6 Replace Ace Editor with ToastUi editor in the ExecutionEnvironments form
Drop unused code related to the Ace markdown editor.
2024-04-26 13:31:49 +02:00
17a4485ce2 Rename PagedownFormBuilder to MarkdownFormBuilder
The term 'Pagedown' was originally associated with the pagedown-bootstrap
library, which is no longer in use.
2024-04-26 13:31:49 +02:00
0667cbeefb Drop pagedown-bootstrap library and all its related code 2024-04-26 13:31:49 +02:00
9fe18f1873 Add and customize ToastUI image insertion option
The default ToastUI image insertion feature includes both URL and file
upload options. However, file upload functionality isn't supported in
the application. This commit addresses the issue by implementing custom
code to hide the file upload button while preserving the URL insertion
option.
2024-04-26 13:31:49 +02:00
9c71c6667a Install and use ToastUi markdown editor
Replace all usages of pagedown-bootstrap editor with the new editor.
Add styles to ensure the editor preview matches the final output.
2024-04-26 13:31:49 +02:00
6e4e376c91 Fix missing linter results caused by incorrect JS loop
Fixes CODEOCEAN-FRONTEND-69
2024-04-24 17:52:46 +02:00
88c6be88f1 Fix race condition on JavaScript initializer
Previously, ProgrammingGroups could have been undefined in rare cases. Therefore, we check whether the variable is properly defined before calling the method.

Fixes CODEOCEAN-FRONTEND-7D
2024-04-24 17:23:29 +02:00
e9941d8f47 Keep indention when displaying comments 2024-04-23 22:55:20 +02:00
dfa970664d Escape text passed in collection sorting
Previously, the ID and title of tips and exercises newly added to the list were gathered from the DOM. While we keep this mechanism, we ensure to escape the text before reusing it.
2024-03-28 19:05:55 +01:00
4f8d313da4 Use webpack to deliver newest ACE editor
With this commit, we change the delivery method for the ACE editor from manually copied files to using yarn and webpack. As a side-change, we also modify how the mode is selected through JavaScript instead of Ruby.

Through webpack, the `modePath`, `themePath`, and `workerPath` are automatically determined and working as expected.

Closes #250
2024-03-25 10:00:04 +01:00
942dbd20db Fix display of custom annotations in ACE Editor
With these changes, we no longer need our custom changes previously restored with 1013903.
2024-03-25 10:00:04 +01:00
e366ebd34c Resolve deprecation warnings for ACE Editor 1.32.6 2024-03-25 10:00:04 +01:00
117d3366ad fix kramdown using curved quotes and replace them with straight quotation marks 2024-03-14 17:03:00 +01:00
60dad19ea5 Rename .js.erb files .js
Since we switched to more I18n-JS and JsRoute functions with f5739a33 and 2f03061f, we don't have the need to use a template engine for those files any longer.
2024-01-19 11:06:40 +01:00
5b35ccdfe8 Reuse jQuery selector where possible 2024-01-19 11:06:40 +01:00
affeb2d3ba Remove obsolete user_id leftover in requestComments() 2024-01-19 11:06:40 +01:00
a9e1d491be Use safe comparison in JavaScript 2024-01-19 11:06:40 +01:00
9147482876 Use JsRoutes in .js.erb files 2024-01-19 11:06:40 +01:00
34aac83909 Use I18n-JS rather than rails-i18n in .js.erb files 2024-01-19 11:06:40 +01:00
d6c4df1bac Remove JavaScript debugger statement 2024-01-19 11:06:40 +01:00
43f93af575 Fix missing confirmation when deleting a user-generated file 2024-01-19 11:06:40 +01:00
bf0e6149da Remove obsolete context-type attribute for submissions
The value and function is no longer used.
2024-01-19 11:06:40 +01:00
6d62dfc3de Remove anchor replacement in active_file.filename
Previously, this replacement was required, but it is no longer (since we are not using some form of direct user-input).
2024-01-19 11:06:40 +01:00
21e0784af5 Rewrite createSubmissionCallback to use real forEach loop 2024-01-19 11:06:40 +01:00
e2c8156f0e Simplify forEach loops in JavaScript
See https://stackoverflow.com/a/9329476
2024-01-19 11:06:40 +01:00
17dd8b1267 Change syntax for routes with filename
Previously, the filename was URL-encoded, thus each / was replaced with %2F. This caused issues with some Apache2 configuration, smartly mingling with the URL to either encode it a second time (resulting in %252F) or decoding it (generating a real /). However, for authenticated file downloads with the JWT, we hardly require a byte-by-byte matching. With these changes, the URL parameter is no longer URL-encoded, so that Apache2 won't break our implementation any longer.

Further, we use this opportunity to get rid of the unnecessary .json extension for those filename routes, simplifying the routes generated and doing some further cleanup.
2024-01-19 11:06:40 +01:00
65212c4b4b Reduce file attributes in JSON for submission#show 2024-01-19 11:06:40 +01:00
293bb5d4ab Switch to proper, dynamic route for SortableJS elements 2023-12-14 00:31:41 +01:00
ef89b20986 Improve explanation for hidden feedback messages in tests 2023-12-08 20:25:02 +01:00
f393d8cb48 Sentry: Allow backend filtering for WebSocket connections without frontend 2023-12-02 23:30:03 +01:00
b4ee21a00d Reduce global JavaScript variables for Turtle
Fixes
2023-11-25 01:18:19 +01:00
0bd7c93d65 Allow clicking on checkboxes for batch update 2023-11-24 16:41:49 +01:00
175c8933f3 Automatically submit LTI grade on each score run
With this commit, we refactor the overall score handling of CodeOcean. Previously, "Score" and "Submit" were two distinct actions, requiring users to confirm the LTI transmission of their score (after assessing their submission). This yielded many questions and was unnecessary, since LTI parameters are no longer expiring after each use. Therefore, we can now transmit the current grade on each score run with the very same LTI parameters. As a consequence, the LTI consumer gets a more detailed history of the scores, enabling further analytical insights.

For users, the previous "Submit" button got replaced with a notification that is shown as soon as the full score got reached. Then, learners can decide to "finalize" their work on the given exercise, which will initiate a redirect to a follow-up action (as defined in the RedirectBehavior). This RedirectBehavior has also been unified and simplified for better readability.

As part of this refactoring, we rephrased the notifications and UX workflow of a) the LTI transmission, b) the finalization of an exercise (measured by reaching the full score) and c) the deadline handling (on time, within grace period, too late). Those information are now separately shown, potentially resulting in multiple notifications. As a side effect, they are much better maintainable, and the LTI transmission is more decoupled from this notification handling.
2023-11-23 14:42:10 +01:00