Skip to content

Commit 4bb35d1

Browse files
authored
Merge pull request #3686 from verifywise-ai/hp-apr-7-fix-nist-ai-bug
Fix nist ai UI render bug
2 parents 2f085a8 + 3256f27 commit 4bb35d1

File tree

4 files changed

+26
-25
lines changed

4 files changed

+26
-25
lines changed

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"Bash(find /Users/harsh/Data/vw/verifywise/Clients -type f \\\\\\(-name *.yaml -o -name *.yml -o -name docker-compose* \\\\\\))",
1212
"Bash(find /Users/harsh/Data/vw/verifywise -type f \\\\\\(-name *.yaml -o -name *.yml -o -name docker-compose* \\\\\\) -not -path */node_modules/*)",
1313
"Bash(grep -r \"superadmin\\\\|super.admin\\\\|SuperAdmin\" /Users/harsh/Data/vw/verifywise/Servers/src --include=*.ts -i)",
14-
"Bash(grep:*)"
14+
"Bash(grep:*)",
15+
"Bash(git log:*)"
1516
]
1617
}
1718
}

Clients/src/presentation/components/EntityLinkSelector/index.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -362,24 +362,24 @@ const EntityLinkSelector: React.FC<EntityLinkSelectorProps> = ({
362362
const nistData = nistResponse?.data || nistResponse;
363363
const functions = nistData?.functions || [];
364364
functions.forEach((func: any) => {
365-
const funcData = func.dataValues || func;
366-
const funcType = funcData.type?.toUpperCase() || "FUNCTION";
367-
const categories = funcData.categories || [];
365+
const funcType = (func.function || "FUNCTION").toUpperCase();
366+
const categories = func.categories || [];
368367
categories.forEach((cat: any, catIndex: number) => {
369-
const catData = cat.dataValues || cat;
370-
const subcategories = catData.subcategories || [];
368+
const subcategories = cat.subcategories || [];
371369
// Always use function type + category index for unique category label
372370
const categoryLabel = `${funcType} ${catIndex + 1}`;
373371
subcategories.forEach((sub: any, subIndex: number) => {
374-
const subData = sub.dataValues || sub;
375-
const subTitle = subData.title || "";
376-
// Format: "GOVERN 1.1: Description..." or just "GOVERN 1.1" if no title
372+
// Skip subcategories that have no implementation record yet —
373+
// the backend returns id: 0 for those, which would collide.
374+
if (!sub.id) return;
375+
const subTitle = sub.description || "";
376+
// Format: "GOVERN 1.1: Description..." or just "GOVERN 1.1" if no description
377377
const subLabel = subTitle
378378
? `${categoryLabel}.${subIndex + 1}: ${subTitle.substring(0, 60)}${subTitle.length > 60 ? "..." : ""}`
379379
: `${categoryLabel}.${subIndex + 1}`;
380380
subEntityList.push({
381-
_id: `nist_subcategory_${subData.id}`,
382-
entity_id: subData.id,
381+
_id: `nist_subcategory_${sub.id}`,
382+
entity_id: sub.id,
383383
name: subLabel,
384384
type: "nist_subcategory",
385385
});

Clients/src/presentation/pages/Framework/Dashboard/NISTFunctionsOverviewCard.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,21 @@ interface NISTFunctionsOverviewCardProps {
2424

2525
interface SubcategoryData {
2626
id: number;
27-
title: string;
27+
subcategory_id: number;
28+
description: string;
2829
status: string;
2930
owner: number | null;
3031
}
3132

3233
interface CategoryData {
3334
id: number;
34-
title: string;
35+
category_id: number;
36+
description: string;
3537
subcategories: SubcategoryData[];
3638
}
3739

3840
interface FunctionData {
39-
id: number;
40-
type: string;
41+
function: string;
4142
title: string;
4243
icon: LucideIcon;
4344
categories: CategoryData[];
@@ -81,10 +82,9 @@ const NISTFunctionsOverviewCard = ({ frameworksData, onNavigate }: NISTFunctions
8182

8283
if (overviewResponse?.data?.functions) {
8384
const functions = overviewResponse.data.functions.map((func: any) => ({
84-
id: func.id,
85-
type: func.type,
85+
function: func.function,
8686
title: func.title,
87-
icon: NIST_FUNCTION_ICONS[func.type?.toLowerCase()] || Shield,
87+
icon: NIST_FUNCTION_ICONS[func.function?.toLowerCase()] || Shield,
8888
categories: func.categories || [],
8989
}));
9090
setFunctionsData(functions);
@@ -187,7 +187,7 @@ const NISTFunctionsOverviewCard = ({ frameworksData, onNavigate }: NISTFunctions
187187

188188
const handleCardClick = () => {
189189
if (onNavigate) {
190-
onNavigate("NIST AI RMF", func.type.toLowerCase());
190+
onNavigate("NIST AI RMF", func.function.toLowerCase());
191191
}
192192
};
193193

@@ -223,7 +223,7 @@ const NISTFunctionsOverviewCard = ({ frameworksData, onNavigate }: NISTFunctions
223223
textTransform: "capitalize",
224224
}}
225225
>
226-
{func.type}
226+
{func.title}
227227
</Typography>
228228
</Box>
229229
{onNavigate && (
@@ -313,10 +313,10 @@ const NISTFunctionsOverviewCard = ({ frameworksData, onNavigate }: NISTFunctions
313313
};
314314

315315
// Get functions by type for 2x2 grid layout
316-
const governFunc = functionsData.find(f => f.type.toLowerCase() === "govern");
317-
const mapFunc = functionsData.find(f => f.type.toLowerCase() === "map");
318-
const measureFunc = functionsData.find(f => f.type.toLowerCase() === "measure");
319-
const manageFunc = functionsData.find(f => f.type.toLowerCase() === "manage");
316+
const governFunc = functionsData.find(f => f.function?.toLowerCase() === "govern");
317+
const mapFunc = functionsData.find(f => f.function?.toLowerCase() === "map");
318+
const measureFunc = functionsData.find(f => f.function?.toLowerCase() === "measure");
319+
const manageFunc = functionsData.find(f => f.function?.toLowerCase() === "manage");
320320

321321
return (
322322
<Stack spacing={0}>

docker-compose.prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ services:
1717

1818
frontend:
1919
ports:
20-
- $FRONTEND_PORT:80
20+
- "127.0.0.1:${FRONTEND_PORT}:80"
2121
env_file:
2222
- ./.env.prod
2323

0 commit comments

Comments
 (0)