Add configurable compliance portal commitment cards

The compliance portal home page rendered security-commitment cards from
a hardcoded placeholder POJO. Back them with real, per-organization data
that admins configure in the console and the portal loads over the trust
center GraphQL API.

Model two entities under the trust center: a commitment group (title,
description, rank) and a commitment card (icon, eyebrow, title,
description, rank). The card icon is a curated enum mapped to a Phosphor
icon in the portal. New entities adopt the compliance_portal_ prefix as
the start of the broader rename away from trust_center_ naming.

Expose the groups and cards read-only on the public trust API and with
full CRUD on the console API, add a Commitments tab to the compliance
page, and replace the placeholder section with a Relay-driven one.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-07-16 13:36:44 +02:00
parent 936162d5c7
commit 0b146a4054
39 changed files with 4079 additions and 175 deletions

View File

@@ -47,6 +47,13 @@ type TrustCenter implements Node {
before: CursorKey
): TrustCenterReferenceConnection! @goField(forceResolver: true)
commitmentGroups(
first: Int
after: CursorKey
last: Int
before: CursorKey
): CompliancePortalCommitmentGroupConnection! @goField(forceResolver: true)
trustCenterFiles(
first: Int
after: CursorKey
@@ -304,6 +311,91 @@ type TrustCenterReferenceEdge @nda {
node: TrustCenterReference!
}
enum CompliancePortalCommitmentIcon
@goModel(model: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIcon") {
LOCK_KEY
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconLockKey")
EYE_SLASH
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconEyeSlash")
FINGERPRINT
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconFingerprint")
SHIELD_WARNING
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconShieldWarning")
SHIELD_CHECK
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconShieldCheck")
SIREN
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconSiren")
KEY
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconKey")
LOCK
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconLock")
CLOUD
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconCloud")
DATABASE
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconDatabase")
GLOBE
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconGlobe")
EYE
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconEye")
USERS
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconUsers")
CERTIFICATE
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconCertificate")
GAVEL
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconGavel")
HEARTBEAT
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconHeartbeat")
BELL
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconBell")
BUG
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconBug")
CODE
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconCode")
SERVER
@goEnum(value: "go.probo.inc/probo/pkg/coredata.CompliancePortalCommitmentIconServer")
}
type CompliancePortalCommitmentGroup implements Node {
id: ID!
title: String!
description: String!
commitments(
first: Int
after: CursorKey
last: Int
before: CursorKey
): CompliancePortalCommitmentConnection! @goField(forceResolver: true)
}
type CompliancePortalCommitmentGroupConnection {
edges: [CompliancePortalCommitmentGroupEdge!]!
pageInfo: PageInfo!
}
type CompliancePortalCommitmentGroupEdge {
cursor: CursorKey!
node: CompliancePortalCommitmentGroup!
}
type CompliancePortalCommitment implements Node {
id: ID!
icon: CompliancePortalCommitmentIcon!
eyebrow: String!
title: String!
description: String!
}
type CompliancePortalCommitmentConnection {
edges: [CompliancePortalCommitmentEdge!]!
pageInfo: PageInfo!
}
type CompliancePortalCommitmentEdge {
cursor: CursorKey!
node: CompliancePortalCommitment!
}
type TrustCenterFile implements Node @nda {
id: ID!
name: String!

View File

@@ -175,6 +175,25 @@ func (r *complianceFrameworkResolver) Framework(ctx context.Context, obj *types.
return types.NewFramework(framework), nil
}
// Commitments is the resolver for the commitments field.
func (r *compliancePortalCommitmentGroupResolver) Commitments(ctx context.Context, obj *types.CompliancePortalCommitmentGroup, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.CompliancePortalCommitmentConnection, error) {
compliancePage := compliancepage.CompliancePageFromContext(ctx)
scope := coredata.NewScopeFromObjectID(compliancePage.OrganizationID)
pageOrderBy := page.OrderBy[coredata.CompliancePortalCommitmentOrderField]{
Field: coredata.CompliancePortalCommitmentOrderFieldRank,
Direction: page.OrderDirectionAsc,
}
cursor := types.NewCursor(first, after, last, before, pageOrderBy)
commitmentPage, err := r.trust.CompliancePortalCommitments.ListForGroupID(ctx, scope, obj.ID, cursor)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot list public compliance portal commitments", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return types.NewCompliancePortalCommitmentConnection(commitmentPage), nil
}
// Alias is the resolver for the alias field.
func (r *documentResolver) Alias(ctx context.Context, obj *types.Document) (*string, error) {
return r.ResourceAliasResolver(ctx, obj.ID)
@@ -897,6 +916,25 @@ func (r *trustCenterResolver) References(ctx context.Context, obj *types.TrustCe
return types.NewTrustCenterReferenceConnection(referencePage), nil
}
// CommitmentGroups is the resolver for the commitmentGroups field.
func (r *trustCenterResolver) CommitmentGroups(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.CompliancePortalCommitmentGroupConnection, error) {
compliancePage := compliancepage.CompliancePageFromContext(ctx)
scope := coredata.NewScopeFromObjectID(compliancePage.OrganizationID)
pageOrderBy := page.OrderBy[coredata.CompliancePortalCommitmentGroupOrderField]{
Field: coredata.CompliancePortalCommitmentGroupOrderFieldRank,
Direction: page.OrderDirectionAsc,
}
cursor := types.NewCursor(first, after, last, before, pageOrderBy)
groupPage, err := r.trust.CompliancePortalCommitmentGroups.ListForTrustCenterID(ctx, scope, obj.ID, cursor)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot list public compliance portal commitment groups", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return types.NewCompliancePortalCommitmentGroupConnection(groupPage), nil
}
// TrustCenterFiles is the resolver for the trustCenterFiles field.
func (r *trustCenterResolver) TrustCenterFiles(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey, filter *types.TrustCenterVisibilityFilter) (*types.TrustCenterFileConnection, error) {
compliancePage := compliancepage.CompliancePageFromContext(ctx)
@@ -1115,6 +1153,11 @@ func (r *Resolver) ComplianceFramework() schema.ComplianceFrameworkResolver {
return &complianceFrameworkResolver{r}
}
// CompliancePortalCommitmentGroup returns schema.CompliancePortalCommitmentGroupResolver implementation.
func (r *Resolver) CompliancePortalCommitmentGroup() schema.CompliancePortalCommitmentGroupResolver {
return &compliancePortalCommitmentGroupResolver{r}
}
// Document returns schema.DocumentResolver implementation.
func (r *Resolver) Document() schema.DocumentResolver { return &documentResolver{r} }
@@ -1140,13 +1183,14 @@ func (r *Resolver) TrustCenterReference() schema.TrustCenterReferenceResolver {
}
type (
auditResolver struct{ *Resolver }
auditReportResolver struct{ *Resolver }
complianceFrameworkResolver struct{ *Resolver }
documentResolver struct{ *Resolver }
frameworkResolver struct{ *Resolver }
subprocessorConnectionResolver struct{ *Resolver }
trustCenterResolver struct{ *Resolver }
trustCenterFileResolver struct{ *Resolver }
trustCenterReferenceResolver struct{ *Resolver }
auditResolver struct{ *Resolver }
auditReportResolver struct{ *Resolver }
complianceFrameworkResolver struct{ *Resolver }
compliancePortalCommitmentGroupResolver struct{ *Resolver }
documentResolver struct{ *Resolver }
frameworkResolver struct{ *Resolver }
subprocessorConnectionResolver struct{ *Resolver }
trustCenterResolver struct{ *Resolver }
trustCenterFileResolver struct{ *Resolver }
trustCenterReferenceResolver struct{ *Resolver }
)

View File

@@ -0,0 +1,94 @@
// Copyright (c) 2026 Probo Inc <hello@probo.com>.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
package types
import (
"go.probo.inc/probo/pkg/coredata"
"go.probo.inc/probo/pkg/page"
)
func NewCompliancePortalCommitmentGroup(g *coredata.CompliancePortalCommitmentGroup) *CompliancePortalCommitmentGroup {
return &CompliancePortalCommitmentGroup{
ID: g.ID,
Title: g.Title,
Description: g.Description,
}
}
func NewCompliancePortalCommitmentGroupConnection(
p *page.Page[*coredata.CompliancePortalCommitmentGroup, coredata.CompliancePortalCommitmentGroupOrderField],
) *CompliancePortalCommitmentGroupConnection {
edges := make([]*CompliancePortalCommitmentGroupEdge, len(p.Data))
for i, item := range p.Data {
edges[i] = NewCompliancePortalCommitmentGroupEdge(item, p.Cursor.OrderBy.Field)
}
return &CompliancePortalCommitmentGroupConnection{
Edges: edges,
PageInfo: NewPageInfo(p),
}
}
func NewCompliancePortalCommitmentGroupEdge(
g *coredata.CompliancePortalCommitmentGroup,
orderBy coredata.CompliancePortalCommitmentGroupOrderField,
) *CompliancePortalCommitmentGroupEdge {
return &CompliancePortalCommitmentGroupEdge{
Cursor: g.CursorKey(orderBy),
Node: NewCompliancePortalCommitmentGroup(g),
}
}
func NewCompliancePortalCommitment(c *coredata.CompliancePortalCommitment) *CompliancePortalCommitment {
return &CompliancePortalCommitment{
ID: c.ID,
Icon: c.Icon,
Eyebrow: c.Eyebrow,
Title: c.Title,
Description: c.Description,
}
}
func NewCompliancePortalCommitmentConnection(
p *page.Page[*coredata.CompliancePortalCommitment, coredata.CompliancePortalCommitmentOrderField],
) *CompliancePortalCommitmentConnection {
edges := make([]*CompliancePortalCommitmentEdge, len(p.Data))
for i, item := range p.Data {
edges[i] = NewCompliancePortalCommitmentEdge(item, p.Cursor.OrderBy.Field)
}
return &CompliancePortalCommitmentConnection{
Edges: edges,
PageInfo: NewPageInfo(p),
}
}
func NewCompliancePortalCommitmentEdge(
c *coredata.CompliancePortalCommitment,
orderBy coredata.CompliancePortalCommitmentOrderField,
) *CompliancePortalCommitmentEdge {
return &CompliancePortalCommitmentEdge{
Cursor: c.CursorKey(orderBy),
Node: NewCompliancePortalCommitment(c),
}
}