Skip to content

GUI whitelabel runtime system - #8942

Merged
sureshanaparti merged 24 commits into
apache:mainfrom
scclouds:whitelabel-gui
Jul 15, 2025
Merged

GUI whitelabel runtime system#8942
sureshanaparti merged 24 commits into
apache:mainfrom
scclouds:whitelabel-gui

Conversation

@BryanMLima

@BryanMLimaBryanMLima commented Apr 18, 2024

Copy link
Copy Markdown
Contributor

Description

1. Problem description

Currently ACS allows the GUI personalization (color changing, add a personalized logo, and so on); however, those configurations are set for the whole environment, which does not allow Apache CloudStack to have a personalized GUI by domain, account and so on. In a scenario of cloud providers reselling the infrastructure, the current behavior does not allow the operators to personalize the GUI for each use case (reseller, domain, account, and so on).

2. Proposed Changes

This spec introduces the concept of Runtime White Label to the Apache CloudStack GUI, which combines the market concept of White Label and enables it to be configured in runtime and by scope (domain, account, and so on). Briefly, we will introduce APIs to allow the operators to define GUI themes for a set of Internet common names (fixed or wildcard), a set of ACS domain UUIDs (also known as ID for the end-user), and a set of ACS account UUIDs (also known as ID for the end-user). The APIs will receive the CSS and JSON configuration as parameter and will store them into the database. When accessing Apache CloudStack, the UI will retrieve the CSS and JSON configurations according to the access definition and import them into the browser. If there are no themes match, the GUI will fallback to the current environment configuration.

Operations that create/modify/remove the themes will be registered with events in ACS.

2.1. Database model

A table named gui_themes will be created in the cloud schema and will have the following columns:

NameTypeNullableDefaultDescription
idbigint(20) unsignedNoAuto increment-
uuidvarchar(40)Nonull-
namevarchar(2048)NonullA name to identify the theme.
descriptionvarchar(4096)YesnullA description for the theme.
csstextYesnullThe CSS to be retrieved and imported into the GUI when matching the theme access configurations.
NameTypeNullableDefaultDescription
json_configurationtextYesnullThe JSON with the configurations to be retrieved and imported into the GUI when matching the theme access configurations.
common_namestextYesnullA set of Internet common names (fixed or wildcard) separated by comma that can use the theme; e.g.: *acme.com,acme2.com.
domain_uuidstextYesnullA set of [ACS] domain IDs separated by comma that can use the theme.
account_uuidstextYesnullA set of [ACS] account IDs separated by comma that can use the theme
is_publicbooleanYestrueDefines whether a theme can be retrieved by anyone when only the common_names is informed. If the domain_uuids or account_uuids is informed, it is considered as false.
createddatetimeNonullWhen the theme was created.
removeddatetimeYesnullWhen the theme was removed.
2.2. APIs

Right below there are the descriptions of the APIs to be introduced to allow the management of GUI themes by scope.

2.2.1. createGuiTheme

The API createGuiTheme will be accessible only by the operators (Root Admin accounts) and will allow them to create themes for several scopes. It will have the following parameters:

ParameterDescriptionMandatoryTypeDefault valueLength
nameA name to identify the theme.YesStringnull2048
descriptionA description for the theme.NoStringnull4096
ParameterDescriptionMandatoryTypeDefault valueLength
cssThe CSS to be retrieved and imported into the GUI when matching the theme access configurations.NoStringnull65535
jsonconfigurationThe JSON with the configurations to be retrieved and imported into the GUI when matching the theme access configurations. More details about the JSON configurations can be found in the JSON Configurations session.NoStringnull65535
commonnamesA set of Internet common names (fixed or wildcard) separated by comma that can retrieve the theme; e.g.: *acme.com,acme2.comNoStringnull65535
domainidsA set of [ACS] domain UUIDs (also known as ID for the end-user) separated by comma that can retrieve the theme.NoStringnull65535
accountidsA set of [ACS] account UUIDs (also known as ID for the end-user) separated by comma that can retrieve the themeNoStringnull65535
ispublicDefines whether a theme can be retrieved by anyone when only the domainnames is informed. If the domainids or accountids is informed, it is considered as false.NoBooleantrue-

Either css or jsonconfiguration parameter must be informed for the GUI theme creation. If neither commonnames, domainids, and accountids is defined, the theme will be considered as the default; there can exist only one default theme and it automatically will be public. If there are no themes match, the GUI will fallback to the current environment configuration.

2.2.2. listGuiThemes

The API listGuiThemes will be accessible by anyone and will retrieve the themes according to the parameters and the caller access. It will have the following parameters:

ParameterDescriptionMandatoryTypeDefault valueLength
idThe theme ID.NoStringnull40
nameThe name of the theme.NoStringnull2048
commonnameThe Internet common name to be filtered.NoStringnull256
domainidThe UUID (also known as ID for the end-user) of the domain to be filtered.NoStringnull40
accountidThe UUID (also known as ID for the end-user) of the account to be filtered.NoStringnull40
listallWhether to list all themes.NoBooleanfalse-
listremovedWhether to list removed themes.NoBooleanfalse-
ispublicWhether to list public themes. By default, it lists them all.NoBooleannull-
listonlydefaultthemeWhether to list only the default theme. If this parameter is true, than all other parameters are ignored.NoBooleanfalse-

In order to allow the theme to be displayed yet in the login web page, it will be possible to call this API without authentication; however, there will be limitations and all the parameters will be ignored. An unauthenticated call to the API listGuiThemes will retrieve no entry or only a single entry; the single entry will be the default theme or the public, most recently, and active theme that matches the Internet common name requesting the API.

2.2.3. updateGuiTheme

The API updateGuiTheme will be accessible only by the operators (Root Admin accounts) and will allow them to update a theme. It will have the following parameters:

ParameterDescriptionMandatoryTypeDefault valueLength
idThe ID of the theme to be updated.YesStringnull40
nameA name to identify the theme.NoStringnull2048
descriptionA description for the theme.NoStringnull4096
cssThe CSS to be retrieved and imported into the GUI when matching the theme access configurations.NoStringnull65535
jsonconfigurationThe JSON with the configurations to be retrieved and imported into the GUI when matching the theme access configurations. More details about the JSON configurations can be found in the JSON Configurations session.NoStringnull65535
commonnamesA set of Internet common names (fixed or wildcard) separated by comma that can retrieve the theme; e.g.: *acme.com,acme2.comNoStringnull65535
domainidsA set of [ACS] domain UUIDs (also known as ID for the end-user) separated by comma that can retrieve the theme.NoStringnull65535
accountidsA set of [ACS] account UUIDs (also known as ID for the end-user) separated by comma that can retrieve the themeNoStringnull65535
ispublicDefines whether a theme can be retrieved by anyone when only the domainnames is informed. If the domainids or accountids is informed, it is considered as false.NoBooleannull-

By default, all the parameters are null; therefore, to remove one of the parameters, it will be necessary to explicitly pass it as an empty string. If commonnames, domainids, and accountids are passed as empty, the theme will be considered as the default; there can exist only one default theme and it automatically will be public. If there are no themes match, the GUI will fallback to the current environment configuration.

2.2.4. removeGuiTheme

The API removeGuiTheme will be accessible only by the operators (Root Admin accounts) and will allow them to remove a theme. It will have the following parameter:

ParameterDescriptionMandatoryTypeDefault valueLength
idThe UUID (also known as ID for the end-user) of the theme to be removed.YesStringnull40

If the default theme is removed and there is no match to a theme access configuration, the GUI will fallback to the current environment configuration.

3.0. Future works

With this proposal, it will be only possible to manage the themes via API; for the future, we plan to add support for the themes management on the GUI. We will extend the feature to comply with projects, identity federation and domains change. Also, we will extend the feature to allow domain admins and users to manage their own themes.

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

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

There were two themes added with this PR: Dark theme and Apache Foundation theme. They can be used by anyone using the createGuiTheme API. They serve only to demonstrate the usage of this new feature, as presented in the screenshots below:

  • Apache theme:

image

image

Dark theme:

image

image

How Has This Been Tested?

I created multiple themes for specific accounts, domains and common names; they were correctly assigned.

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

@DaanHoogland

Copy link
Copy Markdown
Contributor

interesting

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland 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
Copy Markdown

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

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test alma9 kvm-alma9 keepEnv

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Trillian-Jenkins test job (alma9 mgmt + kvm-alma9) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-9917)
Environment: kvm-alma9 (x2), Advanced Networking with Mgmt server a9
Total time taken: 51841 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8942-t9917-kvm-alma9.zip
Smoke tests completed. 127 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
test_01_events_resourceError318.04test_events_resource.py
test_01_events_resourceError318.05test_events_resource.py
test_04_deploy_vm_for_other_user_and_test_vm_operationsFailure96.36test_network_permissions.py
ContextSuite context=TestNetworkPermissions>:teardownError1.62test_network_permissions.py

@BryanMLima

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@BryanMLima 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
Copy Markdown

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

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@github-actions

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-9967)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 47193 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8942-t9967-kvm-centos7.zip
Smoke tests completed. 127 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
test_01_events_resourceError306.15test_events_resource.py
test_01_events_resourceError306.16test_events_resource.py
test_04_deploy_vm_for_other_user_and_test_vm_operationsFailure92.52test_network_permissions.py
ContextSuite context=TestNetworkPermissions>:teardownError1.50test_network_permissions.py

@DaanHoogland

Copy link
Copy Markdown
Contributor

nice work @BryanMLima , haven't reviewed all of it, but I like it so far.

@codecov-commenter

codecov-commenter commented Apr 24, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 8.84265% with 701 lines in your changes missing coverage. Please review.

Project coverage is 16.56%. Comparing base (8e4fe1c) to head (c5f3efd).
Report is 17 commits behind head on main.

Files with missing linesPatch %Lines
...ache/cloudstack/gui/theme/GuiThemeServiceImpl.java24.32%166 Missing and 2 partials ⚠️
...va/org/apache/cloudstack/gui/theme/GuiThemeVO.java0.00%80 Missing ⚠️
...ache/cloudstack/api/response/GuiThemeResponse.java0.00%75 Missing ⚠️
...oudstack/gui/theme/dao/GuiThemeDetailsDaoImpl.java0.00%66 Missing ⚠️
.../cloudstack/gui/theme/dao/GuiThemeJoinDaoImpl.java1.53%64 Missing ⚠️
.../api/command/user/gui/theme/UpdateGuiThemeCmd.java0.00%46 Missing ⚠️
.../api/command/user/gui/theme/CreateGuiThemeCmd.java0.00%43 Missing ⚠️
...rg/apache/cloudstack/gui/theme/GuiThemeJoinVO.java0.00%43 Missing ⚠️
...k/api/command/user/gui/theme/ListGuiThemesCmd.java0.00%36 Missing ⚠️
...apache/cloudstack/gui/theme/GuiThemeDetailsVO.java0.00%32 Missing ⚠️
... and 7 more
Additional details and impacted files
@@ Coverage Diff @@## main #8942 +/- ##
============================================
- Coverage 16.57% 16.56% -0.02% - Complexity 13988 14009 +21 
============================================
Files 5745 5758 +13 Lines 510847 511578 +731 Branches 62140 62192 +52 ============================================
+ Hits 84696 84755 +59 - Misses 416677 417350 +673 + Partials 9474 9473 -1 
FlagCoverage Δ
uitests3.91% <ø> (-0.01%)⬇️
unittests17.46% <8.84%> (-0.02%)⬇️

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.

@JoaoJandreJoaoJandre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks great, just a few minor remarks.

Comment threadui/public/css/apache-theme.css
Comment threadui/public/css/dark-theme.css
@hsato03

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@hsato03 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
Copy Markdown

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

@hsato03

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@hsato03 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
Copy Markdown

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

@JoaoJandre

Copy link
Copy Markdown
Contributor

@DaanHoogland could we run the CI again?

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-13738)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 60524 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8942-t13738-kvm-ol8.zip
Smoke tests completed. 140 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
test_01_deployVMInSharedNetworkFailure331.93test_network.py

@BryanMLima

Copy link
Copy Markdown
ContributorAuthor

@DaanHoogland, the tests do not seem related to this PR. I also cannot access the logs to check the failure. Could you trigger the CI again?

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-13759)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 53645 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8942-t13759-kvm-ol8.zip
Smoke tests completed. 141 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File

@DaanHoogland

Copy link
Copy Markdown
Contributor

@bernardodemarco can you apply @sureshanaparti ‘ s sugestions. we can run one more time if anybody feels the need.

Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
@bernardodemarco

Copy link
Copy Markdown
Member

@bernardodemarco can you apply @sureshanaparti ‘ s sugestions. we can run one more time if anybody feels the need.

@DaanHoogland, sure, done!

@sureshanaparti

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@sureshanaparti 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
Copy Markdown

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

@sureshanaparti

Copy link
Copy Markdown
Contributor

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

UI build failed: ✖️
(SL-JID-668)

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

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

10 participants

@BryanMLima@DaanHoogland@blueorangutan@codecov-commenter@hsato03@JoaoJandre@bernardodemarco@sureshanaparti@kiranchavala@winterhazel