Skip to content

Commit d07df02

Browse files
CopilotRaubzeug
andauthored
refactor(healthcheck): address review feedback on type helpers and breadcrumb
Agent-Logs-Url: https://github.com/ydb-platform/ydb-embedded-ui/sessions/dfbbca66-7c86-4d44-b9f0-a9261612faa8 Co-authored-by: Raubzeug <42094364+Raubzeug@users.noreply.github.com>
1 parent b633efd commit d07df02

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

src/containers/Tenant/Healthcheck/components/HealthcheckIssues.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,17 @@ export function Issues({issues}: IssuesProps) {
4646
() =>
4747
view
4848
? filteredIssues.filter((issue) => {
49-
const type = issue.rootTypeForUI || issue.type;
49+
const type = issue.rootTypeForUI ?? issue.type;
50+
const isStorageRelated = isStorageRelatedType(type);
51+
const isComputeRelated = isComputeRelatedType(type);
52+
5053
if (view === 'storage') {
51-
return isStorageRelatedType(type);
54+
return isStorageRelated;
5255
}
5356
if (view === 'compute') {
54-
return isComputeRelatedType(type);
57+
return isComputeRelated;
5558
}
56-
return !isStorageRelatedType(type) && !isComputeRelatedType(type);
59+
return !isStorageRelated && !isComputeRelated;
5760
})
5861
: [],
5962
[filteredIssues, view],

src/store/reducers/healthcheckInfo/utils.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ export const selfCheckResultToHcStatus: Record<SelfCheckResult, StatusFlag> = {
2222
[SelfCheckResult.EMERGENCY]: StatusFlag.RED,
2323
};
2424

25-
// State storage related issue types are categorized under "storage" in the UI,
26-
// so that ring/board/state-storage issues appear in the storage tab and can
27-
// share the same parent-chain (breadcrumb) rendering as disk issues.
28-
const STATE_STORAGE_RELATED_PREFIXES = ['SCHEME_BOARD', 'BOARD', 'STATE_STORAGE'];
25+
// Issue type prefixes that should be routed to the "storage" tab in the UI,
26+
// covering ring/board/state-storage issues alongside regular disk issues.
27+
// 'BOARD_' (with underscore) is intentionally narrow to match only BOARD_RING /
28+
// BOARD_NODE and avoid silently capturing any unrelated future BOARD* types.
29+
const STORAGE_TAB_PREFIXES = ['SCHEME_BOARD', 'BOARD_', 'STATE_STORAGE'];
2930

3031
// Root issue types that should be included in the breadcrumb chain.
3132
// For these roots, the leaf preserves a parent link to the root so that the
@@ -40,7 +41,7 @@ export function isStorageRelatedType(type?: string): boolean {
4041
if (type.startsWith('STORAGE')) {
4142
return true;
4243
}
43-
return STATE_STORAGE_RELATED_PREFIXES.some((prefix) => type.startsWith(prefix));
44+
return STORAGE_TAB_PREFIXES.some((prefix) => type.startsWith(prefix));
4445
}
4546

4647
export function isComputeRelatedType(type?: string): boolean {
@@ -88,7 +89,7 @@ export function getLeavesFromTree(issues: IssueLog[], root: IssueLog): IssuesTre
8889

8990
const initialNode: IssuesTree = includeRootInChain
9091
? extendIssue(directChild, directChildType, {
91-
parent: extendIssue(root, directChildType),
92+
parent: extendIssue(root, getTypeForUI(root.type)),
9293
})
9394
: directChild;
9495
const stack: IssuesTree[] = [initialNode];

0 commit comments

Comments
 (0)