-
Notifications
You must be signed in to change notification settings - Fork 356
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
Vertical navbar #5854
Vertical navbar #5854
Conversation
Adding a bit of context. Right now it still uses the same logic as current navigation. This PR changes migrates the haml layout to React and adds a new function that generates JSON fro which the menu is rendered. In future PR we will move all the show/hide, click/hover and any other logic to the react component. Currently that is handled via pf JS which is triggering these state changes based on css classes (not id or any other unique identifiers) I know that @epwinchell has some requests to change the current behavior. We would like to introduce them once we start moving the logic to React component. @epwinchell if you could create GH issue with the changes you would like to see that would be great. |
0: props => <TopLevel level={level} {...props} />, | ||
1: props => <SecondLevel level={level} {...props} />, | ||
2: props => <ThirdLevel level={level} {...props} />, | ||
})[level]; |
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 we should add a fallback component if somebody passes level value other than 0 - 3
const getLevelComponent = level => ({
0: props => <TopLevel level={level} {...props} />,
1: props => <SecondLevel level={level} {...props} />,
2: props => <ThirdLevel level={level} {...props} />,
})[level] || props => <ThirdLevel level={level} {...props} />;
This will always return ThirdLevel component if you gave the function any level that it does not cover.
items, | ||
level, | ||
}) => ( | ||
<li className={`list-group-item ${items.length > 0 && 'tertiary-nav-item-pf'}`} data-target={`#menu-${id}`}> |
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.
This will add false
to className if the condition is not met. We don't want that.
</div> | ||
<ul className="list-group"> | ||
{ | ||
items.map(props => <MenuItem key={props.id} level={level + 1} {...props} />) |
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.
Put this on single line please.
Marking this as "WIP" as we do not want it merged (even if it was finished) until the release is out. |
app/views/layouts/_header.html.haml
Outdated
@@ -15,7 +15,7 @@ | |||
%li.dropdown{"open" => "!hideDrawer"} | |||
%a{:class => "nav-item-iconic drawer-pf-trigger-icon", :title => "{{vm.notificationsIndicatorTooltip}}", "ng-click" => "vm.toggleNotificationsList()"} | |||
%span.fa.fa-bell | |||
%span{"ng-class" => "{'badge badge-pf-bordered': vm.newNotifications}"} | |||
%span{"ng-class" => "{'badge badge-pf-bordered': vm.newNotifications}"} |
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 don't think this file should be changed 😉
@miq-bot add_reviewer @epwinchell |
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.
Works great
@fhlavac Please rebase |
|
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.
Looks good. @martinpovolny i think you can merge this once the release is out. We will continue with next PR that will extract the logic from PF3. We will have to re do the top Nav too because its controlled by the same PF JS code.
Ok, @fhlavac : please un"WIP" the PR. @epwinchell : good to go? |
Is this new menu expected to support all the existing features? Specifically, I'm not seeing any code dealing with:
|
(This should really not be ignoring anything from => not ready yet IMO |
@himdel : I sort of expected something like that ;-) Can we somehow capture the functionality that you pointed out in some tests? Sounds to me like 3 pretty important concepts and all the tests are green. |
Well, link params provided the whole Though, since we're moving to react, a new snapshot test could cover this. |
@martinpovolny yes, reviewed/approved |
4c12d7e
to
a8df32e
Compare
|
45e559a
to
9dc4894
Compare
This adds non expanging markup for top-level items with no child items
The CSS can be simplified, the JSON conversion can be refactored, but in a future PR, I'm good with this. Clicked through the UI a little and it all worked, even the custom menu. |
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.
Confirming custom menus are working :) But now everything has an id, not only menu items. |
Checked commits fhlavac/manageiq-ui-classic@24e56b0~...4eb3f7d with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
Update:
|
Merging when green :) |
ssh, it's green 😉 |
require('jquery.hotkeys'); | ||
|
||
// all of patternfly js except for vertical navigation (patternfly-functions-vertical-nav.js) |
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.
so, this bit didn't really work,
because require('angular-patternfly')
requires the whole thing anyway.
Fixing in #6449,
and removing the call to setupVerticalNavigation
which no longer works without patternfly-functions-vertical-nav.js
.
Task
#5759
@Hyperkid123 @martinpovolny @epwinchell
fixes https://bugzilla.redhat.com/show_bug.cgi?id=1734661