-
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-20709] - CSS updates for widget level filters for ACLP #10903
Changes from 19 commits
41b1a3d
1deb9ee
d4b2528
b0abd06
e0e7f16
cb8dc53
0764a82
00d005d
4611a69
68a4610
f00d7a7
add192c
17d8454
8cedef8
f25ec83
c9bc84f
2a20ac8
d038ea3
b3e5bc3
c319787
2b44bbf
eb7fe32
2383332
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
Update CSS for widget level filters and widget heading title for ACLP ([#10903](https://github.com/linode/manager/pull/10903)) |
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. 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. They used to be longer, but with the changes this looks weird. You're correct, the grid will need to be adjusted now 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. @mjac0bs / @jaalah-akamai , for smaller screens we have made the autocomplete to occupy 100 percent width now, please check 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. Thanks @venkymano-akamai, this looks much better on small screens. I left one comment about how to write that styling rule better to rely on our |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
import React from 'react'; | ||
|
||
import { Autocomplete } from 'src/components/Autocomplete/Autocomplete'; | ||
import { StyledWidgetAutocomplete } from '../../Utils/CloudPulseWidgetUtils'; | ||
|
||
import type { TimeGranularity } from '@linode/api-v4'; | ||
|
||
interface IntervalOptions { | ||
label: string; | ||
unit: string; | ||
value: number; | ||
} | ||
|
||
export interface IntervalSelectProperties { | ||
/** | ||
* Default time granularity to be selected | ||
|
@@ -39,7 +45,7 @@ export const getInSeconds = (interval: string) => { | |
}; | ||
|
||
// Intervals must be in ascending order here | ||
export const all_interval_options = [ | ||
export const allIntervalOptions: IntervalOptions[] = [ | ||
{ | ||
label: '1 min', | ||
unit: 'min', | ||
|
@@ -62,14 +68,14 @@ export const all_interval_options = [ | |
}, | ||
]; | ||
|
||
const autoIntervalOption = { | ||
const autoIntervalOption: IntervalOptions = { | ||
label: 'Auto', | ||
unit: 'Auto', | ||
value: -1, | ||
}; | ||
|
||
export const getIntervalIndex = (scrapeIntervalValue: number) => { | ||
return all_interval_options.findIndex( | ||
return allIntervalOptions.findIndex( | ||
(interval) => | ||
scrapeIntervalValue <= | ||
getInSeconds(String(interval.value) + interval.unit.slice(0, 1)) | ||
|
@@ -83,18 +89,18 @@ export const CloudPulseIntervalSelect = React.memo( | |
const firstIntervalIndex = getIntervalIndex(scrapeIntervalValue); | ||
|
||
// all intervals displayed if srape interval > highest available interval. Error handling done by api | ||
const available_interval_options = | ||
const availableIntervalOptions = | ||
firstIntervalIndex < 0 | ||
? all_interval_options.slice() | ||
: all_interval_options.slice( | ||
? allIntervalOptions.slice() | ||
: allIntervalOptions.slice( | ||
firstIntervalIndex, | ||
all_interval_options.length | ||
allIntervalOptions.length | ||
); | ||
|
||
let default_interval = | ||
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. Nit: 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. done |
||
props.default_interval?.unit === 'Auto' | ||
? autoIntervalOption | ||
: available_interval_options.find( | ||
: availableIntervalOptions.find( | ||
(obj) => | ||
obj.value === props.default_interval?.value && | ||
obj.unit === props.default_interval?.unit | ||
|
@@ -109,11 +115,17 @@ export const CloudPulseIntervalSelect = React.memo( | |
} | ||
|
||
return ( | ||
<Autocomplete | ||
isOptionEqualToValue={(option, value) => { | ||
<StyledWidgetAutocomplete | ||
isOptionEqualToValue={( | ||
option: IntervalOptions, | ||
value: IntervalOptions | ||
) => { | ||
return option?.value === value?.value && option?.unit === value?.unit; | ||
}} | ||
onChange={(_: any, selectedInterval: any) => { | ||
onChange={( | ||
_: React.SyntheticEvent, | ||
selectedInterval: IntervalOptions | ||
) => { | ||
props.onIntervalChange({ | ||
unit: selectedInterval?.unit, | ||
value: selectedInterval?.value, | ||
|
@@ -127,7 +139,7 @@ export const CloudPulseIntervalSelect = React.memo( | |
fullWidth={false} | ||
label="Select an Interval" | ||
noMarginTop={true} | ||
options={[autoIntervalOption, ...available_interval_options]} | ||
options={[autoIntervalOption, ...availableIntervalOptions]} | ||
sx={{ width: { xs: '100%' } }} | ||
/> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import ZoomInMap from '@mui/icons-material/ZoomInMap'; | ||
import ZoomOutMap from '@mui/icons-material/ZoomOutMap'; | ||
import { useTheme } from '@mui/material/styles'; | ||
import * as React from 'react'; | ||
|
||
export interface ZoomIconProperties { | ||
|
@@ -9,6 +10,8 @@ export interface ZoomIconProperties { | |
} | ||
|
||
export const ZoomIcon = React.memo((props: ZoomIconProperties) => { | ||
const theme = useTheme(); | ||
|
||
const handleClick = (needZoomIn: boolean) => { | ||
props.handleZoomToggle(needZoomIn); | ||
}; | ||
|
@@ -17,18 +20,26 @@ export const ZoomIcon = React.memo((props: ZoomIconProperties) => { | |
if (props.zoomIn) { | ||
return ( | ||
<ZoomInMap | ||
style={{ | ||
color: theme.color.grey1, | ||
fontSize: 'x-large', | ||
height: '34px', | ||
}} | ||
data-testid="zoom-in" | ||
onClick={() => handleClick(false)} | ||
style={{ color: 'grey', fontSize: 'x-large' }} | ||
/> | ||
); | ||
} | ||
|
||
return ( | ||
<ZoomOutMap | ||
style={{ | ||
color: theme.color.grey1, | ||
fontSize: 'x-large', | ||
height: '34px', | ||
}} | ||
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. Can we use the 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. done |
||
data-testid="zoom-out" | ||
onClick={() => handleClick(true)} | ||
style={{ color: 'grey', fontSize: 'x-large' }} | ||
/> | ||
); | ||
}; | ||
|
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.
Using our
theme.breakpoint
values is a better way to do this. For example: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.
done