Page MenuHomePhabricator

Upgrade Select2 in Page Forms (was formerly: Upgrade JS libraries included in Page Forms)
Closed, ResolvedPublic

Description

The Page Forms extension includes a number of JavaScript libraries, and all of them are at least somewhat in need of upgrading. In some cases, the library being used is already defunct and needs to be replaced altogether.

The JS libraries used by Page Forms, and the version being used of each one, are:

  • FancyBox - version being used is from 2010 (has been replaced by fancyBox3, which is apparently a separate library) (this was done)
  • Select2 - version being used is from 2014
  • Dynatree - version used is from 2013 (has been replaced by Fancytree - http://wwwendt.de/tech/fancytree/demo/) (this was done)
  • RateYo! - version is from 2014 (this was done)
  • jsGrid - version is from 2016 (no point)

jsGrid is probably not worth upgrading at the moment, because it's still fairly recent, and Page Forms' version of it has some customizations. But the others should all get upgraded.

In MediaWiki 1.30, the version of jQuery bundled in with MediaWiki jumped from 1.11 to 3 - and when jQuery 3 is used, it leads to JS warnings for at least Dynatree and RateYo!, and possibly some of these other libraries. Additionally, there are probably useful features and bug fixes that have gone into these libraries in the intervening years.

Update from 2020: there is now a plan to replace jsGrid altogether (see T241632), so it doesn't make sense to upgrade it.

Event Timeline

I would update the libraries and see if any breaks happen.

This comment was removed by Fz-29.

Got it. Just didn't had a GCI tag, so thought why not.

Yeah, sure. I'm sorry, I got a bit confused. I thought your comment was on its subtask.

Could bower be used as a package manager to take care of the JS libraries included in Page Forms ?

Do you mean, require everyone installing Page Forms to use Bower to also install the necessary JS files?

Thinking about it, yes it would complicate the installation process. I guess it's better not to use bower.

Can I take up this task to upgrade the libraries?

@yashdeep97 - well, someone's already working on the Dynatree one, and jsGrid probably isn't worth doing, so that just leaves Select2 and FancyBox. I looked into Select2 at some point and I think it might be quite challenging. But the FancyBox upgrade may be doable. Sure, feel free to take it if you're interested.

@Yaron_Koren - Thanks! I'll work on the FancyBox upgrade then.

Change 418734 had a related patch set uploaded (by Yashdeep97; owner: Yashdeep97):
[mediawiki/extensions/PageForms@master] Upgrade FancyBox library to fancyBox3

https://gerrit.wikimedia.org/r/418734

Change 418734 merged by jenkins-bot:
[mediawiki/extensions/PageForms@master] Upgrade FancyBox library to fancyBox3

https://gerrit.wikimedia.org/r/418734

Yaron_Koren updated the task description. (Show Details)
Yaron_Koren updated the task description. (Show Details)

The FancyBox upgrade has now been done, thanks to a patch from @yashdeep97, and there's also a patch in place for the Dynatree/Fancytree upgrade (https://gerrit.wikimedia.org/r/#/c/416920/), though it needs a little work. So the only upgrade really left to do is the Select2 one, and, as noted before, that's the hardest one. Still, this has been great progress.

Yaron_Koren renamed this task from Upgrade JS libraries included in Page Forms to Upgrade Select2 in Page Forms (was formerly: Upgrade JS libraries included in Page Forms).Feb 11 2019, 3:22 PM

I guess the following problem is related to this:

When you use the filtered format in SMW which uses a newer version of select2, you cannot have a #forminput: call on the same page where the filtered format is used. What happens is that the token-filters of the filtered format are broken as long as the forminput call is on the same page. If you remove it from the page, the token-filters work again.

any plans to upgrade the select2 library?

Not any immediate plans, but I do still want to get this done, yes.

Change 588761 had a related patch set uploaded (by Priyanshu varshney; owner: priyanshu-3390):
[mediawiki/extensions/PageForms@master] Upgrade select2.js in Page Forms

https://gerrit.wikimedia.org/r/588761

Great, I can confirm that this patch works in my wikis. Now a #forminput call on the same page as as filtered result format are working (before that, the tokens input in the filtered result format was broken if both were present on the same page)!
Thank you!

@Krabina - that's great to hear! This patch isn't quite ready for merging in yet, but it's very good to know that it's working for you already.

Change 589077 had a related patch set uploaded (by Priyanshu varshney; owner: priyanshu-3390):
[mediawiki/extensions/PageForms@master] Upgrade select2.js in Page Forms

https://gerrit.wikimedia.org/r/589077

Change 588761 abandoned by Priyanshu varshney:
Upgrade select2.js in Page Forms

Reason:
New patch has been uploaded with more code on behalf.

https://gerrit.wikimedia.org/r/588761

What I realized with the initial patch: the tokens input was broken in query forms. So this is something to consider. I moved back to master and token inputs in query forms worked again.

It showed a much smaller field, you could not click on it and select existing values (none where shown) or add new values.

yes, this is looking very good!

Change 589077 merged by jenkins-bot:
[mediawiki/extensions/PageForms@master] Upgrade Select2

https://gerrit.wikimedia.org/r/589077

Yaron_Koren claimed this task.

@Krabina - that's great to hear. The patch (by @priyanshu_varshney) has been merged in.

After 2 1/2 years, I'm excited to finally close this task!