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

[input controls] Horizontal layout #14918

Merged
merged 7 commits into from
Nov 29, 2017
Merged

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Nov 13, 2017

Dynamically configure the input control panel layout based on the panel dimensions. When the panel is short and long - lay the controls out in a horizontal fashion. When the panel is tall and skinny - lay the controls out in a vertical fashion

layout

@stacey-gammon
Copy link
Contributor

I suspect a flaky test:

27:08          │ debg  clickByCssSelector([href="#/visualize"])
18:27:08          │ debg  findByCssSelector [href="#/visualize"]
18:27:08          │ debg  clickVisualizationByLinkText(Visualization TileMap)
18:27:19          │ debg  --- tryForTime failure: [POST http://localhost:9515/session/f64b0bb49a0a40eeabeb455dc1452c97/element / {"using":"partial link text","value":"Visualization TileMap"}] no such element: Unable to locate element: {"method":"partial link text","selector":"Visualization TileMap"}
18:27:19          │         (Session info: chrome=62.0.3202.75)
18:27:19          │         (Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.4.0-45-generic x86_64)
18:27:29          │ debg  --- tryForTime failed again with the same message  ...
18:27:40          │ debg  --- tryForTime failed again with the same message  ...
18:27:50          │ debg  --- tryForTime failed again with the same message  ...
18:27:51          │ debg  Taking screenshot "/var/lib/jenkins/workspace/elastic+kibana+pull-request+multijob-selenium/test/functional/screenshots/failure/visualize app tile map visualize app tile map chart should save with zoom level and load, take screenshot.png"
18:27:51        └- ✖ fail: "visualize app tile map visualize app tile map chart should save with zoom level and load, take screenshot"
18:27:51        │        tryForTime timeout: [POST http://localhost:9515/session/f64b0bb49a0a40eeabeb455dc1452c97/element / {"using":"partial link text","value":"Visualization TileMap"}] no such element: Unable to locate element: {"method":"partial link text","selector":"Visualization TileMap"}
18:27:51        │         (Session info: chrome=62.0.3202.75)
18:27:51        │         (Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.4.0-45-generic x86_64)
18:27:51        │           at Server._post (/var/lib/jenkins/workspace/elastic+kibana+pull-request+multijob-

screenshot:
visualize app tile map visualize app tile map chart should save with zoom level and load take screenshot 2

cc @elastic/kibana-visualizations, does this look like a flaky test to you at all? I'm pretty sure I've seen this one before.

jenkins, test this

@thomasneirynck
Copy link
Contributor

thomasneirynck commented Nov 13, 2017

@nreese yeah, this test seems to have been failing every once in a while, the last couple of weeks. I can take a look. fyi I created #14920.

}
const panelWidth = panelNode.clientWidth;
const panelHeight = panelNode.clientHeight;
// todo - how do we make this less fragile to css changes?
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we need something exposed to the embeddable from dashboard - width/height that is only the inner values, and an onResize function.

Copy link
Contributor

Choose a reason for hiding this comment

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

I filed #14921 so I can keep track of these kinds of things. Plus then maybe we can remember to go back and clean this up, since I agree, it's going to be very fragile.

What about adding a selenium test to try to ensure we don't break it accidentally? I'm dubious whether the react test would catch any issues. I've had problems testing dimension values in the jest tests because jsdom returns all 0 for getClientBoundingRect (or whatever that function is called).

Copy link
Contributor

@stacey-gammon stacey-gammon left a comment

Choose a reason for hiding this comment

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

Some minor feedback, but lgtm.

.pressMouseButton()
.moveMouseTo(null, 300, 0)
.releaseMouseButton();
await PageObjects.common.sleep(500); //give time for vis to redraw
Copy link
Contributor

Choose a reason for hiding this comment

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

I try to avoid sleeps as much as possible - what about wrapping the below in a retry, so if it fails the first time, I'll try again, and by then enough time should have passed so it finished redrawing? (here and below function)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

retry does not work in this situation since the elements already exist and will be returned the first attempt. A sleep is needed before the expect to allow the elements to be re-drawn with the new state. I updated the commits around the sleep to reflect this.

before(async () => {
await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.dashboard.addVisualizations(['Visualization InputControl']);
Copy link
Contributor

Choose a reason for hiding this comment

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

sweeeet, now you're going to have to show me how to add more visualization types to the archive. :)

@@ -44,5 +44,9 @@ visualization.input_control_vis {
}
}

visualize.input_control_vis {
padding: 0 !important;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should add a comment here explaining why this is important (I'm guessing bc of the width calculations?)

const panelMargin = 1;
const embeddedPanelPadding = 8;
const inputControlVisMargin = 5;
const flexGridSmallMargin = 4;
Copy link
Contributor

Choose a reason for hiding this comment

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

tiny nit but I think as static const variables, these are supposed to be named like EMBEDDED_PANEL_PADDING. Also, is there a file you grabbed these from? Might be worthwhile to point to it so if anything looks off someone can double check the values match and know where to look. (though who knows how long that will stay in sync for... just a suggestion, take it or leave it)

Copy link
Contributor

@kobelb kobelb left a comment

Choose a reason for hiding this comment

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

This is behaving really weirdly:

horizontal layout

@nreese
Copy link
Contributor Author

nreese commented Nov 27, 2017

@stacey-gammon @kobelb I have refactor this PR to use the ui framework's KuiFlexGroup with the wrap option (thanks @cjcenizal ). This avoids the entire width calculation funny business. Please take another look.

Copy link
Contributor

@kobelb kobelb left a comment

Choose a reason for hiding this comment

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

LGTM

@kobelb
Copy link
Contributor

kobelb commented Nov 27, 2017

The CI failure looks unrelated, but I'd much prefer a green CI run before merging as it could be caused by this PR.

✖ fail: "dashboard app dashboard state Directly modifying url updates dashboard state for panel size parameters"

@nreese
Copy link
Contributor Author

nreese commented Nov 27, 2017

jenkins, test this

1 similar comment
@ppisljar
Copy link
Member

jenkins, test this

@nreese nreese merged commit c579677 into elastic:master Nov 29, 2017
nreese added a commit to nreese/kibana that referenced this pull request Nov 29, 2017
* input controls horizontal layout

* fix controlWidth calculation

* add functional test to ensure panel resizing changes layout

* use all caps for consts, add more comments about where values came from

* replace sleeps in functional tests with retry

* use KuiFlexGroup with wrap option instead of manually calculating widths

* remove no longer used min width constants
nreese added a commit to nreese/kibana that referenced this pull request Nov 30, 2017
* input controls horizontal layout

* fix controlWidth calculation

* add functional test to ensure panel resizing changes layout

* use all caps for consts, add more comments about where values came from

* replace sleeps in functional tests with retry

* use KuiFlexGroup with wrap option instead of manually calculating widths

* remove no longer used min width constants
nreese added a commit that referenced this pull request Nov 30, 2017
* [input controls] Horizontal layout (#14918)

* input controls horizontal layout

* fix controlWidth calculation

* add functional test to ensure panel resizing changes layout

* use all caps for consts, add more comments about where values came from

* replace sleeps in functional tests with retry

* use KuiFlexGroup with wrap option instead of manually calculating widths

* remove no longer used min width constants

* fix dashboard grid function test.
chrisronline pushed a commit to chrisronline/kibana that referenced this pull request Dec 1, 2017
* input controls horizontal layout

* fix controlWidth calculation

* add functional test to ensure panel resizing changes layout

* use all caps for consts, add more comments about where values came from

* replace sleeps in functional tests with retry

* use KuiFlexGroup with wrap option instead of manually calculating widths

* remove no longer used min width constants
@nreese nreese deleted the horizontal_layout branch February 13, 2018 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants