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

[Controls] Control Group Embeddable and Management Experience #111065

Merged
merged 33 commits into from
Oct 5, 2021

Conversation

ThomThomson
Copy link
Contributor

@ThomThomson ThomThomson commented Sep 2, 2021

Closes #101191
Closes #108296
Closes #112838
Closes #108292
Closes #112841

Summary

Replacement for #109138.

This PR introduces a Control Group embeddable to the input controls storybook. This embeddable is a container similar to the Dashboard Container, and has the ability to:

  • Add Controls - complete with an inline embeddable creating workflow.
  • Edit Controls - using the same workflow as above.
  • Rearrange Controls - using DndKit to allow for smooth dragging over multiple lines, keyboard controls, and dragging with custom widths.
  • Set widths of all Controls
  • Reactively switch the design of controls from One Line to Two Line

Gifs covering important features incoming once @andreadelrio is finished making it look nicer!

Todo next:

@ThomThomson ThomThomson force-pushed the controls/dndKitDragDrop branch from 3085e6b to cdb50c1 Compare September 21, 2021 22:07
@ThomThomson ThomThomson marked this pull request as ready for review September 22, 2021 14:50
@ThomThomson ThomThomson requested review from a team as code owners September 22, 2021 14:50
@ThomThomson ThomThomson changed the title [Controls] Control Frame Layout Management Experience V2 [Controls] Control Group Embeddable and Management Experience Sep 22, 2021
@mdefazio
Copy link
Contributor

I think some of the PR description ghosted on you.

@ThomThomson ThomThomson added Feature:Dashboard Dashboard related features Feature:Input Control Input controls visualization impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:x-large Extra Large Level of Effort Project:Controls release_note:skip Skip the PR/issue when compiling release notes labels Sep 22, 2021
Copy link
Contributor

@poffdeluxe poffdeluxe left a comment

Choose a reason for hiding this comment

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

Overall looks pretty good! Just a few nits

@@ -58,22 +61,19 @@ export const OPTIONS_LIST_CONTROL = 'optionsListControl';
export interface OptionsListEmbeddableInput extends InputControlInput {
field: string;
indexPattern: string;
multiSelect: boolean;
singleSelect?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

just curious: what's the reason for this flip?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is flipped because multiselect defaults to true. Making an optional singleSelect entry in the input is the easiest way to handle that because undefined is falsy. If you want multiselect you can just pass nothing!

It's the perfect time right for renaming input keys, because once this is released we'd have to write migrations for changes like this.

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.

A couple of items to consider in addition to the comments in the code:

Mismatched border-radius

Screen Shot 2021-09-29 at 1 46 00 PM

Consider sorting selected items to the top

If this list is very long, it would be a pain to find all the currently selected values. Alternatively, a way to unselect all would be nice (this sounds like an EUI request).
Screen Shot 2021-09-29 at 2 58 41 PM

$smallControl: $euiSize * 14;
$mediumControl: $euiSize * 25;
$largeControl: $euiSize * 50;
$controlMinWidth: $euiSize * 14;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to just set $controlMinWidth: $smallControl since they are the same value?

@ryankeairns
Copy link
Contributor

Also, FWIW, the dragging feels more natural than it did last time I tried this out. The gray bordered box/placeholder also reminds me of the size of the thing I'm about to drop which seems like a decent tradeoff (and better than the empty space from before).

@andreadelrio
Copy link
Contributor

Mismatched border-radius

Screen Shot 2021-09-29 at 1 46 00 PM

This is happening because we're doing $euiBorderRadius which in K8 is 6px and for some reason it seems like Storybook is using the K7 value for this variable which is 4px. We decided to leave it in thinking that once this makes its way to real Kibana it will get fixed (i.e. the right value for K8 will get used). So instead of hard coding the value we left the variable. @ThomThomson can you confirm?

@andreadelrio
Copy link
Contributor

andreadelrio commented Sep 29, 2021

Regarding the Add control form, DeFazio brought up a good point which I think is worth considering. What if we reorder the fields so that Title comes after Index pattern and Field and we autofill Title with the value for Field. Users would still be free to edit that Title but if they're happy with the default it would save them time and be convenient.

image 47

Also, do we want to adjust the title of this flyout so that it is Add control for the creation flow and Manage/Edit control for the edit flow?

@ThomThomson
Copy link
Contributor Author

@ryankeairns for the issue of sorting selected items to the top, I think we need to holistically consider it for the Options List. I have created a follow up issue, which I will address in another PR. The issue includes some of the items we talked about before with selections, and can use your input!

@andreadelrio:
Updating the titles of the management flyouts sounds like a great idea! In the future, we should also consider including the type of embeddable which is being edited, since this is set up to be able to handle multiple different types. So it would eventually read Create / Manage Options List Control

Moving the title to the bottom is a great idea UX-wise. Unfortunately, it will take some engineering effort, since the title is part of the generic editor, and the field name is selected in the editor for the specific input control type. That said, the UX benefits far outweigh the challenges, so it would be an ideal candidate for a follow-up PR.

@ThomThomson
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

merge conflict between base and head

@ThomThomson
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@vadimkibana vadimkibana left a comment

Choose a reason for hiding this comment

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

AppServices change LGTM.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
presentationUtil 119 121 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
presentationUtil 43.1KB 43.1KB +6.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
embeddable 70.6KB 70.6KB +18.0B
presentationUtil 43.3KB 43.6KB +351.0B
total +369.0B
Unknown metric groups

References to deprecated APIs

id before after diff
presentationUtil 13 4 -9

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@ryankeairns ryankeairns self-requested a review October 5, 2021 16:30
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.

Thanks for the changes and for creating follow-up issues.

The border radius still looks a little off but, as Andrea and I discussed, we can do some final polish work once we see this within the Kibana context.

@ThomThomson ThomThomson merged commit ac39f94 into elastic:master Oct 5, 2021
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Oct 7, 2021
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 111065 or prevent reminders by adding the backport:skip label.

@ThomThomson ThomThomson added the backport:skip This commit does not require backporting label Oct 7, 2021
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Dashboard Dashboard related features Feature:Embedding Embedding content via iFrame Feature:Input Control Input controls visualization impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:x-large Extra Large Level of Effort Project:Controls release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.0.0
Projects
None yet
8 participants