-
Notifications
You must be signed in to change notification settings - Fork 898
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
miq_policy/_policy_folders.html.haml is bogus #9483
Comments
@martinpovolny please reply to @cben's questions and suggest a path forward that is in line with our refactoring strategy. |
Thanks, this helps me proceed. Higher-level questionThis view (and friends e.g. _condition_folders) renders into the right side essentially the same info as the controllers & tree_builder render into the explorer. Are there plans to share code between the 2 sides, for simple list-the-children views? |
@cben : Feel free to cleanup the view. There are many to be cleaned up. I can give you a few points on refactoring:
|
Notes on the refactoring needed here: There should be no need for the There should be a decorator available (or new one created) to get the image_path. |
https://github.com/ManageIQ/manageiq/blob/master/app/views/miq_policy/_policy_folders.html.haml
@miq-bot add_label control, ui, technical debt
- The incoming `@folders` array is either `["Compliance", "Control"]` at root level or e.g. `["Host Compliance", "Vm Compliance", "Container Image Compliance"]` at 2nd level. - Root level is detected by literally checking for `%w(Compliance Control)`. In that case we do needless `.split.first` on the single-word string, and call it `model_name` despite not being a model. - We need that for the icon `"100/#{model_name.underscore}.png"`. - At 2nd level, we reconstruct the model_name by from the user-readable string carefully crafted in [miq_policy_controller](https://github.com/ManageIQ/manageiq/blob/69f9b91b700f46f214b7f94ce02f9308fd3f9faf/app/controllers/miq_policy_controller.rb#L957-L959) using `model.name.titleize`: we lope off the last word which we know to be "Control" or "Compliance", join the model name back, and lowerCamelize. - Then we do a bogus ui_lookup attempt. See, in this branch `model_name` _is_ a model name (though not UpperCamelized), but instead we lookup `f` — for any f as long as `f == "Vm"`, which it never is. - However the `_("%s Policies")` part works eg. "»Container Image Compliance ポリシー«".I'll be happy to rewrite this (split into 2 views, pass structured
@folders
).But there is some interaction with #8815 which is darga/yes.
=> Will it be OK to backport this refactoring too?
The text was updated successfully, but these errors were encountered: