dodona icon indicating copy to clipboard operation
dodona copied to clipboard

Tracking JS modernization

Open bmesuere opened this issue 2 years ago • 1 comments

The goal of this issue is to track the "older" parts of our JavaScript code. There are 3 separate parts:

  • Getting rid of jQuery: this is a big library and not really needed on the modern web
  • Getting rid of the old application.js file: this will unify our build setup to only use the application pack
  • Migrate to typescript: better type checking

jQuery

  • [x] The bootstrap token-field and typeahead still depend on jQuery. This is only used in the course label edit. #4083
  • [x] Almost all views contain code to initialize something that is wrapped in $(function() {}). This can probably be replaced by a jQuery-less equivalent #3692
  • [ ] A lot of old JS code still uses jQuery. I think there a limited number of uses:
    • Selecting elements: can easily be replaced by native JS
    • Fetching: can also be replaced by a fetch
    • Events: should also be possible to refactor without too many issues
    • Adding HTML to pages, mostly by converting strings to html elements. There is no easy replacement for this, but the template system from lit could be reused here.

application.js

  • [x] i18n: is only there because this is loaded first. Can probably move to the pack without any problems once the rest is gone https://github.com/dodona-edu/dodona/pull/3841
  • [ ] ace: not really straightforward on how to move this. We now use a ruby gem for this that hooks into sprockets. The library has a lot of individual files for programming languages that are loaded on demand so not sure how bundling would work.
  • [x] tokenfield/typeahead: Already removed everywhere #4189
  • [x] first-input-delay: No longer used to my knowledge. Can probably be removed here (and from the package file) #3591

TypeScript

  • [ ] translations.js
  • [x] course.js #3921
  • [x] course_membership.js #4083
  • [ ] drag_and_drop.js #4209
  • [x] exercise.js #3930
  • [ ] export.js
  • [x] favorite_course_buttons.js #3963
  • [ ] modal.js
  • [x] polyfills.js (removed) #3593
  • [x] punchcard.js #4080
  • [ ] pythia_submission.js
  • [ ] repository.js
  • [ ] scoresheet.js
  • [ ] series.js
  • [x] sign_in.js https://github.com/dodona-edu/dodona/pull/4023
  • [x] submission.js #4127
  • [ ] util.js

bmesuere avatar May 03 '22 09:05 bmesuere