Fix pull request comments
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -9,17 +9,14 @@ import {
|
|||||||
} from "react-relay";
|
} from "react-relay";
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Input } from "@/components/ui/input";
|
|
||||||
import { Textarea } from "@/components/ui/textarea";
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import { toast } from "@/hooks/use-toast";
|
import { toast } from "@/hooks/use-toast";
|
||||||
import { Suspense } from "react";
|
import { Suspense } from "react";
|
||||||
import PeopleSelector from "@/components/PeopleSelector";
|
|
||||||
import type { EditPolicyViewQuery } from "./__generated__/EditPolicyViewQuery.graphql";
|
import type { EditPolicyViewQuery } from "./__generated__/EditPolicyViewQuery.graphql";
|
||||||
import type { EditPolicyViewMutation as EditPolicyViewMutationType } from "./__generated__/EditPolicyViewMutation.graphql";
|
import type { EditPolicyViewMutation as EditPolicyViewMutationType } from "./__generated__/EditPolicyViewMutation.graphql";
|
||||||
import { PageTemplate } from "@/components/PageTemplate";
|
import { PageTemplate } from "@/components/PageTemplate";
|
||||||
import { EditPolicyViewSkeleton } from "./EditPolicyPage";
|
import { EditPolicyViewSkeleton } from "./EditPolicyPage";
|
||||||
import { User } from "lucide-react";
|
|
||||||
|
|
||||||
const editPolicyViewQuery = graphql`
|
const editPolicyViewQuery = graphql`
|
||||||
query EditPolicyViewQuery($policyId: ID!, $organizationId: ID!, $policyVersionId: ID!) {
|
query EditPolicyViewQuery($policyId: ID!, $organizationId: ID!, $policyVersionId: ID!) {
|
||||||
|
|||||||
@@ -38,11 +38,8 @@ import {
|
|||||||
DialogTitle,
|
DialogTitle,
|
||||||
DialogDescription,
|
DialogDescription,
|
||||||
} from "@/components/ui/dialog";
|
} from "@/components/ui/dialog";
|
||||||
import { Avatar } from "@/components/ui/avatar";
|
|
||||||
import { cn } from "@/lib/utils";
|
|
||||||
import PeopleSelector from "@/components/PeopleSelector";
|
import PeopleSelector from "@/components/PeopleSelector";
|
||||||
import type { PeopleSelector_organization$key } from "@/components/__generated__/PeopleSelector_organization.graphql";
|
import type { PeopleSelector_organization$key } from "@/components/__generated__/PeopleSelector_organization.graphql";
|
||||||
import { Input } from "@/components/ui/input";
|
|
||||||
import { Textarea } from "@/components/ui/textarea";
|
import { Textarea } from "@/components/ui/textarea";
|
||||||
|
|
||||||
const policyListViewQuery = graphql`
|
const policyListViewQuery = graphql`
|
||||||
@@ -363,7 +360,7 @@ function CreatePolicyModal({
|
|||||||
className={`text-4xl leading-tight font-bold outline-none focus:outline-none ${!title ? 'text-gray-400' : 'text-black'}`}
|
className={`text-4xl leading-tight font-bold outline-none focus:outline-none ${!title ? 'text-gray-400' : 'text-black'}`}
|
||||||
contentEditable
|
contentEditable
|
||||||
suppressContentEditableWarning
|
suppressContentEditableWarning
|
||||||
onBlur={(e) => setTitle(e.currentTarget.textContent || "")}
|
onInput={(e) => setTitle(e.currentTarget.textContent || "")}
|
||||||
style={{ WebkitTapHighlightColor: 'transparent' }}
|
style={{ WebkitTapHighlightColor: 'transparent' }}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
if (!title) {
|
if (!title) {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ SELECT
|
|||||||
p.tenant_id,
|
p.tenant_id,
|
||||||
p.id,
|
p.id,
|
||||||
1,
|
1,
|
||||||
'',
|
p.content,
|
||||||
'Initial version',
|
'Initial version',
|
||||||
p.owner_id,
|
p.owner_id,
|
||||||
'DRAFT',
|
'DRAFT',
|
||||||
@@ -56,5 +56,5 @@ SET current_published_version = 1
|
|||||||
WHERE EXISTS (
|
WHERE EXISTS (
|
||||||
SELECT 1 FROM policy_versions pv
|
SELECT 1 FROM policy_versions pv
|
||||||
WHERE pv.policy_id = p.id
|
WHERE pv.policy_id = p.id
|
||||||
AND pv.status = 'published'
|
AND pv.status = 'PUBLISHED'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ INSERT INTO policy_versions (
|
|||||||
"content": p.Content,
|
"content": p.Content,
|
||||||
"changelog": p.Changelog,
|
"changelog": p.Changelog,
|
||||||
"created_by": p.CreatedBy,
|
"created_by": p.CreatedBy,
|
||||||
"status": PolicyStatusDraft,
|
"status": p.Status,
|
||||||
"created_at": now,
|
"created_at": now,
|
||||||
"updated_at": now,
|
"updated_at": now,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ func (pvs *PolicyVersionSignatureState) UnmarshalText(data []byte) error {
|
|||||||
case PolicyVersionSignatureStateSigned.String():
|
case PolicyVersionSignatureStateSigned.String():
|
||||||
*pvs = PolicyVersionSignatureStateSigned
|
*pvs = PolicyVersionSignatureStateSigned
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("invalid MesureState value: %q", val)
|
return fmt.Errorf("invalid PolicyVersionSignatureState value: %q", val)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -55,6 +55,8 @@ func (pvs PolicyVersionSignatureState) String() string {
|
|||||||
val = "REQUESTED"
|
val = "REQUESTED"
|
||||||
case PolicyVersionSignatureStateSigned:
|
case PolicyVersionSignatureStateSigned:
|
||||||
val = "SIGNED"
|
val = "SIGNED"
|
||||||
|
default:
|
||||||
|
panic(fmt.Errorf("invalid PolicyVersionSignatureState value: %q", string(pvs)))
|
||||||
}
|
}
|
||||||
|
|
||||||
return val
|
return val
|
||||||
@@ -63,7 +65,7 @@ func (pvs PolicyVersionSignatureState) String() string {
|
|||||||
func (pvs *PolicyVersionSignatureState) Scan(value any) error {
|
func (pvs *PolicyVersionSignatureState) Scan(value any) error {
|
||||||
val, ok := value.(string)
|
val, ok := value.(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("invalid scan source for MesureState, expected string got %T", value)
|
return fmt.Errorf("invalid scan source for PolicyVersionSignatureState, expected string got %T", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pvs.UnmarshalText([]byte(val))
|
return pvs.UnmarshalText([]byte(val))
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ func (s *PolicyService) Create(
|
|||||||
PolicyID: policyID,
|
PolicyID: policyID,
|
||||||
VersionNumber: 1,
|
VersionNumber: 1,
|
||||||
Content: req.Content,
|
Content: req.Content,
|
||||||
|
Status: coredata.PolicyStatusDraft,
|
||||||
CreatedBy: req.CreatedBy,
|
CreatedBy: req.CreatedBy,
|
||||||
CreatedAt: now,
|
CreatedAt: now,
|
||||||
UpdatedAt: now,
|
UpdatedAt: now,
|
||||||
@@ -147,7 +148,7 @@ func (s *PolicyService) Create(
|
|||||||
return fmt.Errorf("cannot insert policy: %w", err)
|
return fmt.Errorf("cannot insert policy: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := policyVersion.Update(ctx, conn, s.svc.scope); err != nil {
|
if err := policyVersion.Insert(ctx, conn, s.svc.scope); err != nil {
|
||||||
return fmt.Errorf("cannot create policy version: %w", err)
|
return fmt.Errorf("cannot create policy version: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user