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

Upgrade to PrimeFaces 7 #5975

Closed
mheppler opened this issue Jun 26, 2019 · 10 comments · Fixed by #6281
Closed

Upgrade to PrimeFaces 7 #5975

mheppler opened this issue Jun 26, 2019 · 10 comments · Fixed by #6281
Assignees
Labels
Component: Code Infrastructure formerly "Feature: Code Infrastructure"

Comments

@mheppler
Copy link
Contributor

Saw this warning in my server log today while on the create dataset form, and it reminded me to create this placeholder issue for the eventual move to PrimeFaces 7 (released Mar '19).

Info:   autoUpdate attribute is deprecated and will be removed in a future version, use p:autoUpdate component instead.

For a background on this component, see my comment on the PrimeFaces 6.2 Upgrade issue

Accessibility improvements are also a big selling point for the upgrade.

Various components have been enhanced for accessibility related to keyboard support and screen readers.

From the PrimeFaces upgrade guide:

https://github.com/primefaces/primefaces/wiki/Migration-Guide

6.2 to 7.0

Breaking Changes

  • Push has been removed. Please use the JSF2.3 socket or OmniFaces now.
  • Mobile has been removed in favor of responsive features.
  • RequestContext has been replaced by PrimeFaces.current(). RequestContext is still available as PrimeRequestContext but it's internal PrimeFaces API and should therefore be avoided to use.
  • autoUpdate attribute of outputPanel, fragment, messages and growl has been removed. Use p:autoUpdate instead.
  • OverlayPanel: appendToBody has been removed. Use appendTo="@(body)" instead.
  • Button/Link/MenuItem: The url/href attribute isn't automatically prepended by contextPath anymore. Use the outcome attribute for referencing JSF views in the same application or manually prepend url/href with #{request.contextPath}. See OutcomeTargetRenderer: unwarranted and possibly erroneous inclusion of the context path primefaces/primefaces#3506.

Others

  • Schedule: Schedule was updated to the newest FullCalender version and therefore some attributes are deprecated.
    • Instead of slotMinutes, use slotDuration now (format: 12:30:00).
    • Instead of firstHour, use scrollTime now (format 12:30:00).
    • Instead of ignoreTimezone, use clientTimezone='local'
    • Instead of axisFormat, use slotLabelFormat
@mheppler mheppler added the Component: Code Infrastructure formerly "Feature: Code Infrastructure" label Jun 26, 2019
@mheppler
Copy link
Contributor Author

mheppler commented Jul 2, 2019

Regarding the autoUpdate attribute of outputPanel, we need to review the recent additions of this component + attribute combination to editFilesFragment.xhtml (#5565) and dataset.xhtml (#1219). The use of these are filling the server log with message reported in my previous comment.

@djbrooke
Copy link
Contributor

@mheppler - does this upgrade include Bootstrap 4 or will that be a different effort?

@mheppler
Copy link
Contributor Author

mheppler commented Jul 18, 2019

Like our last effort to update PrimeFaces (6.2 #4220) and Bootstrap (3.3.7 #4219), they can be developed separately, but released together. This was due to both needing to be in sync, using the same version of jQuery.

UPDATE: It appears that the jQuery requirements of our last upgrade efforts would not effect us for this upgrade. With that last upgrade, we bumped up to jQuery 3, and that was the major hurdle. Looking over the migration guides for both, we should not be blocked to upgrade these independently. It is worth pointing out in this discussion that Bootstrap 4 is considered a "major rewrite of the entire project".

@mheppler
Copy link
Contributor Author

With #6035 and #5977 prioritized and moving through development, anything of note related to primefaces/primefaces#4849 (h/t @PaulBoon) should be relevant to this issue. Which might mean waiting for the release of PrimeFaces 7.1.

@djbrooke
Copy link
Contributor

Still no 7.1...

https://www.primefaces.org/downloads/

@mheppler
Copy link
Contributor Author

mheppler commented Oct 2, 2019

Did a quick switch over to 7.0 in my pom, and just watched the compilation errors pile up. Missed the RequestContext breaking change outlined above. And we apparently use Push more than I thought, because I didn't think we used it at all. I'm gonna put this issue back down and let someone a lil more familiar with the java handle it. Sorry.

-------------------------------------------------------------
COMPILATION ERROR : 
-------------------------------------------------------------
edu/harvard/iq/dataverse/FileDownloadServiceBean.java:[35,30] cannot find symbol
  symbol:   class RequestContext
  location: package org.primefaces.context
edu/harvard/iq/dataverse/FileDownloadHelper.java:[27,30] cannot find symbol
  symbol:   class RequestContext
  location: package org.primefaces.context
edu/harvard/iq/dataverse/authorization/providers/builtin/PasswordEncryption.java:[8,27] cannot find symbol
  symbol:   class Base64
  location: package org.primefaces.util
edu/harvard/iq/dataverse/ThemeWidgetFragment.java:[36,30] cannot find symbol
  symbol:   class RequestContext
  location: package org.primefaces.context
edu/harvard/iq/dataverse/DatasetPage.java:[85,30] cannot find symbol
  symbol:   class RequestContext
  location: package org.primefaces.context
edu/harvard/iq/dataverse/EditDatafilesPage.java:[87,30] cannot find symbol
  symbol:   class RequestContext
  location: package org.primefaces.context
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[10,27] package org.primefaces.push does not exist
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[11,27] package org.primefaces.push does not exist
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[12,38] package org.primefaces.push.annotation does not exist
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[13,38] package org.primefaces.push.annotation does not exist
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[14,38] package org.primefaces.push.annotation does not exist
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[15,38] package org.primefaces.push.annotation does not exist
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[16,38] package org.primefaces.push.annotation does not exist
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[17,38] package org.primefaces.push.annotation does not exist
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[18,32] package org.primefaces.push.impl does not exist
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[27,2] cannot find symbol
  symbol: class PushEndpoint
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[28,2] cannot find symbol
  symbol: class Singleton
edu/harvard/iq/dataverse/dataaccess/ImageThumbConverter.java:[52,27] cannot find symbol
  symbol:   class Base64
  location: package org.primefaces.util
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[32,6] cannot find symbol
  symbol:   class PathParam
  location: class edu.harvard.iq.dataverse.IngestUpdatePushResource
edu/harvard/iq/dataverse/IngestUpdatePushResource.java:[47,6] cannot find symbol
  symbol:   class OnMessage
  location: class edu.harvard.iq.dataverse.IngestUpdatePushResource
20 errors 

@scolapasta
Copy link
Contributor

Reviewed at tech hours. The two major sources of errors seemed to be:

• from org.primefaces.push, which we don't actually use, so is just code that should be easily removable
• org.primefaces.context.RequestContext no longer being available - there is good documentation* on the methods for doing the same things, so should be (several) straightforward changes, e.q. change RequestContext.execute() to Primefaces.executeScript()

*See https://www.primefaces.org/docs/api/6.2/org/primefaces/context/RequestContext.html

And the reference fot the new object:
https://www.primefaces.org/docs/api/7.0/org/primefaces/PrimeFaces.html

There also was a Base64 issue - it looks like we are using the a primefaces class for encoding to a string in https://github.com/IQSS/dataverse/blob/develop/src/main/java/edu/harvard/iq/dataverse/dataaccess/ImageThumbConverter.java (line 531) and we can just change that to something like java.util.Base64.getEncoder().encodetoString().

@landreev
Copy link
Contributor

landreev commented Oct 16, 2019

I got it to the point where it builds and deploys. I obviously haven't verified if all the UI pages are working properly... But basic functionality appears to be there.
Verified that Base64-encoded thumbnails are working on the dataset and dataverse pages (PrimeFaces implementation of Base64 was discontinued in favor of java.util.Base64 that's available in 1.8; and the former always generates encoded strings with line breaks - unlike what we had before, but it appears to be working ok).

@mheppler
Copy link
Contributor Author

mheppler commented Oct 17, 2019

@landreev confirmed a successful build and deploy locally. Clicked around and found everything looks kosher, specifically with the popups and ingest -- which were the code changes related to the compile errors above.

I would suggest that instead of commenting all the old code out, that those lines are deleted. GitHub will save previous code for us in their commit history.

Also, found a couple of bugs, but was able to replicate them on demo, so I will open new issues for those (#6283, #6284).

Outline of moving pieces related to RequestContext, Base64 and Push changes:

Dataset pg

  • computeInvalid popup
  • selectFilesForDownload popup
  • downloadInvalid popup
  • downloadMixed popup
  • selectFilesForRestrict popup
  • accessPopup popup
  • selectFilesForRestrict popup
  • selectFilesForUnRestrict popup
  • selectFilesForDownload popup
  • downloadPopup popup
  • openCompareTwo on compareVersionDifferences
  • selectFilesForRequestAccess popup
  • requestAccessPopup popup
  • downloadDataSubsetPopup popup (FileDownloadHelper.java)
  • downloadPackagePopup popup (FileDownloadHelper.java)

Edit Files pg

  • fileTypeDifferentPopup popup (replace workflow)
  • Base64 (ImageThumbConverter.java)
  • REMOVED IngestUpdatePushResource.java

Theme & Widget pg

  • themeWidgetsTabView on resetForm

Account pg

  • Base64 (PasswordEncryption.java)

@mheppler mheppler removed their assignment Oct 17, 2019
@landreev
Copy link
Contributor

OK, tested it a little more - looks good, so moving into CR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Code Infrastructure formerly "Feature: Code Infrastructure"
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants