-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Geomap: Improve geojson style editor #41926
Conversation
public/app/plugins/panel/geomap/editor/GeomapStyleRulesEditor.tsx
Outdated
Show resolved
Hide resolved
@@ -40,7 +40,21 @@ export const StyleRuleEditor: FC<StandardEditorProps<FeatureStyleConfig, any, an | |||
const uniqueSelectables = useMemo(() => { | |||
const key = value?.check?.property; | |||
if (key && feats && value.check?.operation === ComparisonOperation.EQ) { | |||
return getUniqueFeatureValues(feats, key).map((v) => ({ value: v, label: v })); | |||
return getUniqueFeatureValues(feats, key).map((v) => { |
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.
hymm -- rather than adding this funky business, maybe we should check when calling onChangeValue
?
The weird part is that the number vs string distinction should really come from the feature value, not the comparison value 🤔
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.
I originally had these checks in the onChangeValue
but that resulted in the value select to have (not found)
appended to each value due to number and string inequality. It seems that we want to store number values as numbers for best UX (hence during initialization step vs. later on)
@@ -30,6 +33,7 @@ import { defaultStyleConfig, StyleConfig, TextAlignment, TextBaseline } from '.. | |||
import { styleUsesText } from '../../style/utils'; | |||
|
|||
export interface StyleEditorOptions { | |||
features?: Observable<FeatureLike[]>; |
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.
features?: Observable<FeatureLike[]>; | |
layerInfo: Observable<LayerContentInfo>; |
@@ -79,10 +83,43 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions | |||
onChange({ ...value, textConfig: { ...value.textConfig, textBaseline: textBaseline as TextBaseline } }); | |||
}; | |||
|
|||
let featuresHavePoints = false; |
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.
layerInfo has a geometryType property :)
Co-authored-by: Ryan McKinley <[email protected]>
… pass layerInfo instead of features
let featuresHavePoints = false; | ||
if (item.settings?.layerInfo) { | ||
const propertyOptions = useObservable(item.settings?.layerInfo); | ||
featuresHavePoints = propertyOptions?.geometryType === 'point'; |
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.
featuresHavePoints = propertyOptions?.geometryType === 'point'; | |
featuresHavePoints = propertyOptions?.geometryType === GeometryTypeId.Point; |
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.
whoops, didn't see this suggestion
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.
looks great!
(cherry picked from commit 541d154)
…nents * main: (22 commits) Refactor drone yaml (#41937) Update latest.json (#41873) Fix loop when cannot fetch roles (#41901) AzureMonitor: Fix metric namespace clear (#41878) Access Control: use role groups in role picker (#41912) AccessControl: RolePicker fetch roles in org (#41927) add unsupported renderer message to catalog (#41898) Install netcat to build-container and update the version (#41825) Transformers: extract fields from JSON and text (alpha) (#41791) Candlestick: fix volume histogram height by using mapped field name (#41931) Geomap: Improve geojson style editor (#41926) Docs: Add configuration option for the image renderer (#41798) Chore: Move babel config to a root babel.config.json (#41615) Make initialize depend on clone, only on enterprise pipelines (#41909) Run integration tests after initialize (#41906) Datasource: Fix stable sort order of query responses (#41868) Disable lint-drone from release pipelines (#41899) Add basic resource trimming command (#41780) Update grabpl version to 2.6.1 (#41892) Azure Monitor: Clean up fields when editing Metrics (#41762) ...
What this PR does / why we need it:
Improve geojson style editor in following ways:
!=
comparator optionGeojson.UX.improvements.mov
Which issue(s) this PR fixes:
Fixes #41913