Skip to content

Replace remaining Select2 and jquery-timeago uses with native equivalents. - #2010

Open
shadyvb wants to merge 1 commit into
ticket/XWPENG-54-native-selectsfrom
ticket/XWPENG-55-replace-select2
Open

Replace remaining Select2 and jquery-timeago uses with native equivalents.#2010
shadyvb wants to merge 1 commit into
ticket/XWPENG-54-native-selectsfrom
ticket/XWPENG-55-replace-select2

Conversation

@shadyvb

@shadyvb shadyvb commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Fixes XWPENG-55.

Rolls the native-select pattern from the records filter screen to every remaining Select2 consumer, and drops both frontend dependencies (select2, jquery-timeago).

  • Form_Generator: select2 field becomes grouped_select (flat parent+children markup plus optgroup support).
  • Settings exclude rules: author/role is one native select with Roles/Users optgroups; IP rule is a comma-separated text input; unused stream_get_users / stream_get_ips Ajax actions are removed.
  • Alert triggers: author/connector/context/action render native selects (the preload cap returns with the Ajax combobox in Add accessible Ajax user combobox over the preload cap. #2011).
  • Relative timestamps use Intl.RelativeTimeFormat with the previous presentation (bold relative string alongside the absolute date).
  • Regenerates an alert's list title whenever its triggers are edited, so Quick-Edit no longer keeps the original author.

Stacked on #2009.

Test plan

  • Settings exclude author/role is a native grouped select; IP is a text input.
  • New-alert and quick-edit trigger fields are native selects.
  • Relative timestamps still show a bold relative string plus absolute date.
  • Quick-editing an alert's author updates the list title.
  • select2 and timeago are gone from package.json and the admin bundle.

…ents (XWPENG-55)

Roll the native-select pattern out from the records filter screen to
every remaining Select2 consumer, and drop both frontend dependencies:

- Form_Generator: `select2` field becomes `grouped_select`, a native
  <select> that keeps the previous flat parent+children markup and adds
  optgroup support for value-less group headers. Only the fixes new
  callers require are included (array-value preselection, placeholder
  option text, aria-labels).
- Settings exclude rules: author/role is one native select with
  Roles/Users optgroups (all users + super-admins + WP-CLI, matching the
  previous Ajax dropdown's result set); stored values for deleted users
  still render as "N/A"; the IP rule is a plain comma-separated text
  input, and Log::record_matches_rules() trims list entries so spaced
  input still matches. The unused stream_get_users and stream_get_ips
  Ajax actions are removed.
- Alert triggers: author/connector/context/action render native
  selects; the preload cap returns with the Ajax combobox in a
  follow-up commit.
- Relative timestamps use a new Intl.RelativeTimeFormat helper
  (locale-aware via document language) with the previous presentation:
  bold relative string alongside the absolute date.
- select2, timeago, and copy-webpack-plugin leave package.json; the
  bundled vendor copies no longer ship in build/.
- The predefined date-range select shows its "All Time" placeholder
  option again (Select2 used to render it; the native select had an
  empty one).

Also regenerate an alert's list title ("Author > Context > Action")
whenever its triggers are edited. Previously the title was built once
at creation, so Quick-Editing an alert kept showing the original
author in the list even though the saved trigger had changed.

Note: also sets `creatable` on one Alerts_Admin_UI unit-test mock,
unbreaking the suite after the webhook alert commit added that property.
@shadyvb
shadyvb added this pull request to stack #1987 September 10, 2026 13:58
@shadyvb shadyvb changed the title ticket/XWPENG 55 replace select2 Replace remaining Select2 and jquery-timeago uses with native equivalents. Sep 10, 2026
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.

1 participant