Visitar URL original
[task] migrate dashboard carousel to Swiper by butterfly-520-boy · Pull Request #4427 · apache/hertzbeat · GitHub
Skip to content

[task] migrate dashboard carousel to Swiper - #4427

Open
butterfly-520-boy wants to merge 8 commits into
apache:masterfrom
butterfly-520-boy:codex/dashboard-swiper-1344
Open

butterfly-520-boy wants to merge 8 commits into
apache:masterfrom
butterfly-520-boy:codex/dashboard-swiper-1344

Conversation

@butterfly-520-boy

Copy link
Copy Markdown
Contributor

What's changed?

  • Replace the dashboard category-card carousel with Swiper Element.
  • Preserve responsive card counts, navigation, autoplay, and wrap-around behavior.
  • Remove the unused Slick and jQuery dependencies and global assets.
  • Add unit tests for overflow behavior and responsive breakpoints.

Closes #1344

Checklist

  • I have read the Contributing Guide.
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed. (Not applicable: no API changes.)

@github-actions github-actions Bot added the webapp label Oct 5, 2026

@Duansg Duansg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the migration. Could you also update the distribution’s license files for Swiper?

The existing jQuery/Slick dependencies are listed in both material/licenses/frontend/LICENSE and material/licenses/LICENSE, with their license texts under material/licenses/frontend/.

Please add Swiper’s version and MIT license entry to those lists, and include its copyright notice and full license text in material/licenses/frontend/LICENSE-swiper.txt. If jQuery, slick-carousel, and ngx-slick-carousel are no longer bundled, please remove their obsolete entries and license files as well.

This will keep the license information aligned with what HertzBeat distributes.

@butterfly-520-boy

Copy link
Copy Markdown
Contributor Author

Thanks for catching this, @Duansg. Updated both license lists for Swiper 14.3.0 and included the copyright notice and full MIT text from the published package in LICENSE-swiper.txt. I also removed the obsolete jQuery, slick-carousel and ngx-slick-carousel entries and license files after confirming they are absent from the frontend dependencies and lockfile. Fixed in 6c06a89; ready for another look.

@Duansg Duansg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for providing the additional information. However, I tested this PR and found that it didn't produce the expected results. This may be related to the Swiper initialization logic. Have you tested it locally to see if it works?

@Duansg

Duansg commented Oct 9, 2026

Copy link
Copy Markdown
Member

Hi, thanks for providing the additional information. However, I tested this PR and found that it didn't produce the expected results. This may be related to the Swiper initialization logic. Have you tested it locally to see if it works?

You might want to check this out: https://swiperjs.com/element#parameters-as-props

@butterfly-520-boy

Copy link
Copy Markdown
Contributor Author

Yes, the issue does exist. However, when I previously tested it locally, I didn't stay on the page for long, and the card displayed normally within a short period. The current problem is that over time, the card gradually expands from its normal width to span the entire row, and the status label on the right also disappears. I will identify the root cause and fix this bug. Thank you for pointing it out.

@butterfly-520-boy

Copy link
Copy Markdown
Contributor Author

Just like this.
屏幕截图 2026-10-09 161900
屏幕截图 2026-10-09 161818

@Duansg

Duansg commented Oct 9, 2026

Copy link
Copy Markdown
Member

Just like this.

@butterfly-520-boy You might want to try adding monitoring for multiple categories, since I've noticed that they aren't displayed in a carousel.

@butterfly-520-boy

Copy link
Copy Markdown
Contributor Author

Just like this.

@butterfly-520-boy You might want to try adding monitoring for multiple categories, since I've noticed that they aren't displayed in a carousel.

Okay, I’ll follow this approach to fix the issue

@butterfly-520-boy

butterfly-520-boy commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the pointers! I've fixed the Swiper initialization and the card-width issue after statistics refreshes.

I tested the carousel locally with six monitoring categories, and all 15 related tests pass.

The screenshots below show the updated carousel.

@butterfly-520-boy

butterfly-520-boy commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Here's the screenshot.
Image_1791553119844_618.png

@Duansg

Duansg commented Oct 10, 2026

Copy link
Copy Markdown
Member

pls check ci

@Duansg Duansg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tomsun28

Copy link
Copy Markdown
Member

The Angular app this PR builds on (angular.json, app.module.ts, the dashboard component) was replaced by a React + Vite frontend in the 2.0 merge. Can't be merged — if we still want the carousel swap it needs to be rebuilt on the new dashboard.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] <Use swiperjs to instead of slickjs in dashboard ui card scroll>

3 participants