Fix UI not refresh after create vendor risk
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -176,7 +176,7 @@ const createRiskAssessmentMutation = graphql`
|
|||||||
$connections: [ID!]!
|
$connections: [ID!]!
|
||||||
) {
|
) {
|
||||||
createVendorRiskAssessment(input: $input) {
|
createVendorRiskAssessment(input: $input) {
|
||||||
vendorRiskAssessmentEdge @appendEdge(connections: $connections) {
|
vendorRiskAssessmentEdge @prependEdge(connections: $connections) {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
assessedAt
|
assessedAt
|
||||||
@@ -195,40 +195,6 @@ const createRiskAssessmentMutation = graphql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function EditableField({
|
|
||||||
label,
|
|
||||||
value,
|
|
||||||
onChange,
|
|
||||||
type = "text",
|
|
||||||
helpText,
|
|
||||||
disabled = false,
|
|
||||||
}: {
|
|
||||||
label: string;
|
|
||||||
value: string;
|
|
||||||
onChange: (value: string) => void;
|
|
||||||
type?: string;
|
|
||||||
helpText?: string;
|
|
||||||
disabled?: boolean;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<div className="space-y-2">
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<HelpCircle className="h-4 w-4 text-tertiary" />
|
|
||||||
<Label className="text-sm">{label}</Label>
|
|
||||||
</div>
|
|
||||||
<div className="space-y-2">
|
|
||||||
<Input
|
|
||||||
type={type}
|
|
||||||
value={value}
|
|
||||||
onChange={(e) => onChange(e.target.value)}
|
|
||||||
disabled={disabled}
|
|
||||||
/>
|
|
||||||
{helpText && <p className="text-sm text-secondary">{helpText}</p>}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Format date for input field (YYYY-MM-DDTHH:mm)
|
// Format date for input field (YYYY-MM-DDTHH:mm)
|
||||||
function formatDateForInput(date: string | null | undefined): string {
|
function formatDateForInput(date: string | null | undefined): string {
|
||||||
if (!date) return "";
|
if (!date) return "";
|
||||||
@@ -689,20 +655,6 @@ function RiskAssessmentsTable({
|
|||||||
return new Date(expiresAt) < new Date();
|
return new Date(expiresAt) < new Date();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get severity label based on data sensitivity and business impact
|
|
||||||
const getSeverityLabel = (dataSensitivity: string, businessImpact: string) => {
|
|
||||||
// Simple logic to determine severity - can be adjusted based on requirements
|
|
||||||
if (dataSensitivity === 'CRITICAL' || businessImpact === 'CRITICAL') {
|
|
||||||
return { label: 'Critical', color: 'bg-red-100 text-red-800' };
|
|
||||||
} else if (dataSensitivity === 'HIGH' || businessImpact === 'HIGH') {
|
|
||||||
return { label: 'High', color: 'bg-orange-100 text-orange-800' };
|
|
||||||
} else if (dataSensitivity === 'MEDIUM' || businessImpact === 'MEDIUM') {
|
|
||||||
return { label: 'Medium', color: 'bg-yellow-100 text-yellow-800' };
|
|
||||||
} else {
|
|
||||||
return { label: 'Low', color: 'bg-green-100 text-green-800' };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="rounded-xl border border-[#ECEFEC] bg-white overflow-hidden">
|
<div className="rounded-xl border border-[#ECEFEC] bg-white overflow-hidden">
|
||||||
@@ -729,11 +681,6 @@ function RiskAssessmentsTable({
|
|||||||
<span className="text-xs font-semibold text-[#818780]">Business Impact</span>
|
<span className="text-xs font-semibold text-[#818780]">Business Impact</span>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<th className="px-4 py-3 text-left">
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<span className="text-xs font-semibold text-[#818780]">Severity</span>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
<th className="px-4 py-3 text-left">
|
<th className="px-4 py-3 text-left">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span className="text-xs font-semibold text-[#818780]">Assessed By</span>
|
<span className="text-xs font-semibold text-[#818780]">Assessed By</span>
|
||||||
@@ -744,7 +691,6 @@ function RiskAssessmentsTable({
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{assessments.map((assessment) => {
|
{assessments.map((assessment) => {
|
||||||
const severity = getSeverityLabel(assessment.dataSensitivity, assessment.businessImpact);
|
|
||||||
const expired = isExpired(assessment.expiresAt);
|
const expired = isExpired(assessment.expiresAt);
|
||||||
return (
|
return (
|
||||||
<tr
|
<tr
|
||||||
@@ -793,14 +739,6 @@ function RiskAssessmentsTable({
|
|||||||
{assessment.businessImpact.charAt(0) + assessment.businessImpact.slice(1).toLowerCase()}
|
{assessment.businessImpact.charAt(0) + assessment.businessImpact.slice(1).toLowerCase()}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-4 py-3">
|
|
||||||
<span className={cn(
|
|
||||||
"text-sm font-normal px-2 py-1 rounded-full",
|
|
||||||
expired ? "bg-[#F0F0F0] text-[#818780]" : severity.color
|
|
||||||
)}>
|
|
||||||
{severity.label}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td className="px-4 py-3">
|
<td className="px-4 py-3">
|
||||||
<span className={cn(
|
<span className={cn(
|
||||||
"text-sm font-normal",
|
"text-sm font-normal",
|
||||||
@@ -1342,6 +1280,8 @@ function VendorViewContent({
|
|||||||
loadQuery({
|
loadQuery({
|
||||||
vendorId: data.node.id!,
|
vendorId: data.node.id!,
|
||||||
organizationId: organizationId!,
|
organizationId: organizationId!,
|
||||||
|
}, {
|
||||||
|
fetchPolicy: "network-only",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<08de2d8758474132b472d63f413b59a5>>
|
* @generated SignedSource<<863e9f8552e5bb472cc4b02a6dbad1bf>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -204,7 +204,7 @@ return {
|
|||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"filters": null,
|
"filters": null,
|
||||||
"handle": "appendEdge",
|
"handle": "prependEdge",
|
||||||
"key": "",
|
"key": "",
|
||||||
"kind": "LinkedHandle",
|
"kind": "LinkedHandle",
|
||||||
"name": "vendorRiskAssessmentEdge",
|
"name": "vendorRiskAssessmentEdge",
|
||||||
@@ -232,6 +232,6 @@ return {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "7def769f97c5a728a7331756a6e3c5b2";
|
(node as any).hash = "d28e057eba5f7287f3d0f5e38d444ca5";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
Reference in New Issue
Block a user