mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add support for multiple banners (#13081)
This commit is contained in:
@@ -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
@@ -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"`
|
||||
|
||||
Reference in New Issue
Block a user