Rename severity to score

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-05-22 16:07:40 -07:00
parent ce22fa7f62
commit 9c5828b525
7 changed files with 133 additions and 116 deletions

View File

@@ -485,10 +485,10 @@ const measureRisksQuery = graphql`
description description
inherentLikelihood inherentLikelihood
inherentImpact inherentImpact
inherentSeverity inherentRiskScore
residualLikelihood residualLikelihood
residualImpact residualImpact
residualSeverity residualRiskScore
createdAt createdAt
updatedAt updatedAt
} }
@@ -556,7 +556,7 @@ function MeasureViewContent({
}) { }) {
const data = usePreloadedQuery<MeasureViewQueryType>( const data = usePreloadedQuery<MeasureViewQueryType>(
measureViewQuery, measureViewQuery,
queryRef, queryRef
); );
// Define a type for the measure with evidences field // Define a type for the measure with evidences field
@@ -591,7 +591,7 @@ function MeasureViewContent({
const environment = useRelayEnvironment(); const environment = useRelayEnvironment();
const [commitDeleteMeasure, isDeletingMeasure] = useMutation<any>( const [commitDeleteMeasure, isDeletingMeasure] = useMutation<any>(
deleteMeasureMutation, deleteMeasureMutation
); );
const [isDeleteMeasureOpen, setIsDeleteMeasureOpen] = useState(false); const [isDeleteMeasureOpen, setIsDeleteMeasureOpen] = useState(false);
@@ -615,7 +615,7 @@ function MeasureViewContent({
useState<MeasureViewLinkedControlsQuery$data | null>(null); useState<MeasureViewLinkedControlsQuery$data | null>(null);
const [controlSearchQuery, setControlSearchQuery] = useState(""); const [controlSearchQuery, setControlSearchQuery] = useState("");
const [selectedFrameworkId, setSelectedFrameworkId] = useState<string | null>( const [selectedFrameworkId, setSelectedFrameworkId] = useState<string | null>(
null, null
); );
const [isLoadingControls, setIsLoadingControls] = useState(false); const [isLoadingControls, setIsLoadingControls] = useState(false);
const [isLinkingControl, setIsLinkingControl] = useState(false); const [isLinkingControl, setIsLinkingControl] = useState(false);
@@ -624,11 +624,11 @@ function MeasureViewContent({
// Create mutation hooks for control mapping // Create mutation hooks for control mapping
const [commitCreateControlMapping] = const [commitCreateControlMapping] =
useMutation<MeasureViewCreateControlMappingMutation>( useMutation<MeasureViewCreateControlMappingMutation>(
createControlMappingMutation, createControlMappingMutation
); );
const [commitDeleteControlMapping] = const [commitDeleteControlMapping] =
useMutation<MeasureViewDeleteControlMappingMutation>( useMutation<MeasureViewDeleteControlMappingMutation>(
deleteControlMappingMutation, deleteControlMappingMutation
); );
useEffect(() => { useEffect(() => {
@@ -652,7 +652,7 @@ function MeasureViewContent({
fetchQuery<MeasureViewLinkedControlsQuery>( fetchQuery<MeasureViewLinkedControlsQuery>(
environment, environment,
linkedControlsQuery, linkedControlsQuery,
{ measureId }, { measureId }
).subscribe({ ).subscribe({
next: (data) => { next: (data) => {
setLinkedControlsData(data); setLinkedControlsData(data);
@@ -666,7 +666,7 @@ function MeasureViewContent({
// Add state for risks data // Add state for risks data
const [risksData, setRisksData] = useState<MeasureViewRisksQuery$data | null>( const [risksData, setRisksData] = useState<MeasureViewRisksQuery$data | null>(
null, null
); );
// Load risks data when component mounts // Load risks data when component mounts
@@ -713,7 +713,7 @@ function MeasureViewContent({
}; };
const [updateTask] = useMutation<MeasureViewUpdateTaskStateMutationType>( const [updateTask] = useMutation<MeasureViewUpdateTaskStateMutationType>(
updateTaskStateMutation, updateTaskStateMutation
); );
const [createTask] = const [createTask] =
useMutation<MeasureViewCreateTaskMutationType>(createTaskMutation); useMutation<MeasureViewCreateTaskMutationType>(createTaskMutation);
@@ -721,19 +721,19 @@ function MeasureViewContent({
useMutation<MeasureViewDeleteTaskMutationType>(deleteTaskMutation); useMutation<MeasureViewDeleteTaskMutationType>(deleteTaskMutation);
const [requestEvidence] = useMutation<any>(requestEvidenceMutation); const [requestEvidence] = useMutation<any>(requestEvidenceMutation);
const [deleteEvidence] = useMutation<MeasureViewDeleteEvidenceMutationType>( const [deleteEvidence] = useMutation<MeasureViewDeleteEvidenceMutationType>(
deleteEvidenceMutation, deleteEvidenceMutation
); );
const [assignTask] = const [assignTask] =
useMutation<MeasureViewAssignTaskMutationType>(assignTaskMutation); useMutation<MeasureViewAssignTaskMutationType>(assignTaskMutation);
const [unassignTask] = const [unassignTask] =
useMutation<MeasureViewUnassignTaskMutationType>(unassignTaskMutation); useMutation<MeasureViewUnassignTaskMutationType>(unassignTaskMutation);
const [fulfillEvidence] = useMutation<MeasureViewFulfillEvidenceMutationType>( const [fulfillEvidence] = useMutation<MeasureViewFulfillEvidenceMutationType>(
fulfillEvidenceMutation, fulfillEvidenceMutation
); );
const [updateMeasureState] = const [updateMeasureState] =
useMutation<MeasureViewUpdateMeasureStateMutationType>( useMutation<MeasureViewUpdateMeasureStateMutationType>(
updateMeasureStateMutation, updateMeasureStateMutation
); );
const [isCreateTaskOpen, setIsCreateTaskOpen] = useState(false); const [isCreateTaskOpen, setIsCreateTaskOpen] = useState(false);
@@ -756,7 +756,7 @@ function MeasureViewContent({
const hiddenFileInputRef = useRef<HTMLInputElement>(null); const hiddenFileInputRef = useRef<HTMLInputElement>(null);
const [draggedOverTaskId, setDraggedOverTaskId] = useState<string | null>( const [draggedOverTaskId, setDraggedOverTaskId] = useState<string | null>(
null, null
); );
const [uploadingTaskId, setUploadingTaskId] = useState<string | null>(null); const [uploadingTaskId, setUploadingTaskId] = useState<string | null>(null);
const [isDraggingFile, setIsDraggingFile] = useState(false); const [isDraggingFile, setIsDraggingFile] = useState(false);
@@ -810,7 +810,7 @@ function MeasureViewContent({
// Add state for selected task panel // Add state for selected task panel
const [selectedTask, setSelectedTask] = useState<(typeof tasks)[0] | null>( const [selectedTask, setSelectedTask] = useState<(typeof tasks)[0] | null>(
null, null
); );
// Track if task panel is open // Track if task panel is open
@@ -846,7 +846,7 @@ function MeasureViewContent({
} }
return null; return null;
}, },
[tasks], [tasks]
); );
// Add a function to get the measure evidence connection ID // Add a function to get the measure evidence connection ID
@@ -1140,8 +1140,10 @@ function MeasureViewContent({
if (taskForEvidence) { if (taskForEvidence) {
// This is a task-specific evidence // This is a task-specific evidence
const evidenceConnectionId = getEvidenceConnectionId(taskForEvidence.id); const evidenceConnectionId = getEvidenceConnectionId(
taskForEvidence.id
);
// Upload the URI file as task evidence // Upload the URI file as task evidence
uploadTaskEvidence({ uploadTaskEvidence({
variables: { variables: {
@@ -1180,7 +1182,7 @@ function MeasureViewContent({
} else { } else {
// This is a measure-level evidence // This is a measure-level evidence
const evidenceConnectionId = getMeasureEvidenceConnectionId(); const evidenceConnectionId = getMeasureEvidenceConnectionId();
// Upload the URI file as measure evidence // Upload the URI file as measure evidence
uploadMeasureEvidence({ uploadMeasureEvidence({
variables: { variables: {
@@ -1416,7 +1418,7 @@ function MeasureViewContent({
const handleDeleteEvidence = ( const handleDeleteEvidence = (
evidenceId: string, evidenceId: string,
filename: string, filename: string,
taskId: string, taskId: string
) => { ) => {
setEvidenceToDelete({ id: evidenceId, filename, taskId }); setEvidenceToDelete({ id: evidenceId, filename, taskId });
setIsDeleteEvidenceOpen(true); setIsDeleteEvidenceOpen(true);
@@ -1431,7 +1433,7 @@ function MeasureViewContent({
}; };
const handleFulfillEvidenceWithFile = ( const handleFulfillEvidenceWithFile = (
e: React.ChangeEvent<HTMLInputElement>, e: React.ChangeEvent<HTMLInputElement>
) => { ) => {
if (!e.target.files || e.target.files.length === 0 || !evidenceToFulfill) if (!e.target.files || e.target.files.length === 0 || !evidenceToFulfill)
return; return;
@@ -1448,7 +1450,7 @@ function MeasureViewContent({
const evidenceId = evidenceToFulfill.id; const evidenceId = evidenceToFulfill.id;
// Get connection ID for the parent task (assuming it's available in the view) // Get connection ID for the parent task (assuming it's available in the view)
const task = tasks.find((task) => const task = tasks.find((task) =>
task.evidences?.edges.some((edge) => edge?.node?.id === evidenceId), task.evidences?.edges.some((edge) => edge?.node?.id === evidenceId)
); );
const evidenceConnectionId = task?.id const evidenceConnectionId = task?.id
@@ -1512,7 +1514,7 @@ function MeasureViewContent({
try { try {
console.log( console.log(
"Creating URI file to fulfill evidence:", "Creating URI file to fulfill evidence:",
evidenceToFulfill.id, evidenceToFulfill.id
); );
// Create a URI file with the link // Create a URI file with the link
@@ -1529,8 +1531,8 @@ function MeasureViewContent({
// Get connection ID for the parent task // Get connection ID for the parent task
const task = tasks.find((task) => const task = tasks.find((task) =>
task.evidences?.edges.some( task.evidences?.edges.some(
(edge) => edge?.node?.id === evidenceToFulfill.id, (edge) => edge?.node?.id === evidenceToFulfill.id
), )
); );
const evidenceConnectionId = task?.id const evidenceConnectionId = task?.id
@@ -1687,7 +1689,7 @@ function MeasureViewContent({
toast({ toast({
title: "Measure state updated", title: "Measure state updated",
description: `Measure state has been updated to ${formatState( description: `Measure state has been updated to ${formatState(
newState, newState
)}.`, )}.`,
}); });
}, },
@@ -1741,7 +1743,7 @@ function MeasureViewContent({
return { days: "", hours: "", minutes: "" }; return { days: "", hours: "", minutes: "" };
} }
}, },
[], []
); );
// Function to handle saving the updated duration // Function to handle saving the updated duration
@@ -1807,7 +1809,7 @@ function MeasureViewContent({
toast, toast,
selectedTask, selectedTask,
setSelectedTask, setSelectedTask,
], ]
); );
// Control mapping functions // Control mapping functions
@@ -1841,7 +1843,7 @@ function MeasureViewContent({
linkedControlsQuery, linkedControlsQuery,
{ {
measureId, measureId,
}, }
).subscribe({ ).subscribe({
next: (data) => { next: (data) => {
setLinkedControlsData(data); setLinkedControlsData(data);
@@ -1877,7 +1879,7 @@ function MeasureViewContent({
const frameworks = frameworksData.organization.frameworks.edges; const frameworks = frameworksData.organization.frameworks.edges;
if (selectedFrameworkId) { if (selectedFrameworkId) {
const selectedFramework = frameworks.find( const selectedFramework = frameworks.find(
(edge) => edge.node.id === selectedFrameworkId, (edge) => edge.node.id === selectedFrameworkId
); );
if (selectedFramework?.node?.controls?.edges) { if (selectedFramework?.node?.controls?.edges) {
@@ -1887,14 +1889,14 @@ function MeasureViewContent({
// If no framework is selected or it doesn't have controls, return controls from all frameworks // If no framework is selected or it doesn't have controls, return controls from all frameworks
return frameworks.flatMap((framework) => return frameworks.flatMap((framework) =>
framework.node.controls.edges.map((edge) => edge.node), framework.node.controls.edges.map((edge) => edge.node)
); );
}, [frameworksData, selectedFrameworkId]); }, [frameworksData, selectedFrameworkId]);
const getLinkedControls = useCallback(() => { const getLinkedControls = useCallback(() => {
if (!linkedControlsData?.measure?.controls?.edges) return []; if (!linkedControlsData?.measure?.controls?.edges) return [];
return (linkedControlsData.measure.controls.edges || []).map( return (linkedControlsData.measure.controls.edges || []).map(
(edge) => edge.node, (edge) => edge.node
); );
}, [linkedControlsData]); }, [linkedControlsData]);
@@ -1903,7 +1905,7 @@ function MeasureViewContent({
const linkedControls = getLinkedControls(); const linkedControls = getLinkedControls();
return linkedControls.some((control) => control.id === controlId); return linkedControls.some((control) => control.id === controlId);
}, },
[getLinkedControls], [getLinkedControls]
); );
const handleLinkControl = useCallback( const handleLinkControl = useCallback(
@@ -1938,7 +1940,7 @@ function MeasureViewContent({
linkedControlsQuery, linkedControlsQuery,
{ {
measureId, measureId,
}, }
).subscribe({ ).subscribe({
next: (data) => { next: (data) => {
setLinkedControlsData(data); setLinkedControlsData(data);
@@ -1964,7 +1966,7 @@ function MeasureViewContent({
}, },
}); });
}, },
[commitCreateControlMapping, environment, measureId, toast], [commitCreateControlMapping, environment, measureId, toast]
); );
const handleUnlinkControl = useCallback( const handleUnlinkControl = useCallback(
@@ -1999,7 +2001,7 @@ function MeasureViewContent({
}).subscribe({ }).subscribe({
next: (data: unknown) => { next: (data: unknown) => {
setLinkedControlsData( setLinkedControlsData(
data as MeasureViewLinkedControlsQuery$data, data as MeasureViewLinkedControlsQuery$data
); );
}, },
error: (error: Error) => { error: (error: Error) => {
@@ -2023,7 +2025,7 @@ function MeasureViewContent({
}, },
}); });
}, },
[commitDeleteControlMapping, environment, measureId, toast], [commitDeleteControlMapping, environment, measureId, toast]
); );
const handleOpenControlMappingDialog = useCallback(() => { const handleOpenControlMappingDialog = useCallback(() => {
@@ -2041,7 +2043,7 @@ function MeasureViewContent({
control.referenceId.toLowerCase().includes(lowerQuery) || control.referenceId.toLowerCase().includes(lowerQuery) ||
control.name.toLowerCase().includes(lowerQuery) || control.name.toLowerCase().includes(lowerQuery) ||
(control.description && (control.description &&
control.description.toLowerCase().includes(lowerQuery)), control.description.toLowerCase().includes(lowerQuery))
); );
}, [controlSearchQuery, getControls]); }, [controlSearchQuery, getControls]);
@@ -2086,7 +2088,7 @@ function MeasureViewContent({
const confirmDeleteMeasure = () => { const confirmDeleteMeasure = () => {
const connectionId = ConnectionHandler.getConnectionID( const connectionId = ConnectionHandler.getConnectionID(
organizationId!, organizationId!,
"MeasureListView_measures", "MeasureListView_measures"
); );
commitDeleteMeasure({ commitDeleteMeasure({
@@ -2115,7 +2117,7 @@ function MeasureViewContent({
// Add the mutation hook for uploadMeasureEvidence // Add the mutation hook for uploadMeasureEvidence
const [uploadMeasureEvidence] = useMutation<any>( const [uploadMeasureEvidence] = useMutation<any>(
uploadMeasureEvidenceMutation, uploadMeasureEvidenceMutation
); );
// Add a function to handle uploading evidence directly to the measure // Add a function to handle uploading evidence directly to the measure
@@ -2203,7 +2205,10 @@ function MeasureViewContent({
<Card className="mt-4"> <Card className="mt-4">
<CardContent className="pt-6"> <CardContent className="pt-6">
<div className="prose prose-gray prose-sm md:prose-base text-secondary max-w-3xl"> <div className="prose prose-gray prose-sm md:prose-base text-secondary max-w-3xl">
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}> <ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw]}
>
{data.measure.description} {data.measure.description}
</ReactMarkdown> </ReactMarkdown>
</div> </div>
@@ -2222,14 +2227,19 @@ function MeasureViewContent({
<TabsTrigger value="evidence" className="flex items-center gap-2"> <TabsTrigger value="evidence" className="flex items-center gap-2">
<FileText className="w-4 h-4" /> <FileText className="w-4 h-4" />
Evidence Evidence
{((measureWithEvidences.evidences?.edges && measureWithEvidences.evidences.edges.length > 0) || {((measureWithEvidences.evidences?.edges &&
tasks.some((task) => task.evidences?.edges && task.evidences.edges.length > 0)) && ( measureWithEvidences.evidences.edges.length > 0) ||
tasks.some(
(task) =>
task.evidences?.edges && task.evidences.edges.length > 0
)) && (
<span className="ml-1.5 bg-blue-100 text-blue-800 rounded-full text-xs px-2 py-0.5"> <span className="ml-1.5 bg-blue-100 text-blue-800 rounded-full text-xs px-2 py-0.5">
{(measureWithEvidences.evidences?.edges?.length || 0) + {(measureWithEvidences.evidences?.edges?.length || 0) +
tasks.reduce( tasks.reduce(
(count, task) => count + (task.evidences?.edges?.length || 0), (count, task) =>
0, count + (task.evidences?.edges?.length || 0),
)} 0
)}
</span> </span>
)} )}
</TabsTrigger> </TabsTrigger>
@@ -2379,7 +2389,7 @@ function MeasureViewContent({
<div className="bg-white p-1.5 rounded-md border border-mid-b"> <div className="bg-white p-1.5 rounded-md border border-mid-b">
{getFileIcon( {getFileIcon(
evidence.mimeType, evidence.mimeType,
evidence.type, evidence.type
)} )}
</div> </div>
<div className="flex-1 overflow-hidden"> <div className="flex-1 overflow-hidden">
@@ -2430,7 +2440,7 @@ function MeasureViewContent({
onClick={() => onClick={() =>
handleFulfillEvidence( handleFulfillEvidence(
evidence.id, evidence.id,
evidence.filename, evidence.filename
) )
} }
className="p-1.5 rounded-full hover:bg-white hover:shadow-sm transition-all" className="p-1.5 rounded-full hover:bg-white hover:shadow-sm transition-all"
@@ -2452,7 +2462,7 @@ function MeasureViewContent({
<Link2 className="w-4 h-4 text-blue-600" /> <Link2 className="w-4 h-4 text-blue-600" />
</button> </button>
) : evidence.mimeType.startsWith( ) : evidence.mimeType.startsWith(
"image/", "image/"
) ? ( ) ? (
<button <button
onClick={() => onClick={() =>
@@ -2493,7 +2503,7 @@ function MeasureViewContent({
handleDeleteEvidence( handleDeleteEvidence(
evidence.id, evidence.id,
evidence.filename, evidence.filename,
"", ""
) )
} }
className="p-1.5 rounded-full hover:bg-red-50 hover:shadow-sm transition-all" className="p-1.5 rounded-full hover:bg-red-50 hover:shadow-sm transition-all"
@@ -2505,7 +2515,7 @@ function MeasureViewContent({
</td> </td>
</tr> </tr>
); );
}, }
)} )}
</tbody> </tbody>
</table> </table>
@@ -2554,7 +2564,7 @@ function MeasureViewContent({
e.stopPropagation(); e.stopPropagation();
handleToggleTaskState( handleToggleTaskState(
task.id, task.id,
task.state || "TODO", task.state || "TODO"
); );
}} }}
> >
@@ -2563,7 +2573,11 @@ function MeasureViewContent({
)} )}
</div> </div>
<h3 <h3
className={`font-medium ${task.state === "DONE" ? "line-through text-secondary" : ""}`} className={`font-medium ${
task.state === "DONE"
? "line-through text-secondary"
: ""
}`}
> >
{task.name} {task.name}
</h3> </h3>
@@ -2728,20 +2742,20 @@ function MeasureViewContent({
<Badge <Badge
variant="outline" variant="outline"
className={getRiskSeverityColor( className={getRiskSeverityColor(
risk.inherentSeverity, risk.inherentRiskScore
)} )}
> >
Inherent:{" "} Inherent:{" "}
{getRiskSeverityText(risk.inherentSeverity)} {getRiskSeverityText(risk.inherentRiskScore)}
</Badge> </Badge>
<Badge <Badge
variant="outline" variant="outline"
className={getRiskSeverityColor( className={getRiskSeverityColor(
risk.residualSeverity, risk.residualRiskScore
)} )}
> >
Residual:{" "} Residual:{" "}
{getRiskSeverityText(risk.residualSeverity)} {getRiskSeverityText(risk.residualRiskScore)}
</Badge> </Badge>
</div> </div>
</div> </div>
@@ -2833,7 +2847,10 @@ function MeasureViewContent({
Description Description
</h3> </h3>
<div className="prose prose-gray prose-sm max-w-none text-primary bg-invert-bg p-4 rounded-md border border-mid-b"> <div className="prose prose-gray prose-sm max-w-none text-primary bg-invert-bg p-4 rounded-md border border-mid-b">
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}> <ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw]}
>
{selectedTask.description} {selectedTask.description}
</ReactMarkdown> </ReactMarkdown>
</div> </div>
@@ -2923,7 +2940,7 @@ function MeasureViewContent({
onClick={() => onClick={() =>
handleAssignPerson( handleAssignPerson(
selectedTask.id, selectedTask.id,
person.id, person.id
) )
} }
> >
@@ -3028,7 +3045,7 @@ function MeasureViewContent({
onClick={() => { onClick={() => {
// Parse current duration into components // Parse current duration into components
const { days, hours, minutes } = parseISODuration( const { days, hours, minutes } = parseISODuration(
selectedTask.timeEstimate, selectedTask.timeEstimate
); );
setEditTimeEstimateDays(days); setEditTimeEstimateDays(days);
setEditTimeEstimateHours(hours); setEditTimeEstimateHours(hours);
@@ -3055,7 +3072,7 @@ function MeasureViewContent({
onClick={() => onClick={() =>
handleCreateEvidence( handleCreateEvidence(
selectedTask.id, selectedTask.id,
selectedTask.name, selectedTask.name
) )
} }
> >
@@ -3080,7 +3097,7 @@ function MeasureViewContent({
<div className="bg-white p-1.5 rounded-md border border-mid-b"> <div className="bg-white p-1.5 rounded-md border border-mid-b">
{getFileIcon( {getFileIcon(
evidence.mimeType, evidence.mimeType,
evidence.type, evidence.type
)} )}
</div> </div>
<div> <div>
@@ -3108,7 +3125,7 @@ function MeasureViewContent({
onClick={() => onClick={() =>
handleFulfillEvidence( handleFulfillEvidence(
evidence.id, evidence.id,
evidence.filename, evidence.filename
) )
} }
className="p-1.5 rounded-full hover:bg-white hover:shadow-sm transition-all" className="p-1.5 rounded-full hover:bg-white hover:shadow-sm transition-all"
@@ -3130,7 +3147,7 @@ function MeasureViewContent({
<Link2 className="w-4 h-4 text-blue-600" /> <Link2 className="w-4 h-4 text-blue-600" />
</button> </button>
) : evidence.mimeType.startsWith( ) : evidence.mimeType.startsWith(
"image/", "image/"
) ? ( ) ? (
<button <button
onClick={() => onClick={() =>
@@ -3171,7 +3188,7 @@ function MeasureViewContent({
handleDeleteEvidence( handleDeleteEvidence(
evidence.id, evidence.id,
evidence.filename, evidence.filename,
selectedTask.id, selectedTask.id
) )
} }
className="p-1.5 rounded-full hover:bg-red-50 hover:shadow-sm transition-all" className="p-1.5 rounded-full hover:bg-red-50 hover:shadow-sm transition-all"
@@ -3206,7 +3223,7 @@ function MeasureViewContent({
onClick={() => onClick={() =>
handleToggleTaskState( handleToggleTaskState(
selectedTask.id, selectedTask.id,
selectedTask.state || "TODO", selectedTask.state || "TODO"
) )
} }
> >
@@ -3221,7 +3238,7 @@ function MeasureViewContent({
if (selectedTask) { if (selectedTask) {
handleToggleTaskState( handleToggleTaskState(
selectedTask.id, selectedTask.id,
selectedTask.state || "DONE", selectedTask.state || "DONE"
); );
} }
}} }}
@@ -3646,7 +3663,7 @@ function MeasureViewContent({
<SelectItem key={edge.node.id} value={edge.node.id}> <SelectItem key={edge.node.id} value={edge.node.id}>
{edge.node.name} {edge.node.name}
</SelectItem> </SelectItem>
), )
)} )}
</SelectContent> </SelectContent>
</Select> </Select>

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<f1eccfbde625d131166d0fac7f4613aa>> * @generated SignedSource<<bcc2641c30833b1da31cfcc88d18ffea>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -23,11 +23,11 @@ export type MeasureViewRisksQuery$data = {
readonly id: string; readonly id: string;
readonly inherentImpact: number; readonly inherentImpact: number;
readonly inherentLikelihood: number; readonly inherentLikelihood: number;
readonly inherentSeverity: number; readonly inherentRiskScore: number;
readonly name: string; readonly name: string;
readonly residualImpact: number; readonly residualImpact: number;
readonly residualLikelihood: number; readonly residualLikelihood: number;
readonly residualSeverity: number; readonly residualRiskScore: number;
readonly updatedAt: string; readonly updatedAt: string;
}; };
}>; }>;
@@ -118,7 +118,7 @@ v4 = [
"alias": null, "alias": null,
"args": null, "args": null,
"kind": "ScalarField", "kind": "ScalarField",
"name": "inherentSeverity", "name": "inherentRiskScore",
"storageKey": null "storageKey": null
}, },
{ {
@@ -139,7 +139,7 @@ v4 = [
"alias": null, "alias": null,
"args": null, "args": null,
"kind": "ScalarField", "kind": "ScalarField",
"name": "residualSeverity", "name": "residualRiskScore",
"storageKey": null "storageKey": null
}, },
{ {
@@ -291,7 +291,7 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "e0a3387051cf8312a5ac831f1a9012df", "cacheID": "b04e121f2347f02738178eb93d1a437d",
"id": null, "id": null,
"metadata": { "metadata": {
"connection": [ "connection": [
@@ -308,11 +308,11 @@ return {
}, },
"name": "MeasureViewRisksQuery", "name": "MeasureViewRisksQuery",
"operationKind": "query", "operationKind": "query",
"text": "query MeasureViewRisksQuery(\n $measureId: ID!\n) {\n measure: node(id: $measureId) {\n __typename\n id\n ... on Measure {\n risks(first: 100) {\n edges {\n node {\n id\n name\n description\n inherentLikelihood\n inherentImpact\n inherentSeverity\n residualLikelihood\n residualImpact\n residualSeverity\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n" "text": "query MeasureViewRisksQuery(\n $measureId: ID!\n) {\n measure: node(id: $measureId) {\n __typename\n id\n ... on Measure {\n risks(first: 100) {\n edges {\n node {\n id\n name\n description\n inherentLikelihood\n inherentImpact\n inherentRiskScore\n residualLikelihood\n residualImpact\n residualRiskScore\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
} }
}; };
})(); })();
(node as any).hash = "22056b7f008dc87a4ad410bacac9a838"; (node as any).hash = "a66b2e9bdc293b6fe9a7737a09610c13";
export default node; export default node;

View File

@@ -56,11 +56,11 @@ func (r *Risk) CursorKey(orderBy RiskOrderField) page.CursorKey {
panic(fmt.Sprintf("unsupported order by: %s", orderBy)) panic(fmt.Sprintf("unsupported order by: %s", orderBy))
} }
func (r *Risk) InherentSeverity() int { func (r *Risk) InherentRiskScore() int {
return r.InherentLikelihood * r.InherentImpact return r.InherentLikelihood * r.InherentImpact
} }
func (r *Risk) ResidualSeverity() int { func (r *Risk) ResidualRiskScore() int {
return r.ResidualLikelihood * r.ResidualImpact return r.ResidualLikelihood * r.ResidualImpact
} }

View File

@@ -732,10 +732,10 @@ type Risk implements Node {
treatment: RiskTreatment! treatment: RiskTreatment!
inherentLikelihood: Int! inherentLikelihood: Int!
inherentImpact: Int! inherentImpact: Int!
inherentSeverity: Int! inherentRiskScore: Int!
residualLikelihood: Int! residualLikelihood: Int!
residualImpact: Int! residualImpact: Int!
residualSeverity: Int! residualRiskScore: Int!
note: String! note: String!
owner: People @goField(forceResolver: true) owner: People @goField(forceResolver: true)

View File

@@ -528,7 +528,7 @@ type ComplexityRoot struct {
ID func(childComplexity int) int ID func(childComplexity int) int
InherentImpact func(childComplexity int) int InherentImpact func(childComplexity int) int
InherentLikelihood func(childComplexity int) int InherentLikelihood func(childComplexity int) int
InherentSeverity func(childComplexity int) int InherentRiskScore func(childComplexity int) int
Measures func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.MeasureOrderBy) int Measures func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.MeasureOrderBy) int
Name func(childComplexity int) int Name func(childComplexity int) int
Note func(childComplexity int) int Note func(childComplexity int) int
@@ -537,7 +537,7 @@ type ComplexityRoot struct {
Policies func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PolicyOrderBy) int Policies func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PolicyOrderBy) int
ResidualImpact func(childComplexity int) int ResidualImpact func(childComplexity int) int
ResidualLikelihood func(childComplexity int) int ResidualLikelihood func(childComplexity int) int
ResidualSeverity func(childComplexity int) int ResidualRiskScore func(childComplexity int) int
Treatment func(childComplexity int) int Treatment func(childComplexity int) int
UpdatedAt func(childComplexity int) int UpdatedAt func(childComplexity int) int
} }
@@ -2974,12 +2974,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.Risk.InherentLikelihood(childComplexity), true return e.complexity.Risk.InherentLikelihood(childComplexity), true
case "Risk.inherentSeverity": case "Risk.inherentRiskScore":
if e.complexity.Risk.InherentSeverity == nil { if e.complexity.Risk.InherentRiskScore == nil {
break break
} }
return e.complexity.Risk.InherentSeverity(childComplexity), true return e.complexity.Risk.InherentRiskScore(childComplexity), true
case "Risk.measures": case "Risk.measures":
if e.complexity.Risk.Measures == nil { if e.complexity.Risk.Measures == nil {
@@ -3047,12 +3047,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.Risk.ResidualLikelihood(childComplexity), true return e.complexity.Risk.ResidualLikelihood(childComplexity), true
case "Risk.residualSeverity": case "Risk.residualRiskScore":
if e.complexity.Risk.ResidualSeverity == nil { if e.complexity.Risk.ResidualRiskScore == nil {
break break
} }
return e.complexity.Risk.ResidualSeverity(childComplexity), true return e.complexity.Risk.ResidualRiskScore(childComplexity), true
case "Risk.treatment": case "Risk.treatment":
if e.complexity.Risk.Treatment == nil { if e.complexity.Risk.Treatment == nil {
@@ -4703,10 +4703,10 @@ type Risk implements Node {
treatment: RiskTreatment! treatment: RiskTreatment!
inherentLikelihood: Int! inherentLikelihood: Int!
inherentImpact: Int! inherentImpact: Int!
inherentSeverity: Int! inherentRiskScore: Int!
residualLikelihood: Int! residualLikelihood: Int!
residualImpact: Int! residualImpact: Int!
residualSeverity: Int! residualRiskScore: Int!
note: String! note: String!
owner: People @goField(forceResolver: true) owner: People @goField(forceResolver: true)
@@ -22269,8 +22269,8 @@ func (ec *executionContext) fieldContext_Risk_inherentImpact(_ context.Context,
return fc, nil return fc, nil
} }
func (ec *executionContext) _Risk_inherentSeverity(ctx context.Context, field graphql.CollectedField, obj *types.Risk) (ret graphql.Marshaler) { func (ec *executionContext) _Risk_inherentRiskScore(ctx context.Context, field graphql.CollectedField, obj *types.Risk) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Risk_inherentSeverity(ctx, field) fc, err := ec.fieldContext_Risk_inherentRiskScore(ctx, field)
if err != nil { if err != nil {
return graphql.Null return graphql.Null
} }
@@ -22283,7 +22283,7 @@ func (ec *executionContext) _Risk_inherentSeverity(ctx context.Context, field gr
}() }()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children ctx = rctx // use context from middleware stack in children
return obj.InherentSeverity, nil return obj.InherentRiskScore, nil
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
@@ -22300,7 +22300,7 @@ func (ec *executionContext) _Risk_inherentSeverity(ctx context.Context, field gr
return ec.marshalNInt2int(ctx, field.Selections, res) return ec.marshalNInt2int(ctx, field.Selections, res)
} }
func (ec *executionContext) fieldContext_Risk_inherentSeverity(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_Risk_inherentRiskScore(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{ fc = &graphql.FieldContext{
Object: "Risk", Object: "Risk",
Field: field, Field: field,
@@ -22401,8 +22401,8 @@ func (ec *executionContext) fieldContext_Risk_residualImpact(_ context.Context,
return fc, nil return fc, nil
} }
func (ec *executionContext) _Risk_residualSeverity(ctx context.Context, field graphql.CollectedField, obj *types.Risk) (ret graphql.Marshaler) { func (ec *executionContext) _Risk_residualRiskScore(ctx context.Context, field graphql.CollectedField, obj *types.Risk) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Risk_residualSeverity(ctx, field) fc, err := ec.fieldContext_Risk_residualRiskScore(ctx, field)
if err != nil { if err != nil {
return graphql.Null return graphql.Null
} }
@@ -22415,7 +22415,7 @@ func (ec *executionContext) _Risk_residualSeverity(ctx context.Context, field gr
}() }()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
ctx = rctx // use context from middleware stack in children ctx = rctx // use context from middleware stack in children
return obj.ResidualSeverity, nil return obj.ResidualRiskScore, nil
}) })
if err != nil { if err != nil {
ec.Error(ctx, err) ec.Error(ctx, err)
@@ -22432,7 +22432,7 @@ func (ec *executionContext) _Risk_residualSeverity(ctx context.Context, field gr
return ec.marshalNInt2int(ctx, field.Selections, res) return ec.marshalNInt2int(ctx, field.Selections, res)
} }
func (ec *executionContext) fieldContext_Risk_residualSeverity(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_Risk_residualRiskScore(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{ fc = &graphql.FieldContext{
Object: "Risk", Object: "Risk",
Field: field, Field: field,
@@ -23092,14 +23092,14 @@ func (ec *executionContext) fieldContext_RiskEdge_node(_ context.Context, field
return ec.fieldContext_Risk_inherentLikelihood(ctx, field) return ec.fieldContext_Risk_inherentLikelihood(ctx, field)
case "inherentImpact": case "inherentImpact":
return ec.fieldContext_Risk_inherentImpact(ctx, field) return ec.fieldContext_Risk_inherentImpact(ctx, field)
case "inherentSeverity": case "inherentRiskScore":
return ec.fieldContext_Risk_inherentSeverity(ctx, field) return ec.fieldContext_Risk_inherentRiskScore(ctx, field)
case "residualLikelihood": case "residualLikelihood":
return ec.fieldContext_Risk_residualLikelihood(ctx, field) return ec.fieldContext_Risk_residualLikelihood(ctx, field)
case "residualImpact": case "residualImpact":
return ec.fieldContext_Risk_residualImpact(ctx, field) return ec.fieldContext_Risk_residualImpact(ctx, field)
case "residualSeverity": case "residualRiskScore":
return ec.fieldContext_Risk_residualSeverity(ctx, field) return ec.fieldContext_Risk_residualRiskScore(ctx, field)
case "note": case "note":
return ec.fieldContext_Risk_note(ctx, field) return ec.fieldContext_Risk_note(ctx, field)
case "owner": case "owner":
@@ -24550,14 +24550,14 @@ func (ec *executionContext) fieldContext_UpdateRiskPayload_risk(_ context.Contex
return ec.fieldContext_Risk_inherentLikelihood(ctx, field) return ec.fieldContext_Risk_inherentLikelihood(ctx, field)
case "inherentImpact": case "inherentImpact":
return ec.fieldContext_Risk_inherentImpact(ctx, field) return ec.fieldContext_Risk_inherentImpact(ctx, field)
case "inherentSeverity": case "inherentRiskScore":
return ec.fieldContext_Risk_inherentSeverity(ctx, field) return ec.fieldContext_Risk_inherentRiskScore(ctx, field)
case "residualLikelihood": case "residualLikelihood":
return ec.fieldContext_Risk_residualLikelihood(ctx, field) return ec.fieldContext_Risk_residualLikelihood(ctx, field)
case "residualImpact": case "residualImpact":
return ec.fieldContext_Risk_residualImpact(ctx, field) return ec.fieldContext_Risk_residualImpact(ctx, field)
case "residualSeverity": case "residualRiskScore":
return ec.fieldContext_Risk_residualSeverity(ctx, field) return ec.fieldContext_Risk_residualRiskScore(ctx, field)
case "note": case "note":
return ec.fieldContext_Risk_note(ctx, field) return ec.fieldContext_Risk_note(ctx, field)
case "owner": case "owner":
@@ -37951,8 +37951,8 @@ func (ec *executionContext) _Risk(ctx context.Context, sel ast.SelectionSet, obj
if out.Values[i] == graphql.Null { if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1) atomic.AddUint32(&out.Invalids, 1)
} }
case "inherentSeverity": case "inherentRiskScore":
out.Values[i] = ec._Risk_inherentSeverity(ctx, field, obj) out.Values[i] = ec._Risk_inherentRiskScore(ctx, field, obj)
if out.Values[i] == graphql.Null { if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1) atomic.AddUint32(&out.Invalids, 1)
} }
@@ -37966,8 +37966,8 @@ func (ec *executionContext) _Risk(ctx context.Context, sel ast.SelectionSet, obj
if out.Values[i] == graphql.Null { if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1) atomic.AddUint32(&out.Invalids, 1)
} }
case "residualSeverity": case "residualRiskScore":
out.Values[i] = ec._Risk_residualSeverity(ctx, field, obj) out.Values[i] = ec._Risk_residualRiskScore(ctx, field, obj)
if out.Values[i] == graphql.Null { if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1) atomic.AddUint32(&out.Invalids, 1)
} }

View File

@@ -51,10 +51,10 @@ func NewRisk(r *coredata.Risk) *Risk {
Treatment: r.Treatment, Treatment: r.Treatment,
InherentLikelihood: r.InherentLikelihood, InherentLikelihood: r.InherentLikelihood,
InherentImpact: r.InherentImpact, InherentImpact: r.InherentImpact,
InherentSeverity: r.InherentSeverity(), InherentRiskScore: r.InherentRiskScore(),
ResidualLikelihood: r.ResidualLikelihood, ResidualLikelihood: r.ResidualLikelihood,
ResidualImpact: r.ResidualImpact, ResidualImpact: r.ResidualImpact,
ResidualSeverity: r.ResidualSeverity(), ResidualRiskScore: r.ResidualRiskScore(),
Category: r.Category, Category: r.Category,
CreatedAt: r.CreatedAt, CreatedAt: r.CreatedAt,
UpdatedAt: r.UpdatedAt, UpdatedAt: r.UpdatedAt,

View File

@@ -712,10 +712,10 @@ type Risk struct {
Treatment coredata.RiskTreatment `json:"treatment"` Treatment coredata.RiskTreatment `json:"treatment"`
InherentLikelihood int `json:"inherentLikelihood"` InherentLikelihood int `json:"inherentLikelihood"`
InherentImpact int `json:"inherentImpact"` InherentImpact int `json:"inherentImpact"`
InherentSeverity int `json:"inherentSeverity"` InherentRiskScore int `json:"inherentRiskScore"`
ResidualLikelihood int `json:"residualLikelihood"` ResidualLikelihood int `json:"residualLikelihood"`
ResidualImpact int `json:"residualImpact"` ResidualImpact int `json:"residualImpact"`
ResidualSeverity int `json:"residualSeverity"` ResidualRiskScore int `json:"residualRiskScore"`
Note string `json:"note"` Note string `json:"note"`
Owner *People `json:"owner,omitempty"` Owner *People `json:"owner,omitempty"`
Organization *Organization `json:"organization"` Organization *Organization `json:"organization"`