Skip to content

Commit 44dd3b4

Browse files
authored
feat: use environment in paths (#3020)
1 parent 9bc7195 commit 44dd3b4

File tree

69 files changed

+633
-393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+633
-393
lines changed

src/components/NodeHostWrapper/NodeHostWrapper.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {getDefaultNodePath} from '../../containers/Node/NodePages';
1+
import {getDefaultNodePath} from '../../routes';
22
import type {PreparedStorageNode} from '../../store/reducers/storage/types';
33
import type {NodeAddress} from '../../types/additionalProps';
44
import type {TNodeInfo, TSystemStateInfo} from '../../types/api/nodes';
@@ -35,11 +35,10 @@ export const NodeHostWrapper = ({
3535

3636
const nodePath = isNodeAvailable
3737
? getDefaultNodePath(
38-
node.NodeId,
38+
{id: node.NodeId, activeTab: node.TenantName ? 'tablets' : 'storage'},
3939
{
4040
database: database ?? node.TenantName,
4141
},
42-
node.TenantName ? 'tablets' : 'storage',
4342
)
4443
: undefined;
4544

src/components/NodeId/NodeId.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {getDefaultNodePath} from '../../containers/Node/NodePages';
1+
import {getDefaultNodePath} from '../../routes';
22
import {useDatabaseFromQuery} from '../../utils/hooks/useDatabaseFromQuery';
33
import {InternalLink} from '../InternalLink';
44

@@ -8,5 +8,5 @@ interface NodeIdProps {
88

99
export function NodeId({id}: NodeIdProps) {
1010
const database = useDatabaseFromQuery();
11-
return <InternalLink to={getDefaultNodePath(id, {database})}>{id}</InternalLink>;
11+
return <InternalLink to={getDefaultNodePath({id}, {database})}>{id}</InternalLink>;
1212
}

src/components/PDiskInfo/PDiskInfo.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {Flex} from '@gravity-ui/uikit';
22

3-
import {getPDiskPagePath} from '../../routes';
43
import {valueIsDefined} from '../../utils';
54
import {formatBytes} from '../../utils/bytesParsers';
65
import {formatStorageValuesToGb} from '../../utils/dataFormatters/dataFormatters';
@@ -10,6 +9,7 @@ import {useIsUserAllowedToMakeChanges} from '../../utils/hooks/useIsUserAllowedT
109
import type {InfoViewerItem} from '../InfoViewer';
1110
import {InfoViewer} from '../InfoViewer/InfoViewer';
1211
import {LinkWithIcon} from '../LinkWithIcon/LinkWithIcon';
12+
import {PDiskPageLink} from '../PDiskPageLink/PDiskPageLink';
1313
import {ProgressViewer} from '../ProgressViewer/ProgressViewer';
1414
import {StatusIcon} from '../StatusIcon/StatusIcon';
1515

@@ -149,7 +149,6 @@ function getPDiskInfo<T extends PreparedPDisk>({
149149
valueIsDefined(nodeId);
150150

151151
if (shouldDisplayLinks) {
152-
const pDiskPagePath = getPDiskPagePath(PDiskId, nodeId);
153152
const pDiskInternalViewerPath = createPDiskDeveloperUILink({
154153
nodeId,
155154
pDiskId: PDiskId,
@@ -159,13 +158,7 @@ function getPDiskInfo<T extends PreparedPDisk>({
159158
label: pDiskInfoKeyset('links'),
160159
value: (
161160
<Flex wrap="wrap" gap={2}>
162-
{withPDiskPageLink && (
163-
<LinkWithIcon
164-
title={pDiskInfoKeyset('pdisk-page')}
165-
url={pDiskPagePath}
166-
external={false}
167-
/>
168-
)}
161+
{withPDiskPageLink && <PDiskPageLink pDiskId={PDiskId} nodeId={nodeId} />}
169162
{isUserAllowedToMakeChanges && (
170163
<LinkWithIcon
171164
title={pDiskInfoKeyset('developer-ui')}

src/components/PDiskInfo/i18n/en.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"links": "Links",
2020

2121
"developer-ui": "Developer UI",
22-
"pdisk-page": "PDisk page",
2322

2423
"yes": "Yes"
2524
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {getPDiskPagePath} from '../../routes';
2+
import {LinkWithIcon} from '../LinkWithIcon/LinkWithIcon';
3+
4+
import {i18n} from './i18n';
5+
6+
interface PDiskPageLinkProps {
7+
pDiskId: string | number;
8+
nodeId: string | number;
9+
}
10+
11+
export function PDiskPageLink({pDiskId: PDiskId, nodeId}: PDiskPageLinkProps) {
12+
return (
13+
<LinkWithIcon
14+
title={i18n('pdisk-page')}
15+
url={getPDiskPagePath(PDiskId, nodeId)}
16+
external={false}
17+
/>
18+
);
19+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"pdisk-page": "PDisk page"
3+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {registerKeysets} from '../../../utils/i18n';
2+
3+
import en from './en.json';
4+
5+
const COMPONENT = 'ydb-pDisk-link';
6+
7+
export const i18n = registerKeysets(COMPONENT, {en});

src/components/PDiskPopup/PDiskPopup.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from 'react';
22

33
import {Flex} from '@gravity-ui/uikit';
44

5-
import {getPDiskPagePath} from '../../routes';
65
import {selectNodesMap} from '../../store/reducers/nodesList';
76
import {EFlag} from '../../types/api/enums';
87
import {valueIsDefined} from '../../utils';
@@ -17,6 +16,7 @@ import {InfoViewer} from '../InfoViewer';
1716
import type {InfoViewerItem} from '../InfoViewer';
1817
import {LinkWithIcon} from '../LinkWithIcon/LinkWithIcon';
1918
import {pDiskInfoKeyset} from '../PDiskInfo/i18n';
19+
import {PDiskPageLink} from '../PDiskPageLink/PDiskPageLink';
2020

2121
const errorColors = [EFlag.Orange, EFlag.Red, EFlag.Yellow];
2222

@@ -83,16 +83,11 @@ export const preparePDiskData = (
8383
pDiskId: PDiskId,
8484
});
8585

86-
const pDiskPagePath = getPDiskPagePath(PDiskId, NodeId);
8786
pdiskData.push({
8887
label: 'Links',
8988
value: (
9089
<Flex gap={2} wrap="wrap">
91-
<LinkWithIcon
92-
title={pDiskInfoKeyset('pdisk-page')}
93-
url={pDiskPagePath}
94-
external={false}
95-
/>
90+
<PDiskPageLink pDiskId={PDiskId} nodeId={NodeId} />
9691
<LinkWithIcon
9792
title={pDiskInfoKeyset('developer-ui')}
9893
url={pDiskInternalViewerPath}

src/components/QueriesActivityBar/QueriesActivityAlert.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import {CirclePlay, Display, Person} from '@gravity-ui/icons';
22
import {Button, Card, Flex, Icon, Label, Text} from '@gravity-ui/uikit';
33
import {useHistory, useLocation} from 'react-router-dom';
44

5-
import {TenantTabsGroups, getTenantPath} from '../../containers/Tenant/TenantPages';
6-
import {parseQuery} from '../../routes';
5+
import {TenantTabsGroups} from '../../containers/Tenant/TenantPages';
6+
import {getTenantPath, parseQuery} from '../../routes';
77
import {TENANT_DIAGNOSTICS_TABS_IDS} from '../../store/reducers/tenant/constants';
88
import {cn} from '../../utils/cn';
99

src/components/QueriesActivityBar/QueriesActivityExpandable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {CirclePlay, Clock, Display, Person, Rocket} from '@gravity-ui/icons';
44
import {ArrowToggle, Button, Card, Flex, Icon, Label, Text} from '@gravity-ui/uikit';
55
import {useHistory, useLocation} from 'react-router-dom';
66

7-
import {TenantTabsGroups, getTenantPath} from '../../containers/Tenant/TenantPages';
8-
import {parseQuery} from '../../routes';
7+
import {TenantTabsGroups} from '../../containers/Tenant/TenantPages';
8+
import {getTenantPath, parseQuery} from '../../routes';
99
import {TENANT_DIAGNOSTICS_TABS_IDS} from '../../store/reducers/tenant/constants';
1010
import {cn} from '../../utils/cn';
1111

0 commit comments

Comments
 (0)