diff --git a/core/src/main/java/org/keycloak/representations/info/ThemeInfoRepresentation.java b/core/src/main/java/org/keycloak/representations/info/ThemeInfoRepresentation.java index 7bf6b2d8df5..82d8dde2f9e 100644 --- a/core/src/main/java/org/keycloak/representations/info/ThemeInfoRepresentation.java +++ b/core/src/main/java/org/keycloak/representations/info/ThemeInfoRepresentation.java @@ -27,6 +27,7 @@ public class ThemeInfoRepresentation { private String name; private String[] locales; + private String description; public String getName() { return name; @@ -43,4 +44,12 @@ public class ThemeInfoRepresentation { public void setLocales(String[] locales) { this.locales = locales; } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } } diff --git a/js/apps/account-ui/maven-resources/theme/keycloak.v3/account/theme.properties b/js/apps/account-ui/maven-resources/theme/keycloak.v3/account/theme.properties index b24e3ae5e5b..4f5fa5feffe 100644 --- a/js/apps/account-ui/maven-resources/theme/keycloak.v3/account/theme.properties +++ b/js/apps/account-ui/maven-resources/theme/keycloak.v3/account/theme.properties @@ -2,5 +2,7 @@ parent=base deprecatedMode=false darkMode=true +description=Refined, v3 is more cohesive and dynamic. (Default for Account) + kcDarkModeClass=pf-v5-theme-dark contentHashPattern=assets/.* \ No newline at end of file diff --git a/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/theme.properties b/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/theme.properties index a5a8f3a3982..78465c8b2a9 100644 --- a/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/theme.properties +++ b/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/theme.properties @@ -1,5 +1,7 @@ parent=base darkMode=true +description=Cleaner and more modern, v2 supports automatic light/dark mode switching. (Default for Admin) + kcDarkModeClass=pf-v5-theme-dark contentHashPattern=assets/.* \ No newline at end of file diff --git a/js/apps/admin-ui/src/realm-settings/themes/ThemeSettings.tsx b/js/apps/admin-ui/src/realm-settings/themes/ThemeSettings.tsx index d1e82239d39..6b651c52d86 100644 --- a/js/apps/admin-ui/src/realm-settings/themes/ThemeSettings.tsx +++ b/js/apps/admin-ui/src/realm-settings/themes/ThemeSettings.tsx @@ -57,6 +57,7 @@ export const ThemeSettingsTab = ({ realm, save }: ThemeSettingsTabProps) => { themeTypes.login.map((theme) => ({ key: theme.name, value: theme.name, + description: theme.description, })), )} /> @@ -71,6 +72,7 @@ export const ThemeSettingsTab = ({ realm, save }: ThemeSettingsTabProps) => { themeTypes.account.map((theme) => ({ key: theme.name, value: theme.name, + description: theme.description, })), )} /> @@ -85,6 +87,7 @@ export const ThemeSettingsTab = ({ realm, save }: ThemeSettingsTabProps) => { themeTypes.admin.map((theme) => ({ key: theme.name, value: theme.name, + description: theme.description, })), )} /> @@ -99,6 +102,7 @@ export const ThemeSettingsTab = ({ realm, save }: ThemeSettingsTabProps) => { themeTypes.email.map((theme) => ({ key: theme.name, value: theme.name, + description: theme.description, })), )} /> diff --git a/js/libs/keycloak-admin-client/src/defs/serverInfoRepesentation.ts b/js/libs/keycloak-admin-client/src/defs/serverInfoRepesentation.ts index f63d9f46235..23bcb2c010f 100644 --- a/js/libs/keycloak-admin-client/src/defs/serverInfoRepesentation.ts +++ b/js/libs/keycloak-admin-client/src/defs/serverInfoRepesentation.ts @@ -32,6 +32,7 @@ export interface ServerInfoRepresentation { export interface ThemeInfoRepresentation { name: string; locales?: string[]; + description?: string; } export interface SpiInfoRepresentation { diff --git a/js/libs/ui-shared/src/controls/select-control/SelectControl.tsx b/js/libs/ui-shared/src/controls/select-control/SelectControl.tsx index 42d328726b8..d181e3c4016 100644 --- a/js/libs/ui-shared/src/controls/select-control/SelectControl.tsx +++ b/js/libs/ui-shared/src/controls/select-control/SelectControl.tsx @@ -19,6 +19,7 @@ export enum SelectVariant { export type SelectControlOption = { key: string; value: string; + description?: string; }; export type OptionType = string[] | SelectControlOption[]; diff --git a/js/libs/ui-shared/src/controls/select-control/SingleSelectControl.tsx b/js/libs/ui-shared/src/controls/select-control/SingleSelectControl.tsx index 3cac75918b9..5d9aa81a163 100644 --- a/js/libs/ui-shared/src/controls/select-control/SingleSelectControl.tsx +++ b/js/libs/ui-shared/src/controls/select-control/SingleSelectControl.tsx @@ -108,7 +108,15 @@ export const SingleSelectControl = < > {[...options, ...selectedOptions].map((option) => ( - + {isString(option) ? option : option.value} ))} diff --git a/js/libs/ui-shared/src/controls/select-control/TypeaheadSelectControl.tsx b/js/libs/ui-shared/src/controls/select-control/TypeaheadSelectControl.tsx index ee6f049b6ff..2a0e25ca8b9 100644 --- a/js/libs/ui-shared/src/controls/select-control/TypeaheadSelectControl.tsx +++ b/js/libs/ui-shared/src/controls/select-control/TypeaheadSelectControl.tsx @@ -304,6 +304,11 @@ export const TypeaheadSelectControl = < value={key(option)} isFocused={focusedItemIndex === index} isActive={field.value.includes(getValue(option))} + description={ + !isString(option) && "description" in option + ? option.description + : undefined + } > {getValue(option)} diff --git a/services/src/main/java/org/keycloak/services/resources/admin/info/ServerInfoAdminResource.java b/services/src/main/java/org/keycloak/services/resources/admin/info/ServerInfoAdminResource.java index 3cd9e4a959c..19d3d4aa507 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/info/ServerInfoAdminResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/info/ServerInfoAdminResource.java @@ -249,6 +249,8 @@ public class ServerInfoAdminResource { ti.setLocales(locales.replaceAll(" ", "").split(",")); } + ti.setDescription(getThemeDescription(theme)); + themes.add(ti); } } catch (IOException e) { @@ -258,6 +260,10 @@ public class ServerInfoAdminResource { } } + private String getThemeDescription(Theme theme) throws IOException { + return theme.getProperties().getProperty("description"); + } + private LinkedList filterThemes(Theme.Type type, LinkedList themeNames) { LinkedList filteredNames = new LinkedList<>(themeNames); boolean filterAdminV2 = (type == Theme.Type.ADMIN) && diff --git a/themes/src/main/resources/theme/keycloak.v2/login/theme.properties b/themes/src/main/resources/theme/keycloak.v2/login/theme.properties index b0dcf94498b..d8f00a63d53 100644 --- a/themes/src/main/resources/theme/keycloak.v2/login/theme.properties +++ b/themes/src/main/resources/theme/keycloak.v2/login/theme.properties @@ -1,6 +1,8 @@ parent=base import=common/keycloak +description=Cleaner and more modern, v2 supports automatic light/dark mode switching. (Default for Login) + styles=css/styles.css stylesCommon=vendor/patternfly-v5/patternfly.min.css vendor/patternfly-v5/patternfly-addons.css diff --git a/themes/src/main/resources/theme/keycloak/email/theme.properties b/themes/src/main/resources/theme/keycloak/email/theme.properties index f1dbb7215d4..1e2f67d0cad 100644 --- a/themes/src/main/resources/theme/keycloak/email/theme.properties +++ b/themes/src/main/resources/theme/keycloak/email/theme.properties @@ -1 +1,3 @@ -parent=base \ No newline at end of file +parent=base + +description=High contrast, sharp, utilitarian, basic. (Default for Email) \ No newline at end of file diff --git a/themes/src/main/resources/theme/keycloak/login/theme.properties b/themes/src/main/resources/theme/keycloak/login/theme.properties index a6ec593d9ca..295545d3ad9 100644 --- a/themes/src/main/resources/theme/keycloak/login/theme.properties +++ b/themes/src/main/resources/theme/keycloak/login/theme.properties @@ -1,6 +1,8 @@ parent=base import=common/keycloak +description=High contrast, sharp, utilitarian, basic. + styles=css/login.css stylesCommon=vendor/patternfly-v4/patternfly.min.css vendor/patternfly-v3/css/patternfly.min.css vendor/patternfly-v3/css/patternfly-additions.min.css lib/pficon/pficon.css diff --git a/themes/src/main/resources/theme/keycloak/welcome/theme.properties b/themes/src/main/resources/theme/keycloak/welcome/theme.properties index 1a14a5dced5..40e01dcaf1c 100644 --- a/themes/src/main/resources/theme/keycloak/welcome/theme.properties +++ b/themes/src/main/resources/theme/keycloak/welcome/theme.properties @@ -1,5 +1,7 @@ import=common/keycloak +description=High contrast, sharp, utilitarian, basic. + stylesCommon=vendor/patternfly-v5/patternfly.min.css vendor/patternfly-v5/patternfly-addons.css styles=css/welcome.css