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

Feature: Align Bioportal and AgroPortal - part 3 - Update ontology viewer to Turbo #23

Merged

Conversation

syphax-bouazzouni
Copy link
Contributor

@syphax-bouazzouni syphax-bouazzouni commented Oct 10, 2024

An updated version of ncbo#223

Require to be merged first

What and why

This PR simplifies and updates our current JS code, by removing 814 lines of JS code but still keeping the same behaviors and features.

It's possible using the two following tools:

  • Tubro frame: will use Ajax to send and replace the HTML in a specified part of the current page (without reloading and JS code), this will replace most parts of our current JS code that are exactly doing that.
  • Stimulus JS: will centralize/isolate js code, so that we can reuse it more easily and avoid duplication and unused/forgotten code (a problem that we have a lot currently).

Changes

  • Replace bp_ontology_viewer.js with turbo frame in the ontology viewer ( same behavior with 417 (JS) lines less)(ncbo@9371bc4)

  • Fix visits chart not showing( (see The visits chart is not displayed in the summary page ncbo/bioportal_web_ui#179)

    • replacing app/assets/javascripts/ontologies.js with a stimulus controller "load-chart"
  • Fix more... submission button that was not working (ncbo@4e06e29)

    • clicking in the 'more...' will show the full table of submissions and replace the "more..." text with "less..." (and vis-versa)
  • Remove empty functions in app/assets/javascripts/bp_notes.js (10 lines less)

  • Replace concepts tree view node click js code with turbo_frames (same behavior with 259 (JS) lines less)

  • Update and centralize Split dependency (17 JS code less)

    • install split with yarn (js package manager) and remove lines that upload it <script src="//unpkg.com/split.js/dist/split.min.js">
    • centralize the split usage inside a stimulus controller called "container-splitter"
  • Centralize Simple tree dependency and replace JS code that displays the treeview with a turbo frame (41 JS code less)

    • remove/move the file app/assets/javascripts/bp_class_tree.js.erb (82 lines of js code)
    • centralize the simple tree view usage inside a stimulus controller called "simple-tree"
    • use a turbo_frame in app/views/ontologies/visualize.html.haml to display the tree view
    • remove unused function in app/assets/javascripts/bioportal.js.erb (16 lines less)
  • Extract/centralize autocomplete behavior in a stimulus controller

    • remove/move the code that does the jump to a concept feature from app/assets/javascripts/bp_visualize.js.erb to a stimulus controller (87 lines of JS code)
  • Use TabsContainerComponent for the ontology viewer tabs and replace the js code responsible for showing concepts tabs with bootstrap tabs ( 70 lines js code less )

    • remove file app/assets/javascripts/bp_visualize.js.erb

Demo

Screencast.from.2024-10-10.16-27-25.webm

@syphax-bouazzouni syphax-bouazzouni force-pushed the pr/align-bioportal-agroportal-part-2 branch from 6975e69 to 1882dc6 Compare October 10, 2024 14:27
@syphax-bouazzouni syphax-bouazzouni changed the title Feauture: Align Bioportal and AgroPortal - part 2 - Update ontology viewer to Turbo Feature: Align Bioportal and AgroPortal - part 2 - Update ontology viewer to Turbo Oct 11, 2024
@syphax-bouazzouni syphax-bouazzouni force-pushed the pr/align-bioportal-agroportal-part-2 branch 14 times, most recently from 6b62c3a to 3a7afef Compare October 12, 2024 13:38
@syphax-bouazzouni syphax-bouazzouni changed the title Feature: Align Bioportal and AgroPortal - part 2 - Update ontology viewer to Turbo Feature: Align Bioportal and AgroPortal - part 3 - Update ontology viewer to Turbo Oct 12, 2024
@syphax-bouazzouni syphax-bouazzouni force-pushed the pr/align-bioportal-agroportal-part-2 branch from 3a7afef to d19a83e Compare October 12, 2024 14:19
@syphax-bouazzouni syphax-bouazzouni marked this pull request as ready for review October 19, 2024 17:26
@alexskr alexskr merged commit 1173da8 into ontoportal:master Oct 23, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants