Skip to content

Commit 7f19bcf

Browse files
committed
fix: modify getVDiskPagePath
1 parent 4d17e5f commit 7f19bcf

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

src/components/VDisk/utils.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ export function getVDiskLink(data: PreparedVDisk) {
1010
valueIsDefined(data.PDiskId) &&
1111
valueIsDefined(data.NodeId)
1212
) {
13-
vDiskPath = getVDiskPagePath(data.VDiskSlotId, data.PDiskId, data.NodeId);
13+
vDiskPath = getVDiskPagePath({
14+
vDiskSlotId: data.VDiskSlotId,
15+
pDiskId: data.PDiskId,
16+
nodeId: data.NodeId,
17+
});
1418
} else if (valueIsDefined(data.StringifiedId)) {
15-
vDiskPath = getVDiskPagePath(
16-
undefined as unknown as string,
17-
data.PDiskId as number,
18-
data.NodeId as number,
19-
{
20-
vDiskId: data.StringifiedId,
21-
},
22-
);
19+
vDiskPath = getVDiskPagePath({
20+
vDiskId: data.StringifiedId,
21+
pDiskId: data.PDiskId,
22+
nodeId: data.NodeId,
23+
});
2324
}
2425

2526
return vDiskPath;

src/components/VDiskInfo/VDiskInfo.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ export function VDiskInfo<T extends PreparedVDisk>({
154154
const links: React.ReactNode[] = [];
155155

156156
if (withVDiskPageLink) {
157-
const vDiskPagePath = getVDiskPagePath(VDiskSlotId, PDiskId, NodeId);
157+
const vDiskPagePath = getVDiskPagePath({
158+
vDiskSlotId: VDiskSlotId,
159+
pDiskId: PDiskId,
160+
nodeId: NodeId,
161+
});
158162
links.push(
159163
<LinkWithIcon
160164
key={vDiskPagePath}

src/containers/PDiskPage/PDiskSpaceDistribution/PDiskSpaceDistribution.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function Slot<T extends SlotItemType>({item, pDiskId, nodeId}: SlotProps<T>) {
8181
valueIsDefined(item.SlotData?.VDiskSlotId) &&
8282
valueIsDefined(pDiskId) &&
8383
valueIsDefined(nodeId)
84-
? getVDiskPagePath(item.SlotData.VDiskSlotId, pDiskId, nodeId)
84+
? getVDiskPagePath({vDiskSlotId: item.SlotData.VDiskSlotId, pDiskId, nodeId})
8585
: undefined;
8686

8787
return (

src/routes.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,16 @@ export function getPDiskPagePath(
121121
}
122122

123123
export function getVDiskPagePath(
124-
vDiskSlotId: string | number,
125-
pDiskId: string | number,
126-
nodeId: string | number,
124+
params:
125+
| {
126+
vDiskSlotId: string | number;
127+
pDiskId: string | number;
128+
nodeId: string | number;
129+
}
130+
| {vDiskId: string; pDiskId?: string | number; nodeId?: string | number},
127131
query: Query = {},
128132
) {
129-
return createHref(routes.vDisk, undefined, {...query, nodeId, pDiskId, vDiskSlotId});
133+
return createHref(routes.vDisk, undefined, {...query, ...params});
130134
}
131135

132136
export function getStorageGroupPath(groupId: string | number, query: Query = {}) {

0 commit comments

Comments
 (0)