Skip to content

Conversation

karelhala
Copy link
Contributor

@karelhala karelhala commented Jul 12, 2016

As we were talking @martinpovolny here is approach of angular's toolbar.

No need to change anything in current ui or ruby backend. Every toolbar generation in app/views/lauouts/_content.html.haml contains generating of toolbar via javascript.
Settings is generated in render phase to JSON (this way we don't have to add any context variables when fetching toolbar object). However we should switch to AJAX later down the line so we can have dynamic toolbars (will be needed once we will move to ui-router since rendering of htmls will no longer be part of ruby).

Removed jquery click function, because it did not bound to toolbar properly every time (.click function does not check if any new elements are added), but rather used on-click in angular world and call miqToolbarOnClick(event) of miq_application.js from angular.

We had to use custom generated toolbars from hawkular-ui-components because we have need for custom html passed along side with selectboxes and buttons. So any changes to look and feel should be done in ui-components (leader of this package is @mtho11 so contact him if new version is needed).

selection_045

  • add tests
  • make a way of how to bind js function to buttons

@karelhala
Copy link
Contributor Author

@miq-bot add_label wip ui

@miq-bot
Copy link
Member

miq-bot commented Jul 12, 2016

@karelhala Cannot apply the following label because they are not recognized: wip ui

@karelhala
Copy link
Contributor Author

@miq-bot add_label wip, ui

@miq-bot
Copy link
Member

miq-bot commented Jul 14, 2016

@karelhala Cannot apply the following label because they are not recognized: wip ui

@martinpovolny
Copy link
Member

martinpovolny commented Jul 14, 2016

The general goal here is to use observables and observers to communicate between toolbars, GTL lists and other components.

One example of that communication is the enabling/disabling of buttons based on selection in the GTL lists.

Another example is the changing of the layout of the GTL component in reaction on clicking the view toolbar buttons.

Sure, there are more to come.

The toolbars will be downloaded in JSON by the client or send as part of JSON messages throught the ExplorerPresenter and similar and processed by ManageIQ.explorer or simillar.

@miq-bot
Copy link
Member

miq-bot commented Jul 15, 2016

<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush.

Copy link
Member

Choose a reason for hiding this comment

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

collect returns a list, no need to do push

Copy link
Member

Choose a reason for hiding this comment

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

gtl

@miq-bot
Copy link
Member

miq-bot commented Jul 20, 2016

<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush.

@karelhala karelhala force-pushed the toolbarAngular branch 3 times, most recently from c681a5b to 38fb6c2 Compare July 25, 2016 16:32
@karelhala
Copy link
Contributor Author

@martinpovolny I dug deeply and found that it's not possible to have multiple ng-app elements on page, but we don't have to rely only on default angular's bootstrap mechanism as described in docs ngApp we can use angular.bootstrap. However there is warning that angular team does not test this and we should pay attention when using manual bootstrapping Things to keep in mind. But I tried it and clicked trough couple of pages in MiQ and it worked good (even with ng-app element on page).

So I think it's good to go, we can test it and see if anything gets broken. I believe I have changed all toolbars to use = render :partial => "layouts/angular/toolbar" so we can give it a try and see if anything got broken. If not we can merge it.

@himdel
Copy link
Contributor

himdel commented Jul 26, 2016

@karelhala Kinda expected that ng-app thing, I'm thinking maybe we should replace all those ng-app with angular.bootstrap and reserve ng-app only for that eventual whole-page app (adding to my list :)).

@abonas
Copy link
Member

abonas commented Jul 26, 2016

is it safe to take the direction which is declared as untested by Angular dev team?

@himdel
Copy link
Contributor

himdel commented Jul 26, 2016

@abonas Not much choice, the alternative would involve even less tested approaches, until we can get rid of RJS. (Would probably need to pass every replace_partial through $compile, ..)

@karelhala karelhala force-pushed the toolbarAngular branch 2 times, most recently from 63d9703 to 947817c Compare July 27, 2016 10:58
@karelhala
Copy link
Contributor Author

Okay clicked trough couple of pages (topology, dashboard, normal gtl pages, detail pages, etc.) and it seems good to go. However it would be nice if someone else tried it (I don't know MiQ that well and that deep as you guys).

So removing WIP and you can review the code.

@karelhala
Copy link
Contributor Author

@miq-bot remove_label wip

@karelhala karelhala changed the title [WIP] Replace ruby generated toolbar with angular's Replace ruby generated toolbar with angular's Jul 27, 2016
@miq-bot miq-bot removed the wip label Jul 27, 2016
when explorer got refreshed toolbar didn't reacted properly to this. We have to send JSON object instead of HTML string and update toolbar based on this object.

When in compare mode, we want to see two state buttons, similiar behaving as buttons.
dashboard toolbar is secified in custom html file, so we have to use render partial and this html string insert to JSON response so we can use angular's toolbars
when switching views in explorer ajax call instead of pure redirect needs to be called.
Images in toolbar lists are fetched from ruby and inserted to JSON object

Remove nested toolbar-pf-actions from dashboard
Add missing property to test case for toolbar builder
use different image_path to determine image_url
@karelhala
Copy link
Contributor Author

Updated bower.json to use newest version of ui-components. If no-one has any other complaints it's good to go from my side.

@miq-bot
Copy link
Member

miq-bot commented Aug 22, 2016

Checked commits karelhala/manageiq@e416daa~...e448d6e with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
9 files checked, 0 offenses detected
Everything looks good. ⭐

@epwinchell
Copy link
Contributor

@dclarizio Tested. Looks good.

@dclarizio dclarizio merged commit 17f79d0 into ManageIQ:master Aug 22, 2016
@dclarizio dclarizio added this to the Sprint 45 Ending Aug 22, 2016 milestone Aug 22, 2016
skateman pushed a commit to skateman/manageiq that referenced this pull request Aug 30, 2016
we keep the toolbar wrapping margin fix, and remove the resulting double margin by forcing toolbar-pf-actions' bottom margin to 0

.. and remove duplicate css introduced in ManageIQ#9753
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants