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

Script version #612

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Script version #612

wants to merge 8 commits into from

Conversation

will-moore
Copy link
Member

@will-moore will-moore commented Jan 29, 2025

This addresses a couple of issues:

  • Fixes Export script version check #556 - Users get incorrect or failed figure export if using an old version of the script - Easily done if the script is not updated when OMERO.figure is upgraded.
  • Also makes it possible for Admins to use the OMERO.figure app itself to upload the current version of the script.

With this PR, the web app loads the Figure_To_Pdf.py script from within the Django app (using relative path from views.py -> ../scripts/omero/Figure_Scripts/Figure_To_Pdf.py and uploads it to the server using the script service (if the current user is an Admin).

We also add a FIGURE_VERSION parameter to the Figure_To_Pdf.py script, with the default value being set to the release version of OMERO.figure. This allows the web app to use the script service to query the script parameters and get the FIGURE_VERSION from the script. Scripts from before this PR won't have this parameter, so the version will be "unknown". If the FIGURE_VERSION from the script doesn't match the version of the app, all users will see a warning, and if user is an Admin, they can update the script with a single button click!

For regular users:

  • If no export script is on the server, Export PDF button is disabled (no change)
  • If an out-of-date version of the script is on the server, they will see a warning button that opens a dialog to show mismatching version numbers, and a message "Admin needs to fix this".

For admin users:

  • If no export script is on the server, show a warning button to open script upload dialog. Upload Script button.
  • If an out-of-date version of the script is on the server, they will see a warning button that opens a dialog to show mismatching version numbers, and an Update Script button.

Testing info, see below...

Screenshot 2025-01-30 at 13 23 41

Screenshot 2025-01-30 at 13 27 23

Screenshot 2025-01-30 at 13 28 21

To test:

  • Start with NO script on the server. Use cli $ omero script list to get the ID of the Figure_To_Pdf.py and then delete it with $ omero delete OriginalFile:ID.
  • Login to OMERO.figure as an Admin. Export Pdf button will be disabled as before. You should now see a warning button (top right) with appropriate tooltip. Click the button to show dialog (first screenshot above). Click "Upload Script" to upload to the server. Should see success message and Export Pdf button will be enabled etc.
  • Go to webclient and use the script menu to upload an OLD version of the Figure_To_Pdf.py (e.g. from last release). Make sure it is in the correct path omero/figure_scripts/Figure_To_Pdf.py so that is replaces the existing script.
  • Login to OMERO.figure page as regular user. Now you should see the script warning with version mismatch. Dialog gives more info, including a "contact Admin" message. (2nd screenshot)
  • Login to OMERO.figure as an Admin. You'll get the warning and the dialog should allow you to Upgrade the script (3rd screenshot)

NB: for devs: this PR adds usage of https://www.npmjs.com/package/vite-plugin-html-inject so we can include html files into index.html. This will allow us to move all the dialogs into separate html files (as I've done for the new dialog here).

@snoopycrimecop
Copy link
Member

snoopycrimecop commented Jan 30, 2025

Conflicting PR. Removed from build OMERO-plugins-push#320. See the console output for more details.
Possible conflicts:

--conflicts Conflict resolved in build OMERO-plugins-push#321. See the console output for more details.

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.

Export script version check
2 participants