feat: add support for multiple banners (#13081)

This commit is contained in:
Kayla Washburn-Love
2024-05-08 15:40:43 -06:00
committed by GitHub
parent a4bd50c985
commit d8e0be6ee6
57 changed files with 1483 additions and 820 deletions
+19 -3
View File
@@ -277,15 +277,15 @@ func ProtoFromApp(a codersdk.WorkspaceApp) (*proto.WorkspaceApp, error) {
}, nil
}
func ServiceBannerFromProto(sbp *proto.ServiceBanner) codersdk.ServiceBannerConfig {
return codersdk.ServiceBannerConfig{
func ServiceBannerFromProto(sbp *proto.ServiceBanner) codersdk.BannerConfig {
return codersdk.BannerConfig{
Enabled: sbp.GetEnabled(),
Message: sbp.GetMessage(),
BackgroundColor: sbp.GetBackgroundColor(),
}
}
func ProtoFromServiceBanner(sb codersdk.ServiceBannerConfig) *proto.ServiceBanner {
func ProtoFromServiceBanner(sb codersdk.BannerConfig) *proto.ServiceBanner {
return &proto.ServiceBanner{
Enabled: sb.Enabled,
Message: sb.Message,
@@ -293,6 +293,22 @@ func ProtoFromServiceBanner(sb codersdk.ServiceBannerConfig) *proto.ServiceBanne
}
}
func BannerConfigFromProto(sbp *proto.BannerConfig) codersdk.BannerConfig {
return codersdk.BannerConfig{
Enabled: sbp.GetEnabled(),
Message: sbp.GetMessage(),
BackgroundColor: sbp.GetBackgroundColor(),
}
}
func ProtoFromBannerConfig(sb codersdk.BannerConfig) *proto.BannerConfig {
return &proto.BannerConfig{
Enabled: sb.Enabled,
Message: sb.Message,
BackgroundColor: sb.BackgroundColor,
}
}
func ProtoFromSubsystems(ss []codersdk.AgentSubsystem) ([]proto.Startup_Subsystem, error) {
ret := make([]proto.Startup_Subsystem, len(ss))
for i, s := range ss {
+15 -8
View File
@@ -2100,19 +2100,26 @@ func (c *Client) DeploymentStats(ctx context.Context) (DeploymentStats, error) {
}
type AppearanceConfig struct {
ApplicationName string `json:"application_name"`
LogoURL string `json:"logo_url"`
ServiceBanner ServiceBannerConfig `json:"service_banner"`
SupportLinks []LinkConfig `json:"support_links,omitempty"`
ApplicationName string `json:"application_name"`
LogoURL string `json:"logo_url"`
// Deprecated: ServiceBanner has been replaced by NotificationBanners.
ServiceBanner BannerConfig `json:"service_banner"`
NotificationBanners []BannerConfig `json:"notification_banners"`
SupportLinks []LinkConfig `json:"support_links,omitempty"`
}
type UpdateAppearanceConfig struct {
ApplicationName string `json:"application_name"`
LogoURL string `json:"logo_url"`
ServiceBanner ServiceBannerConfig `json:"service_banner"`
ApplicationName string `json:"application_name"`
LogoURL string `json:"logo_url"`
// Deprecated: ServiceBanner has been replaced by NotificationBanners.
ServiceBanner BannerConfig `json:"service_banner"`
NotificationBanners []BannerConfig `json:"notification_banners"`
}
type ServiceBannerConfig struct {
// Deprecated: ServiceBannerConfig has been renamed to BannerConfig.
type ServiceBannerConfig = BannerConfig
type BannerConfig struct {
Enabled bool `json:"enabled"`
Message string `json:"message,omitempty"`
BackgroundColor string `json:"background_color,omitempty"`