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

Update Saved Object edit form with new components. #9543

Conversation

cjcenizal
Copy link
Contributor

@cjcenizal cjcenizal commented Dec 17, 2016

CC @alt74 @uboness

I took some fields out of the below screenshots to fit everything on the screen.

Before

image

After

image

@cjcenizal cjcenizal added Team:Platform-Design Team Label for Kibana Design Team. Support the Analyze group of plugins. v5.2.0 v6.0.0 labels Dec 17, 2016
@cjcenizal cjcenizal force-pushed the improvement/componentize-saved-object-edit-view branch from 72fef58 to 171dbe0 Compare December 17, 2016 04:34
@w33ble w33ble self-assigned this Dec 19, 2016
<a
class="kuiButton kuiButton--basic kuiButton--iconText"
href="{{ link }}"
>
Copy link
Contributor

Choose a reason for hiding this comment

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

You made a comment about this format here. Where did this style come from? ie:

<tag
   attr="val"
>
content
</tag>

I see that it was added to the style guide, but it also seems to have been added by you. ;)

Copy link
Contributor Author

@cjcenizal cjcenizal Dec 19, 2016

Choose a reason for hiding this comment

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

Haha yeah that was me. I'll add further explanation to the style guide about it. I've found it to be useful for a few reasons...

Tag alignment

When I'm scanning markup, it's easier for me to discern the parent child relationship between the enclosing tags and the content when the tags share the same indentation, and the child is indented one level deeper. Conceptually, this makes sense to me too, since the enclosing tags become a parent node and the text content becomes a child node. So the markup mirrors the DOM a little more clearly.

Bracket alignment

When there are multiple attributes in the opening tag, having the closing bracket aligned to the same depth as the opening bracket helps me visually match them and group them. For example, I might scan and think content is an attribute if the closing bracket is on the same line:

<tag
  attr="val">
  content
</tag>

This might only make sense to me, but I also think of this way of indenting brackets as similar to the way you would indent the opening and closing braces and brackets in object and array definitions. They have the same indentation to form a visual alignment, which helps visually enclose their content:

const object = {
  'a': {
  },
  'b': [
    0,
    1,
    2,
  ],
};

Separation between tag and attributes

By putting the attributes on the same line it's easy for me to visually separate them from the tag. This is important because the tag defines the base identity of the element, but the attributes are used to customize it and define its role in the UI.

Easier attribute comparison

When there are a number of elements with similar, yet slightly different attributes, having each attribute on its own row makes it easier for me to scan, find the pattern, and discern differences.

<button
  class="kuiButton kuiButton--basic"
  ng-click="edit(service, item)"
  aria-label="Edit"
>
  <span
    aria-hidden="true"
    class="kuiButton__icon kuiIcon fa-pencil"
  ></span>
</button>

<button
  class="kuiButton kuiButton--basic"
  ng-click="open(item)"
  aria-label="View"
>
  <span
    aria-hidden="true"
    class="kuiButton__icon kuiIcon fa-eye"
  ></span>
</button>

In this example, I need to scan and check that:

  1. Both buttons follow the same general structure: they're both default icon buttons.
  2. Both buttons have aria-label attributes.
  3. The aria-label attribute is different for each and has the correct value.
  4. Both buttons contain icons.
  5. Both icons have aria-hidden="true" attributes.
  6. Each icon is a different (and correct) kind of icon.

This would be much harder for me to do if they were formatted like this:

<button class="kuiButton kuiButton--basic" ng-click="edit(service, item)" aria-label="Edit">
  <span aria-hidden="true" class="kuiButton__icon kuiIcon fa-pencil"></span>
</button>

<button class="kuiButton kuiButton--basic" ng-click="open(item)" aria-label="View">
  <span aria-hidden="true" class="kuiButton__icon kuiIcon fa-eye"></span>
</button>

I think the difficulty of scanning this kind of markup is that you have to scan right, jump to the next line, start at the left side, and continue. It's sort of like the reason we write things in list form -- because lists are easier to scan than long comma-separated sentences. Also, I think the shape of the opening tag becomes easier to identify. So I don't need to actually read and compare every attribute inside of it. Once it has a general shape, it's easier to see where the shape changes in the other opening tags that I'm comparing it against.

Copy link
Contributor

@BigFunger BigFunger Dec 22, 2016

Choose a reason for hiding this comment

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

I totally agree that the vertical listing of attributes makes sense, and 100% support that. I really don't like the floating > of the opening tag...

...Conceptually, this makes sense to me too, since the enclosing tags become a parent node and the text content becomes a child node.
For example, I might scan and think content is an attribute if the closing bracket is on the same line

I conceptualize it in the opposite way. This really only becomes an issue when a tag contains simple text as its content. In that case, I see the attributes of a tag and the contents of a tag to all describe what that tag is supposed to represent, and think it makes sense to have them all justified.

The > isn't a 'tag' it's part of the definition of the opening tag of the element.

This might only make sense to me, but I also think of this way of indenting brackets as similar to the way you would indent the opening and closing braces and brackets in object and array definitions.

Your pattern, if applied to object and array declarations, would be more akin to this. For clarity, I would not suggest this either.

const object = {
  'a':
  {
  },
  'b': 
  [
    0,
    1,
    2,
  ],
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A better example just occurred to me. I used to write a lot of Jade and that must be where I picked up this pattern. Here's how Jade (now known as Pug) structures its tags:

input(
  type='checkbox'
  name='agreement'
  checked
)

Can you see how this structure is much more analogous to the way I'm proposing? The tag is almost like a function, and the attributes are what gets passed into it. The brackets act to encapsulate the attributes... due to the way HTML works though, your opening bracket comes before the "function name" instead of after.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One last objective argument for the dangling bracket is that it's easier to add/remove/shuffle attributes. You won't need to mess with the closing bracket to make sure it's on the last attribute.

@cjcenizal cjcenizal force-pushed the improvement/componentize-saved-object-edit-view branch from 171dbe0 to 929a804 Compare December 20, 2016 05:12
@w33ble
Copy link
Contributor

w33ble commented Dec 20, 2016

I notice the background in the editor is now white, while the background for everything else is a light gray. Is this intentional? Are you planning to update all the other pages to match?

@cjcenizal
Copy link
Contributor Author

@w33ble Yep, we're going to update all of Kibana to have a white background.

@cjcenizal cjcenizal force-pushed the improvement/componentize-saved-object-edit-view branch 2 times, most recently from 6a8dd10 to d117b23 Compare December 21, 2016 20:09
@cjcenizal
Copy link
Contributor Author

I resolved some merge conflicts and force-pushed FYI.

@cjcenizal
Copy link
Contributor Author

This passes the functional tests locally.

@cjcenizal cjcenizal force-pushed the improvement/componentize-saved-object-edit-view branch from d117b23 to 6cc8be9 Compare December 22, 2016 02:00
@cjcenizal cjcenizal force-pushed the improvement/componentize-saved-object-edit-view branch from 6cc8be9 to 6d0cc00 Compare December 22, 2016 18:26
@BigFunger BigFunger self-assigned this Dec 22, 2016
@w33ble
Copy link
Contributor

w33ble commented Dec 22, 2016

Why the de-emphasis on the warning dialog? Users should, generally speaking, not be in this screen, so that broad warning is helpful.


screenshot 2016-12-22 13 38 54

This version was much more apparent. I immediately see that the text in that warning is important


screenshot 2016-12-22 13 36 29

Now, me being the non-reading user that I am, I don't even see the text at the top, or notice the tiny icon there. There's also no indication that the text under that little heading is a warning message of any kind. It seems like a regression.


Even just a small amount of contrast here would help tremendously (here, a background color and a small amount of vertical padding):

screenshot 2016-12-22 13 51 37

@w33ble
Copy link
Contributor

w33ble commented Dec 22, 2016

I guess the white on white conversation is off the table at this point... so aside from the regression on the warning dialog, this PR seems fine.

@cjcenizal
Copy link
Contributor Author

@w33ble Great catch, and thanks for the suggestion. I added a component called InfoPanel to the UI Framework to present content with this yellow background and updated the form with it:

image

export default createExample([{
title: 'Warning',
description: (
<p>Use this InfoPanel to warn the user against decisions they might regret.</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

What about warning them against decisions they will certainly regret? :trollface:

}

.kuiInfoPanel--warning {
background-color: #FFF6E4;
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you pulled the color from my screenshot. I'm no designer, and I know nothing about color theory, I just moved a slider until I found a color that looked good enough to me. I'm fine with leaving it this way, since I think it looks good enough, but just wanted to give you a little warning...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha thanks... I think it's good for now. We'll adjust later.

@w33ble
Copy link
Contributor

w33ble commented Dec 23, 2016

Still not a fan of all that white on white, but this PR LGTM! :shipit:

@BigFunger
Copy link
Contributor

I still don't like the HTML styling, but this is a stopgap PR anyway.

LGTM

@cjcenizal cjcenizal added blocked and removed blocked labels Dec 23, 2016
@cjcenizal cjcenizal merged commit d8af803 into elastic:master Dec 23, 2016
@cjcenizal cjcenizal deleted the improvement/componentize-saved-object-edit-view branch December 23, 2016 20:21
elastic-jasper added a commit that referenced this pull request Dec 23, 2016
Backports PR #9543

**Commit 1:**
Update Saved Object edit form with new components.

* Original sha: 6d0cc00
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-12-17T02:12:58Z

**Commit 2:**
Add InfoPanel. Use InfoPanel to present warning in Saved Object form.

* Original sha: bbb5c03
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-12-23T01:06:36Z
cjcenizal pushed a commit that referenced this pull request Dec 23, 2016
Backports PR #9543

**Commit 1:**
Update Saved Object edit form with new components.

* Original sha: 6d0cc00
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-12-17T02:12:58Z

**Commit 2:**
Add InfoPanel. Use InfoPanel to present warning in Saved Object form.

* Original sha: bbb5c03
* Authored by CJ Cenizal <cj@cenizal.com> on 2016-12-23T01:06:36Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Platform-Design Team Label for Kibana Design Team. Support the Analyze group of plugins. v5.2.0 v6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants