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 }) {
const logo = availableLogos.get(name);
return logo ? (
<img src={logo} alt="" className="size-12" />
<img src={logo} alt="" className="h-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 selectedControl = controlId
? controls.find((control) => control.id === controlId)
: controls[0];
: controls[0] || null;
const connectionId = framework.controls.__id;
const deleteFramework = useDeleteFrameworkMutation(
framework,
@@ -109,7 +109,7 @@ export default function FrameworkDetailPage(props: Props) {
});
};
if (!controlId) {
if (!controlId && controls.length > 0) {
return (
<Navigate
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",
},
{
id: "GDPR",
name: "GDPR",
logo: "/logos/gdpr.png",
description: "General Data Protection Regulation",
},
{
id: "SOX",
name: "SOX",
logo: "/logos/sox.png",
description: "Sarbanes-Oxley Act",
id: "HIPAA",
name: "HIPAA",
logo: "/logos/hipaa.png",
description: "Health Insurance Portability and Accountability Act",
},
];

View File

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

View File

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

View File

@@ -6718,7 +6718,7 @@ input CreateControlInput {
sectionTitle: String!
name: String!
description: String!
status: ControlStatus
status: ControlStatus!
exclusionJustification: String
}
@@ -38150,7 +38150,7 @@ func (ec *executionContext) unmarshalInputCreateControlInput(ctx context.Context
it.Description = data
case "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 {
return it, err
}

View File

@@ -169,12 +169,12 @@ type CreateControlDocumentMappingPayload struct {
}
type CreateControlInput struct {
FrameworkID gid.GID `json:"frameworkId"`
SectionTitle string `json:"sectionTitle"`
Name string `json:"name"`
Description string `json:"description"`
Status *coredata.ControlStatus `json:"status,omitempty"`
ExclusionJustification *string `json:"exclusionJustification,omitempty"`
FrameworkID gid.GID `json:"frameworkId"`
SectionTitle string `json:"sectionTitle"`
Name string `json:"name"`
Description string `json:"description"`
Status coredata.ControlStatus `json:"status"`
ExclusionJustification *string `json:"exclusionJustification,omitempty"`
}
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())
control, err := prb.Controls.Create(ctx, probo.CreateControlRequest{
FrameworkID: input.FrameworkID,
Name: input.Name,
Description: input.Description,
SectionTitle: input.SectionTitle,
FrameworkID: input.FrameworkID,
Name: input.Name,
Description: input.Description,
SectionTitle: input.SectionTitle,
Status: &input.Status,
ExclusionJustification: input.ExclusionJustification,
})
if err != nil {
return nil, fmt.Errorf("cannot create control: %w", err)