Skip to content

Commit f97c082

Browse files
fix: fix buttons incorrect align in Nodes and Tenants tables (#830)
1 parent 62d8ec9 commit f97c082

File tree

6 files changed

+40
-42
lines changed

6 files changed

+40
-42
lines changed

src/components/EntityStatus/EntityStatus.scss

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
}
1515

1616
&__clipboard-button {
17+
display: flex;
1718
visibility: hidden;
19+
flex-shrink: 0;
1820

1921
margin-left: 8px;
2022

@@ -25,16 +27,6 @@
2527
}
2628
}
2729

28-
a {
29-
text-decoration: none;
30-
31-
color: var(--g-color-text-link);
32-
}
33-
34-
a:hover {
35-
color: var(--g-color-text-link-hover);
36-
}
37-
3830
&__label {
3931
margin-right: 2px;
4032

src/components/EntityStatus/EntityStatus.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {Link as UIKitLink} from '@gravity-ui/uikit';
2-
import {Link} from 'react-router-dom';
32

43
import {EFlag} from '../../types/api/enums';
54
import {cn} from '../../utils/cn';
65
import {ClipboardButton} from '../ClipboardButton';
6+
import {InternalLink} from '../InternalLink/InternalLink';
77
import {StatusIcon} from '../StatusIcon/StatusIcon';
88
import type {StatusIconMode, StatusIconSize} from '../StatusIcon/StatusIcon';
99

@@ -29,6 +29,8 @@ interface EntityStatusProps {
2929
clipboardButtonAlwaysVisible?: boolean;
3030

3131
className?: string;
32+
33+
additionalControls?: React.ReactNode;
3234
}
3335

3436
export function EntityStatus({
@@ -49,6 +51,8 @@ export function EntityStatus({
4951
clipboardButtonAlwaysVisible = false,
5052

5153
className,
54+
55+
additionalControls,
5256
}: EntityStatusProps) {
5357
const renderIcon = () => {
5458
if (!showStatus) {
@@ -75,9 +79,9 @@ export function EntityStatus({
7579
}
7680

7781
return (
78-
<Link className={b('name')} to={path}>
82+
<InternalLink className={b('name')} to={path}>
7983
{name}
80-
</Link>
84+
</InternalLink>
8185
);
8286
}
8387
return name && <span className={b('name')}>{name}</span>;
@@ -100,6 +104,7 @@ export function EntityStatus({
100104
})}
101105
/>
102106
)}
107+
{additionalControls}
103108
</div>
104109
);
105110
}

src/components/NodeHostWrapper/NodeHostWrapper.scss

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
.ydb-node-host-wrapper {
2-
&__host {
3-
overflow: hidden;
4-
}
5-
62
&__external-button {
73
display: none;
4+
flex-shrink: 0;
85

96
margin-left: 4px;
107
}

src/components/NodeHostWrapper/NodeHostWrapper.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ export const NodeHostWrapper = ({node, getNodeRef}: NodeHostWrapperProps) => {
3232
})
3333
: undefined;
3434

35+
const additionalControls = nodeRef ? (
36+
<Button size="s" href={nodeRef} className={b('external-button')} target="_blank">
37+
<Icon name="external" />
38+
</Button>
39+
) : null;
40+
3541
return (
3642
<CellWithPopover
3743
disabled={!isNodeAvailable}
@@ -44,13 +50,8 @@ export const NodeHostWrapper = ({node, getNodeRef}: NodeHostWrapperProps) => {
4450
status={node.SystemState}
4551
path={nodePath}
4652
hasClipboardButton
47-
className={b('host')}
53+
additionalControls={additionalControls}
4854
/>
49-
{nodeRef && (
50-
<Button size="s" href={nodeRef} className={b('external-button')} target="_blank">
51-
<Icon name="external" />
52-
</Button>
53-
)}
5455
</CellWithPopover>
5556
);
5657
};

src/containers/Tenants/Tenants.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@
4949
display: block;
5050
}
5151

52-
&__name-wrapper {
53-
display: flex;
54-
align-items: center;
55-
gap: 4px;
52+
&__monitoring-button {
53+
margin-left: 4px;
5654
}
5755

5856
&__name {

src/containers/Tenants/Tenants.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,26 @@ export const Tenants = ({additionalTenantsProps}: TenantsProps) => {
104104
const backend = getTenantBackend(row);
105105
const isExternalLink = Boolean(backend);
106106
return (
107-
<div className={b('name-wrapper')}>
108-
<EntityStatus
109-
externalLink={isExternalLink}
110-
className={b('name')}
111-
name={row.Name || 'unknown database'}
112-
withLeftTrim={true}
113-
status={row.Overall}
114-
hasClipboardButton
115-
path={getTenantPath({
116-
name: row.Name,
117-
backend,
118-
})}
119-
/>
120-
{additionalTenantsProps?.getMonitoringLink?.(row.Name, row.Type)}
121-
</div>
107+
<EntityStatus
108+
externalLink={isExternalLink}
109+
className={b('name')}
110+
name={row.Name || 'unknown database'}
111+
withLeftTrim={true}
112+
status={row.Overall}
113+
hasClipboardButton
114+
path={getTenantPath({
115+
name: row.Name,
116+
backend,
117+
})}
118+
additionalControls={
119+
<span className={b('monitoring-button')}>
120+
{additionalTenantsProps?.getMonitoringLink?.(
121+
row.Name,
122+
row.Type,
123+
)}
124+
</span>
125+
}
126+
/>
122127
);
123128
},
124129
width: 440,

0 commit comments

Comments
 (0)