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

UI for add/remove interface on network router #60

Merged
merged 1 commit into from
Jan 13, 2017

Conversation

sseago
Copy link
Contributor

@sseago sseago commented Jan 4, 2017

This commit adds UI code for adding and removing router interfaces.

BZ for this is:

https://bugzilla.redhat.com/show_bug.cgi?id=1394284

Euwe backport depends on merging ManageIQ/manageiq#13005

@sseago sseago force-pushed the router-interfaces-ui branch from 58ebed1 to 5838d94 Compare January 4, 2017 04:04
@sseago
Copy link
Contributor Author

sseago commented Jan 4, 2017

So whoever reviews this, regarding the rubocop output, are all of those hash-related comments in the haml files false positives? They don't seem to match well to the actual content, and the content here is very similar to other haml files that have succeeded in the past.

@mzazrivec mzazrivec self-assigned this Jan 4, 2017
@sseago sseago force-pushed the router-interfaces-ui branch from 5838d94 to e977e11 Compare January 4, 2017 15:19
@@ -41,6 +46,30 @@ ManageIQ.angular.app.controller('networkRouterFormController', ['$http', '$scope
miqService.miqAjaxButton(url, $scope.networkRouterModel, { complete: false });
};

$scope.addInterfaceClicked = function() {
miqService.sparkleOn();
var url = '/network_router/add_interface/' + networkRouterFormId + '?button=addInterface';
Copy link
Contributor

Choose a reason for hiding this comment

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

Why addInterface when the info is already contained in the path? This should be just:

var url = '/network_router/add_interface/' + networkRouterFormId + '?button=add';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mostly I was just following convention elsewhere for similar add/remove association functionality. I can change it to just 'add'. I need to verify that this won't cause any ambiguity with the normal create 'add' form, but from a quick glance I think it will be fine. I'll update and re-test to make sure it's working with the change, though.


$scope.removeInterfaceClicked = function() {
miqService.sparkleOn();
var url = '/network_router/remove_interface/' + networkRouterFormId + '?button=removeInterface';
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

%td{:align => 'right'}
#buttons_on
= render :partial => "layouts/angular/x_custom_form_buttons_angular",
:locals => {:button_label => N_("Add"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Not N_("Add"), that wouldn't work. You need to use _("Add") here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I just noticed that you made this same change last month to the code that I modeled this from -- I'll make the same change here.

%td{:align => 'right'}
#buttons_on
= render :partial => "layouts/angular/x_custom_form_buttons_angular",
:locals => {:button_label => N_("Remove"),
Copy link
Contributor

Choose a reason for hiding this comment

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

_("Remove")

@sseago sseago force-pushed the router-interfaces-ui branch from e977e11 to aa50b80 Compare January 5, 2017 15:19
@sseago
Copy link
Contributor Author

sseago commented Jan 5, 2017

@mzazrivec OK the suggested changes have been made and the PR updated.

#buttons_on
= render :partial => "layouts/angular/x_custom_form_buttons_angular",
:locals => {:button_label => _("Remove"),
:button_click => "removeInterfaceClicked()"}
Copy link
Contributor

Choose a reason for hiding this comment

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

@sseago I know this part with %table ... was copied from other places in our views,
but I fixed that recently -- we don't want to use table for styling here, so please fix
this similarly to what I did here:

https://github.com/ManageIQ/manageiq-ui-classic/pull/78/files#diff-64b58413d95ff03ddc058038d06cae9dR17

#buttons_on
= render :partial => "layouts/angular/x_custom_form_buttons_angular",
:locals => {:button_label => _("Add"),
:button_click => "addInterfaceClicked()"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as below.

@sseago sseago force-pushed the router-interfaces-ui branch from aa50b80 to 380be9f Compare January 7, 2017 04:44
var url = '/network_router/remove_interface/' + networkRouterFormId + '?button=cancel';
miqService.miqAjaxButton(url);
};

Copy link
Contributor

Choose a reason for hiding this comment

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

Where are the cancelAddInterfaceClicked() and cancelRemoveInterfaceClicked() routines called from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, it looks like this is not needed as a result of earlier refactoring. More specifically, this PR was based off the add/remove host functionality on HostAggregate, so this came from cancelAddHostClicked and cancelRemoveHostClicked, both of which were originally called in the UI form with manually-created buttons but should have been removed when I created x_custom_form_buttons_angular.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll remove these from network_router_form_controller, although I guess those two functions in host_aggregate_form_controller.js should also be removed (probably not as part of this PR, though)

@sseago sseago force-pushed the router-interfaces-ui branch from 380be9f to a4f83dd Compare January 9, 2017 14:24
@@ -0,0 +1,23 @@
%form#form_div{:name => "angularForm", 'ng-controller' => "networkRouterFormController"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add :novalidate => true to the list of options for the %form here, so that the browser won't render that
annoying "Please Select an Item from the List." popup when you click Cancel in the add form. We do use
that in other angular forms as well.

@@ -0,0 +1,23 @@
%form#form_div{:name => "angularForm", 'ng-controller' => "networkRouterFormController"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above with novalidate.

@sseago sseago force-pushed the router-interfaces-ui branch from a4f83dd to 23f6d91 Compare January 10, 2017 15:44
@sseago
Copy link
Contributor Author

sseago commented Jan 10, 2017

@mzazrivec OK the novalidate changes have been made.

@mzazrivec
Copy link
Contributor

Failing CI, because of backend changes, it seems.

This commit adds UI code for adding and removing router interfaces.

BZ for this is:

https://bugzilla.redhat.com/show_bug.cgi?id=1394284

Euwe backport depends on merging ManageIQ/manageiq#13005
@sseago sseago force-pushed the router-interfaces-ui branch from 23f6d91 to b91242e Compare January 11, 2017 15:07
@miq-bot
Copy link
Member

miq-bot commented Jan 11, 2017

Checked commit sseago@b91242e with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
5 files checked, 13 offenses detected

app/controllers/network_router_controller.rb

spec/controllers/network_router_controller_spec.rb

@sseago
Copy link
Contributor Author

sseago commented Jan 11, 2017

@mzazrivec Looks like a recent change in the main repo (method names changed) broke my spec test. Fixed and the test works locally now, so hopefully the build goes through now.

@tzumainn
Copy link
Contributor

@miq-bot add_label euwe/yes, blocker, bug

@mzazrivec mzazrivec added this to the Sprint 52 Ending Jan 16, 2017 milestone Jan 13, 2017
@mzazrivec mzazrivec merged commit bc890e0 into ManageIQ:master Jan 13, 2017
sseago added a commit to sseago/manageiq that referenced this pull request Jan 15, 2017
This commit adds UI code for adding and removing router interfaces.

BZ for this is:

https://bugzilla.redhat.com/show_bug.cgi?id=1394284

This is the Euwe-only backport PR corresponding to ManageIQ/manageiq-ui-classic#60
@simaishi
Copy link
Contributor

Euwe backport (to manageiq repo) details:

$ git log -1
commit 228f8c3069a446b8692351b3d8a0573179b5b01e
Author: Milan Zázrivec <[email protected]>
Date:   Fri Jan 13 09:19:53 2017 +0100

    Merge pull request #60 from sseago/router-interfaces-ui
    
    UI for add/remove interface on network router
    (cherry picked from commit bc890e0e029e4ea0e0b4cc109fe01bdb5b592086)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1413212

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.

5 participants