Skip to content
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
12 changes: 12 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ export default [
curly: ['error', 'all'],
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
'no-restricted-syntax': [
'error',
{
selector:
"ImportDeclaration[source.value='react'] :matches(ImportNamespaceSpecifier, ImportDefaultSpecifier:not([local.name='React']), ImportSpecifier)",
message: "Please use import React from 'react' instead.",
},
{
selector: 'JSXFragment>JSXOpeningFragment:not(:has(JSXIdentifier))',
message: 'Please use React.Fragment instead.',
},
],
},
},
// TypeScript-specific rules that require type information
Expand Down
2 changes: 1 addition & 1 deletion src/components/Portal/Portal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';

import ReactDOM from 'react-dom';

Expand Down
6 changes: 3 additions & 3 deletions src/containers/App/AppTitleContext.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, {createContext, useContext} from 'react';
import React from 'react';

interface AppTitleContextType {
appTitle: string;
}

const AppTitleContext = createContext<AppTitleContextType | undefined>(undefined);
const AppTitleContext = React.createContext<AppTitleContextType | undefined>(undefined);

interface AppTitleProviderProps {
appTitle: string;
Expand All @@ -16,7 +16,7 @@ export function AppTitleProvider({appTitle, children}: AppTitleProviderProps) {
}

export function useAppTitle(): AppTitleContextType {
const context = useContext(AppTitleContext);
const context = React.useContext(AppTitleContext);
if (context === undefined) {
throw new Error('useAppTitle must be used within an AppTitleProvider');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useMemo} from 'react';
import React from 'react';

import {Flex} from '@gravity-ui/uikit';
import {useLocation} from 'react-router-dom';
Expand Down Expand Up @@ -75,22 +75,28 @@ export function MetricsTabs({
};

// Use only pools that directly indicate resources available to perform user queries
const cpuPools = useMemo(
const cpuPools = React.useMemo(
() =>
(poolsCpuStats || []).filter((pool) => !(pool.name === 'Batch' || pool.name === 'IO')),
[poolsCpuStats],
);
const cpuMetrics = useMemo(() => calculateMetricAggregates(cpuPools), [cpuPools]);
const cpuMetrics = React.useMemo(() => calculateMetricAggregates(cpuPools), [cpuPools]);

// Calculate storage metrics using utility
const storageStats = useMemo(
const storageStats = React.useMemo(
() => tabletStorageStats || blobStorageStats || [],
[tabletStorageStats, blobStorageStats],
);
const storageMetrics = useMemo(() => calculateMetricAggregates(storageStats), [storageStats]);
const storageMetrics = React.useMemo(
() => calculateMetricAggregates(storageStats),
[storageStats],
);

// Calculate memory metrics using utility
const memoryMetrics = useMemo(() => calculateMetricAggregates(memoryStats), [memoryStats]);
const memoryMetrics = React.useMemo(
() => calculateMetricAggregates(memoryStats),
[memoryStats],
);

// Pass raw network values; DedicatedMetricsTabs computes percent and legend
const [showNetworkUtilization] = useSetting<boolean>(SHOW_NETWORK_UTILIZATION);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from 'react';

import {Flex} from '@gravity-ui/uikit';

import {setTopQueriesFilters} from '../../../../../store/reducers/executeTopQueries/executeTopQueries';
Expand Down Expand Up @@ -34,7 +36,7 @@ export function TenantCpu({database, databaseType, databaseFullPath}: TenantCpuP
return (
<Flex direction="column" gap={4}>
{!isServerless && (
<>
<React.Fragment>
<TenantDashboard database={database} charts={cpuDashboardConfig} />
<StatsWrapper
allEntitiesLink={allNodesLink}
Expand All @@ -48,7 +50,7 @@ export function TenantCpu({database, databaseType, databaseFullPath}: TenantCpuP
>
<TopNodesByCpu database={database} />
</StatsWrapper>
</>
</React.Fragment>
)}
<StatsWrapper title={i18n('title_top-shards')} allEntitiesLink={topShardsLink}>
<TopShards database={database} databaseFullPath={databaseFullPath} />
Expand Down
2 changes: 1 addition & 1 deletion src/routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';

import type {Location} from 'history';
import isEmpty from 'lodash/isEmpty';
Expand Down
Loading