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

Adds WorkflowSelector #1

Merged
merged 7 commits into from
Aug 28, 2019
Merged

Adds WorkflowSelector #1

merged 7 commits into from
Aug 28, 2019

Conversation

schottra
Copy link
Contributor

This implements the mixed-behavior workflow selector for the Launch form.
The selector takes a list of default options to be shown if the selector is triggered. It also allows the user to type in a search term, which will be auto-completed once it passes 4 characters by calling a provided fetch function. Canceling the search by blurring or hitting escape will restore the current selection. The fetch function is only invoked after the user has ceased typing for 500ms.

Note: Most of the implementation of this component could be made generic. I'll do that once I need to use it again.

  • Implemented WorkflowSelector component.
  • Added stories fixture for WorkflowSelector.
  • Added a useDebouncedValue hook, which will debounce updates to a given value until the last change happened after a specified interval.
  • Added a common keyboard event handler for escape. My plan is to add/move more implementations of keyboard event handling into this common file, since they can get a little complicated.
  • Added some promise utilities to make it easier to provide a resolved/rejected promise after a certain timeout. This pattern is used in stories to demonstrate asynchronous behavior of components.
  • Added a helper to create an array of Workflow records with generated version strings.
  • Changed createMockFetchable to allow it to be used outside of tests (also useful in stories)

WorkflowSelector

@schottra schottra requested a review from mrmcduff August 27, 2019 21:34
Copy link

@mrmcduff mrmcduff left a comment

Choose a reason for hiding this comment

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

LGTM -- one question

@@ -0,0 +1,11 @@
export function resolveAfter<T>(waitMs: number, value: T): Promise<T> {

Choose a reason for hiding this comment

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

Are these functions meant only for use in storyboards? If so, just wanted to check if they should exist in a different folder, since I'd imagine /common as being for more shared tools.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My thought in putting them here was that they are generally useful utility functions. But they are currently only used in storybook code.

@schottra schottra merged commit b9d86c7 into launch Aug 28, 2019
@schottra schottra deleted the workflow-selection branch September 4, 2019 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants