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

Fix multi-tab endpoint credential validation by passing the right credential type when user hits "Enter" #4768

Conversation

AparnaKarve
Copy link
Contributor

@AparnaKarve AparnaKarve commented Oct 12, 2018

In a multi-tab form, when user hits the Enter key (and not the "Validate" button), the credential type passed down to the backend is always default, which leads to incorrect validation if the active tab is not "default", as described in the BZ

To fix this, we need to always refer to the currentTab value that accurately gives us the actual credential type for the currently active tab.

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

`$scope.currentTab` will always contain the correct tab value (prefix value for the endpoint validation)

https://bugzilla.redhat.com/show_bug.cgi?id=1609735
@AparnaKarve AparnaKarve force-pushed the bz1609735_handle_enterkey_in_multitab_endpoint branch from f766bc1 to 8c7cd8f Compare October 12, 2018 19:35
@AparnaKarve AparnaKarve force-pushed the bz1609735_handle_enterkey_in_multitab_endpoint branch from 8c7cd8f to f9109f7 Compare October 12, 2018 21:16
@miq-bot
Copy link
Member

miq-bot commented Oct 12, 2018

Checked commits AparnaKarve/manageiq-ui-classic@6a332cf~...f9109f7 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
0 files checked, 0 offenses detected
Everything looks fine. ⭐

@h-kataria
Copy link
Contributor

verified fix in UI, good to go once green.

@h-kataria h-kataria self-assigned this Oct 13, 2018
@h-kataria h-kataria added this to the Sprint 97 Ending Oct 22, 2018 milestone Oct 13, 2018
@h-kataria h-kataria merged commit 0b54e1d into ManageIQ:master Oct 13, 2018
simaishi pushed a commit that referenced this pull request Oct 15, 2018
…n_multitab_endpoint

Fix multi-tab endpoint credential validation by passing the right credential type when user hits "Enter"

(cherry picked from commit 0b54e1d)

https://bugzilla.redhat.com/show_bug.cgi?id=1609735
@simaishi
Copy link
Contributor

Hammer backport details:

$ git log -1
commit 88ce7f0128e15ac63bfcad28324d41ea1d6a999e
Author: Harpreet Kataria <[email protected]>
Date:   Sat Oct 13 09:46:42 2018 -0400

    Merge pull request #4768 from AparnaKarve/bz1609735_handle_enterkey_in_multitab_endpoint
    
    Fix multi-tab endpoint credential validation by passing the right credential type when user hits "Enter"
    
    (cherry picked from commit 0b54e1d530c18ddbaedeaa581e99e52619438ff8)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1609735

@AparnaKarve AparnaKarve deleted the bz1609735_handle_enterkey_in_multitab_endpoint branch October 15, 2018 14:03
@@ -699,7 +698,7 @@ ManageIQ.angular.app.controller('emsCommonFormController', ['$http', '$scope', '
};

$scope.updateAuthStatus = function(updatedValue) {
$scope.angularForm[$scope.authType + '_auth_status'].$setViewValue(updatedValue);
$scope.angularForm[$scope.currentTab + '_auth_status'].$setViewValue(updatedValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

@AparnaKarve that change causes the 'virtualization' tab of the Container provider to fail.
$scope.authType returns kubevirt, which $scope.currentTab returns 'virtualization`.

There is kubevirt_auth_status but there isn't virtualization_auth_status, therefore attempt to validate the virtualization tab fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@masayag Is this just a matter of renaming the virtualization tab to kubevirt?
Is it OK if we rename the tab to kubevirt? Because $scope.currentTab needs to match with the tab name that is specified in the haml.

Copy link
Contributor

Choose a reason for hiding this comment

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

@AparnaKarve ack from my side for renaming the tab.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@masayag Thanks!
Would you be able to test my rename tab changes here?

Copy link
Contributor

Choose a reason for hiding this comment

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

The PR works fine for editing the Container Provider and for enabling the 'Virtualization' tab
However, we do allow user to view & change token for the Kubevirt provider under Infra --> Providers --> Edit
and that fails with the shown error in the screenshot:

selection_869

the value of: ManageIQ.angular.scope.angularForm['default_auth_status'] is:
undefined
in this context, this one works: ManageIQ.angular.scope.angularForm['kubevirt_auth_status'].$setViewValue(true)
which isn't the conventional way it works for other providers - therefore we can just disable that option on this dialog and not allow changing the token(password) in this context, only under the virtualization tab.

So this PR fixes the blocked functionality of adding kubevirt provider and one gap to close.
I think this PR should be merged and the other issue should be addressed separately.

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