Skip to content

Commit 4fb69ad

Browse files
authored
feat(TenantOverview): do not use tabs (#2655)
1 parent 15a93fd commit 4fb69ad

File tree

24 files changed

+118
-345
lines changed

24 files changed

+118
-345
lines changed

src/components/EntityStatus/EntityStatus.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,4 @@
142142
color: var(--ydb-color-status-red);
143143
}
144144
}
145-
146-
&__info-popover {
147-
padding: var(--g-spacing-4);
148-
}
149145
}

src/components/EntityStatus/EntityStatus.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {Button, ClipboardButton, Icon, Popover, Link as UIKitLink} from '@gravit
55

66
import {EFlag} from '../../types/api/enums';
77
import {cn} from '../../utils/cn';
8+
import {YDB_POPOVER_CLASS_NAME} from '../../utils/constants';
89
import {InternalLink} from '../InternalLink/InternalLink';
910
import {StatusIcon} from '../StatusIcon/StatusIcon';
1011
import type {StatusIconMode, StatusIconSize} from '../StatusIcon/StatusIcon';
@@ -120,7 +121,7 @@ export function EntityStatus({
120121
>
121122
{infoPopoverContent && (
122123
<Popover
123-
className={b('info-popover')}
124+
className={YDB_POPOVER_CLASS_NAME}
124125
content={infoPopoverContent}
125126
placement={['top-start', 'bottom-start']}
126127
onOpenChange={(visible) => setInfoIconHovered(visible)}

src/components/HoverPopup/HoverPopup.scss

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

src/components/HoverPopup/HoverPopup.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@ import type {PopupProps} from '@gravity-ui/uikit';
44
import {Popup} from '@gravity-ui/uikit';
55
import debounce from 'lodash/debounce';
66

7-
import {cn} from '../../utils/cn';
8-
9-
import './HoverPopup.scss';
7+
import {YDB_POPOVER_CLASS_NAME} from '../../utils/constants';
108

119
const DEBOUNCE_TIMEOUT = 100;
1210

13-
const b = cn('ydb-hover-popup');
14-
1511
type HoverPopupProps = {
1612
children: React.ReactNode;
1713
renderPopupContent: () => React.ReactNode;
@@ -112,7 +108,7 @@ export const HoverPopup = ({
112108
// bigger offset for easier switching to neighbour nodes
113109
// matches the default offset for popup with arrow out of a sense of beauty
114110
offset={offset || {mainAxis: 12, crossAxis: 0}}
115-
className={b()}
111+
className={YDB_POPOVER_CLASS_NAME}
116112
>
117113
<div
118114
className={contentClassName}

src/components/SpeedMultiMeter/SpeedMultiMeter.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@
7070
font-size: 18px;
7171
line-height: 24px;
7272
}
73-
&__popover-content {
74-
padding: var(--g-spacing-4);
75-
}
7673

7774
&__popover-row {
7875
display: block;

src/components/SpeedMultiMeter/SpeedMultiMeter.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {Popover} from '@gravity-ui/uikit';
55
import type {BytesSizes, ProcessSpeedStats} from '../../utils/bytesParsers';
66
import {formatBytes} from '../../utils/bytesParsers';
77
import {cn} from '../../utils/cn';
8+
import {YDB_POPOVER_CLASS_NAME} from '../../utils/constants';
89

910
import i18n from './i18n';
1011

@@ -105,7 +106,7 @@ export const SpeedMultiMeter = ({
105106
)}
106107
<Popover
107108
content={renderPopoverContent()}
108-
className={b('popover-container')}
109+
className={b('popover-container', YDB_POPOVER_CLASS_NAME)}
109110
placement={'bottom'}
110111
disabled={!withPopover}
111112
hasArrow={true}

src/containers/App/App.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,7 @@ body,
123123

124124
height: 100%;
125125
}
126+
127+
.ydb-popover {
128+
padding: var(--g-spacing-4);
129+
}

src/containers/Storage/PaginatedStorageGroupsTable/columns/columns.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {ShieldKeyhole} from '@gravity-ui/icons';
22
import DataTable from '@gravity-ui/react-data-table';
3-
import {Icon, Label, Popover} from '@gravity-ui/uikit';
3+
import {Flex, Icon, Label, Popover} from '@gravity-ui/uikit';
44

55
import {CellWithPopover} from '../../../../components/CellWithPopover/CellWithPopover';
66
import {EntityStatus} from '../../../../components/EntityStatus/EntityStatus';
@@ -9,7 +9,7 @@ import {UsageLabel} from '../../../../components/UsageLabel/UsageLabel';
99
import {getStorageGroupPath} from '../../../../routes';
1010
import {valueIsDefined} from '../../../../utils';
1111
import {cn} from '../../../../utils/cn';
12-
import {EMPTY_DATA_PLACEHOLDER} from '../../../../utils/constants';
12+
import {EMPTY_DATA_PLACEHOLDER, YDB_POPOVER_CLASS_NAME} from '../../../../utils/constants';
1313
import {formatNumber} from '../../../../utils/dataFormatters/dataFormatters';
1414
import {getUsageSeverity} from '../../../../utils/generateEvaluator';
1515
import {formatToMs} from '../../../../utils/timeParsers';
@@ -58,17 +58,22 @@ const typeColumn: StorageGroupsColumn = {
5858
resizeMinWidth: 100,
5959
align: DataTable.LEFT,
6060
render: ({row}) => (
61-
<div>
61+
<Flex>
6262
<Label>{row.MediaType || '—'}</Label>
6363
{'\u00a0'}
6464
{row.Encryption && (
65-
<Popover content={i18n('encrypted')} placement="right" openDelay={0}>
65+
<Popover
66+
content={i18n('encrypted')}
67+
placement="right"
68+
openDelay={0}
69+
className={YDB_POPOVER_CLASS_NAME}
70+
>
6671
<Label>
6772
<Icon data={ShieldKeyhole} size={18} />
6873
</Label>
6974
</Popover>
7075
)}
71-
</div>
76+
</Flex>
7277
),
7378
sortable: false,
7479
};

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import {InfoViewer} from '../../../../../components/InfoViewer/InfoViewer';
22
import {ProgressWrapper} from '../../../../../components/ProgressWrapper';
3+
import {TENANT_DIAGNOSTICS_TABS_IDS} from '../../../../../store/reducers/tenant/constants';
34
import type {TMemoryStats} from '../../../../../types/api/nodes';
45
import {cn} from '../../../../../utils/cn';
56
import {formatStorageValuesToGb} from '../../../../../utils/dataFormatters/dataFormatters';
7+
import {useSearchQuery} from '../../../../../utils/hooks';
8+
import {TenantTabsGroups, getTenantPath} from '../../../TenantPages';
9+
import {StatsWrapper} from '../StatsWrapper/StatsWrapper';
610
import {TenantDashboard} from '../TenantDashboard/TenantDashboard';
711
import i18n from '../i18n';
812

@@ -27,6 +31,7 @@ export function TenantMemory({
2731
memoryUsed,
2832
memoryLimit,
2933
}: TenantMemoryProps) {
34+
const query = useSearchQuery();
3035
const renderMemoryDetails = () => {
3136
if (memoryStats) {
3237
return <MemoryDetailsSection memoryStats={memoryStats} />;
@@ -61,7 +66,16 @@ export function TenantMemory({
6166
<div className={b()}>
6267
<TenantDashboard database={tenantName} charts={memoryDashboardConfig} />
6368
{renderMemoryDetails()}
64-
<TopNodesByMemory tenantName={tenantName} />
69+
70+
<StatsWrapper
71+
title={i18n('title_top-nodes-by-memory')}
72+
allEntitiesLink={getTenantPath({
73+
...query,
74+
[TenantTabsGroups.diagnosticsTab]: TENANT_DIAGNOSTICS_TABS_IDS.nodes,
75+
})}
76+
>
77+
<TopNodesByMemory tenantName={tenantName} />
78+
</StatsWrapper>
6579
</div>
6680
);
6781
}

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

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@ import {
1717
import type {GetNodesColumnsParams} from '../../../../../components/nodesColumns/types';
1818
import {nodesApi} from '../../../../../store/reducers/nodes/nodes';
1919
import type {NodesPreparedEntity} from '../../../../../store/reducers/nodes/types';
20-
import {TENANT_DIAGNOSTICS_TABS_IDS} from '../../../../../store/reducers/tenant/constants';
2120
import type {AdditionalNodesProps} from '../../../../../types/additionalProps';
2221
import type {NodesRequiredField} from '../../../../../types/api/nodes';
2322
import {
2423
TENANT_OVERVIEW_TABLES_LIMIT,
2524
TENANT_OVERVIEW_TABLES_SETTINGS,
2625
} from '../../../../../utils/constants';
27-
import {useAutoRefreshInterval, useSearchQuery} from '../../../../../utils/hooks';
26+
import {useAutoRefreshInterval} from '../../../../../utils/hooks';
2827
import {getRequiredDataFields} from '../../../../../utils/tableUtils/getRequiredDataFields';
29-
import {TenantTabsGroups, getTenantPath} from '../../../TenantPages';
3028
import {TenantOverviewTableLayout} from '../TenantOverviewTableLayout';
31-
import {getSectionTitle} from '../getSectionTitle';
3229
import i18n from '../i18n';
3330

3431
function getTopNodesByMemoryColumns(
@@ -56,8 +53,6 @@ interface TopNodesByMemoryProps {
5653
}
5754

5855
export function TopNodesByMemory({tenantName, additionalNodesProps}: TopNodesByMemoryProps) {
59-
const query = useSearchQuery();
60-
6156
const [autoRefreshInterval] = useAutoRefreshInterval();
6257
const [columns, fieldsRequired] = getTopNodesByMemoryColumns({
6358
getNodeRef: additionalNodesProps?.getNodeRef,
@@ -80,22 +75,8 @@ export function TopNodesByMemory({tenantName, additionalNodesProps}: TopNodesByM
8075

8176
const topNodes = currentData?.Nodes || [];
8277

83-
const title = getSectionTitle({
84-
entity: i18n('nodes'),
85-
postfix: i18n('by-memory'),
86-
link: getTenantPath({
87-
...query,
88-
[TenantTabsGroups.diagnosticsTab]: TENANT_DIAGNOSTICS_TABS_IDS.nodes,
89-
}),
90-
});
91-
9278
return (
93-
<TenantOverviewTableLayout
94-
title={title}
95-
loading={loading}
96-
error={error}
97-
withData={Boolean(currentData)}
98-
>
79+
<TenantOverviewTableLayout loading={loading} error={error} withData={Boolean(currentData)}>
9980
<ResizeableDataTable
10081
columnsWidthLSKey={NODES_COLUMNS_WIDTH_LS_KEY}
10182
data={topNodes}

0 commit comments

Comments
 (0)