(organization *management.Organization)
| 77 | } |
| 78 | |
| 79 | func makeOrganizationView(organization *management.Organization) *organizationView { |
| 80 | accentColor := "" |
| 81 | backgroundColor := "" |
| 82 | |
| 83 | if organization.Branding != nil && organization.Branding.Colors != nil { |
| 84 | if len(organization.Branding.GetColors()["primary"]) > 0 { |
| 85 | accentColor = organization.Branding.GetColors()["primary"] |
| 86 | } |
| 87 | |
| 88 | if len(organization.Branding.GetColors()["page_background"]) > 0 { |
| 89 | backgroundColor = organization.Branding.GetColors()["page_background"] |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | metadata := "" |
| 94 | buf, err := json.MarshalIndent(organization.Metadata, "", " ") |
| 95 | if err == nil { |
| 96 | metadata = string(buf) |
| 97 | } |
| 98 | |
| 99 | return &organizationView{ |
| 100 | ID: organization.GetID(), |
| 101 | Name: organization.GetName(), |
| 102 | DisplayName: organization.GetDisplayName(), |
| 103 | LogoURL: organization.GetBranding().GetLogoURL(), |
| 104 | AccentColor: accentColor, |
| 105 | BackgroundColor: backgroundColor, |
| 106 | Metadata: ansi.ColorizeJSON(metadata), |
| 107 | raw: organization, |
| 108 | } |
| 109 | } |
no test coverage detected