Add note to risk

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-04-24 17:47:39 -07:00
parent 60cdc8f19f
commit cece072619
17 changed files with 254 additions and 66 deletions

View File

@@ -52,6 +52,7 @@ const editRiskViewQuery = graphql`
residualLikelihood
residualImpact
treatment
note
owner {
id
fullName
@@ -78,6 +79,7 @@ const updateRiskMutation = graphql`
residualLikelihood
residualImpact
treatment
note
updatedAt
owner {
id
@@ -107,6 +109,7 @@ function EditRiskViewContent({
const [name, setName] = useState("");
const [description, setDescription] = useState("");
const [category, setCategory] = useState("");
const [note, setNote] = useState("");
const [inherentLikelihood, setInherentLikelihood] = useState<number>(3);
const [inherentImpact, setInherentImpact] = useState<number>(3);
const [residualLikelihood, setResidualLikelihood] = useState<number>(3);
@@ -124,6 +127,7 @@ function EditRiskViewContent({
setName(risk.name || "");
setDescription(risk.description || "");
setCategory(risk.category || "");
setNote(risk.note || "");
// Set values directly as integers
setInherentLikelihood(risk.inherentLikelihood || 3);
setInherentImpact(risk.inherentImpact || 3);
@@ -158,6 +162,7 @@ function EditRiskViewContent({
residualLikelihood,
residualImpact,
treatment,
note,
ownerId: ownerId || undefined,
};
@@ -241,6 +246,17 @@ function EditRiskViewContent({
/>
</div>
<div className="space-y-2">
<Label htmlFor="note">Note</Label>
<Textarea
id="note"
placeholder="Add any additional note about this risk"
value={note}
onChange={(e) => setNote(e.target.value)}
rows={3}
/>
</div>
<div className="space-y-2">
<Label htmlFor="owner" className="flex items-center gap-2">
<User className="h-4 w-4" />

View File

@@ -95,6 +95,7 @@ function NewRiskForm({
const [residualImpact, setResidualImpact] = useState<number>(3);
const [treatment, setTreatment] = useState<string>("MITIGATED");
const [ownerId, setOwnerId] = useState<string | null>(null);
const [note, setNote] = useState<string>("");
const [isSubmitting, setIsSubmitting] = useState(false);
const [selectedTemplate, setSelectedTemplate] = useState<string>("");
const [selectedCategory, setSelectedCategory] = useState<string>("");
@@ -216,6 +217,7 @@ function NewRiskForm({
residualImpact,
treatment,
ownerId: ownerId || undefined,
note,
};
createRisk({
@@ -424,6 +426,20 @@ function NewRiskForm({
</p>
</div>
<div className="space-y-2">
<Label htmlFor="note">Notes</Label>
<Textarea
id="note"
placeholder="Add any additional notes about this risk"
value={note}
onChange={(e) => setNote(e.target.value)}
rows={3}
/>
<p className="text-sm text-tertiary">
Optional notes to provide more context about the risk
</p>
</div>
<Separator className="my-4" />
<div>

View File

@@ -82,6 +82,7 @@ const showRiskViewQuery = graphql`
inherentImpact
residualLikelihood
residualImpact
note
createdAt
updatedAt
mesures(first: 100) @connection(key: "Risk__mesures") {
@@ -1010,6 +1011,19 @@ function ShowRiskViewContent({
</CardContent>
</Card>
{risk.note && (
<Card>
<CardHeader className="pb-2">
<CardTitle>Note</CardTitle>
</CardHeader>
<CardContent>
<div className="prose prose-sm max-w-none">
{risk.note}
</div>
</CardContent>
</Card>
)}
<Tabs defaultValue="mesures" className="w-full">
<TabsList>
<TabsTrigger value="mesures">Mesures</TabsTrigger>

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<028d64b4c532fdc04b77de62bd70311b>>
* @generated SignedSource<<0637df266d41a7d8d4a54f4ecaf2b6ed>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -26,6 +26,7 @@ export type EditRiskViewQuery$data = {
readonly inherentImpact?: number;
readonly inherentLikelihood?: number;
readonly name?: string;
readonly note?: string;
readonly owner?: {
readonly fullName: string;
readonly id: string;
@@ -125,10 +126,17 @@ v12 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"name": "note",
"storageKey": null
},
v13 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"storageKey": null
},
v14 = {
"alias": null,
"args": null,
"concreteType": "People",
@@ -137,25 +145,25 @@ v13 = {
"plural": false,
"selections": [
(v3/*: any*/),
(v12/*: any*/)
(v13/*: any*/)
],
"storageKey": null
},
v14 = [
v15 = [
{
"kind": "Variable",
"name": "id",
"variableName": "organizationId"
}
],
v15 = {
v16 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
v16 = [
v17 = [
{
"kind": "Literal",
"name": "first",
@@ -200,7 +208,8 @@ return {
(v9/*: any*/),
(v10/*: any*/),
(v11/*: any*/),
(v13/*: any*/)
(v12/*: any*/),
(v14/*: any*/)
],
"type": "Risk",
"abstractKey": null
@@ -210,7 +219,7 @@ return {
},
{
"alias": "organization",
"args": (v14/*: any*/),
"args": (v15/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
@@ -245,7 +254,7 @@ return {
"name": "node",
"plural": false,
"selections": [
(v15/*: any*/),
(v16/*: any*/),
(v3/*: any*/),
{
"kind": "InlineFragment",
@@ -258,7 +267,8 @@ return {
(v9/*: any*/),
(v10/*: any*/),
(v11/*: any*/),
(v13/*: any*/)
(v12/*: any*/),
(v14/*: any*/)
],
"type": "Risk",
"abstractKey": null
@@ -268,20 +278,20 @@ return {
},
{
"alias": "organization",
"args": (v14/*: any*/),
"args": (v15/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
(v15/*: any*/),
(v16/*: any*/),
(v3/*: any*/),
{
"kind": "InlineFragment",
"selections": [
{
"alias": null,
"args": (v16/*: any*/),
"args": (v17/*: any*/),
"concreteType": "PeopleConnection",
"kind": "LinkedField",
"name": "peoples",
@@ -304,7 +314,7 @@ return {
"plural": false,
"selections": [
(v3/*: any*/),
(v12/*: any*/),
(v13/*: any*/),
{
"alias": null,
"args": null,
@@ -312,7 +322,7 @@ return {
"name": "primaryEmailAddress",
"storageKey": null
},
(v15/*: any*/)
(v16/*: any*/)
],
"storageKey": null
},
@@ -356,7 +366,7 @@ return {
},
{
"alias": null,
"args": (v16/*: any*/),
"args": (v17/*: any*/),
"filters": [
"orderBy"
],
@@ -375,16 +385,16 @@ return {
]
},
"params": {
"cacheID": "cdae5e406ef1b70c372791cc998e82ac",
"cacheID": "d12002d4d1efd523c4f048d068e78644",
"id": null,
"metadata": {},
"name": "EditRiskViewQuery",
"operationKind": "query",
"text": "query EditRiskViewQuery(\n $riskId: ID!\n $organizationId: ID!\n) {\n risk: node(id: $riskId) {\n __typename\n ... on Risk {\n id\n name\n description\n category\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n treatment\n owner {\n id\n fullName\n }\n }\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ...PeopleSelector_organization\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
"text": "query EditRiskViewQuery(\n $riskId: ID!\n $organizationId: ID!\n) {\n risk: node(id: $riskId) {\n __typename\n ... on Risk {\n id\n name\n description\n category\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n treatment\n note\n owner {\n id\n fullName\n }\n }\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ...PeopleSelector_organization\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
}
};
})();
(node as any).hash = "3ea38c607c8a1d3f18eaa964476f1529";
(node as any).hash = "44e4278c5a81cde3ab21584cb4f6de83";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<5a97a0d2387d66d74de35ec9b5bc86cf>>
* @generated SignedSource<<8241dc0eb1cf23f48be022628e0ab2b3>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -17,6 +17,7 @@ export type UpdateRiskInput = {
inherentImpact?: number | null | undefined;
inherentLikelihood?: number | null | undefined;
name?: string | null | undefined;
note?: string | null | undefined;
ownerId?: string | null | undefined;
residualImpact?: number | null | undefined;
residualLikelihood?: number | null | undefined;
@@ -34,6 +35,7 @@ export type EditRiskViewUpdateRiskMutation$data = {
readonly inherentImpact: number;
readonly inherentLikelihood: number;
readonly name: string;
readonly note: string;
readonly owner: {
readonly fullName: string;
readonly id: string;
@@ -145,6 +147,13 @@ v2 = [
"name": "treatment",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "note",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -196,16 +205,16 @@ return {
"selections": (v2/*: any*/)
},
"params": {
"cacheID": "a640c5be0a7614478f2d229154d9206a",
"cacheID": "9ae05593d756dd95091353fe5706f8e3",
"id": null,
"metadata": {},
"name": "EditRiskViewUpdateRiskMutation",
"operationKind": "mutation",
"text": "mutation EditRiskViewUpdateRiskMutation(\n $input: UpdateRiskInput!\n) {\n updateRisk(input: $input) {\n risk {\n id\n name\n description\n category\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n treatment\n updatedAt\n owner {\n id\n fullName\n }\n }\n }\n}\n"
"text": "mutation EditRiskViewUpdateRiskMutation(\n $input: UpdateRiskInput!\n) {\n updateRisk(input: $input) {\n risk {\n id\n name\n description\n category\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n treatment\n note\n updatedAt\n owner {\n id\n fullName\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "7f4cfbd3d1e3fa396b7ffbcac1e12b0a";
(node as any).hash = "dd20595391e04ea370129e1bf055a5ad";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<5b015e6ca9ba83b884026cca65dcdc1c>>
* @generated SignedSource<<98ddd8a7c3387ae45630b80d033bf623>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -16,6 +16,7 @@ export type CreateRiskInput = {
inherentImpact: number;
inherentLikelihood: number;
name: string;
note?: string | null | undefined;
organizationId: string;
ownerId?: string | null | undefined;
residualImpact?: number | null | undefined;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<166b32236b296d1d0a4956cabacb1715>>
* @generated SignedSource<<e318c9e0fe4355eb4923acb54da59ebb>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -46,6 +46,7 @@ export type ShowRiskViewQuery$data = {
}>;
};
readonly name?: string;
readonly note?: string;
readonly owner?: {
readonly fullName: string;
readonly id: string;
@@ -165,31 +166,38 @@ v11 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "createdAt",
"name": "note",
"storageKey": null
},
v12 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "updatedAt",
"name": "createdAt",
"storageKey": null
},
v13 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"name": "updatedAt",
"storageKey": null
},
v14 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"name": "__typename",
"storageKey": null
},
v15 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
},
v16 = {
"alias": null,
"args": null,
"concreteType": "PageInfo",
@@ -214,7 +222,7 @@ v15 = {
],
"storageKey": null
},
v16 = [
v17 = [
{
"alias": null,
"args": null,
@@ -241,7 +249,7 @@ v16 = [
"name": "category",
"storageKey": null
},
(v11/*: any*/),
(v12/*: any*/),
{
"alias": null,
"args": null,
@@ -249,17 +257,17 @@ v16 = [
"name": "state",
"storageKey": null
},
(v13/*: any*/)
(v14/*: any*/)
],
"storageKey": null
},
(v14/*: any*/)
(v15/*: any*/)
],
"storageKey": null
},
(v15/*: any*/)
(v16/*: any*/)
],
v17 = [
v18 = [
{
"alias": null,
"args": null,
@@ -285,18 +293,18 @@ v17 = [
"name": "status",
"storageKey": null
},
(v11/*: any*/),
(v13/*: any*/)
(v12/*: any*/),
(v14/*: any*/)
],
"storageKey": null
},
(v14/*: any*/)
(v15/*: any*/)
],
"storageKey": null
},
(v15/*: any*/)
(v16/*: any*/)
],
v18 = [
v19 = [
{
"alias": null,
"args": null,
@@ -323,18 +331,18 @@ v18 = [
},
(v3/*: any*/),
(v4/*: any*/),
(v11/*: any*/),
(v13/*: any*/)
(v12/*: any*/),
(v14/*: any*/)
],
"storageKey": null
},
(v14/*: any*/)
(v15/*: any*/)
],
"storageKey": null
},
(v15/*: any*/)
(v16/*: any*/)
],
v19 = [
v20 = [
{
"kind": "Literal",
"name": "first",
@@ -370,6 +378,7 @@ return {
(v10/*: any*/),
(v11/*: any*/),
(v12/*: any*/),
(v13/*: any*/),
{
"alias": "mesures",
"args": null,
@@ -377,7 +386,7 @@ return {
"kind": "LinkedField",
"name": "__Risk__mesures_connection",
"plural": false,
"selections": (v16/*: any*/),
"selections": (v17/*: any*/),
"storageKey": null
},
{
@@ -387,7 +396,7 @@ return {
"kind": "LinkedField",
"name": "__Risk__policies_connection",
"plural": false,
"selections": (v17/*: any*/),
"selections": (v18/*: any*/),
"storageKey": null
},
{
@@ -397,7 +406,7 @@ return {
"kind": "LinkedField",
"name": "__Risk__controls_connection",
"plural": false,
"selections": (v18/*: any*/),
"selections": (v19/*: any*/),
"storageKey": null
}
],
@@ -425,7 +434,7 @@ return {
"name": "node",
"plural": false,
"selections": [
(v13/*: any*/),
(v14/*: any*/),
(v2/*: any*/),
{
"kind": "InlineFragment",
@@ -440,19 +449,20 @@ return {
(v10/*: any*/),
(v11/*: any*/),
(v12/*: any*/),
(v13/*: any*/),
{
"alias": null,
"args": (v19/*: any*/),
"args": (v20/*: any*/),
"concreteType": "MesureConnection",
"kind": "LinkedField",
"name": "mesures",
"plural": false,
"selections": (v16/*: any*/),
"selections": (v17/*: any*/),
"storageKey": "mesures(first:100)"
},
{
"alias": null,
"args": (v19/*: any*/),
"args": (v20/*: any*/),
"filters": null,
"handle": "connection",
"key": "Risk__mesures",
@@ -461,17 +471,17 @@ return {
},
{
"alias": null,
"args": (v19/*: any*/),
"args": (v20/*: any*/),
"concreteType": "PolicyConnection",
"kind": "LinkedField",
"name": "policies",
"plural": false,
"selections": (v17/*: any*/),
"selections": (v18/*: any*/),
"storageKey": "policies(first:100)"
},
{
"alias": null,
"args": (v19/*: any*/),
"args": (v20/*: any*/),
"filters": null,
"handle": "connection",
"key": "Risk__policies",
@@ -480,17 +490,17 @@ return {
},
{
"alias": null,
"args": (v19/*: any*/),
"args": (v20/*: any*/),
"concreteType": "ControlConnection",
"kind": "LinkedField",
"name": "controls",
"plural": false,
"selections": (v18/*: any*/),
"selections": (v19/*: any*/),
"storageKey": "controls(first:100)"
},
{
"alias": null,
"args": (v19/*: any*/),
"args": (v20/*: any*/),
"filters": null,
"handle": "connection",
"key": "Risk__controls",
@@ -507,7 +517,7 @@ return {
]
},
"params": {
"cacheID": "b315b57d1b366f87758e300825909da0",
"cacheID": "05f0fe48c916ecda883f606eed0c9244",
"id": null,
"metadata": {
"connection": [
@@ -542,11 +552,11 @@ return {
},
"name": "ShowRiskViewQuery",
"operationKind": "query",
"text": "query ShowRiskViewQuery(\n $riskId: ID!\n) {\n node(id: $riskId) {\n __typename\n id\n ... on Risk {\n name\n description\n treatment\n owner {\n id\n fullName\n }\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n createdAt\n updatedAt\n mesures(first: 100) {\n edges {\n node {\n id\n name\n description\n category\n createdAt\n state\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n policies(first: 100) {\n edges {\n node {\n id\n name\n status\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n controls(first: 100) {\n edges {\n node {\n id\n referenceId\n name\n description\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
"text": "query ShowRiskViewQuery(\n $riskId: ID!\n) {\n node(id: $riskId) {\n __typename\n id\n ... on Risk {\n name\n description\n treatment\n owner {\n id\n fullName\n }\n inherentLikelihood\n inherentImpact\n residualLikelihood\n residualImpact\n note\n createdAt\n updatedAt\n mesures(first: 100) {\n edges {\n node {\n id\n name\n description\n category\n createdAt\n state\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n policies(first: 100) {\n edges {\n node {\n id\n name\n status\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n controls(first: 100) {\n edges {\n node {\n id\n referenceId\n name\n description\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "bbb709790492c573d25ee19412956501";
(node as any).hash = "25e67618b61999a955716e937a53a470";
export default node;