Skip to content

Commit

Permalink
Merge pull request #5289 from rvsia/bz1634794
Browse files Browse the repository at this point in the history
Fixes value of validate_id in host form
  • Loading branch information
mzazrivec committed Mar 1, 2019
2 parents 5c8fe3c + 6e66bc5 commit ef10b77
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Expand Up @@ -16,7 +16,7 @@ ManageIQ.angular.app.controller('hostFormController', ['$http', '$scope', '$attr
ws_password: '',
ipmi_userid: '',
ipmi_password: '',
validate_id: '',
validate_id: null,
};

$scope.modelCopy = angular.copy( $scope.hostModel );
Expand Down Expand Up @@ -46,7 +46,7 @@ ManageIQ.angular.app.controller('hostFormController', ['$http', '$scope', '$attr
$scope.hostModel.ws_password = '';
$scope.hostModel.ipmi_userid = '';
$scope.hostModel.ipmi_password = '';
$scope.hostModel.validate_id = '';
$scope.hostModel.validate_id = null;
$scope.afterGet = true;
} else if (hostFormId.split(',').length === 1) {
miqService.sparkleOn();
Expand Down
Expand Up @@ -571,7 +571,7 @@
= _("Select Host to validate against")
.col-md-10
= select_tag('validate_id',
options_for_select([["<#{_('Choose')}>", '']] + @selected_hosts.invert.sort, disabled: ["<#{_('Choose')}>", nil]),
options_for_select([["<#{_('Choose')}>", nil]] + @selected_hosts.invert.sort, disabled: ["<#{_('Choose')}>", nil]),
"ng-model" => "#{ng_model}.validate_id",
"checkchange" => "",
"selectpicker-for-select-tag" => "")
Expand Down
11 changes: 10 additions & 1 deletion spec/javascripts/controllers/host/host_form_controller_spec.js
Expand Up @@ -65,6 +65,10 @@ describe('hostFormController', function() {
it('sets the IPMI Address to blank', function() {
expect($scope.hostModel.ipmi_address).toEqual('');
});

it('sets the validate id to null', function() {
expect($scope.hostModel.validate_id).toEqual(null);
});
});

describe('when the hostFormId is an Id', function() {
Expand All @@ -77,7 +81,8 @@ describe('hostFormController', function() {
default_userid: 'abc',
remote_userid: 'xyz',
ws_userid: 'aaa',
ipmi_userid: 'zzz'
ipmi_userid: 'zzz',
validate_id: '1',
};
describe('when the filter type is all', function() {
beforeEach(inject(function(_$controller_) {
Expand Down Expand Up @@ -127,6 +132,10 @@ describe('hostFormController', function() {
it('sets the ipmi password to the placeholder value if a ipmi user exists', function() {
expect($scope.hostModel.ipmi_password).toEqual(miqService.storedPasswordPlaceholder);
});

it('sets the validate id to the value returned from the http request', function() {
expect($scope.hostModel.validate_id).toEqual('1');
});
});
});
});
Expand Down

0 comments on commit ef10b77

Please sign in to comment.