-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
fix #7194 Editor errors on Visualize are broken #7702
Conversation
Functionally looks good to me, but let's take this as an opportunity to clean up the css based on @cjcenizal's guide: #7364 |
@cjcenizal could you please review what i did so far before i continue ...
if i understood correctly i dont need to take bootstrap out now, we'll be doing this gradually ? (since quite a lot of styles in this file are bootstrap modifiers) please be aware that this is still work in progress, but i would fell better if i would know i am going to the right dirrection. |
@ppisljar You nailed the new naming convention! Thanks for doing this. I think this is great in this PR, but in the future I think it's better to should hold off on these kinds of "mass-renaming" changes for now, for a couple reasons...
So I think it's OK if we stick with the existing kebab-case naming convention for components that already exist in Kibana and only apply the new naming convention for new components (either created in Kibana or in the new Kibana UI Framework I'm working on). Instead of applying the new naming convention, I think more high-value changes to our CSS would be to reduce specificity (which has the added benefit of simplifying our styles). In this case, lines 11-35 of Also, you're right that the migration away from bootstrap will be gradual, so you don't need to worry about that here. |
@@ -1,6 +1,6 @@ | |||
<div class="vis-editor-agg-editor-advanced-toggle"> | |||
<div class="visEditorAgg__editor-advanced-toggle"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this should be visEditorAgg__editorAdvancedToggle
, but it really doesn't matter per my comment re mass name-changes.
I opened up the inspector and checked out how the styles on line 11-35 of I noticed a few interesting things:
So I untangled the nested selectors by creating a few unique classes, and using // _editor.less
.visEditor {
.flex-parent();
.btn-xs {
line-height: 1.3;
}
/* ... */
}
/**
* 1. TODO: Override bootstrap styles. Remove !important once we're rid of bootstrap.
*/
.visEditorSubNavLink {
padding: 4px 10px 5px 10px !important; /* 1 */
color: @kibanaGray2 !important; /* 1 */
&.is-vis-editor-sub-nav-link-selected {
border-bottom: 2px solid @kibanaGray2;
color: @kibanaGray1;
background-color: #f6f6f6;
&:before {
display: none;
}
&:hover {
background-color: transparent;
}
}
}
/**
* 1. TODO: Override bootstrap styles. Remove !important once we're rid of bootstrap.
*/
.visEditorSubNavLink--danger {
color: @vis-editor-navbar-error-state-color !important; /* 1 */
background-color: @vis-editor-navbar-error-state-bg;
&:hover {
background-color: darken(@vis-editor-navbar-error-state-bg, 12%) !important; /* 1 */
}
} <!-- sidebar.html -->
<nav class="navbar navbar-default subnav">
<div class="container-fluid">
<!-- tabs -->
<ul class="nav navbar-nav">
<li ng-show="sidebar.showData">
<a
class="navbar-link visEditorSubNavLink"
ng-class="{'is-vis-editor-sub-nav-link-selected': sidebar.section == 'data'}"
ng-click="sidebar.section='data'"
>
@Data
</a>
</li>
<li>
<a
class="navbar-link visEditorSubNavLink"
ng-class="{'is-vis-editor-sub-nav-link-selected': sidebar.section == 'options'}"
ng-click="sidebar.section='options'"
>
Options
</a>
</li>
</ul>
<!-- controls -->
<ul class="nav navbar-nav navbar-right">
<li ng-if="visualizeEditor.softErrorCount() > 0"
disabled
tooltip="{{ visualizeEditor.describeErrors() }}" tooltip-placement="bottom" tooltip-popup-delay="400" tooltip-append-to-body="1"
>
<a class="navbar-link visEditorSubNavLink visEditorSubNavLink--danger">
<i class="fa fa-warning"></i>
</a>
</li>
<li tooltip="Apply changes" tooltip-placement="bottom" tooltip-popup-delay="400" tooltip-append-to-body="1">
<button class="btn-success navbar-btn-link"
type="submit"
ng-disabled="!vis.dirty">
<i class="fa fa-play"></i>
</button>
</li>
<li tooltip="Discard changes" tooltip-placement="bottom" tooltip-popup-delay="400" tooltip-append-to-body="1">
<button class="btn-default navbar-btn-link"
ng-disabled="!vis.dirty"
ng-click="resetEditableVis()">
<i class="fa fa-close"></i>
</button>
</li>
</ul>
</div>
</nav> As an added bonus, this fixes the styles, which I believe are currently "broken" (because Bootstrap is winning the specificity wars against some of the current selectors, so they're not all taking effect): I can also make a PR into this branch if you want to see the diff more clearly. Just let me know. |
@cjcenizal ok i reverted back to the old naming convention and i put in your suggestions on how to reduce specificity. i also removed navbar-link class as it seemed its not needed anymore. please let me know if this is going into the right direction. |
@@ -1,5 +1,5 @@ | |||
<!-- header --> | |||
<div class="vis-editor-agg-header"> | |||
<div class="visEditorAggHeader"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to revert these class names back to the original snake-case versions in all of the markup too.
@ppisljar Left a couple comments! I can continue reviewing after they're addressed. |
sorry seems i messed up the commit ... i think it should be ok now. |
jenkins, test this |
<a class="navbar-link active" ng-click="sidebar.section='data'">Data</a> | ||
<a class="vis-editor-subnav-link" | ||
ng-class="{'is-vis-editor-sub-nav-link-selected': sidebar.section == 'data'}" | ||
ng-click="sidebar.section='data'">Data</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit, the attributes should all be on their own lines, the >
of the opening tag should be on its own line, and the text and closing tag should be on their own lines:
<a
class="vis-editor-subnav-link"
ng-class="{'is-vis-editor-sub-nav-link-selected': sidebar.section == 'data'}"
ng-click="sidebar.section='data'"
>
Data
</a>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm checking some of the other .html files and i cant find this anywhere (last > in a seperate line) ...
also my editor (webstorm) wont put > in line with <a (no indent) if i put it in a seperate line ....
would it be possible to configure .eseditorconfig and .eslint to follow this style ?
also could you update html style guide with this information:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Peter, the most recent version of the style guide exemplifies this in the examples. Should I update the descriptions to point this out more, or do you think this is enough?
This is a pretty recent change to the style guide. You can check out this PR for some context.
I'm using Sublime, so I'm not sure why WebStorm would be unhappy with that formatting... is this something you can look into fixing on your end? Let me know if you want to Zoom about this and tackle it together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks CJ, im not sure how i managed to open the old style guide :) i managed to get webstorm working with it. I updated whole sidebar.html to follow the new style guide, can you please check if it looks ok ?
i still wonder if it would be possible to make a precommit check to enforce this (like we do with eslint) ?
jenkins, test this |
class="vis-editor-subnav-link" | ||
g-class="{'is-vis-editor-sub-nav-link-selected': sidebar.section == 'data'}" | ||
g-click="sidebar.section='data'" | ||
>Data</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will be more maintainable if we separate the opening and closing tags from the content:
>
Data
</a>
I think this consistency will let us change the content, e.g. adding more text, adding new elements, without having to add and remove new lines depending on how much content there is. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait, I found a couple typos here... on lines 21 and 22, it looks like ng-class and ng-click got turned into g-class and g-click.
I just have 1 suggestion. Looks great overall! I agree that it would be great to get a linter to help us with these rules. I haven't been able to find one so far but I'll keep looking. |
LGTM! Just gotta make sure the tests pass. |
jenkins, test this |
fix elastic#7194 Editor errors on Visualize are broken Former-commit-id: c226848
`v94.1.0-backport.0` ⏩ `v94.2.1-backport.0` _[Questions? Please see our Kibana upgrade FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_ --- ## [`v94.2.1-backport.0`](https://github.com/elastic/eui/releases/v94.2.1-backport.0) **This is a backport release only intended for use by Kibana.** - Reverted the `EuiFlexGroup`/`EuiFlexItem` `component` prop feature due to Kibana typing issues ## [`v94.2.1`](https://github.com/elastic/eui/releases/v94.2.1) **Bug fixes** - Fixed an `EuiTabbedContent` edge case bug that occurred when updated with a completely different set of `tabs` ([#7713](elastic/eui#7713)) - Fixed the `@storybook/test` dependency to be listed in `devDependencies` and not `dependencies` ([#7719](elastic/eui#7719)) ## [`v94.2.0`](https://github.com/elastic/eui/releases/v94.2.0) - Updated `getDefaultEuiMarkdownPlugins()` to allow excluding the following plugins in addition to `tooltip`: ([#7676](elastic/eui#7676)) - `checkbox` - `linkValidator` - `lineBreaks` - `emoji` - Updated `EuiSelectable`'s `isPreFiltered` prop to allow passing a configuration object, which allows disabling search highlighting in addition to search filtering ([#7683](elastic/eui#7683)) - Updated `EuiFlexGroup` and `EuiFlexItem` prop types to support passing any valid React component type to the `component` prop and ensure proper type checking of the extra props forwarded to the `component`. ([#7688](elastic/eui#7688)) - Updated `EuiSearchBar` to allow the `@` special character in query string searches ([#7702](elastic/eui#7702)) - Added a new, optional `optionMatcher` prop to `EuiSelectable` and `EuiComboBox` allowing passing a custom option matcher function to these components and controlling option filtering for given search string ([#7709](elastic/eui#7709)) **Bug fixes** - Fixed an `EuiPageTemplate` bug where prop updates would not cascade down to child sections ([#7648](elastic/eui#7648)) - To cascade props down to the sidebar, `EuiPageTemplate` now explicitly requires using the `EuiPageTemplate.Sidebar` rather than `EuiPageSidebar` - Fixed `EuiFieldNumber`'s typing to accept an icon configuration shape ([#7666](elastic/eui#7666)) - Fixed `EuiFieldText` and `EuiFieldNumber` to render the correct paddings for icon shapes set to `side: 'right'` ([#7666](elastic/eui#7666)) - Fixed `EuiFieldText` and `EuiFieldNumber` to fully ignore `icon`/`prepend`/`append` when `controlOnly` is set to true ([#7666](elastic/eui#7666)) - Fixed `EuiColorPicker`'s input not setting the correct right padding for the number of icons displayed ([#7666](elastic/eui#7666)) - Visual fixes for `EuiRange`s with `showInput`: ([#7678](elastic/eui#7678)) - Longer `append`/`prepend` labels no longer cause a background bug - Inputs can no longer overwhelm the actual range in width - Fixed a visual text alignment regression in `EuiTableRowCell`s with the `row` header scope ([#7681](elastic/eui#7681)) - Fixed `toolTipProps` type on `EuiSuperUpdateButton` to use `Partial<EuiToolTipProps>` ([#7692](elastic/eui#7692)) - Fixes missing prop type for `popperProps` on `EuiDatePicker` ([#7694](elastic/eui#7694)) - Fixed a focus bug with `EuiDataGrid`s with `leadingControlColumns` when moving columns to the left/right ([#7701](elastic/eui#7701)) ([#7698](elastic/eui#7698)) - Fixed `EuiSuperDatePicker` to validate date string with respect of locale on `EuiAbsoluteTab`. ([#7705](elastic/eui#7705)) - Fixed a visual bug with `EuiSuperDatePicker`'s absolute tab on small mobile screens ([#7708](elastic/eui#7708)) - Fixed i18n of empty and loading state messages for the `FieldValueSelectionFilter` component ([#7718](elastic/eui#7718)) **Dependency updates** - Updated `@hello-pangea/dnd` to v16.6.0 ([#7599](elastic/eui#7599)) - Updated `remark-rehype` to v8.1.0 ([#7601](elastic/eui#7601)) **Accessibility** - Improved `EuiBasicTable` and `EuiInMemoryTable`'s selection checkboxes to have unique aria-labels per row ([#7672](elastic/eui#7672)) - Added `aria-valuetext` attributes to `EuiRange`s with tick labels for improved screen reader UX ([#7675](elastic/eui#7675)) - Updated `EuiAccordion` to keep focus on accordion trigger instead of moving to content on click/keypress ([#7696](elastic/eui#7696)) - Added `aria-disabled` attribute to `EuiHorizontalSteps` when status is "disabled" ([#7699](elastic/eui#7699)) --------- Co-authored-by: Tomasz Kajtoch <[email protected]>
`v93.6.0` ⏩ `v93.6.0-backport.0` --- ## [`v93.6.0-backport.0`](https://github.com/elastic/eui/releases/v93.6.0-backport.0) **This is a backport release only intended for use by Kibana.** - Updated `EuiSearchBar` to allow the `@` special character in query string searches ([#7702](elastic/eui#7702)) **Bug fixes** - Fixed a focus bug with `EuiDataGrid`s with `leadingControlColumns` when moving columns to the left/right ([#7701](elastic/eui#7701)) ([#7698](elastic/eui#7698)) Co-authored-by: Kibana Machine <[email protected]>
fix for #7194 - editor errors on visualize are broken
updated edtor.less file to show error icon in the same style as the buttons next to it.