Skip to content
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

Merged
merged 11 commits into from
Jan 29, 2019
Merged

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Jan 24, 2019

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

screen shot 2019-01-24 at 4 16 16 pm

@nreese nreese added v7.0.0 [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v6.7.0 labels Jan 24, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis

@nreese
Copy link
Contributor Author

nreese commented Jan 24, 2019

cc @cchaos

@nreese nreese requested a review from thomasneirynck January 24, 2019 23:26
@@ -23,7 +23,6 @@ function mapStateToProps(state = {}) {
layerId: selectedLayer.getId(),
maxZoom: selectedLayer.getMaxZoom(),
minZoom: selectedLayer.getMinZoom(),
renderSourceDetails: selectedLayer.renderSourceDetails,
Copy link
Contributor

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.
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

@thomasneirynck thomasneirynck Jan 25, 2019

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

@nreese
Copy link
Contributor Author

nreese commented Jan 24, 2019

PR also adds icons for WMS and TMS layers

screen shot 2019-01-24 at 4 39 03 pm

@elasticmachine
Copy link
Contributor

💔 Build Failed

@nreese
Copy link
Contributor Author

nreese commented Jan 25, 2019

flaky test

jenkins, test this

@elasticmachine
Copy link
Contributor

💔 Build Failed

@nreese
Copy link
Contributor Author

nreese commented Jan 25, 2019

flaky test

jenkins, test this

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

return (
<EuiText color="subdued" size="s">
<p className="gisLayerDetails">
<strong className="gisLayerDetails__label">Source </strong><span>Elastic Maps Service</span><br/>
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@cchaos
Copy link
Contributor

cchaos commented Jan 25, 2019

Some design feedback:

  1. Line up accordion with layer title

  1. Use EuiText size="xs" for the details

  2. Add spacing after accordion header

  3. Remove spacing between detail items


{this.renderZoomSliders()}
{props.renderSourceSettingsEditor({ onChange: onSourceChange })}
Copy link
Contributor

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() {
Copy link
Contributor

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 [
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only thing that might bite us if we want to do more fancy stuff depending on the source-type. E.g. ems-hotlinking is such a small edge-case. I feel like we take a step back with this:

image

It used to say "Preview on Elastic Maps Landing Page", which is more descriptive

Copy link
Contributor

@thomasneirynck thomasneirynck left a 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 [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only thing that might bite us if we want to do more fancy stuff depending on the source-type. E.g. ems-hotlinking is such a small edge-case. I feel like we take a step back with this:

image

It used to say "Preview on Elastic Maps Landing Page", which is more descriptive

@nreese nreese requested a review from a team as a code owner January 26, 2019 19:41
@nreese
Copy link
Contributor Author

nreese commented Jan 26, 2019

@cchaos I updated the styling as requested and now it looks like. Let me know if I butchered the CSS changes

screen shot 2019-01-26 at 12 39 08 pm

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@cchaos cchaos left a 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 {
Copy link
Contributor

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>
Copy link
Contributor

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">
Copy link
Contributor

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">
Copy link
Contributor

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">
Copy link
Contributor

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.

@nreese
Copy link
Contributor Author

nreese commented Jan 29, 2019

@cchaos Made the suggested changes and here is how things look now

screen shot 2019-01-28 at 6 41 51 pm

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@cchaos cchaos left a 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 ?

@nreese
Copy link
Contributor Author

nreese commented Jan 29, 2019

Last I checked with @gchaps, she was against colons but we can always add them if needed.

@nreese nreese merged commit f3046de into elastic:master Jan 29, 2019
nreese added a commit to nreese/kibana that referenced this pull request Jan 29, 2019
* [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 added a commit that referenced this pull request Jan 29, 2019
* [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
@gchaps
Copy link
Contributor

gchaps commented Jan 29, 2019

@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
Index pattern: kibana_sample_data_logs
Geospatial field: geo.coordinates
Show as: heatmap

If we were to do something like this, then I don't think they would be needed.

screen shot 2019-01-29 at 8 04 56 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v6.7.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Maps] selecting a different layer when the layer-panel is open does not change the layer-name
5 participants