Page MenuHomePhabricator

Move the `mw-datatable` rules out of legacy to mediawiki.pager.tablePager
Closed, ResolvedPublic

Description

The legacy feature inside ResourceLoaderSkinModule refers to a mw-datatable class which is only used inside the TablePager PHP class which already has a dedicated stylesheet. We should move them.

acceptance criteria

  • [x ] The rules in resources/src/mediawiki.skinning/legacy.less relating to resources/src/mediawiki.pager.tablePager/TablePager.less should be moved there and removed from the legacy.less file

Event Timeline

I'm also seeing this in other places than TablePager, such as Special:Tags and Special:TrackingCategories, which do not use TablePager.

Certain extensions, such as MediaWiki-extensions-Cargo, MediaWiki-extensions-SecurePoll and CheckUser use this outside TablePager too. They'll need converting before this can be split out without regressions.

@Mainframe98 what kind of damage are we looking at if those styles were to disappear from legacy? Is it acceptable?

SecurePoll, CheckUser, Cargo can add the mediawiki.pager.tablePager module to their pages before we make the move if it's not.

Regression kind of stuff, as it removes all the styles from those tables. At least for the core special pages, that's trainblocker stuff.

Depending on how you'd like to prioritize it, adding mediawiki.pager.tablePager as a workaround would work, and related code can be converted to use TablePager afterwards.
For the extensions I'm not sure. CheckUser only uses it in JS, Cargo has partial styling for that table and SecurePoll is unknown territory for me.

I also found a few outdated gadgets using it: https://global-search.toolforge.org/?q=mw-datatable&regex=1&namespaces=8&title=, most of which copy an old version of https://commons.wikimedia.org/wiki/MediaWiki:Gadget-Cat-a-lot.js.

Right, perhaps the best approach here then is

  1. retain these styles in legacy for now by importing mediawiki.pager.tablePager inside legacy. The table module is 57 lines long so that's unlikely a problem.
  1. We'll then patch Cargo, CheckUser and SecurePoll
  1. We deprecate the use of legacy in Vector after a tech news User-notice to inform gadgets with a suitable timeframe.

Right, perhaps the best approach here then is

  1. retain these styles in legacy for now by importing mediawiki.pager.tablePager inside legacy. The table module is 57 lines long so that's unlikely a problem.
  1. We'll then patch Cargo, CheckUser and SecurePoll
  1. We deprecate the use of legacy in Vector after a tech news User-notice to inform gadgets with a suitable timeframe.

Sounds like a plan!

I took a stab at converting Special:Tags and Special:TrackingCategories to use TablePager, but that's quite complex, due their data structures being unsuitable for use in TablePager.

Change 674953 had a related patch set uploaded (by Mainframe98; author: Mainframe98):
[mediawiki/core@master] Move mw-datatables styles to mediawiki.pager.tablePager

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

Change 674954 had a related patch set uploaded (by Mainframe98; author: Mainframe98):
[mediawiki/extensions/Cargo@master] Use mediawiki.pager.tablePager on Special:CargoTables

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

Change 674955 had a related patch set uploaded (by Mainframe98; author: Mainframe98):
[mediawiki/extensions/CheckUser@master] Add mediawiki.pager.tablePager as dependency of ext.CheckUser

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

Change 674954 merged by jenkins-bot:
[mediawiki/extensions/Cargo@master] Use mediawiki.pager.tablePager on Special:CargoTables

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

Change 674953 merged by jenkins-bot:
[mediawiki/core@master] Move mw-datatables styles to mediawiki.pager.tablePager

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

Good news! SecurePoll already uses TablePager so it includes the mediawiki.pager.tablePager module so we're done here. Attached is a screenshot showing this is working as expected when Vector disables the legacy module.

Screen Shot 2021-03-25 at 4.48.06 PM.png (688×2 px, 112 KB)

Change 674955 merged by jenkins-bot:
[mediawiki/extensions/CheckUser@master] Add mediawiki.pager.tablePager as dependency of ext.CheckUser

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

(Mind you, I don't endorse that use, but this is another example where due diligence was missed.)

The change we made here should be backwards compatible (for now) [1]

We will deal with template usages at a later date when we actually remove the styles from skins.

[1] https://gerrit.wikimedia.org/r/c/mediawiki/core/+/674953/2/resources/src/mediawiki.skinning/legacy.less