mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-23 16:27:35 +00:00
cb7b50b513
* feat: enable only specific themes in label policy * feat: enable only specific themes in label policy * feat: enable only specific themes in label policy * feat: enable only specific themes in label policy * add management in console * pass enabledTheme * render login ui based on enabled theme * add in branding / settings service and name consistently * update console to latest proto state * fix console linting * fix linting * cleanup * add translations --------- Co-authored-by: Livio Spring <livio.a@gmail.com> Co-authored-by: Tim Möhlmann <tim+github@zitadel.com>
55 lines
1.8 KiB
Go
55 lines
1.8 KiB
Go
package management
|
|
|
|
import (
|
|
"github.com/zitadel/zitadel/internal/domain"
|
|
mgmt_pb "github.com/zitadel/zitadel/pkg/grpc/management"
|
|
policy_pb "github.com/zitadel/zitadel/pkg/grpc/policy"
|
|
)
|
|
|
|
func AddLabelPolicyToDomain(p *mgmt_pb.AddCustomLabelPolicyRequest) *domain.LabelPolicy {
|
|
return &domain.LabelPolicy{
|
|
PrimaryColor: p.PrimaryColor,
|
|
BackgroundColor: p.BackgroundColor,
|
|
WarnColor: p.WarnColor,
|
|
FontColor: p.FontColor,
|
|
PrimaryColorDark: p.PrimaryColorDark,
|
|
BackgroundColorDark: p.BackgroundColorDark,
|
|
WarnColorDark: p.WarnColorDark,
|
|
FontColorDark: p.FontColorDark,
|
|
HideLoginNameSuffix: p.HideLoginNameSuffix,
|
|
DisableWatermark: p.DisableWatermark,
|
|
ThemeMode: themeModeToDomain(p.ThemeMode),
|
|
}
|
|
}
|
|
|
|
func themeModeToDomain(theme policy_pb.ThemeMode) domain.LabelPolicyThemeMode {
|
|
switch theme {
|
|
case policy_pb.ThemeMode_THEME_MODE_AUTO:
|
|
return domain.LabelPolicyThemeAuto
|
|
case policy_pb.ThemeMode_THEME_MODE_DARK:
|
|
return domain.LabelPolicyThemeDark
|
|
case policy_pb.ThemeMode_THEME_MODE_LIGHT:
|
|
return domain.LabelPolicyThemeLight
|
|
case policy_pb.ThemeMode_THEME_MODE_UNSPECIFIED:
|
|
return domain.LabelPolicyThemeAuto
|
|
default:
|
|
return domain.LabelPolicyThemeAuto
|
|
}
|
|
}
|
|
|
|
func updateLabelPolicyToDomain(p *mgmt_pb.UpdateCustomLabelPolicyRequest) *domain.LabelPolicy {
|
|
return &domain.LabelPolicy{
|
|
PrimaryColor: p.PrimaryColor,
|
|
BackgroundColor: p.BackgroundColor,
|
|
WarnColor: p.WarnColor,
|
|
FontColor: p.FontColor,
|
|
PrimaryColorDark: p.PrimaryColorDark,
|
|
BackgroundColorDark: p.BackgroundColorDark,
|
|
WarnColorDark: p.WarnColorDark,
|
|
FontColorDark: p.FontColorDark,
|
|
HideLoginNameSuffix: p.HideLoginNameSuffix,
|
|
DisableWatermark: p.DisableWatermark,
|
|
ThemeMode: themeModeToDomain(p.ThemeMode),
|
|
}
|
|
}
|