diff --git a/internal/web/assets/app.css b/internal/web/assets/app.css index 1f19767..751588c 100644 --- a/internal/web/assets/app.css +++ b/internal/web/assets/app.css @@ -3455,6 +3455,8 @@ button.top-stats-row { width: 100%; border-width: 0 0 1px; background: none; col .unifi-status { display: flex; gap: .7rem; border: 1px solid var(--border); border-radius: .5rem; background: var(--muted); padding: .8rem; } .unifi-status.error { border-color: color-mix(in srgb, var(--destructive) 45%, var(--border)); background: color-mix(in srgb, var(--destructive) 8%, transparent); } .unifi-status.error > .nav-icon { color: var(--destructive); } +.unifi-status.success { border-color: color-mix(in srgb, var(--metric-no-error) 45%, var(--border)); background: color-mix(in srgb, var(--metric-no-error) 8%, transparent); } +.unifi-status.success > .nav-icon { color: var(--metric-no-error); } .unifi-status > .nav-icon { width: 1rem; height: 1rem; flex: 0 0 1rem; margin-top: .1rem; } .unifi-status > div { display: grid; gap: .2rem; } .unifi-status strong { font-size: .75rem; } diff --git a/internal/web/pages/integrations.templ b/internal/web/pages/integrations.templ index 54e4592..05b329e 100644 --- a/internal/web/pages/integrations.templ +++ b/internal/web/pages/integrations.templ @@ -623,7 +623,7 @@ templ SSOCard(view SSOAppView) {
if view.Check.Ran { if view.Check.Reachable { -
@Icon("shield-check")
The provider answered{ ssoCheckSummary(view.Check) }
+
@Icon("shield-check")
The provider answered{ ssoCheckSummary(view.Check) }
} else {
@Icon("alert-triangle")
Could not reach the provider{ view.Check.Error }
} diff --git a/internal/web/pages/integrations_templ.go b/internal/web/pages/integrations_templ.go index 5dbed1d..ecc15e6 100644 --- a/internal/web/pages/integrations_templ.go +++ b/internal/web/pages/integrations_templ.go @@ -2584,7 +2584,7 @@ func SSOCard(view SSOAppView) templ.Component { } if view.Check.Ran { if view.Check.Reachable { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 210, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 210, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -2599,7 +2599,7 @@ func SSOCard(view SSOAppView) templ.Component { var templ_7745c5c3_Var94 string templ_7745c5c3_Var94, templ_7745c5c3_Err = templ.JoinStringErrs(ssoCheckSummary(view.Check)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `integrations.templ`, Line: 626, Col: 131} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `integrations.templ`, Line: 626, Col: 139} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var94)) if templ_7745c5c3_Err != nil { diff --git a/internal/web/pages/integrations_test.go b/internal/web/pages/integrations_test.go index af393a1..ebae89b 100644 --- a/internal/web/pages/integrations_test.go +++ b/internal/web/pages/integrations_test.go @@ -8,6 +8,19 @@ import ( "github.com/a-h/templ" ) +// Testing the provider shows its answer in green when it answered and in red +// when it did not, like other results in the console. +func TestSSOCheckResultIsGreenOrRed(t *testing.T) { + answered := render(t, SSOCard(SSOAppView{Configured: true, Enabled: true, SecretStored: true, Check: SSOCheckView{Ran: true, Reachable: true}})) + if !strings.Contains(answered, `
`) || !strings.Contains(answered, "The provider answered") { + t.Errorf("a provider that answered is not shown as a success: %s", answered) + } + failed := render(t, SSOCard(SSOAppView{Configured: true, Enabled: true, SecretStored: true, Check: SSOCheckView{Ran: true, Error: "connection refused"}})) + if !strings.Contains(failed, `
`) || !strings.Contains(failed, "Could not reach the provider") { + t.Errorf("a provider that did not answer is not shown as an error: %s", failed) + } +} + func TestSSOReadOnlyCardOmitsAdministrationActions(t *testing.T) { for _, configured := range []bool{false, true} { markup := render(t, SSOCard(SSOAppView{Configured: configured, Enabled: true}))