diff --git a/internal/app/controlplane/forge_connections.go b/internal/app/controlplane/forge_connections.go index c398e3ac1..2f31715f0 100644 --- a/internal/app/controlplane/forge_connections.go +++ b/internal/app/controlplane/forge_connections.go @@ -3,6 +3,7 @@ package controlplane import ( "fmt" "maps" + "net/url" "slices" "strings" @@ -41,7 +42,7 @@ func forgeConnectionsDefinition() Definition { // and is filled by a verification. func seedForgeConnections(cfg config.Config) any { out := []config.ForgeConnection{} - if c, ok := connectionFromForge(rootConnectionID, "Instance forge", cfg.Forge); ok { + if c, ok := connectionFromForge(rootConnectionID, connectionDisplayName(cfg.Forge), cfg.Forge); ok { // Root tasks act as the instance, not as an organisation execution // identity, so they take this connection without a permit entry. An // execution identity needs one, and the file granted it none. @@ -60,6 +61,21 @@ func seedForgeConnections(cfg config.Config) any { return out } +// connectionDisplayName is the label an operator sees, so it names the thing +// that tells one connection from another -- the host it points at -- rather +// than the archie concept it was migrated from. The file never named the +// forge, so there is nothing better to carry over. +func connectionDisplayName(cfg config.Forge) string { + host := strings.TrimSpace(cfg.Host) + if u, err := url.Parse(host); err == nil && u.Hostname() != "" { + host = u.Hostname() + } + if host != "" { + return host + } + return strings.TrimSpace(cfg.Type) +} + // connectionFromForge reads one file forge section as a connection. A forge // with no type is not configured and seeds nothing. func connectionFromForge(id, name string, cfg config.Forge) (config.ForgeConnection, bool) { diff --git a/internal/app/controlplane/forge_connections_test.go b/internal/app/controlplane/forge_connections_test.go index e3a3f5d52..3ea96cdf5 100644 --- a/internal/app/controlplane/forge_connections_test.go +++ b/internal/app/controlplane/forge_connections_test.go @@ -112,6 +112,9 @@ func TestConnectionMigrationKeepsTheFilesGrants(t *testing.T) { if root.ID != rootConnectionID || len(root.Permits) != 0 { t.Fatalf("root connection = %+v, want the root's forge and no permitted execution identity", root) } + if root.Name != "github.com" { + t.Fatalf("root connection name = %q, want the host an operator recognises, not an internal label", root.Name) + } if root.Token.Key != "ROOT_TOKEN" { t.Fatalf("root connection credential = %+v, want the file's reference", root.Token) } diff --git a/ui/src/org/AccessPage.vue b/ui/src/org/OrgShell.vue similarity index 100% rename from ui/src/org/AccessPage.vue rename to ui/src/org/OrgShell.vue