Skip to content

Commit

Permalink
[#231] Refactor: Clean up all index.ts files from Metrics
Browse files Browse the repository at this point in the history
Cleaned up index.ts files from the following folders:
  - /Metrics/components
  - /Metrics/hooks
  - /Metrics/utils
  • Loading branch information
Msarawan authored and lavocatt committed Jul 15, 2024
1 parent 3278d04 commit d7d7b63
Show file tree
Hide file tree
Showing 32 changed files with 45 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { FC, useCallback, useState } from 'react';
import {
CardBrokerMemoryUsageMetricsContainer,
CardBrokerMemoryUsageMetricsContainerProps,
CardBrokerCPUUsageMetricsContainer,
MetricsActions,
} from './components';
import { parsePrometheusDuration } from '../Metrics/utils';
import { MetricsType } from './utils';
} from './components/CardBrokerMemoryUsageMetrics/CardBrokerMemoryUsageMetrics.container';
import { MetricsActions } from './components/MetricsActions/MetricsActions';
import { CardBrokerCPUUsageMetricsContainer } from './components/CardBrokerCPUUsageMetrics/CardBrokerCPUUsageMetrics.container';
import { parsePrometheusDuration } from '../Metrics/utils/prometheus';
import { MetricsType } from './utils/types';
import { MetricsLayout } from './components/MetricsLayout/MetricsLayout';

export type MetricsProps = CardBrokerMemoryUsageMetricsContainerProps;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { FC, useEffect, useState } from 'react';
//import { CardBrokerCPUUsageMetrics } from './CardBrokerCPUUsageMetrics';
import { parsePrometheusDuration } from '../../../../Overview/Metrics/utils';
import { getMaxSamplesForSpan, valueFormatter } from '../../utils';
import { useFetchCpuUsageMetrics } from '../../hooks';
import { parsePrometheusDuration } from '../../../../Overview/Metrics/utils/prometheus';
import { getMaxSamplesForSpan, valueFormatter } from '../../utils/format';
import { useFetchCpuUsageMetrics } from '../../hooks/useFetchCpuUsageMetrics';
import { useTranslation } from '../../../../../../../i18n/i18n';
import { CardQueryBrowser } from '../CardQueryBrowser/CardQueryBrowser';
//import { MetricsType } from '../../utils';

export type CardBrokerCPUUsageMetricsContainerProps = {
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { useTranslation } from '../../../../../../../i18n/i18n';
import { CardBodyLoading } from '../CardBodyLoading/CardBodyLoading';
import { EmptyStateNoMetricsData } from '../EmptyStateNoMetricsData/EmptyStateNoMetricsData';
import { ChartTitle } from '../ChartTitle';
import { ChartTitle } from '../ChartTitle/ChartTitle';

export type CardBrokerCPUUsageMetricsProps = ChartCPUUsageProps & {
isInitialLoading: boolean;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { FC, useState, useEffect, useMemo, useCallback } from 'react';
import { parsePrometheusDuration } from '../../../Metrics/utils';
import {
ByteDataTypes,
GraphSeries,
getMaxSamplesForSpan,
humanizeBinaryBytes,
processFrame,
} from '../../utils';
import { useFetchMemoryUsageMetrics } from '../../hooks';
import { parsePrometheusDuration } from '../../../Metrics/utils/prometheus';
import { getMaxSamplesForSpan } from '../../utils/format';
import { humanizeBinaryBytes } from '../../utils/units';
import { ByteDataTypes, GraphSeries } from '../../utils/types';
import { processFrame } from '../../utils/data-utils';
import { useFetchMemoryUsageMetrics } from '../../hooks/useFetchMemoryUsageMetrics';
import { useTranslation } from '../../../../../../../i18n/i18n';
import { CardQueryBrowser } from '../CardQueryBrowser/CardQueryBrowser';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { useTranslation } from '../../../../../../../i18n/i18n';
import { CardBodyLoading } from '../CardBodyLoading/CardBodyLoading';
import { EmptyStateNoMetricsData } from '../EmptyStateNoMetricsData/EmptyStateNoMetricsData';
import { ChartTitle } from '../ChartTitle';
import { ChartTitle } from '../ChartTitle/ChartTitle';

export type CardBrokerMemoryUsageMetricsProps = ChartMemoryUsageProps & {
isInitialLoading: boolean;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FC } from 'react';
import { Card, CardBody } from '@patternfly/react-core';
import { ChartTitle } from '../ChartTitle';
import { CardBodyLoading } from '../CardBodyLoading';
import { EmptyStateNoMetricsData } from '../EmptyStateNoMetricsData';
import { ChartTitle } from '../ChartTitle/ChartTitle';
import { CardBodyLoading } from '../CardBodyLoading/CardBodyLoading';
import { EmptyStateNoMetricsData } from '../EmptyStateNoMetricsData/EmptyStateNoMetricsData';
import { QueryBrowser, QueryBrowserProps } from '../QueryBrowser/QueryBrowser';

export type CardQueryBrowserProps = QueryBrowserProps & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ import {
} from '../../../../../../../constants/constants';
import { useChartWidth } from '../../hooks/useChartWidth';
import { useTranslation } from '../../../../../../../i18n/i18n';
import { chartTheme } from '../../utils/chart-theme';
import {
chartTheme,
valueFormatter,
formatSeriesValues,
xAxisTickFormat,
} from '../../utils/format';
import {
AxisDomain,
FormatSeriesTitle,
GraphSeries,
GraphDataPoint,
// getXDomain,
Series,
formatSeriesValues,
xAxisTickFormat,
} from '../../utils';
} from '../../utils/types';

const colors = chartTheme.line.colorScale;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,18 @@ import {
} from '../../../../../../../constants/constants';
import { useChartWidth } from '../../hooks/useChartWidth';
import { useTranslation } from '../../../../../../../i18n/i18n';
import { chartTheme } from '../../utils/chart-theme';
import { formatSeriesValues, xAxisTickFormat } from '../../utils/format';
import { humanizeBinaryBytes } from '../../utils/units';
import {
chartTheme,
ByteDataTypes,
processFrame,
humanizeBinaryBytes,
AxisDomain,
FormatSeriesTitle,
GraphSeries,
GraphDataPoint,
// getXDomain,
Series,
formatSeriesValues,
xAxisTickFormat,
} from '../../utils';
} from '../../utils/types';
import { processFrame } from '../../utils/data-utils';

const colors = chartTheme.line.colorScale;

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC } from 'react';
import { CardTitle } from '@patternfly/react-core';
import { ChartPopover } from '../ChartPopover';
import { ChartPopover } from '../ChartPopover/ChartPopover';

export type ChartTitleProps = {
title: string;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { FC } from 'react';
import { Card, CardActions, CardHeader } from '@patternfly/react-core';
import { useTranslation } from '../../../../../../../i18n/i18n';
import { MetricsType } from '../../utils';
import { DropdownWithToggle, IDropdownOption } from '../DropDownWithToggle';
import { MetricsType } from '../../utils/types';
import {
DropdownWithToggle,
IDropdownOption,
} from '../DropDownWithToggle/DropdownWithToggle';

export type MetricsActionsProps = {
pollingTime: string;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, waitForI18n } from '../../../../../../../test-utils';
import { MetricsLayout } from '../MetricsLayout/MetricsLayout';
import { MetricsType } from '../../utils';
import { MetricsType } from '../../utils/types';

describe('MetricsLayout', () => {
const mockMetricsMemoryUsage = <div>Mock Memory Usage</div>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, ReactElement } from 'react';
import { Grid, GridItem, PageSection, Title } from '@patternfly/react-core';
import { MetricsType } from '../../utils';
import { MetricsType } from '../../utils/types';

export type MetricsLayoutProps = {
metricsMemoryUsage?: ReactElement;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,16 @@ import {
} from '../../../../../../../constants/constants';
import { useChartWidth } from '../../hooks/useChartWidth';
import { useTranslation } from '../../../../../../../i18n/i18n';
import { chartTheme } from '../../utils/chart-theme';
import { formatSeriesValues, xAxisTickFormat } from '../../utils/format';
import {
chartTheme,
AxisDomain,
FormatSeriesTitle,
GraphSeries,
GraphDataPoint,
// getXDomain,
Series,
formatSeriesValues,
xAxisTickFormat,
DataPoint,
} from '../../utils';
} from '../../utils/types';
import { DataPoint } from '../../utils/data-utils';

const colors = chartTheme.line.colorScale;

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
usePrometheusPoll,
PrometheusEndpoint,
} from '@openshift-console/dynamic-plugin-sdk';
import { QueryInput } from '../utils';
import { QueryInput } from '../utils/types';

export const cpuUsageQuery = (
name: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
usePrometheusPoll,
PrometheusEndpoint,
} from '@openshift-console/dynamic-plugin-sdk';
import { QueryInput } from '../utils';
import { QueryInput } from '../utils/types';

export const memoryUsageQuery = (
name: string,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
BrokerCR,
SecretResource,
} from '../../../../k8s/types';
import { Metrics } from './Metrics';
import { Metrics } from './Metrics/Metrics';

const useGetIssuerCa = (
cr: BrokerCR,
Expand Down

0 comments on commit d7d7b63

Please sign in to comment.