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

Feat: Autoplay pages in fullscreen #35981

Merged
merged 7 commits into from
May 21, 2019
Merged

Conversation

w33ble
Copy link
Contributor

@w33ble w33ble commented May 2, 2019

Summary

Part of #23061

Adds new settings and functionality that will auto-cycle through the pages in a workpad when in fullscreen mode, on a set interval.

Screenshot 2019-05-02 13 39 26

Pages will only rotate in fullscreen mode, and only automatically if the toggle is set. When leaving fullscreen mode, the playing stops, and it will resume when back in fullscreen mode, if the feature is still enabled (the play state is preserved).

May-02-2019 12-32-40-optimized

And while in fullscreen mode, users can use the p hotkey to toggle autoplay of pages.

How it works

  • Page cycling needs to be enabled. This can be done using the toggle in the settings interface, or by pressing p when in fullscreen mode. It is disabled by default.
  • The cycling interval also needs to be set. It is set by default, to 10 seconds, and can be changed in the settings interface.
  • Nothing happens unless you are in fullscreen mode. Once you enter fullscreen, if the above conditions are met, the pages will start "playing" based on the interval.
  • You can stop the playing by pressing p (to disable the feature), or by exiting fullscreen mode. The state is preserved, so if it's playing and you exit fullscreen, it will start playing again once you enter fullscreen again. Likewise, if you toggle it off and leave fullscreen mode, it will remain off when you go back into it.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@w33ble w33ble added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas review labels May 2, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-canvas

@w33ble w33ble marked this pull request as ready for review May 2, 2019 23:50
@w33ble w33ble requested review from a team as code owners May 2, 2019 23:50
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@alexfrancoeur alexfrancoeur requested a review from shaunmcgough May 3, 2019 14:26
@alexfrancoeur
Copy link

alexfrancoeur commented May 3, 2019

Works like a charm, there is one thing I noticed though. We're missing a tooltip on hover / key for these settings. As long as this is fixed, LGTM

image

image

I just added @shaunmcgough as a reviewer as well.

@w33ble
Copy link
Contributor Author

w33ble commented May 3, 2019

Added this, happy to change the text or whatever.

Screenshot 2019-05-03 10 49 00

@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link

@shaunmcgough shaunmcgough left a comment

Choose a reason for hiding this comment

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

Works as expected. Great work!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@ryankeairns
Copy link
Contributor

@w33ble I have a small PR coming with some minor layout touch up.

Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

This looks great! There are a couple small layout changes that I've placed in a PR:
w33ble#9

  • Keeps the custom interval forms aligned at bottom of panel
  • Converts the 'disable auto-refresh' from a link to an icon button and places next to the manual refresh icon button
  • Change the wording of the cycle section to more closely match the refresh seciton

The after state will now look like:
Screenshot 2019-05-06 10 15 35

Copy link
Contributor

@clintandrewhall clintandrewhall left a comment

Choose a reason for hiding this comment

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

Nice... easy to follow.

As a team, we've got to got to get into the habit of 1/ writing new code in Typescript, 2/ ensuring our components are not monolithic and 3/ backing our components with stories (which automatically create tests). I would strongly prefer you commit this with those considerations in mind.

From the look of things, this is a prime candidate for these priorities... the types are simple, the stories should be easy to write, and the strong types will help detect any bugs or assumptions in the logic.

refreshInput = null;
return (
<div>
<EuiFlexGroup alignItems="center" justifyContent="spaceAround" gutterSize="xs">
Copy link
Contributor

Choose a reason for hiding this comment

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

This component has a ton of moving parts and a lot of markup. I'd like to see this component broken up into its disparate parts as separate components with independent stories/snapshots... and Typescript'd. This component in particular should be fairly straightforward.

import { timeDurationString } from '../../../lib/time_duration';
import { CustomInterval } from './custom_interval';

const ListGroup = ({ children }) => <ul style={{ listStyle: 'none', margin: 0 }}>{[children]}</ul>;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's interesting you have RefreshItem in scope and this as global. I'd relocate the other here to avoid re-renders.

Copy link
Contributor Author

@w33ble w33ble May 20, 2019

Choose a reason for hiding this comment

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

RefreshItem uses a prop. I could hoist it via a partial, but either way the location of the helper shouldn't affect re-renders as far as I know. What am I missing?

<EuiFlexGrid gutterSize="s" columns={2}>
<EuiFlexItem>
<ListGroup>
<RefreshItem duration="5000" label="5 seconds" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: make this functional, e.g. create a number[] constant and write a function that takes a duration and produces the item with the appropriate label. That will make these ListGroups more terse, and allows us to add/remove durations at will.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand how you're suggesting I change this.

@crob611
Copy link
Contributor

crob611 commented May 10, 2019

Noticed this weird interaction that I don't think is the intended result. When you select a cycle interval, the Refresh Control receives focus and it's tool tip appears. Same thing also happens when you click "Disable Auto Refresh"

I poked around for a minute and couldn't seem to figure out what's causing it to receive the focus. Perhaps it's something in Eui that's making it happen.

May-10-2019 14-09-11

@w33ble
Copy link
Contributor Author

w33ble commented May 20, 2019

@crob611 that is weird, and certainly not intended. I see it too... but I don't see any code that controls focus, so I suspect this is either EUI weirdness or maybe there's some more component wrapping I need to add. @ryankeairns you have any idea why this button focusing happens?

@w33ble
Copy link
Contributor Author

w33ble commented May 20, 2019

@ryankeairns merged (or rather, cherry-picked) your changes. Mind taking another look?

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@w33ble w33ble requested a review from ryankeairns May 20, 2019 20:54
Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

👍 LGTM. Works as described, design changes pulled in. Thanks!

@w33ble w33ble merged commit 917ece2 into elastic:master May 21, 2019
@alexfrancoeur
Copy link

alexfrancoeur commented May 21, 2019

YESSSS 🎉 🎉 🎉 🎉 🎉 🎉 🎉 nice work @w33ble !!! :alex_approved:

@alexfrancoeur alexfrancoeur mentioned this pull request May 22, 2019
3 tasks
w33ble added a commit to w33ble/kibana that referenced this pull request May 22, 2019
* feat: add autoplay redux boilerplate

WIP auto-play settings

* feat: add page cycle settings

* feat: add cycle toggle hotkey

* chore: add tooltip text to settings icon

* settings layout

* fix: handle invalid input for custom interval

* chore: address nit
w33ble added a commit that referenced this pull request May 22, 2019
* feat: add autoplay redux boilerplate

WIP auto-play settings

* feat: add page cycle settings

* feat: add cycle toggle hotkey

* chore: add tooltip text to settings icon

* settings layout

* fix: handle invalid input for custom interval

* chore: address nit
w33ble added a commit to w33ble/kibana that referenced this pull request May 28, 2019
* feat: add autoplay redux boilerplate

WIP auto-play settings

* feat: add page cycle settings

* feat: add cycle toggle hotkey

* chore: add tooltip text to settings icon

* settings layout

* fix: handle invalid input for custom interval

* chore: address nit
w33ble added a commit that referenced this pull request May 28, 2019
* feat: add autoplay redux boilerplate

WIP auto-play settings

* feat: add page cycle settings

* feat: add cycle toggle hotkey

* chore: add tooltip text to settings icon

* settings layout

* fix: handle invalid input for custom interval

* chore: address nit
@w33ble
Copy link
Contributor Author

w33ble commented May 28, 2019

7.2: 4a2f90f
7.x: 3b69399

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:enhancement review Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.2.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants