Skip to content

Commit 6fa1e0b

Browse files
fix: add margin for developer ui button (#1041)
1 parent dbb5ba7 commit 6fa1e0b

File tree

11 files changed

+44
-59
lines changed

11 files changed

+44
-59
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
.developer-ui-link {
1+
.developer-ui-link-button {
22
display: none;
33

44
&_visible {
55
display: inline-block;
66
}
77

8-
.data-table__row:hover & {
8+
.data-table__row:hover &,
9+
.ydb-paginated-table__row:hover & {
910
display: inline-block;
1011
}
1112
}

src/components/DeveloperUiLink/DeveloperUiLink.tsx renamed to src/components/DeveloperUILinkButton/DeveloperUILinkButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import {Button, Icon} from '@gravity-ui/uikit';
33

44
import {cn} from '../../utils/cn';
55

6-
import './DeveloperUiLink.scss';
6+
import './DeveloperUILinkButton.scss';
77

8-
const b = cn('developer-ui-link');
8+
const b = cn('developer-ui-link-button');
99

1010
interface DeveloperUiLinkProps {
1111
className?: string;
1212
visible?: boolean;
1313
href: string;
1414
}
1515

16-
export function DeveloperUiLink({href, visible = false, className}: DeveloperUiLinkProps) {
16+
export function DeveloperUILinkButton({href, visible = false, className}: DeveloperUiLinkProps) {
1717
return (
1818
<Button size="s" href={href} className={b({visible}, className)} target="_blank">
1919
<Icon data={ArrowUpRightFromSquare} />

src/components/EntityStatus/EntityStatus.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
@include body-2-typography();
1111

1212
&__icon {
13-
margin-right: 8px;
13+
margin-right: var(--g-spacing-2);
1414
}
1515

1616
&__clipboard-button {
1717
display: flex;
1818
flex-shrink: 0;
1919

20-
margin-left: 8px;
20+
margin-left: var(--g-spacing-2);
2121

2222
opacity: 0;
2323
color: var(--g-color-text-secondary);
@@ -28,6 +28,10 @@
2828
}
2929
}
3030

31+
&__additional-controls {
32+
margin-left: var(--g-spacing-1);
33+
}
34+
3135
&__label {
3236
margin-right: 2px;
3337

src/components/EntityStatus/EntityStatus.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ export function EntityStatus({
104104
})}
105105
/>
106106
)}
107-
{additionalControls}
107+
{additionalControls && (
108+
<span className={b('additional-controls ')}>{additionalControls}</span>
109+
)}
108110
</div>
109111
);
110112
}

src/components/NodeHostWrapper/NodeHostWrapper.scss

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/components/NodeHostWrapper/NodeHostWrapper.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
import {ArrowUpRightFromSquare} from '@gravity-ui/icons';
2-
import {Button, Icon, PopoverBehavior} from '@gravity-ui/uikit';
1+
import {PopoverBehavior} from '@gravity-ui/uikit';
32

43
import {getDefaultNodePath} from '../../containers/Node/NodePages';
54
import type {NodesPreparedEntity} from '../../store/reducers/nodes/types';
65
import type {NodeAddress} from '../../types/additionalProps';
7-
import {cn} from '../../utils/cn';
86
import {createDeveloperUILinkWithNodeId} from '../../utils/developerUI/developerUI';
97
import {isUnavailableNode} from '../../utils/nodes';
108
import {CellWithPopover} from '../CellWithPopover/CellWithPopover';
9+
import {DeveloperUILinkButton} from '../DeveloperUILinkButton/DeveloperUILinkButton';
1110
import {EntityStatus} from '../EntityStatus/EntityStatus';
1211
import {NodeEndpointsTooltipContent} from '../TooltipsContent';
1312

14-
import './NodeHostWrapper.scss';
15-
16-
const b = cn('ydb-node-host-wrapper');
17-
1813
interface NodeHostWrapperProps {
1914
node: NodesPreparedEntity;
2015
getNodeRef?: (node?: NodeAddress) => string | null;
@@ -40,11 +35,7 @@ export const NodeHostWrapper = ({node, getNodeRef}: NodeHostWrapperProps) => {
4035
})
4136
: undefined;
4237

43-
const additionalControls = nodeHref ? (
44-
<Button size="s" href={nodeHref} className={b('external-button')} target="_blank">
45-
<Icon data={ArrowUpRightFromSquare} />
46-
</Button>
47-
) : null;
38+
const additionalControls = nodeHref ? <DeveloperUILinkButton href={nodeHref} /> : null;
4839

4940
return (
5041
<CellWithPopover

src/containers/Tablets/Tablets.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ import {Icon, Label, Text} from '@gravity-ui/uikit';
44
import {skipToken} from '@reduxjs/toolkit/query';
55

66
import {ButtonWithConfirmDialog} from '../../components/ButtonWithConfirmDialog/ButtonWithConfirmDialog';
7-
import {DeveloperUiLink} from '../../components/DeveloperUiLink/DeveloperUiLink';
7+
import {DeveloperUILinkButton} from '../../components/DeveloperUILinkButton/DeveloperUILinkButton';
88
import {EntityStatus} from '../../components/EntityStatus/EntityStatus';
99
import {ResponseError} from '../../components/Errors/ResponseError';
1010
import {InternalLink} from '../../components/InternalLink';
1111
import {ResizeableDataTable} from '../../components/ResizeableDataTable/ResizeableDataTable';
1212
import {TableSkeleton} from '../../components/TableSkeleton/TableSkeleton';
1313
import routes, {createHref} from '../../routes';
14-
import {backend} from '../../store';
1514
import {selectTabletsWithFqdn, tabletsApi} from '../../store/reducers/tablets';
1615
import {ETabletState} from '../../types/api/tablet';
1716
import type {TTabletStateInfo} from '../../types/api/tablet';
1817
import type {TabletsApiRequestParams} from '../../types/store/tablets';
1918
import {cn} from '../../utils/cn';
20-
import {DEFAULT_TABLE_SETTINGS} from '../../utils/constants';
19+
import {DEFAULT_TABLE_SETTINGS, EMPTY_DATA_PLACEHOLDER} from '../../utils/constants';
2120
import {calcUptime} from '../../utils/dataFormatters/dataFormatters';
21+
import {createTabletDeveloperUIHref} from '../../utils/developerUI/developerUI';
2222
import {useAutoRefreshInterval, useTypedDispatch, useTypedSelector} from '../../utils/hooks';
2323
import {mapTabletStateToLabelTheme} from '../../utils/tablet';
2424
import {getDefaultNodePath} from '../Node/NodePages';
@@ -43,14 +43,20 @@ const columns: DataTableColumn<TTabletStateInfo & {fqdn?: string}>[] = [
4343
},
4444
{
4545
name: 'TabletId',
46-
width: 230,
46+
width: 220,
4747
get header() {
4848
return i18n('Tablet');
4949
},
5050
render: ({row}) => {
51-
const tabletPath =
52-
row.TabletId &&
53-
createHref(routes.tablet, {id: row.TabletId}, {nodeId: row.NodeId, type: row.Type});
51+
if (!row.TabletId) {
52+
return EMPTY_DATA_PLACEHOLDER;
53+
}
54+
55+
const tabletPath = createHref(
56+
routes.tablet,
57+
{id: row.TabletId},
58+
{nodeId: row.NodeId, type: row.Type},
59+
);
5460

5561
return (
5662
<EntityStatus
@@ -59,7 +65,7 @@ const columns: DataTableColumn<TTabletStateInfo & {fqdn?: string}>[] = [
5965
hasClipboardButton
6066
showStatus={false}
6167
additionalControls={
62-
<DeveloperUiLink href={`${backend}/tablets?TabletID=${row.TabletId}`} />
68+
<DeveloperUILinkButton href={createTabletDeveloperUIHref(row.TabletId)} />
6369
}
6470
/>
6571
);

src/containers/Tenant/Diagnostics/TopShards/getTopShardsColumns.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import DataTable from '@gravity-ui/react-data-table';
22
import type {Column} from '@gravity-ui/react-data-table';
33
import type {Location} from 'history';
44

5-
import {DeveloperUiLink} from '../../../../components/DeveloperUiLink/DeveloperUiLink';
5+
import {DeveloperUILinkButton} from '../../../../components/DeveloperUILinkButton/DeveloperUILinkButton';
66
import {EntityStatus} from '../../../../components/EntityStatus/EntityStatus';
77
import {InternalLink} from '../../../../components/InternalLink';
88
import {LinkToSchemaObject} from '../../../../components/LinkToSchemaObject/LinkToSchemaObject';
99
import {UsageLabel} from '../../../../components/UsageLabel/UsageLabel';
1010
import routes, {createHref} from '../../../../routes';
11-
import {backend} from '../../../../store';
1211
import {getLoadSeverityForShard} from '../../../../store/reducers/tenantOverview/topShards/utils';
1312
import type {KeyValueRow} from '../../../../types/api/query';
1413
import type {ValueOf} from '../../../../types/common';
1514
import {formatNumber, roundToPrecision} from '../../../../utils/dataFormatters/dataFormatters';
15+
import {createTabletDeveloperUIHref} from '../../../../utils/developerUI/developerUI';
1616
import {getDefaultNodePath} from '../../../Node/NodePages';
1717

1818
export const TOP_SHARDS_COLUMNS_WIDTH_LS_KEY = 'topShardsColumnsWidth';
@@ -92,13 +92,13 @@ const tabletIdColumn: Column<KeyValueRow> = {
9292
hasClipboardButton
9393
showStatus={false}
9494
additionalControls={
95-
<DeveloperUiLink href={`${backend}/tablets?TabletID=${row.TabletId}`} />
95+
<DeveloperUILinkButton href={createTabletDeveloperUIHref(row.TabletId)} />
9696
}
9797
/>
9898
);
9999
},
100100
sortable: false,
101-
width: 190,
101+
width: 220,
102102
};
103103

104104
const nodeIdColumn: Column<KeyValueRow> = {

src/containers/Tenants/Tenants.scss

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

52-
&__monitoring-button {
53-
margin-left: 4px;
54-
}
55-
5652
&__name {
5753
overflow: hidden;
5854
}

src/containers/Tenants/Tenants.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,10 @@ export const Tenants = ({additionalTenantsProps}: TenantsProps) => {
116116
name: row.Name,
117117
backend,
118118
})}
119-
additionalControls={
120-
<span className={b('monitoring-button')}>
121-
{additionalTenantsProps?.getMonitoringLink?.(
122-
row.Name,
123-
row.Type,
124-
)}
125-
</span>
126-
}
119+
additionalControls={additionalTenantsProps?.getMonitoringLink?.(
120+
row.Name,
121+
row.Type,
122+
)}
127123
/>
128124
);
129125
},

0 commit comments

Comments
 (0)