Skip to content

Add GAlert component and replace BAlert in exemplar usages - #22687

Merged
mvdbeek merged 3 commits into
galaxyproject:devfrom
dannon:feature/g-alert
May 14, 2026
Merged

Add GAlert component and replace BAlert in exemplar usages#22687
mvdbeek merged 3 commits into
galaxyproject:devfrom
dannon:feature/g-alert

Conversation

@dannon

@dannon dannon commented May 13, 2026

Copy link
Copy Markdown
Member

Summary

Adds a small Vue 3-friendly GAlert SFC at client/src/components/BaseComponents/GAlert.vue and replaces <BAlert> with <GAlert> at twelve call sites across eight components. Part of the bootstrap-vue scoped-slot replacement effort tracked in #21956.

The motivation is concrete: BAlert "works" through @vue/compat for production rendering, but in tests bootstrap-vue's compat shim renders it as a bare <__compat__transition> element with no slot content. On the Vue 3 migration branch (#20787) that shows up as 92 failing test files whose selectors look for .alert or specific alert IDs and find nothing. GAlert emits the same <div class="alert alert-{variant}"> markup the existing bootstrap CSS expects, so the rendered DOM matches what real and test selectors are looking for.

What's in the component

GAlert is intentionally a subset of BAlert, not a full API clone:

  • Props: show, variant, dismissible, dismissLabel, fade
  • Emits: dismissed, update:show
  • Slot: default only
  • Self-dismiss: mirrors BAlert -- clicking the close button on a dismissible alert hides it locally without requiring a parent handler; a subsequent show prop change re-syncs

Dropped from BAlert: numeric show countdown (one production usage in InteractiveTools.vue), the dismiss named slot (zero usages), and the dismissCountDown event (zero usages). These can be added back if a future call site needs them.

The exemplar swaps

I intentionally did not do a sweeping replacement. BAlert has ~200 remaining production usages and a single mega-PR would be hard to review. Instead this PR swaps twelve alerts across eight components that exercise the common API patterns -- info/warning/danger, plain show, reactive :show, dismissible with @dismissed, v-localize, and rich slot content (lists, icons, LoadingSpan):

ConfirmDialog, HistoryImport (2), Citation/CitationsList, Tour/TourList, Form/Elements/FormRadio, admin/Notifications/BroadcastsList (2), User/UserDeletion (3), and Form/FormCardSticky. The FormCardSticky.test.js selector was updated from a BAlert component-name lookup to a DOM-level .alert.alert-danger assertion, which is the migration pattern future swaps will follow.

Subsequent PRs will pick up the remaining BAlert call sites incrementally, similar to how the BTable migration was split across many PRs.

Test plan

  • pnpm eslint --quiet clean on changed files
  • pnpm type-check clean
  • pnpm test for affected component areas (FormCardSticky, FormRadio, BroadcastsList) green
  • Manual smoke: render BroadcastsList, HistoryImport, UserDeletion in dev server and verify alerts render and dismiss correctly

dannon added 3 commits May 13, 2026 09:36
Adds a small Vue 3-friendly SFC that mirrors the bootstrap-vue BAlert
markup the codebase relies on, ahead of the broader bootstrap-vue
removal tracked in galaxyproject#21956. The API covers the subset of BAlert that
Galaxy actually uses -- show, variant, dismissible, dismissLabel, fade,
default slot, dismissed and update:show events. Numeric show countdown,
the dismiss named slot, and the dismissCountDown event are dropped for
now; they have ~zero production usages and can be revisited if needed.
Swaps eight call sites (twelve alerts total) over to the new GAlert
SFC: ConfirmDialog, HistoryImport, CitationsList, TourList, FormRadio,
BroadcastsList, UserDeletion, and FormCardSticky. These cover the
variants the codebase actually uses -- info/warning/danger, plain
show, reactive :show, dismissible with @dismissed, v-localize, and
rich slot content (lists, icons, LoadingSpan).

This is intentionally not a sweeping replacement -- ~200 BAlert
usages remain and will get picked up incrementally in follow-up PRs,
similar to how the BTable migration was split across many PRs.
FormCardSticky's test was tweaked to assert on the rendered DOM
(.alert.alert-danger) instead of the BAlert component name.
Tracks visibility in a localShow ref so a `dismissible` GAlert with no
parent handler still hides itself when the close button is clicked, mirroring
bootstrap-vue's BAlert. The watcher re-syncs whenever the parent's `show`
prop changes, so reactive `:show` bindings keep working too. Fixes a
footgun future mechanical migrations would have hit -- BAlert callsites
that pass `show dismissible` without wiring a `dismissed`/`input` handler
expect the alert to disappear on click.
@github-actions github-actions Bot added this to the 26.1 milestone May 13, 2026
@mvdbeek
mvdbeek merged commit 8439bd7 into galaxyproject:dev May 14, 2026
32 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in Galaxy Dev - weeklies May 14, 2026
@nsoranzo nsoranzo added kind/enhancement kind/refactoring cleanup or refactoring of existing code, no functional changes labels May 14, 2026
@galaxyproject galaxyproject deleted a comment from github-actions Bot May 14, 2026
@ahmedhamidawan

Copy link
Copy Markdown
Member

We have #22328 to track this as well!

@itisAliRH
itisAliRH deleted the feature/g-alert branch July 28, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/admin area/UI-UX kind/enhancement kind/refactoring cleanup or refactoring of existing code, no functional changes

Projects

Development

Successfully merging this pull request may close these issues.

4 participants