feat: add attribute to only enable specific themes (#6798)

* 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>
This commit is contained in:
Stefan Benz
2023-10-26 07:54:09 +02:00
committed by GitHub
parent 7b0506c19c
commit cb7b50b513
43 changed files with 527 additions and 100 deletions

View File

@@ -14,7 +14,7 @@ import (
)
const (
LabelPolicyTable = "projections.label_policies2"
LabelPolicyTable = "projections.label_policies3"
LabelPolicyIDCol = "id"
LabelPolicyCreationDateCol = "creation_date"
@@ -29,6 +29,7 @@ const (
LabelPolicyShouldErrorPopupCol = "should_error_popup"
LabelPolicyFontURLCol = "font_url"
LabelPolicyOwnerRemovedCol = "owner_removed"
LabelPolicyThemeModeCol = "theme_mode"
LabelPolicyLightPrimaryColorCol = "light_primary_color"
LabelPolicyLightWarnColorCol = "light_warn_color"
@@ -83,6 +84,7 @@ func (*labelPolicyProjection) Init() *old_handler.Check {
handler.NewColumn(LabelPolicyDarkLogoURLCol, handler.ColumnTypeText, handler.Nullable()),
handler.NewColumn(LabelPolicyDarkIconURLCol, handler.ColumnTypeText, handler.Nullable()),
handler.NewColumn(LabelPolicyOwnerRemovedCol, handler.ColumnTypeBool, handler.Default(false)),
handler.NewColumn(LabelPolicyThemeModeCol, handler.ColumnTypeEnum, handler.Default(0)),
},
handler.NewPrimaryKey(LabelPolicyInstanceIDCol, LabelPolicyIDCol, LabelPolicyStateCol),
handler.WithIndex(handler.NewIndex("owner_removed", []string{LabelPolicyOwnerRemovedCol})),
@@ -264,6 +266,7 @@ func (p *labelPolicyProjection) reduceAdded(event eventstore.Event) (*handler.St
handler.NewCol(LabelPolicyHideLoginNameSuffixCol, policyEvent.HideLoginNameSuffix),
handler.NewCol(LabelPolicyShouldErrorPopupCol, policyEvent.ErrorMsgPopup),
handler.NewCol(LabelPolicyWatermarkDisabledCol, policyEvent.DisableWatermark),
handler.NewCol(LabelPolicyThemeModeCol, policyEvent.ThemeMode),
}), nil
}
@@ -314,6 +317,9 @@ func (p *labelPolicyProjection) reduceChanged(event eventstore.Event) (*handler.
if policyEvent.DisableWatermark != nil {
cols = append(cols, handler.NewCol(LabelPolicyWatermarkDisabledCol, *policyEvent.DisableWatermark))
}
if policyEvent.ThemeMode != nil {
cols = append(cols, handler.NewCol(LabelPolicyThemeModeCol, *policyEvent.ThemeMode))
}
return handler.NewUpdateStatement(
&policyEvent,
cols,
@@ -376,6 +382,7 @@ func (p *labelPolicyProjection) reduceActivated(event eventstore.Event) (*handle
handler.NewCol(LabelPolicyDarkFontColorCol, nil),
handler.NewCol(LabelPolicyDarkLogoURLCol, nil),
handler.NewCol(LabelPolicyDarkIconURLCol, nil),
handler.NewCol(LabelPolicyThemeModeCol, nil),
},
[]handler.Column{
handler.NewCol(LabelPolicyChangeDateCol, nil),
@@ -402,6 +409,7 @@ func (p *labelPolicyProjection) reduceActivated(event eventstore.Event) (*handle
handler.NewCol(LabelPolicyDarkFontColorCol, nil),
handler.NewCol(LabelPolicyDarkLogoURLCol, nil),
handler.NewCol(LabelPolicyDarkIconURLCol, nil),
handler.NewCol(LabelPolicyThemeModeCol, nil),
},
[]handler.NamespacedCondition{
handler.NewNamespacedCondition(LabelPolicyIDCol, event.Aggregate().ID),