Fix controls and frameworks small issues

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-07-21 15:54:12 +02:00
parent 07856757c7
commit f0afde219b
9 changed files with 39 additions and 39 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -8,7 +8,7 @@ const availableLogos = new Map(
export function FrameworkLogo({ name }: { name: string }) { export function FrameworkLogo({ name }: { name: string }) {
const logo = availableLogos.get(name); const logo = availableLogos.get(name);
return logo ? ( return logo ? (
<img src={logo} alt="" className="size-12" /> <img src={logo} alt="" className="h-12" />
) : ( ) : (
<Avatar name={name} size="l" className="size-12" /> <Avatar name={name} size="l" className="size-12" />
); );

View File

@@ -83,7 +83,7 @@ export default function FrameworkDetailPage(props: Props) {
const controls = framework.controls.edges.map((edge) => edge.node); const controls = framework.controls.edges.map((edge) => edge.node);
const selectedControl = controlId const selectedControl = controlId
? controls.find((control) => control.id === controlId) ? controls.find((control) => control.id === controlId)
: controls[0]; : controls[0] || null;
const connectionId = framework.controls.__id; const connectionId = framework.controls.__id;
const deleteFramework = useDeleteFrameworkMutation( const deleteFramework = useDeleteFrameworkMutation(
framework, framework,
@@ -109,7 +109,7 @@ export default function FrameworkDetailPage(props: Props) {
}); });
}; };
if (!controlId) { if (!controlId && controls.length > 0) {
return ( return (
<Navigate <Navigate
to={`/organizations/${organizationId}/frameworks/${framework.id}/controls/${controls[0].id}`} to={`/organizations/${organizationId}/frameworks/${framework.id}/controls/${controls[0].id}`}

View File

@@ -12,15 +12,9 @@ export const availableFrameworks = [
description: "System and Organization Controls 2", description: "System and Organization Controls 2",
}, },
{ {
id: "GDPR", id: "HIPAA",
name: "GDPR", name: "HIPAA",
logo: "/logos/gdpr.png", logo: "/logos/hipaa.png",
description: "General Data Protection Regulation", description: "Health Insurance Portability and Accountability Act",
},
{
id: "SOX",
name: "SOX",
logo: "/logos/sox.png",
description: "Sarbanes-Oxley Act",
}, },
]; ];

View File

@@ -31,11 +31,13 @@ type (
} }
CreateControlRequest struct { CreateControlRequest struct {
ID gid.GID ID gid.GID
FrameworkID gid.GID FrameworkID gid.GID
Name string Name string
Description string Description string
SectionTitle string SectionTitle string
Status *coredata.ControlStatus
ExclusionJustification *string
} }
UpdateControlRequest struct { UpdateControlRequest struct {
@@ -498,14 +500,16 @@ func (s ControlService) Create(
framework := &coredata.Framework{} framework := &coredata.Framework{}
control := &coredata.Control{ control := &coredata.Control{
ID: gid.New(s.svc.scope.GetTenantID(), coredata.ControlEntityType), ID: gid.New(s.svc.scope.GetTenantID(), coredata.ControlEntityType),
FrameworkID: req.FrameworkID, FrameworkID: req.FrameworkID,
TenantID: s.svc.scope.GetTenantID(), TenantID: s.svc.scope.GetTenantID(),
Name: req.Name, Name: req.Name,
Description: req.Description, Description: req.Description,
SectionTitle: req.SectionTitle, SectionTitle: req.SectionTitle,
CreatedAt: now, Status: *req.Status,
UpdatedAt: now, ExclusionJustification: req.ExclusionJustification,
CreatedAt: now,
UpdatedAt: now,
} }
err := s.svc.pg.WithTx( err := s.svc.pg.WithTx(

View File

@@ -1761,7 +1761,7 @@ input CreateControlInput {
sectionTitle: String! sectionTitle: String!
name: String! name: String!
description: String! description: String!
status: ControlStatus status: ControlStatus!
exclusionJustification: String exclusionJustification: String
} }

View File

@@ -6718,7 +6718,7 @@ input CreateControlInput {
sectionTitle: String! sectionTitle: String!
name: String! name: String!
description: String! description: String!
status: ControlStatus status: ControlStatus!
exclusionJustification: String exclusionJustification: String
} }
@@ -38150,7 +38150,7 @@ func (ec *executionContext) unmarshalInputCreateControlInput(ctx context.Context
it.Description = data it.Description = data
case "status": case "status":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status"))
data, err := ec.unmarshalOControlStatus2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐControlStatus(ctx, v) data, err := ec.unmarshalNControlStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐControlStatus(ctx, v)
if err != nil { if err != nil {
return it, err return it, err
} }

View File

@@ -169,12 +169,12 @@ type CreateControlDocumentMappingPayload struct {
} }
type CreateControlInput struct { type CreateControlInput struct {
FrameworkID gid.GID `json:"frameworkId"` FrameworkID gid.GID `json:"frameworkId"`
SectionTitle string `json:"sectionTitle"` SectionTitle string `json:"sectionTitle"`
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description"` Description string `json:"description"`
Status *coredata.ControlStatus `json:"status,omitempty"` Status coredata.ControlStatus `json:"status"`
ExclusionJustification *string `json:"exclusionJustification,omitempty"` ExclusionJustification *string `json:"exclusionJustification,omitempty"`
} }
type CreateControlMeasureMappingInput struct { type CreateControlMeasureMappingInput struct {

View File

@@ -1201,10 +1201,12 @@ func (r *mutationResolver) CreateControl(ctx context.Context, input types.Create
prb := r.ProboService(ctx, input.FrameworkID.TenantID()) prb := r.ProboService(ctx, input.FrameworkID.TenantID())
control, err := prb.Controls.Create(ctx, probo.CreateControlRequest{ control, err := prb.Controls.Create(ctx, probo.CreateControlRequest{
FrameworkID: input.FrameworkID, FrameworkID: input.FrameworkID,
Name: input.Name, Name: input.Name,
Description: input.Description, Description: input.Description,
SectionTitle: input.SectionTitle, SectionTitle: input.SectionTitle,
Status: &input.Status,
ExclusionJustification: input.ExclusionJustification,
}) })
if err != nil { if err != nil {
return nil, fmt.Errorf("cannot create control: %w", err) return nil, fmt.Errorf("cannot create control: %w", err)