Skip to content

Conversation

@jhou-pro
Copy link
Member

@jhou-pro jhou-pro commented Apr 15, 2025

Resolve #2407

To be completed by the pull request creator

This section should be completed with reference to section Preparing PR of the Code and PR reviews wiki page.

  • Converted PR to draft while it is being prepared by tapping the "Convert to draft" link beneath the "Reviewers" section.

  • A self-review of all changes has been completed, and the changes are in sync with the issue requirements.

  • Changes to the requirements have been reflected in the issue description.

  • Any "leftovers" such as sysouts, printing of stack traces, and any other "temporary" code, have been removed.

  • Minor refactorings, such as renamings, extraction of constants, etc., have been addressed.

  • Developer documentation (e.g., comments, Javadoc), have been provided where required.

  • New Java tests have been written to cover the new functionality.

  • All existing and new Java tests pass successfully by running them with Maven.

  • All existing Web tests pass successfully.

  • Changes have been inspected for possible NPE situations, and the changes are sufficiently defensive.

  • The correct base branch has been selected for these changes to be merged into.

  • The latest changes from the base branch have already been merged into this feature branch (and tested).

  • Added a change overview to the issue description or as a wiki page, referenced in the issue description.
    Some issue might be very descriptive and server in place of a wiki page.
    In such cases consider adding label Wiki like to the issue.

  • Changes subject to performance considerations have been evaluated, and tested against production-size data if applicable.

  • This pull request does contain significant changes, the section "Significant changes" below is completed and at least one Senior Software Engineer with the relevant area of expertise has been selected as reviewer.

  • The In progress label has been removed from the issue.

  • The Pull request label has been added to the issue.

  • Made PR ready for review by tapping the "Ready for review" button below the list of commits on the PR page.

Significant changes

This pull request contains significant changes as defined in the wiki page.

Details are as follows:

  • FileSaver.js library has been updated from 1.x to 2.0.5, comprising a major version update. The newly updated file saving support has been tested successfully against all three groups of browser engines (WebKit/JSC - Ubuntu GNOME Web aka Epiphany and iOS Safari, Blink/V8 - Ubuntu Chrome and Android Chrome, Gecko/SpiderMonkey - Ubuntu Firefox). It does also work on older Windows Chrome Beta. Notable updates to the library are listed in a Changelog. No other updates were made since 2020, suggesting it is quite stable and works properly with all security-related browser tightening over the last years. All opened tabs are handled security-wise to avoid tabnapping and reverse-tabnapping.
  • saveAs function is not available in a window object now. This is essentially a breaking change. However, only a rare occurence of saveAs function usage have been performed in end-applications (+ HierarchyExportAction only) -- non updated end-app will have a bug.

Additional details

Additional breaking changes have been added to facilitate consistency across all code and to enforce further safer evolution of it. Otherwise, we would be left with some old way and new way and API users would follow what is easier / closer to their context. Actual existence of broken code in end-apps will be marked with [+].

  • +, compile errors 89d365b Creation of pre-/post-actions through PreActions / PostActions factory methods (constructors of existing implementations were made package-private).
  • +, compile errors 89d365b Re-factor GuardCentreRegeneration[Post-]Action to not be IPostAction, but IAction.
  • + 605c0f3 No global import of getParentAnd function in Entity Master contexts.
  • - e918d0b No global import of TgReflector in Entity Master / Centre contexts.
  • +, compile errors cdd63e1 Force bindSavedProperty post-action to use IConvertableToPath.

The following aspects were improved during implementation:

  • As it was discussed with @oleh-maikovych, Main Menu actions, those load from a server dynamically (not generated into source), required special attention by generating imports for them into tg-app-template. It was not sufficient to generate imports there. We needed a way to reference imported functions inside dynamic new Function(' ... some javascript code ... ') functions. It was implemented through passing all arguments into Function constructor and then bind(...) actual imported function values.
  • JavaScript code indentation was added where possible to be able to debug it easier during development:
      return jsCode("""
          bindSavedProperty(functionalEntity, '%s', self, %s);
      """.formatted(
          property.toPath(),
          erroneous
      ));
  • Support for JsImport and CombinedJsImports was added to every place, where IPre/PostActions generate. Even to those places where such actions have no actual imports. This will encourage API user to always use importStatements() where needed and, if added, to remain workable.
  • All private pre-/post-actions made public to allow easier extension in end-apps.
  • fullcalendar and @fullcalendar/moment-timezone were updated from 6.1.15 to 6.1.17. This functionality was retested successfully. See the Changelog about bug fixes, that may be relevant for us.
  • moment-timezone was updated from 0.5.47 to 0.5.48 (very minor, only time-zone descriptions).
  • RichText dependencies are now as follows:
    dompurify 3.2.4 => 3.2.5
    -- Changelog has been reviewed and looks good (only bug fix).
    prosemirror-commands 1.7.0 => 1.7.1
    prosemirror-model 1.25.0 => 1.25.1
    prosemirror-transform 1.10.3 => 1.10.4
    prosemirror-view 1.38.1 => 1.39.2
    -- Changelog has been reviewed and looks good (only bug fixes and one non-breaking feature).
    This functionality was retested successfully.
  • event.waitUntil has been employed everywhere in Service Worker where it was actually needed, including one missing place -- during activation. Even though it is unlikely that the absence of it caused problems to users, we should still be careful in keeping Service Worker alive before our custom actions complete asynchronously.
  • There was some missing checksum deletion in Service Worker during application evolution scenario -- this has been fixed (low impact bug).
  • Even though Service Worker will be activated immediately on client app refresh, is it is still performed after / resource update, which is handled by yet previous version of Service Worker. That's why clearing of redundant resources will not be performed on first release after these changes (but on the next one after the first). The decision to induce clearing on / resource update was made to ensure clearing on each release as soon as possible (but not more than once). Every client reload, including on some non-/ contexts (e.g. on standalone centre), requires / resource update. / resource is updated on each release, because it contains newly generated version in its title.
  • Notes on Service Worker testing: to see the logs in Chrome console a) tap Console settings in right-top corner and uncheck Selected context only and check Preserve log b) use Default levels in right-top corner (Info, Warnings and Errors).

To be completed by the pull request reviewer

This section should be completed with reference to section Performing PR review of the Code and PR reviews wiki page.

  • The In progress label has been added to the pull request in GitHub.

  • The issue requirements have been read and understood (along with any relevant emails and/or Slack messages).

  • The correct base branch is specified, and that base branch is up-to-date in the local source.

  • The issue branch has been checked out locally, and had the base branch merged into it.

  • All automated tests pass successfully.

  • Ensure the implementation satisfies the functional requirements.

  • Ensure that code changes are secure and align with the established coding practices, including code formatting and naming conventions.

  • Ensure that code changes are documented and covered with automated tests as applicable.

  • Ensure that code changes are well-suited for informal reasoning.

  • Ensure that changes are documented for the end-user (a software engineer in the case of TG, or an application user in the case of TG-based applications).

  • If there are significant changes (described above), special attention has been paid to them.
    Marked the task items in section "Significant changes" as completed to indicate that corresponding changes have been reviewed, improved if necessary, and approved.

  • The issue or issues addressed by the pull request are associated with the relevant release milestone.

To be completed by the pull request reviewer once the changes have been reviewed and accepted

  • The changes have been merged into the base branch (unless there is a specific request not to do so, e.g., they are to be released to SIT).

  • The issue branch has been deleted (unless the changes have not been merged - see above, or there is a specific request not to do so).

  • The In progress label has been removed from the pull request.

  • The Pull request label has been removed from the issue.

jhou-pro added 30 commits March 29, 2025 23:39
Continuing to move from old-style imports to rigid ES6-style imports, we need to support custom imports in IPre/PostActions for generated from Java actions. This will be required for FileSaverPostAction and likely will be used in other Pre/PostActions (e.g. OpenLinkPostAction).

This commit contains support for main menu actions.
And placed to npm / Rollup infrastructure. Explicitly used unminified file.
…ing ES6-like file-saver dependency function instead of old, everywhere imported, file).
…indSavedPropertyPostActionSuccess/Error contexts.
…ed in required ReferenceHierarchyPreAction contexts.
'file-saver' dependency is now as a standard ES6 imported one and gets vulcanised into the main file depending if is actually needed.
Revulcanised to get rid of actually unused FileSaver checksums.
@jhou-pro jhou-pro requested review from 01es and oleh-maikovych April 29, 2025 16:15
@jhou-pro jhou-pro marked this pull request as ready for review April 29, 2025 16:17
@jhou-pro jhou-pro changed the title Issue #2407 Issue #2407 - Update FileSaver.js dependency to the latest version Apr 29, 2025
@jhou-pro jhou-pro changed the title Issue #2407 - Update FileSaver.js dependency to the latest version Issue #2407 - Update FileSaver.js dependency to the latest version Apr 29, 2025
…rate JS file.

This also allows easier JavaScript editing through normal means and better future maintenance.
But still closed for usage outside PreActions / PostActions factory methods.
$ Conflicts:
$	platform-web-resources/src/main/java/ua/com/fielden/platform/web/resources/webui/AbstractWebUiConfig.java
$	platform-web-ui/src/main/web/ua/com/fielden/platform/web/app/tg-app-template.js
combinedImports.add(namedImport("TgReflector", "/app/tg-reflector"));
assertEquals(of(namedImport("TgReflector", "/app/tg-reflector", "TgReflector")), combinedImports);
}

Copy link
Member

Choose a reason for hiding this comment

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

It looks like that this test is duplicate of the previous one.

@01es 01es changed the base branch from develop to 3.0.0-SNAPSHOT July 23, 2025 02:41
…2407

$ Conflicts:
$	platform-web-resources/src/main/java/ua/com/fielden/platform/web/resources/webui/AbstractWebUiConfig.java
$	platform-web-resources/src/main/java/ua/com/fielden/platform/web/test/server/config/TgGeneratedEntityForTrippleDecAnalysisWebUiConfig.java
$	platform-web-ui/src/main/java/ua/com/fielden/platform/web/centre/api/resultset/impl/FunctionalActionElement.java
$	platform-web-ui/src/main/web/ua/com/fielden/platform/web/app/tg-app-template.js
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.

Update FileSaver.js dependency to the latest version

3 participants