Skip to content

Allow configuring Announcement banner by admin #10951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sudo87
Copy link
Collaborator

@sudo87 sudo87 commented Jun 4, 2025

Description

This PR enables Admin to configure UI Announcement banner containing message through config.json. HTML based message is supported apart from regular text

It can be configured by defining following section in config.json:

"announcementBanner": {
    "enabled": true,
    "showIcon": true,
    "closable": true,
    "persistDismissal": true,
    "type": "warning",
    "message": "<strong>Performance Notice:</strong> We're experiencing high load. Some operations may be slower than usual.",
    "startDate": "2025-06-01T00:00:00Z",
    "endDate": "2025-07-16T00:00:00Z"
}

Following types are supported:

  1. info
  2. warning
  3. error

To ensure banner is shown only once, enable the following config:

persistDismissal: true

Doc PR: apache/cloudstack-documentation#517

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

Screenshot from 2025-06-09 17-57-49
Screenshot from 2025-06-09 17-56-57
Screenshot from 2025-06-09 17-56-12
Screenshot from 2025-06-09 17-38-44

How Has This Been Tested?

How did you try to break this feature and the system with this change?

New npm dep (dompurify) is included to sanitize the html.

Copy link

codecov bot commented Jun 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.60%. Comparing base (2d669db) to head (0d58cb0).
Report is 12 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #10951      +/-   ##
============================================
- Coverage     16.60%   16.60%   -0.01%     
- Complexity    13924    13925       +1     
============================================
  Files          5730     5731       +1     
  Lines        508082   508123      +41     
  Branches      61770    61783      +13     
============================================
+ Hits          84388    84392       +4     
- Misses       414259   414296      +37     
  Partials       9435     9435              
Flag Coverage Δ
uitests 3.94% <ø> (+<0.01%) ⬆️
unittests 17.50% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sudo87 sudo87 marked this pull request as ready for review June 4, 2025 11:33
@sudo87 sudo87 requested a review from vishesh92 June 5, 2025 06:00
@sudo87
Copy link
Collaborator Author

sudo87 commented Jun 5, 2025

@blueorangutan ui

@blueorangutan
Copy link

@sudo87 a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan
Copy link

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/10951 (QA-JID-637)

@sudo87
Copy link
Collaborator Author

sudo87 commented Jun 5, 2025

@blueorangutan package

@blueorangutan
Copy link

@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13635

Copy link
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

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

code lgtm

@sudo87 can you please add some documentation regarding this, probably somewhere https://github.com/apache/cloudstack-documentation/blob/main/source/adminguide/ui.rst

Copy link
Member

@rohityadavcloud rohityadavcloud left a comment

Choose a reason for hiding this comment

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

The floating banner hides the content behind it. I think it should instead be part of the page view/frame (or top global header component) & push the entire UI content down. See the banner on https://apisix.apache.org/ or https://docusaurus.io/ for example, where the announcement banner is pushing the entire content down, not floating on the UI.

The a-alert Ant Design Vue — An enterprise-class UI components based on Ant Design and Vue.js could be used, or a new component could be created.

@sudo87
Copy link
Collaborator Author

sudo87 commented Jun 9, 2025

@blueorangutan package

@blueorangutan
Copy link

@sudo87 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13670

@sudo87 sudo87 requested a review from rohityadavcloud June 10, 2025 09:29
@shwstppr
Copy link
Contributor

@blueorangutan ui

@blueorangutan
Copy link

@shwstppr a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan
Copy link

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/10951 (QA-JID-643)

Copy link
Contributor

@shwstppr shwstppr left a comment

Choose a reason for hiding this comment

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

LGTM

image

Copy link
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

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

@sudo87 CLGTM. Some minor changes would be good to have:

  1. Add a dummy entry in config.json for the banner which is disabled by default. It helps the end user update the configuration directly on the server.
  2. Allow configuring the banner such that it only shows on login screen or after login or both.

@vishesh92
Copy link
Member

@sudo87 Found an issue.
When the banner is not closed,

  1. Open a list view (e.g. projects) or details page (e.g. Public IP Address)
  2. On scrolling down, there is a gray area on top.
    image

Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@vishesh92
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 13744

@vishesh92
Copy link
Member

@blueorangutan package
@blueorangutan ui

@blueorangutan
Copy link

@vishesh92 a [SL] Jenkins job has been kicked to build packages. It will be bundled with@blueorangutan ui SystemVM template(s). I'll keep you posted as I make progress.

@blueorangutan
Copy link

@vishesh92 a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan
Copy link

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/10951 (QA-JID-646)

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13748

Copy link
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

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

lgtm. tested locally. works as expected.

Copy link
Contributor

@harikrishna-patnala harikrishna-patnala left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

8 participants