-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upcoming: [DI-23083] - Migrated CloudPulseTimeRangeSelect to DateTimeRangePicker #11573
Open
nikhagra-akamai
wants to merge
38
commits into
linode:develop
Choose a base branch
from
nikhagra-akamai:date-range-picker-pr
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+406
β162
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
0e31ff6
upcoming: [DI-20931] - Replaced CloudPulseTimeRange with date time raβ¦
nikhagra-akamai 0ef704c
upcoming: [DI-20931] - Added preference capability to date time rangeβ¦
nikhagra-akamai cb4526d
upcoming: [DI-20931] - Added date range picker support in contextual β¦
nikhagra-akamai ee9f80f
upcoming: [DI-20931] - Updated test cases
nikhagra-akamai b913190
upcoming: [DI-20933] - Added default timezone value
nikhagra-akamai da2444d
upcoming: [DI-20933] - Added disabled state for timezone
nikhagra-akamai b8d5c47
upcoming: [DI-20933] - Added relative time duration in metric requestβ¦
nikhagra-akamai 6ba5ea5
upcoming: [DI-20933] - Removed widget time duration from metric request
nikhagra-akamai eb55e17
upcoming: [DI-20933] - Updated value to be saved in preferences
nikhagra-akamai 6477dfd
upcoming: [DI-20933] - Updated ifelse ladder to switch statement
nikhagra-akamai 6cd1789
upcoming: [DI-20933] - Updated contextual view
nikhagra-akamai ea5228a
upcoming: [DI-20933] - Moved common methods to utils file
nikhagra-akamai 799e43b
upcoming: [DI-20933] - Renamed type name
nikhagra-akamai e49cc12
upcoming: [DI-20933] - Renamed disabledTimeZone to disableTimeZone
nikhagra-akamai 83569d4
upcoming: [DI-20933] - Code refactoring
nikhagra-akamai e3d039d
upcoming: [DI-20933] - Removed unused variabled
nikhagra-akamai 51110e3
upcoming: [DI-20933] - Updatef failing test cases
nikhagra-akamai 38bff82
upcoming: [DI-20931] - Updated logic to retain date time value for prβ¦
nikhagra-akamai ef53c8c
upcoming: [DI-20931] - Updated metrics call logic
nikhagra-akamai e93ac51
upcoming: [DI-20933] - Removed unused variable
nikhagra-akamai 4f17486
upcoming: [DI-20933] - Added 1 hour in preset
nikhagra-akamai 7556662
upcoming: [DI-20933] - bug fix for 1 hour preset
nikhagra-akamai ed19fe9
upcoming: [DI-20933] - Updated failing test cases
nikhagra-akamai 8202028
upcoming: [DI-20932] - Made input readonly for time range picker
nikhagra-akamai b7525a6
upcoming: [DI-20932] - Added qa id
nikhagra-akamai fa27b71
upcoiming: [DI-20931] - Added default start & end date for undefined β¦
nikhagra-akamai 3b6b0fb
upcoming: [DI-23187] - Changed end date for this month preset option
nikhagra-akamai 1010f58
upcoming: [DI-23186] - Changed format of date in date picker
nikhagra-akamai 53c0d76
upcoming: [DI-20931] - Set 0 seconds to selected date
nikhagra-akamai b7e5f5d
upcoming: [DI-20931] - Set seconds value to 0 in default value
nikhagra-akamai b731e14
upcoming: [DI-20931] - Set seconds value to 0 in default value
nikhagra-akamai eff2b61
upcoming: [DI-20931] - Updated test cases
nikhagra-akamai f3fa4d3
upcoming: [DI-20931] - Updated logic to set 0 seconds
nikhagra-akamai 91e8be1
upcoming: [DI-20931] - updated logic to set 0 for seconds
nikhagra-akamai 594ddff
upcoming: [DI-20931] - Added support for multiple screen resolution
nikhagra-akamai fb3fcb5
upcoming: [DI-23083] - Added changeset
nikhagra-akamai d034eb6
upcoming: [DI-20931] - Added test cases
nikhagra-akamai e8bc56b
Merge branch 'develop' of github.com:linode/manager into date-range-pβ¦
nikhagra-akamai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/api-v4/.changeset/pr-11573-upcoming-features-1738066060175.md
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,5 @@ | ||
--- | ||
"@linode/api-v4": Upcoming Features | ||
--- | ||
|
||
Add `DateTimeWithPreset` type in cloudpulse types ([#11573](https://github.com/linode/manager/pull/11573)) |
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
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-11573-upcoming-features-1738066869988.md
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,5 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
Replace `CloudPulseTimeRangeSelect` with `CloudPulseDateTimeRangePicker`, Change metric request body to use `absolute_time_duration` for custom date and `relative_time_duration` for presets, add `1hr` preset option in `DateTimeRangePicker`, Change time select input field to `read-only` in `DateTimePicker ([#11573](https://github.com/linode/manager/pull/11573)) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,7 @@ export interface DateTimeRangePickerProps { | |
} | ||
|
||
type DatePresetType = | ||
| '1hour' | ||
| '7days' | ||
| '12hours' | ||
| '24hours' | ||
|
@@ -83,6 +84,7 @@ type DatePresetType = | |
|
||
const presetsOptions: { label: string; value: DatePresetType }[] = [ | ||
{ label: 'Last 30 Minutes', value: '30minutes' }, | ||
{ label: 'Last 1 Hour', value: '1hour' }, | ||
{ label: 'Last 12 Hours', value: '12hours' }, | ||
{ label: 'Last 24 Hours', value: '24hours' }, | ||
{ label: 'Last 7 Days', value: '7days' }, | ||
|
@@ -121,12 +123,12 @@ export const DateTimeRangePicker = (props: DateTimeRangePickerProps) => { | |
} = {}, | ||
sx, | ||
} = props; | ||
|
||
const [startDateTime, setStartDateTime] = useState<DateTime | null>( | ||
startDateTimeValue | ||
startDateTimeValue ?? | ||
DateTime.now().set({ second: 0 }).minus({ minutes: 30 }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Has there been discussions around setting this to the user time zone? |
||
); | ||
const [endDateTime, setEndDateTime] = useState<DateTime | null>( | ||
endDateTimeValue | ||
endDateTimeValue ?? DateTime.now().set({ second: 0 }) | ||
); | ||
const [presetValue, setPresetValue] = useState< | ||
| { | ||
|
@@ -164,14 +166,17 @@ export const DateTimeRangePicker = (props: DateTimeRangePickerProps) => { | |
}; | ||
|
||
const handlePresetSelection = (value: DatePresetType) => { | ||
const now = DateTime.now(); | ||
const now = DateTime.now().set({ second: 0 }); | ||
let newStartDateTime: DateTime | null = null; | ||
let newEndDateTime: DateTime | null = now; | ||
|
||
switch (value) { | ||
case '30minutes': | ||
newStartDateTime = now.minus({ minutes: 30 }); | ||
break; | ||
case '1hour': | ||
newStartDateTime = now.minus({ hours: 1 }); | ||
break; | ||
case '12hours': | ||
newStartDateTime = now.minus({ hours: 12 }); | ||
break; | ||
|
@@ -185,24 +190,25 @@ export const DateTimeRangePicker = (props: DateTimeRangePickerProps) => { | |
newStartDateTime = now.minus({ days: 30 }); | ||
break; | ||
case 'this_month': | ||
newStartDateTime = now.startOf('month'); | ||
newEndDateTime = now.endOf('month'); | ||
newEndDateTime = DateTime.now(); | ||
newStartDateTime = newEndDateTime.startOf('month'); | ||
break; | ||
case 'last_month': | ||
const lastMonth = now.minus({ months: 1 }); | ||
const lastMonth = DateTime.now().minus({ months: 1 }); | ||
newStartDateTime = lastMonth.startOf('month'); | ||
newEndDateTime = lastMonth.endOf('month'); | ||
break; | ||
|
||
case 'custom_range': | ||
newStartDateTime = null; | ||
newEndDateTime = null; | ||
newStartDateTime = startDateTime; | ||
newEndDateTime = endDateTime; | ||
break; | ||
default: | ||
return; | ||
} | ||
|
||
setStartDateTime(newStartDateTime); | ||
setEndDateTime(newEndDateTime); | ||
setEndDateTime(newEndDateTime?.set({ second: 0 }) ?? null); | ||
setPresetValue( | ||
presetsOptions.find((option) => option.value === value) ?? | ||
presetsOptions[0] | ||
|
@@ -247,7 +253,6 @@ export const DateTimeRangePicker = (props: DateTimeRangePickerProps) => { | |
}); | ||
} | ||
}; | ||
|
||
return ( | ||
<Box display="flex" flexDirection="column" gap={2} sx={sx}> | ||
{showPresets ? ( | ||
|
@@ -257,8 +262,8 @@ export const DateTimeRangePicker = (props: DateTimeRangePickerProps) => { | |
handlePresetSelection(selection.value as DatePresetType); | ||
} | ||
}} | ||
data-qa-preset="preset-select" | ||
data-testid="preset-select" | ||
data-qa-preset="preset-select" | ||
disableClearable | ||
fullWidth | ||
label={presetsLabel} | ||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to avoid user to type inside time select otherwise it'll break the UI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?