Skip to content

Commit

Permalink
fix: fix of comments
Browse files Browse the repository at this point in the history
  • Loading branch information
krosy1337 committed Oct 18, 2023
1 parent 7213e48 commit 3b9f5c0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 24 deletions.
8 changes: 6 additions & 2 deletions src/components/UsageLabel/UsageLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ interface UsageLabelProps extends LabelProps {
overloadThreshold?: number;
}

export function UsageLabel({value, overloadThreshold = 90, theme}: UsageLabelProps) {
export function UsageLabel({value, overloadThreshold = 90, theme, ...props}: UsageLabelProps) {
return (
<Label theme={theme} className={b({overload: Number(value) >= overloadThreshold})}>
<Label
theme={theme}
className={b({overload: Number(value) >= overloadThreshold})}
{...props}
>
{value || 0}%
</Label>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import {useDispatch} from 'react-redux';

import {type Column} from '@gravity-ui/react-data-table';

import {getSchema, setCurrentSchemaPath} from '../../../../../store/reducers/schema/schema';
import {useAutofetcher, useTypedSelector} from '../../../../../utils/hooks';
import type {KeyValueRow} from '../../../../../types/api/query';
import {
sendTenantOverviewTopShardsQuery,
setDataWasNotLoaded,
Expand Down Expand Up @@ -47,7 +44,7 @@ export const TopShards = ({path}: TopShardsProps) => {
};
};

const columns: Column<KeyValueRow>[] = getTopShardsColumns(onSchemaClick, path);
const columns = getTopShardsColumns(onSchemaClick, path);

return (
<TenantOverviewTableLayout
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import cn from 'bem-cn-lite';

import DataTable from '@gravity-ui/react-data-table';
import type {DataTableProps, THEMES} from '@gravity-ui/react-data-table';
import type {DataTableProps} from '@gravity-ui/react-data-table';

import {
TENANT_OVERVIEW_TABLES_LIMIT,
Expand All @@ -14,7 +14,6 @@ import {ResponseError} from '../../../../components/Errors/ResponseError';
const b = cn('tenant-overview');

interface TenantOverviewTableLayoutProps<T> extends Omit<DataTableProps<T>, 'theme'> {
theme?: THEMES | string;
title: string;
loading?: boolean;
wasLoaded?: boolean;
Expand All @@ -26,13 +25,11 @@ interface TenantOverviewTableLayoutProps<T> extends Omit<DataTableProps<T>, 'the

export function TenantOverviewTableLayout<T>({
title,
data,
columns,
error,
loading,
wasLoaded,
emptyDataMessage,
tableClassNameModifiers = {},
...props
}: TenantOverviewTableLayoutProps<T>) {
const renderContent = () => {
if (error) {
Expand All @@ -44,13 +41,7 @@ export function TenantOverviewTableLayout<T>({
}

return (
<DataTable
theme="yandex-cloud"
data={data || []}
columns={columns}
settings={TENANT_OVERVIEW_TABLES_SETTINGS}
emptyDataMessage={emptyDataMessage}
/>
<DataTable theme="yandex-cloud" settings={TENANT_OVERVIEW_TABLES_SETTINGS} {...props} />
);
};
return (
Expand Down
9 changes: 3 additions & 6 deletions src/containers/Tenant/Diagnostics/TopQueries/TopQueries.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {useCallback, useEffect, useRef, useState} from 'react';
import {useDispatch} from 'react-redux';
import {useHistory, useLocation} from 'react-router';
import qs from 'qs';
import cn from 'bem-cn-lite';

import DataTable from '@gravity-ui/react-data-table';
Expand Down Expand Up @@ -29,12 +28,12 @@ import {
import {HOUR_IN_SECONDS} from '../../../../utils/constants';
import {useAutofetcher, useTypedSelector} from '../../../../utils/hooks';
import {prepareQueryError} from '../../../../utils/query';

import {parseQuery} from '../../../../routes';
import {QUERY_TABLE_SETTINGS} from '../../utils/constants';
import {isColumnEntityType} from '../../utils/schema';
import {TenantTabsGroups, getTenantPath} from '../../TenantPages';

import {getTopQueriesColumns} from './getTopQueriesColumns';

import i18n from './i18n';
import './TopQueries.scss';

Expand Down Expand Up @@ -128,9 +127,7 @@ export const TopQueries = ({path, type}: TopQueriesProps) => {

dispatch(changeUserInput({input}));

const queryParams = qs.parse(location.search, {
ignoreQueryPrefix: true,
});
const queryParams = parseQuery(location);

const queryPath = getTenantPath({
...queryParams,
Expand Down

0 comments on commit 3b9f5c0

Please sign in to comment.