Skip to content

Commit 336d74b

Browse files
authored
feat: make links from disk pop-up better (#1986)
1 parent 4a97195 commit 336d74b

File tree

6 files changed

+45
-24
lines changed

6 files changed

+45
-24
lines changed

src/components/PDiskInfo/PDiskInfo.scss

-7
This file was deleted.

src/components/PDiskInfo/PDiskInfo.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {Flex} from '@gravity-ui/uikit';
33
import {getPDiskPagePath} from '../../routes';
44
import {valueIsDefined} from '../../utils';
55
import {formatBytes} from '../../utils/bytesParsers';
6-
import {cn} from '../../utils/cn';
76
import {formatStorageValuesToGb} from '../../utils/dataFormatters/dataFormatters';
87
import {createPDiskDeveloperUILink} from '../../utils/developerUI/developerUI';
98
import type {PreparedPDisk} from '../../utils/disks/types';
@@ -16,10 +15,6 @@ import {StatusIcon} from '../StatusIcon/StatusIcon';
1615

1716
import {pDiskInfoKeyset} from './i18n';
1817

19-
import './PDiskInfo.scss';
20-
21-
const b = cn('ydb-pdisk-info');
22-
2318
interface GetPDiskInfoOptions<T extends PreparedPDisk> {
2419
pDisk?: T;
2520
nodeId?: number | string | null;
@@ -156,7 +151,7 @@ function getPDiskInfo<T extends PreparedPDisk>({
156151
additionalInfo.push({
157152
label: pDiskInfoKeyset('links'),
158153
value: (
159-
<span className={b('links')}>
154+
<Flex wrap="wrap" gap={2}>
160155
{withPDiskPageLink && (
161156
<LinkWithIcon
162157
title={pDiskInfoKeyset('pdisk-page')}
@@ -170,7 +165,7 @@ function getPDiskInfo<T extends PreparedPDisk>({
170165
url={pDiskInternalViewerPath}
171166
/>
172167
)}
173-
</span>
168+
</Flex>
174169
),
175170
});
176171
}

src/components/PDiskPopup/PDiskPopup.tsx

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import React from 'react';
22

3+
import {Flex} from '@gravity-ui/uikit';
4+
5+
import {getPDiskPagePath} from '../../routes';
36
import {selectNodesMap} from '../../store/reducers/nodesList';
47
import {EFlag} from '../../types/api/enums';
58
import {valueIsDefined} from '../../utils';
@@ -12,6 +15,7 @@ import {bytesToGB, isNumeric} from '../../utils/utils';
1215
import {InfoViewer} from '../InfoViewer';
1316
import type {InfoViewerItem} from '../InfoViewer';
1417
import {LinkWithIcon} from '../LinkWithIcon/LinkWithIcon';
18+
import {pDiskInfoKeyset} from '../PDiskInfo/i18n';
1519

1620
const errorColors = [EFlag.Orange, EFlag.Red, EFlag.Yellow];
1721

@@ -78,9 +82,22 @@ export const preparePDiskData = (
7882
pDiskId: PDiskId,
7983
});
8084

85+
const pDiskPagePath = getPDiskPagePath(PDiskId, NodeId);
8186
pdiskData.push({
8287
label: 'Links',
83-
value: <LinkWithIcon title={'Developer UI'} url={pDiskInternalViewerPath} />,
88+
value: (
89+
<Flex gap={2} wrap="wrap">
90+
<LinkWithIcon
91+
title={pDiskInfoKeyset('pdisk-page')}
92+
url={pDiskPagePath}
93+
external={false}
94+
/>
95+
<LinkWithIcon
96+
title={pDiskInfoKeyset('developer-ui')}
97+
url={pDiskInternalViewerPath}
98+
/>
99+
</Flex>
100+
),
84101
});
85102
}
86103

src/components/VDiskInfo/VDiskInfo.scss

-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
.ydb-vdisk-info {
2-
&__links {
3-
display: flex;
4-
flex-flow: row wrap;
5-
gap: var(--g-spacing-2);
6-
}
7-
82
&__title {
93
display: flex;
104
flex-direction: row;

src/components/VDiskInfo/VDiskInfo.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React from 'react';
22

3+
import {Flex} from '@gravity-ui/uikit';
4+
35
import {getVDiskPagePath} from '../../routes';
46
import {valueIsDefined} from '../../utils';
57
import {cn} from '../../utils/cn';
@@ -182,7 +184,11 @@ export function VDiskInfo<T extends PreparedVDisk>({
182184
if (links.length) {
183185
vdiskInfo.push({
184186
label: vDiskInfoKeyset('links'),
185-
value: <div className={b('links')}>{links}</div>,
187+
value: (
188+
<Flex wrap="wrap" gap={2}>
189+
{links}
190+
</Flex>
191+
),
186192
});
187193
}
188194
}

src/components/VDiskPopup/VDiskPopup.tsx

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react';
22

3-
import {Label} from '@gravity-ui/uikit';
3+
import {Flex, Label} from '@gravity-ui/uikit';
44

5+
import {getVDiskPagePath} from '../../routes';
56
import {selectNodesMap} from '../../store/reducers/nodesList';
67
import {EFlag} from '../../types/api/enums';
78
import {valueIsDefined} from '../../utils';
@@ -19,6 +20,7 @@ import {InternalLink} from '../InternalLink';
1920
import {LinkWithIcon} from '../LinkWithIcon/LinkWithIcon';
2021
import {preparePDiskData} from '../PDiskPopup/PDiskPopup';
2122
import {getVDiskLink} from '../VDisk/utils';
23+
import {vDiskInfoKeyset} from '../VDiskInfo/i18n';
2224

2325
import './VDiskPopup.scss';
2426

@@ -162,9 +164,23 @@ const prepareVDiskData = (data: PreparedVDisk, withDeveloperUILink?: boolean) =>
162164
vDiskSlotId: VDiskSlotId,
163165
});
164166

167+
const vDiskPagePath = getVDiskPagePath(VDiskSlotId, PDiskId, NodeId);
165168
vdiskData.push({
166169
label: 'Links',
167-
value: <LinkWithIcon title={'Developer UI'} url={vDiskInternalViewerPath} />,
170+
value: (
171+
<Flex wrap="wrap" gap={2}>
172+
<LinkWithIcon
173+
key={vDiskPagePath}
174+
title={vDiskInfoKeyset('vdisk-page')}
175+
url={vDiskPagePath}
176+
external={false}
177+
/>
178+
<LinkWithIcon
179+
title={vDiskInfoKeyset('developer-ui')}
180+
url={vDiskInternalViewerPath}
181+
/>
182+
</Flex>
183+
),
168184
});
169185
}
170186

0 commit comments

Comments
 (0)