-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Lens] Threshold: set default color for new thresholds #113008
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
781abd2
:lipstick: Make dark grey default threshold color
dej611 1410ea7
:white_check_mark: Fix test
dej611 77d2723
Merge branch 'master' into fix/112796
kibanamachine a6732c1
:ok_hand: Integrate feedback
dej611 91f121e
t pMerge branch 'fix/112796' of github.com:dej611/kibana into fix/112796
dej611 a17b33b
Merge branch 'master' into fix/112796
kibanamachine e1465b8
:ok_hand: Fix bug
dej611 2e0cea2
:ok_hand: Filter threshold layers for color assignments
dej611 c2b7f04
Merge remote-tracking branch 'upstream/master' into fix/112796
dej611 f58d803
:ok_hand: Small refactor
dej611 2e9e1c8
:bug: Fix merging conflicts
dej611 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,13 @@ import { EuiFormRow, EuiColorPicker, EuiColorPickerProps, EuiToolTip, EuiIcon } | |
import type { PaletteRegistry } from 'src/plugins/charts/public'; | ||
import type { VisualizationDimensionEditorProps } from '../../types'; | ||
import { State } from '../types'; | ||
import { FormatFactory } from '../../../common'; | ||
import { FormatFactory, layerTypes } from '../../../common'; | ||
import { getSeriesColor } from '../state_helpers'; | ||
import { getAccessorColorConfig, getColorAssignments } from '../color_assignment'; | ||
import { | ||
defaultThresholdColor, | ||
getAccessorColorConfig, | ||
getColorAssignments, | ||
} from '../color_assignment'; | ||
import { getSortedAccessors } from '../to_expression'; | ||
import { updateLayer } from '.'; | ||
import { TooltipWrapper } from '../../shared_components'; | ||
|
@@ -56,6 +60,9 @@ export const ColorPicker = ({ | |
const overwriteColor = getSeriesColor(layer, accessor); | ||
const currentColor = useMemo(() => { | ||
if (overwriteColor || !frame.activeData) return overwriteColor; | ||
if (layer.layerType === layerTypes.THRESHOLD) { | ||
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: could we move this |
||
return defaultThresholdColor; | ||
} | ||
|
||
const datasource = frame.datasourceLayers[layer.layerId]; | ||
const sortedAccessors: string[] = getSortedAccessors(datasource, layer); | ||
|
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.
nit: could we move it up the line 112? Same as in my previous comment, it's an early return and thanks to that we don't have to execute the lines before (currentYConfig finding)
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.
finding
currentYConfig
is still required to return a user defined color for theyConfig