Skip to content

Commit 8c9b492

Browse files
authored
fix(StorageLocation): pdisk id calculation (#2570)
1 parent f37578d commit 8c9b492

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

src/containers/Tenant/Healthcheck/components/HealthcheckIssueDetails/StorageLocation.tsx

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function VDiskInfo({location}: StorageSectionProps) {
134134
);
135135
}
136136
function PDiskInfo({location}: StorageSectionProps) {
137-
const {node, pool} = location ?? {};
137+
const {pool} = location ?? {};
138138
const {group} = pool ?? {};
139139
const {vdisk} = group ?? {};
140140
const {pdisk} = vdisk ?? {};
@@ -143,23 +143,33 @@ function PDiskInfo({location}: StorageSectionProps) {
143143
return null;
144144
}
145145

146-
return pdisk.map((disk) => (
147-
<LocationDetails
148-
key={disk.id || disk.path}
149-
fields={[
150-
{
151-
value:
152-
disk.id && node?.id ? (
153-
<InternalLink to={getPDiskPagePath(disk.id, node.id)}>
154-
{disk.id}
155-
</InternalLink>
156-
) : (
157-
disk.id
158-
),
159-
title: i18n('label_pdisk-id'),
160-
},
161-
{value: disk.path, title: i18n('label_pdisk-path')},
162-
]}
163-
/>
164-
));
146+
return pdisk.map((disk) => {
147+
let nodeId: string | undefined;
148+
let pdiskId: string | undefined;
149+
if (disk.id) {
150+
const splittedId = disk.id.split('-');
151+
nodeId = splittedId[0];
152+
pdiskId = splittedId.slice(1).join('-');
153+
}
154+
155+
return (
156+
<LocationDetails
157+
key={disk.id || disk.path}
158+
fields={[
159+
{
160+
value:
161+
nodeId && pdiskId ? (
162+
<InternalLink to={getPDiskPagePath(pdiskId, nodeId)}>
163+
{disk.id}
164+
</InternalLink>
165+
) : (
166+
disk.id
167+
),
168+
title: i18n('label_pdisk-id'),
169+
},
170+
{value: disk.path, title: i18n('label_pdisk-path')},
171+
]}
172+
/>
173+
);
174+
});
165175
}

0 commit comments

Comments
 (0)