-
Notifications
You must be signed in to change notification settings - Fork 896
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
Floating IPs provisioning UI #12097
Floating IPs provisioning UI #12097
Conversation
@miq-bot add_label euwe/yes |
<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush. |
@martinpovolny, @himdel, @dclarizio, can you please review? |
@gildub Can you please update the PR description with instructions where to find this functionality and a screenshot? Not seeing anything wrong in the code, except for a few |
Accessed through the left navigation - Networks > Floating IPs |
@himdel added the info, let me know if it helps! I've tested this functionality successfully, so I think we're only really looking for code sanity. |
|
||
floating_ips_to_delete = [] | ||
floating_ips.each do |s| | ||
floating_ip = FloatingIp.find_by_id(s) |
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 should be find(s)
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.
Done
def floating_ip_form_fields | ||
assert_privileges("floating_ip_edit") | ||
# TODO: find_by_id_filtered fails | ||
# floating_ip = find_by_id_filtered(FloatingIp, params[: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.
Any idea why it fails? Sounds like a security problem without it..
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.
Fixed
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.
You say fixed, but I still see the commented out code here..
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.
Btw seems like this is working fine in SecurityGroups so maybe it would now here too..?
So.. I'm a bit concerned about the address field being optional. In particular, @mansam has done changes to the UI in #12446 that depend on every floating ip having an So how is this supposed to work? Is that a valid expectation, do the addresses get filled out during the task or something like that, or do we need that field to be required? (Sorry, I know nothing..) |
Another thing, trying to save a new floating IP, I get an error that just says "Floating IP creation failed: Task start failed: ID [10000000088263]". That's ..very unhelpful :) (What I'm seeing in the log is..., so we do have an actual error message we could show..)
|
A floating IP address from the pool would be automatically assigned unless provided. I fixed the task error. |
options[:ems_id] = params[:ems_id] if params[:ems_id] && params[:ems_id] != 'new' | ||
options[:floating_ip_address] = params[:floating_ip_address] if params[:floating_ip_address] | ||
options[:cloud_network_id] = params[:cloud_network_id] if params[:cloud_network_id] | ||
options[:cloud_tenant_id] = params[:cloud_tenant_id] if params[:cloud_tenant_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 needs to be something like:
options[:cloud_tenant] = find_by_id_filtered(CloudTenant, params[:cloud_tenant_id]) if params[:cloud_tenant_id]
Because the model expects options to include :cloud_tenant, and not :cloud_tenant_id (I'm currently fixing this in other places)
@@ -14,4 +14,260 @@ def self.display_methods | |||
end | |||
|
|||
menu_section :net | |||
|
|||
def button |
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.
Can you cleanup this method a bit?
Please, make it a simple case statement and make sure that all the code is needed. E.g. you are setting the @refresh_div
variable and then testing it. Is there some code between the statements that might change that value?
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.
All the network UI and others (cloud_tenant, cloud_volumes) use the exact same approach.
So I'm keen to make a refactor on all of them using a consistent approach.
That said, I don't see the point of a case for replacing a if/elsif.
No idea about the @refresh_div, I haven't digged into it, what's for? What's the issue here?
Thanks
So.. another problem, similar to #12101 (comment)
|
I can see that issue. |
Ok, so from the UI endpoint, why when selecting the floating IP (whether from the cloud tenant or network port entry) we don't end up in the floating IP controller? A "normal" work flow would be: But obviously we are on a different road, where a controller (such as cloud tenant or network port, from the example above) is managing the views it's not designed for. Unless there is some logic in those button I'm missing. If that the case could you please direct me to the related documentation or at least some good practice example. Thanks |
@dclarizio, any pointers please? |
@gildub exactly, the solution is essentially to handle the button action in both places, redirecting to the right controller from the other one. Or sharing the code. For example, for the edit action, just redirecting to the right URL is usually enough (except you may need something like As @martinpovolny said, we're currently in the process of refactoring this so .. it has to work .. but doesn't have to be perfect right now :). |
It seems like this is an on-going discussion and the shared controller approach might not be the one to take. @martinpovolny also suggested to minimize the impact by not having some button appear on the cross controller. Do you have details about how to do that? |
Can't make them not appear in one controller but yes in another. But what you can do is not add the button to the list toolbar but only to the detail toolbar. So they would not be present in either of the lists, but only in the detail screen. And that is easy because those are separate toolbars (one is in plural, the other not) .. so you just not add it to the other one :).
Just to be sure, I was not proposing a shared controller, I was proposing exactly the opposite - redirecting those actions from the bad controller to the right one. (Similar to https://github.com/ManageIQ/manageiq/pull/12551/files#diff-68512128862e16616d93240055cb3a7dR77) |
The name of a floating ip is the floating address. |
@gildub thanks!, going to re-review right now :)
Yeaah, possibly only in the openstack land.. But I'm not blocking the PR for that, I guess that will change once you can edit other providers' floating ips too.. |
So, @gildub I think this one is ready to get merged 👍 But.. I'm seeing you marked a few Fixnum->Integers as fixed but haven't actually fixed them .. so I'm guessing you may have forgotten to push a commit here? |
<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush. |
Sorry, yes the Fixnum -> Integer commit slipped out, I've restored it and rebased. |
@gildub yeah, happens, thanks :) .. Just one more thing, can you please look at https://github.com/ManageIQ/manageiq/pull/12097/files#r93028604 (line 146 looks like it should be used instead of line 147). But if not for some reason, at least remove the commented out code please :). |
sorry I forgot about that one, it's fixed, using |
Adds controller actions using wait_for_task Adds new and edit views with javascript Depends on #11819
Checked commits https://github.com/gildub/manageiq/compare/41341833bf86da410f33ee171aa0fbabbfa73ebf~...26cac2f757d3ca96aacacc3a220815c531c176e9 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 app/controllers/floating_ip_controller.rb
|
@gildub Thanks, LGTM, the spec failures are probably all unrelated, I'll try to restart the tests once master is OK, and get this in before the UI split.. |
…ps-ui Floating IPs provisioning UI (cherry picked from commit 57b0a61) https://bugzilla.redhat.com/show_bug.cgi?id=1410588
Euwe backport details:
|
Adds controller actions using task queue
Adds new and edit views
https://bugzilla.redhat.com/show_bug.cgi?id=1394277