-
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
[Maps] move source details to Panel header #29298
Conversation
Pinging @elastic/kibana-gis |
cc @cchaos |
@@ -23,7 +23,6 @@ function mapStateToProps(state = {}) { | |||
layerId: selectedLayer.getId(), | |||
maxZoom: selectedLayer.getMaxZoom(), | |||
minZoom: selectedLayer.getMinZoom(), | |||
renderSourceDetails: selectedLayer.renderSourceDetails, |
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.
should be careful for a couple small merge conflicts with https://github.com/elastic/kibana/pull/29294/files
@@ -4,7 +4,7 @@ | |||
* you may not use this file except in compliance with the Elastic License. |
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.
ugh, I absolute hate that function syntax for a react component. so cluttered.
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.
But it is more performant since there are not state checks or life cycle methods
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.
interesting. but if we want to avoid React internally to do this whole life-cycle loop (since internally, it does go through it even when using function-components), we would also need to re-implement how we include the component.
I just got this from:
https://medium.com/missive-app/45-faster-react-functional-components-now-3509a668e69f
💔 Build Failed |
flaky test jenkins, test this |
💔 Build Failed |
flaky test jenkins, test this |
💔 Build Failed |
💚 Build Succeeded |
💚 Build Succeeded |
return ( | ||
<EuiText color="subdued" size="s"> | ||
<p className="gisLayerDetails"> | ||
<strong className="gisLayerDetails__label">Source </strong><span>Elastic Maps Service</span><br/> |
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.
Can you not use the same formatting as I had added here in the new location?
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.
yes. Same components just rendered with different data.
|
||
{this.renderZoomSliders()} | ||
{props.renderSourceSettingsEditor({ onChange: onSourceChange })} |
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.
after merging this will become props.layer.renderSourceSettingsEditor()
.
renderSourceDetails = () => { | ||
return this._source.renderDetails(); | ||
}; | ||
async getImmutableSourceProperties() { |
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.
nice rename
// ignore error, title will just default to id | ||
} | ||
|
||
return [ |
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.
nice improvement to get consistent formatting.
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.
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'm good with it, but feel like we're taking a small step back with regard to adding more customized source details. e.g. the ems hotlink is less descriptive.
// ignore error, title will just default to id | ||
} | ||
|
||
return [ |
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.
@cchaos I updated the styling as requested and now it looks like. Let me know if I butchered the CSS changes |
💚 Build Succeeded |
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.
Thanks for the update. I think we can just get rid of the extra classes and associated styles for the .gisLayerDetails__label
and similar. It just doesn't work with such unknown/dynamic content.
} | ||
|
||
.gisLayerDetails { | ||
p { |
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.
Naked selectors are frowned upon in our linter. You'll want to add a class to the actual <p>
tags.
} | ||
return ( | ||
<p key={label}> | ||
<strong className="gisLayerDetails__label">{label}</strong> |
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.
You can remove this class and remove the span around the value since I was trying to do some line-up trickery but it looks like it won't work in most cases including the screenshot you've got. So just let them line-up normally.
id="accordion1" | ||
buttonContent="Source details" | ||
> | ||
<EuiText color="subdued" size="s"> |
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'd suggest making this size="xs"
buttonContent="Source details" | ||
> | ||
<EuiText color="subdued" size="s"> | ||
<div className="gisLayerDetails"> |
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.
This class (and probably the whole div) can be removed.
@@ -81,6 +135,19 @@ export class LayerPanel extends React.Component { | |||
</EuiTitle> | |||
</EuiFlexItem> | |||
</EuiFlexGroup> | |||
<div className="gisLayerPanel__sourceDetails"> |
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'd add a small or xsmall space before the toggle.
@cchaos Made the suggested changes and here is how things look now |
💚 Build Succeeded |
💚 Build Succeeded |
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.
Much better, thank you. I'm wondering if there needs to be a colon or something between the terms? Maybe ask @gchaps ?
Last I checked with @gchaps, she was against colons but we can always add them if needed. |
* [Maps] move source details to Panel header * fix EMS file link * add grid icon to WMS and TMS source * ensure loadingDisplayName and props is only called once when component mounts * ensure display name gets updated when user changes it in settings panel input * clean-up styling * review feedback
* [Maps] move source details to Panel header * fix EMS file link * add grid icon to WMS and TMS source * ensure loadingDisplayName and props is only called once when component mounts * ensure display name gets updated when user changes it in settings panel input * clean-up styling * review feedback
@nreese You're right, in general, I don't like colons in the UI. But in this case I think they would help with comprehension: Data source: Elasticsearch geohash aggregation If we were to do something like this, then I don't think they would be needed. |
fixes #29006
Follow up to #28716.
Moves source details to Panel header. Source details are no longer rendered by the source. Now the source just provides a list of properties that are rendered by the layer_panel view. Also, the PR takes careful concern to ensure there is symmetry between the layer_addpanel inputs and then viewed source details so the name of the properties is the same and their is correlation between creating a source and viewing the details
PR also fixes the EMS vector layer link. In master, it is getting rendered as a unresolved promise. Now that properties are loaded async so the promise can resolve