Skip to content

fix: require ConnectStatus only for network table #2510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/NetworkTable/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
getConnectionsColumn,
getCpuColumn,
getDataCenterColumn,
getHostColumn,
getNetworkHostColumn,
getNetworkUtilizationColumn,
getNodeIdColumn,
getPingTimeColumn,
Expand All @@ -21,7 +21,7 @@ import type {GetNodesColumnsParams} from '../nodesColumns/types';
export function getNetworkTableNodesColumns(params: GetNodesColumnsParams) {
const columns: Column<NodesPreparedEntity>[] = [
getNodeIdColumn(),
getHostColumn(params, {statusForIcon: 'ConnectStatus'}),
getNetworkHostColumn(params),
getDataCenterColumn(),
getRackColumn(),
getUptimeColumn(),
Expand Down
6 changes: 2 additions & 4 deletions src/components/NodeHostWrapper/NodeHostWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,18 @@ export type NodeHostData = NodeAddress &
TenantName?: string;
};

export type StatusForIcon = 'SystemState' | 'ConnectStatus';

interface NodeHostWrapperProps {
node: NodeHostData;
getNodeRef?: GetNodeRefFunc;
database?: string;
statusForIcon?: StatusForIcon;
statusForIcon?: 'SystemState' | 'ConnectStatus';
}

export const NodeHostWrapper = ({
node,
getNodeRef,
database,
statusForIcon,
statusForIcon = 'SystemState',
}: NodeHostWrapperProps) => {
if (!node.Host) {
return <span>—</span>;
Expand Down
30 changes: 24 additions & 6 deletions src/components/nodesColumns/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {bytesToSpeed, isNumeric} from '../../utils/utils';
import {CellWithPopover} from '../CellWithPopover/CellWithPopover';
import {MemoryViewer} from '../MemoryViewer/MemoryViewer';
import {NodeHostWrapper} from '../NodeHostWrapper/NodeHostWrapper';
import type {NodeHostData, StatusForIcon} from '../NodeHostWrapper/NodeHostWrapper';
import type {NodeHostData} from '../NodeHostWrapper/NodeHostWrapper';
import {PoolsGraph} from '../PoolsGraph/PoolsGraph';
import {ProgressViewer} from '../ProgressViewer/ProgressViewer';
import {TabletsStatistic} from '../TabletsStatistic';
Expand All @@ -44,20 +44,38 @@ export function getNodeIdColumn<T extends {NodeId?: string | number}>(): Column<
align: DataTable.RIGHT,
};
}
export function getHostColumn<T extends NodeHostData>(
{getNodeRef, database}: GetNodesColumnsParams,
{statusForIcon = 'SystemState'}: {statusForIcon?: StatusForIcon} = {},
): Column<T> {
export function getHostColumn<T extends NodeHostData>({
getNodeRef,
database,
}: GetNodesColumnsParams): Column<T> {
return {
name: NODES_COLUMNS_IDS.Host,
header: NODES_COLUMNS_TITLES.Host,
render: ({row}) => {
return <NodeHostWrapper node={row} getNodeRef={getNodeRef} database={database} />;
},
width: 350,
align: DataTable.LEFT,
};
}

// Different column for different set of required fields
// ConnectStatus is required here, it makes handler to return network stats
// On versions before 25-1-2 ConnectStatus also makes handler to return peers - it can significantly increase response size
export function getNetworkHostColumn<T extends NodeHostData>({
getNodeRef,
database,
}: GetNodesColumnsParams): Column<T> {
return {
name: NODES_COLUMNS_IDS.NetworkHost,
header: NODES_COLUMNS_TITLES.NetworkHost,
render: ({row}) => {
return (
<NodeHostWrapper
node={row}
getNodeRef={getNodeRef}
database={database}
statusForIcon={statusForIcon}
statusForIcon={'ConnectStatus'}
/>
);
},
Expand Down
8 changes: 7 additions & 1 deletion src/components/nodesColumns/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const NODES_COLUMNS_WIDTH_LS_KEY = 'nodesTableColumnsWidth';
export const NODES_COLUMNS_IDS = {
NodeId: 'NodeId',
Host: 'Host',
NetworkHost: 'NetworkHost',
Database: 'Database',
NodeName: 'NodeName',
DC: 'DC',
Expand Down Expand Up @@ -51,6 +52,9 @@ export const NODES_COLUMNS_TITLES = {
get Host() {
return i18n('host');
},
get NetworkHost() {
return i18n('host');
},
get Database() {
return i18n('database');
},
Expand Down Expand Up @@ -178,7 +182,8 @@ export function getNodesGroupByFieldTitle(groupByField: NodesGroupByField) {
// Also for some columns we may use more than one field
export const NODES_COLUMNS_TO_DATA_FIELDS: Record<NodesColumnId, NodesRequiredField[]> = {
NodeId: ['NodeId'],
Host: ['Host', 'Rack', 'Database', 'SystemState', 'ConnectStatus'],
Host: ['Host', 'Rack', 'Database', 'SystemState'],
NetworkHost: ['Host', 'Rack', 'Database', 'SystemState', 'ConnectStatus'],
Database: ['Database'],
NodeName: ['NodeName'],
DC: ['DC'],
Expand Down Expand Up @@ -207,6 +212,7 @@ export const NODES_COLUMNS_TO_DATA_FIELDS: Record<NodesColumnId, NodesRequiredFi
const NODES_COLUMNS_TO_SORT_FIELDS: Record<NodesColumnId, NodesSortValue | undefined> = {
NodeId: 'NodeId',
Host: 'Host',
NetworkHost: 'Host',
Database: 'Database',
NodeName: 'NodeName',
DC: 'DC',
Expand Down
Loading