Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/web/assets/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion internal/web/pages/integrations.templ
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ templ SSOCard(view SSOAppView) {
<div class="integration-card-body">
if view.Check.Ran {
if view.Check.Reachable {
<div class="unifi-status">@Icon("shield-check")<div><strong>The provider answered</strong><span>{ ssoCheckSummary(view.Check) }</span></div></div>
<div class="unifi-status success">@Icon("shield-check")<div><strong>The provider answered</strong><span>{ ssoCheckSummary(view.Check) }</span></div></div>
} else {
<div class="unifi-status error">@Icon("alert-triangle")<div><strong>Could not reach the provider</strong><span>{ view.Check.Error }</span></div></div>
}
Expand Down
4 changes: 2 additions & 2 deletions internal/web/pages/integrations_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions internal/web/pages/integrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, `<div class="unifi-status success">`) || !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, `<div class="unifi-status error">`) || !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}))
Expand Down
Loading