-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: pass in refresh rate through the query instead of props
- Loading branch information
Showing
30 changed files
with
131 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/dashboard/src/components/querySettingsSync/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { | ||
RefreshRate, | ||
RefreshRateString, | ||
RefreshRateOption, | ||
} from './types'; | ||
|
||
export const SECOND_IN_MS = 1000 as const satisfies RefreshRate; | ||
export const SECOND_IN_MS_STRING = '1000' as const satisfies RefreshRateString; | ||
|
||
export const FIVE_SECONDS_IN_MS = 5000 as const satisfies RefreshRate; | ||
export const FIVE_SECONDS_IN_MS_STRING = | ||
'5000' as const satisfies RefreshRateString; | ||
|
||
export const TEN_SECONDS_IN_MS = 10000 as const satisfies RefreshRate; | ||
export const TEN_SECONDS_IN_MS_STRING = | ||
'10000' as const satisfies RefreshRateString; | ||
|
||
export const MINUTE_IN_MS = 60000 as const satisfies RefreshRate; | ||
export const MINUTE_IN_MS_STRING = '60000' as const satisfies RefreshRateString; | ||
|
||
export const FIVE_MINUTES_IN_MS = 300000 as const satisfies RefreshRate; | ||
export const FIVE_MINUTES_IN_MS_STRING = | ||
'300000' as const satisfies RefreshRateString; | ||
|
||
export const REFRESH_RATE_OPTIONS = [ | ||
{ label: '1s', value: SECOND_IN_MS_STRING }, | ||
{ label: '5s', value: FIVE_SECONDS_IN_MS_STRING }, | ||
{ label: '10s', value: TEN_SECONDS_IN_MS_STRING }, | ||
{ label: '1m', value: MINUTE_IN_MS_STRING }, | ||
{ 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 = { | ||
[key in RefreshRate]: RefreshRateOption; | ||
}; | ||
|
||
export const REFRESH_RATE_OPTION_MAP = | ||
REFRESH_RATE_OPTIONS.reduce<RefreshRateOptionMap>( | ||
(optionMap, { label, value }) => ({ | ||
...optionMap, | ||
[parseInt(value, 10)]: { label, value }, | ||
}), | ||
{} as RefreshRateOptionMap | ||
); |
37 changes: 23 additions & 14 deletions
37
packages/dashboard/src/components/querySettingsSync/refreshRateDropDown.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
packages/dashboard/src/components/querySettingsSync/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export const SECOND_IN_MS = 1000; | ||
export const FIVE_SECONDS_IN_MS = 5 * SECOND_IN_MS; | ||
export const TEN_SECONDS_IN_MS = 10 * SECOND_IN_MS; | ||
export const MINUTE_IN_MS = 60 * SECOND_IN_MS; | ||
export const FIVE_MINUTES_IN_MS = 5 * MINUTE_IN_MS; | ||
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; | ||
}; |
31 changes: 0 additions & 31 deletions
31
packages/dashboard/src/components/querySettingsSync/utils.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.