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

Deduplicate tree building. #2059

Merged
merged 12 commits into from Oct 10, 2017
Merged

Conversation

martinpovolny
Copy link
Member

deduplicate tree building, unifying some differences

next step should be removing all the build_*_tree methods and calling the TreeBuilder subclass directly

@martinpovolny martinpovolny force-pushed the tree_building_dedup branch 3 times, most recently from 4999cdd to 7f5b293 Compare August 31, 2017 14:52
@martinpovolny martinpovolny changed the title Deduplicate tree building. [WIPDeduplicate tree building. Aug 31, 2017
@martinpovolny martinpovolny changed the title [WIPDeduplicate tree building. [WIP] Deduplicate tree building. Aug 31, 2017
@martinpovolny martinpovolny force-pushed the tree_building_dedup branch 4 times, most recently from a65f256 to b601e16 Compare September 5, 2017 10:49
@miq-bot
Copy link
Member

miq-bot commented Sep 8, 2017

This pull request is not mergeable. Please rebase and repush.

@martinpovolny
Copy link
Member Author

ping @skateman: just rebased with your changes

@martinpovolny martinpovolny changed the title [WIP] Deduplicate tree building. Deduplicate tree building. Sep 19, 2017
@martinpovolny martinpovolny removed the wip label Sep 19, 2017

def try_build_tree(tree_symbol)
method_name = "build_#{tree_symbol}_tree"
return unless respond_to?(method_name, true)
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little bit afraid that someone might try to remove the build_*_tree methods as they might seem unused after a grepping. Maybe it's over-engineering, but I'd rather keep a list of these methods here and check against. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well I prefer not. I'd like to unify it a bit further and then remove the build_*tree methods calling directly the tree builder.

There's no value and little information in the build_*tree methods

Copy link
Member

Choose a reason for hiding this comment

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

Good enough for me 👍

@skateman
Copy link
Member

@martinpovolny try to add a new catalog item, it will fail with:

F, [2017-09-20T08:14:21.326513 #1897] FATAL -- : Error caught: [ArgumentError] wrong number of arguments (given 1, expected 0)
/home/skateman/Repositories/ManageIQ/manageiq-ui-classic/app/controllers/catalog_controller.rb:2108:in `build_svccat_tree'
/home/skateman/Repositories/ManageIQ/manageiq-ui-classic/app/controllers/application_controller/explorer.rb:15:in `call'
/home/skateman/Repositories/ManageIQ/manageiq-ui-classic/app/controllers/application_controller/explorer.rb:15:in `try_build_tree'
/home/skateman/Repositories/ManageIQ/manageiq-ui-classic/app/controllers/application_controller/explorer.rb:8:in `block in build_replaced_trees'
/home/skateman/Repositories/ManageIQ/manageiq-ui-classic/app/controllers/application_controller/explorer.rb:8:in `collect'
/home/skateman/Repositories/ManageIQ/manageiq-ui-classic/app/controllers/application_controller/explorer.rb:8:in `build_replaced_trees'
/home/skateman/Repositories/ManageIQ/manageiq-ui-classic/app/controllers/catalog_controller.rb:1929:in `replace_right_cell'
/home/skateman/Repositories/ManageIQ/manageiq-ui-classic/app/controllers/catalog_controller.rb:955:in `atomic_req_submit'
/home/skateman/Repositories/ManageIQ/manageiq-ui-classic/app/controllers/catalog_controller.rb:95:in `atomic_st_edit'
/home/skateman/Repositories/ManageIQ/manageiq-ui-classic/app/controllers/catalog_controller.rb:74:in `servicetemplate_edit'

I think you forgot to add the optional argument for some of these build_XY_tree methods.

@martinpovolny
Copy link
Member Author

martinpovolny commented Sep 20, 2017

Going to add a spec for that and then fix it... Thx, @skateman !

@martinpovolny martinpovolny force-pushed the tree_building_dedup branch 4 times, most recently from 416b048 to 9f9c89b Compare September 27, 2017 10:47
@skateman
Copy link
Member

@martinpovolny it seems like the tree isn't reloading at all. I opened a catalog item and tried to remove using the toolbar menu, but the tree has not been reloaded and it still displays the removed node.

@martinpovolny martinpovolny force-pushed the tree_building_dedup branch 2 times, most recently from 5ab1f1f to bff0d2f Compare October 3, 2017 14:39
@martinpovolny martinpovolny changed the title [WIP] Deduplicate tree building. Deduplicate tree building. Oct 3, 2017
@martinpovolny martinpovolny removed the wip label Oct 3, 2017
@martinpovolny
Copy link
Member Author

I am not going to fix the CC issue.

  1. It's not a new one
  2. The code is question is going away with the new dialog editor

@skateman
Copy link
Member

skateman commented Oct 5, 2017

  • If you try to add/copy a chargeback rate the action fails
  • If you add/delete something from the RBAC tree, it doesn't reload

@martinpovolny
Copy link
Member Author

@skateman : I have fixed the fist problem + added specs.

@martinpovolny
Copy link
Member Author

@skateman : can you be more specific about the RBAC tree problem? I have created an user w/o any issues. What are you doing? Do you really mean the tree of users, groups and roles, when you say "RBAC tree"?

@martinpovolny
Copy link
Member Author

@skateman: on RBAC tree: The tree is reloading on add/remove user. After excensive testing my working hypotesis is that the initial state of the tree is our of sync between client and server.

The server thinks that Users are not expanded and Groups + Roles are. The client has Users and Groups expanded and Roles collapsed.

So the update does not bring the newly created data to the client. Thus it seems the tree did not rebuild but it did.

If you click around expand/collapse, things get in sync and everything works. So the problem you are seeing can be seen the first time you get there. Login and go directly to adding or removing an user.

Seems unrelated. I'll retest on master. I have found more bugs in that area :-(

@martinpovolny
Copy link
Member Author

martinpovolny commented Oct 9, 2017

The tree unsync issue is a heisenbug. Now I have everything just fine on master or my branch. Don't know what are the conditions for getting the tree out of sync. Might have to do with some reloading and restarting servers while switching branches. Cannot see how it could be related to my changes. I am only changing how the tree building is called and that works.

@miq-bot
Copy link
Member

miq-bot commented Oct 9, 2017

Checked commits martinpovolny/manageiq-ui-classic@bb585ab~...7e9e929 with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0
33 files checked, 0 offenses detected
Everything looks fine. 👍

@martinpovolny
Copy link
Member Author

I just recreated the issue on master when adding a Role. Thus confirming it's not related to this PR.

Copy link
Member

@skateman skateman left a comment

Choose a reason for hiding this comment

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

LGTM

@mzazrivec mzazrivec added this to the Sprint 71 Ending Oct 16, 2017 milestone Oct 10, 2017
@mzazrivec mzazrivec merged commit 6140a02 into ManageIQ:master Oct 10, 2017
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.

None yet

5 participants