Skip to content

Commit cdc4d02

Browse files
committed
fix: review
1 parent 568cc21 commit cdc4d02

File tree

9 files changed

+36
-17
lines changed

9 files changed

+36
-17
lines changed

src/components/EntityStatus/EntityStatus.scss

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
color: var(--g-color-text-secondary);
2121

2222
@include table-hover-appearing-button();
23+
24+
&_visible {
25+
opacity: 1;
26+
}
2327
}
2428

2529
&__wrapper {
@@ -42,13 +46,18 @@
4246
width: 0;
4347
height: 100%;
4448

45-
background-color: var(--g-color-base-float);
49+
&_visible {
50+
width: min-content;
51+
padding: var(--g-spacing-1);
52+
}
4653

4754
.data-table__row:hover &,
4855
.ydb-paginated-table__row:hover &,
4956
.ydb-tree-view__item & {
5057
width: min-content;
5158
padding: var(--g-spacing-1);
59+
60+
background-color: var(--g-color-base-float);
5261
}
5362
}
5463

src/components/EntityStatus/EntityStatus.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ export function EntityStatus({
9595
{renderLink()}
9696
</span>
9797
{hasClipboardButton && (
98-
<div className={b('controls-wrapper')}>
98+
<div
99+
className={b('controls-wrapper', {
100+
visible: clipboardButtonAlwaysVisible,
101+
})}
102+
>
99103
<ClipboardButton
100104
text={name}
101105
size="xs"

src/components/TenantNameWrapper/TenantNameWrapper.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type {AdditionalTenantsProps, NodeAddress} from '../../types/additionalPr
77
import {useTypedSelector} from '../../utils/hooks';
88
import {CellWithPopover} from '../CellWithPopover/CellWithPopover';
99
import {EntityStatus} from '../EntityStatus/EntityStatus';
10+
import {LinkWithIcon} from '../LinkWithIcon/LinkWithIcon';
1011

1112
import i18n from './i18n';
1213

@@ -44,11 +45,16 @@ export function TenantNameWrapper({tenant, additionalTenantsProps}: TenantNameWr
4445
<CellWithPopover
4546
disabled={!isUserAllowedToMakeChanges || !monitoringLink}
4647
content={
47-
<DefinitionList responsive>
48-
<DefinitionList.Item name={i18n('field_monitoring-link')}>
49-
{monitoringLink}
50-
</DefinitionList.Item>
51-
</DefinitionList>
48+
monitoringLink ? (
49+
<DefinitionList responsive>
50+
<DefinitionList.Item name={i18n('field_links')}>
51+
<LinkWithIcon
52+
title={i18n('field_monitoring-link')}
53+
url={monitoringLink}
54+
/>
55+
</DefinitionList.Item>
56+
</DefinitionList>
57+
) : null
5258
}
5359
placement={['top', 'bottom']}
5460
behavior={PopoverBehavior.Immediate}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2-
"field_monitoring-link": "Monitoring link",
2+
"field_links": "Links",
3+
"field_monitoring-link": "Monitoring",
34
"context_unknown": "unknown database"
45
}

src/components/TooltipsContent/NodeEndpointsTooltipContent/NodeEndpointsTooltipContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const NodeEndpointsTooltipContent = ({data, nodeHref}: NodeEdpointsToolti
2323
const info: (DefinitionListItemProps & {key: string})[] = [];
2424

2525
if (data?.Rack) {
26-
info.push({name: 'Rack', children: data.Rack, key: i18n('field_rack')});
26+
info.push({name: i18n('field_rack'), children: data.Rack, key: 'Rack'});
2727
}
2828

2929
if (data?.Endpoints && data.Endpoints.length) {

src/containers/AppWithClusters/ExtendedCluster/ExtendedCluster.tsx

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

3-
import {MonitoringButton} from '../../../components/MonitoringButton/MonitoringButton';
43
import type {
54
AdditionalClusterProps,
65
AdditionalTenantsProps,
@@ -103,8 +102,7 @@ const getAdditionalTenantsProps = (
103102
if (monitoring && getMonitoringLink) {
104103
additionalTenantsProps.getMonitoringLink = (dbName?: string, dbType?: ETenantType) => {
105104
if (dbName && dbType) {
106-
const href = getMonitoringLink({monitoring, dbName, dbType, clusterName});
107-
return <MonitoringButton href={href} />;
105+
return getMonitoringLink({monitoring, dbName, dbType, clusterName});
108106
}
109107

110108
return null;

src/containers/AppWithClusters/ExtendedTenant/ExtendedTenant.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {MonitoringButton} from '../../../components/MonitoringButton/MonitoringButton';
21
import {useClusterBaseInfo} from '../../../store/reducers/cluster/cluster';
32
import type {ETenantType} from '../../../types/api/tenant';
43
import type {GetMonitoringLink} from '../../../utils/monitoring';
@@ -20,12 +19,11 @@ export function ExtendedTenant({
2019
const additionalTenantProps = {
2120
getMonitoringLink: (dbName?: string, dbType?: ETenantType) => {
2221
if (monitoring && dbName && dbType && getMonitoringLink) {
23-
const href = getMonitoringLink({
22+
return getMonitoringLink({
2423
monitoring,
2524
dbName,
2625
dbType,
2726
});
28-
return href ? <MonitoringButton href={href} size="xs" /> : null;
2927
}
3028

3129
return null;

src/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Loader} from '@gravity-ui/uikit';
22

33
import {EntityStatus} from '../../../../components/EntityStatus/EntityStatus';
4+
import {MonitoringButton} from '../../../../components/MonitoringButton/MonitoringButton';
45
import {overviewApi} from '../../../../store/reducers/overview/overview';
56
import {TENANT_METRICS_TABS_IDS} from '../../../../store/reducers/tenant/constants';
67
import {tenantApi} from '../../../../store/reducers/tenant/tenant';
@@ -147,13 +148,15 @@ export function TenantOverview({
147148
);
148149
}
149150

151+
const monitoringLink = additionalTenantProps?.getMonitoringLink?.(Name, Type);
152+
150153
return (
151154
<div className={b()}>
152155
<div className={b('info')}>
153156
<div className={b('top-label')}>{tenantType}</div>
154157
<div className={b('top')}>
155158
{renderName()}
156-
{additionalTenantProps?.getMonitoringLink?.(Name, Type)}
159+
{monitoringLink && <MonitoringButton href={monitoringLink} />}
157160
</div>
158161
<MetricsCards
159162
poolsCpuStats={poolsStats}

src/types/additionalProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface AdditionalClusterProps {
2020

2121
export interface AdditionalTenantsProps {
2222
prepareTenantBackend?: (backend: string | NodeAddress | undefined) => string | undefined;
23-
getMonitoringLink?: (name?: string, type?: ETenantType) => React.ReactNode;
23+
getMonitoringLink?: (name?: string, type?: ETenantType) => string | null;
2424
}
2525

2626
export type NodeAddress = Pick<TSystemStateInfo, 'Host' | 'Endpoints' | 'NodeId'>;

0 commit comments

Comments
 (0)