Skip to content

Commit

Permalink
fix: remove duplicate constants and types
Browse files Browse the repository at this point in the history
  • Loading branch information
ssjagad committed Mar 13, 2024
1 parent b9687ae commit 44a866f
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/data-module/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export type DataModuleSubscription<Query extends DataStreamQuery> = {
queries: Query[];
};

type RefreshRate = 1000 | 5000 | 10000 | 60000 | 300000;
export type RefreshRate = 1000 | 5000 | 10000 | 60000 | 300000;

export type RequestSettings = {
refreshRate?: RefreshRate;
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard/src/components/dashboard/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Dashboard from './index';
import React from 'react';
import { type IoTTwinMakerClient } from '@aws-sdk/client-iottwinmaker';
import { type IoTSiteWiseClient } from '@aws-sdk/client-iotsitewise';
import { RefreshRate } from '../querySettingsSync/types';
import type { RefreshRate } from '@iot-app-kit/core';

it('renders', function () {
const { queryByText, queryByTestId } = render(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import type {
RefreshRate,
RefreshRateString,
RefreshRateOption,
} from './types';
import type { RefreshRateString, RefreshRateOption } from './types';
import { type RefreshRate } from '@iot-app-kit/core';

export const SECOND_IN_MS = 1000 as const satisfies RefreshRate;
export const SECOND_IN_MS_STRING = '1000' as const satisfies RefreshRateString;
Expand Down Expand Up @@ -30,7 +27,6 @@ export const REFRESH_RATE_OPTIONS = [
{ label: '5m', value: FIVE_MINUTES_IN_MS_STRING },
] satisfies RefreshRateOption[];

export const DEFAULT_REFRESH_RATE = FIVE_SECONDS_IN_MS;
export const DEFAULT_REFRESH_RATE_OPTION = REFRESH_RATE_OPTIONS[1];

type RefreshRateOptionMap = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { useRefreshRate } from '~/customization/hooks/useRefreshRate';
import { SECOND_IN_MS } from '@iot-app-kit/core';
import invariant from 'tiny-invariant';
import { RefreshRate } from './types';
import { type RefreshRate } from '@iot-app-kit/core';

export const RefreshRateDropDown = () => {
const [refreshRate, updateRefreshRate] = useRefreshRate();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { type SelectProps } from '@cloudscape-design/components';

export type RefreshRate = 1000 | 5000 | 10000 | 60000 | 300000;
export type RefreshRateString = '1000' | '5000' | '10000' | '60000' | '300000';
export type RefreshRateOption = NonNullable<SelectProps['options']>[number] & {
value: RefreshRateString;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useDispatch, useSelector } from 'react-redux';
import { RefreshRate } from '~/components/querySettingsSync/types';
import { RefreshRate } from '@iot-app-kit/core';
import { onUpdateRefreshRateAction } from '~/store/actions';
import { DashboardState } from '~/store/state';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Action } from 'redux';
import type { DashboardState } from '../../state';
import { type RefreshRate } from '~/components/querySettingsSync/types';
import type { RefreshRate } from '@iot-app-kit/core';

type UpdateRefreshRateActionPayload = {
refreshRate: RefreshRate;
Expand Down
3 changes: 1 addition & 2 deletions packages/dashboard/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Viewport } from '@iot-app-kit/core';
import type { Viewport, RefreshRate } from '@iot-app-kit/core';
import { IoTSiteWiseClient } from '@aws-sdk/client-iotsitewise';
import { IoTEventsClient } from '@aws-sdk/client-iot-events';
import type { AwsCredentialIdentity, Provider } from '@aws-sdk/types';
Expand All @@ -9,7 +9,6 @@ import {
SiteWiseQuery,
} from '@iot-app-kit/source-iotsitewise';
import { IoTTwinMakerClient } from '@aws-sdk/client-iottwinmaker';
import { RefreshRate } from './components/querySettingsSync/types';

export type DashboardClientCredentials = {
awsCredentials: AwsCredentialIdentity | Provider<AwsCredentialIdentity>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Dashboard, { DashboardProperties } from '../../src/components/dashboard';
import { DashboardClientConfiguration } from '../../src/types';
import { DEFAULT_REGION } from '~/msw/constants';
import { useWorker } from '~/msw/useWorker';
import { RefreshRate } from '~/components/querySettingsSync/types';
import type { RefreshRate } from '@iot-app-kit/core';

/**
* Data is mocked by the service worker started above.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export const BarChart = (props: BarChartProps) => {
[HOUR_IN_MS]: '1h',
[DAY_IN_MS * 5]: '1d',
},
// refreshRate,
},
styles,
});
Expand Down

0 comments on commit 44a866f

Please sign in to comment.