Fixed problem setting host OTP.

The handler for host 'Set OTP' button has been modified to obtain
the primary key from the entity and return false to stop the normal
event processing.

Ticket #1511
This commit is contained in:
Endi S. Dewata
2011-07-26 09:30:59 -05:00
parent 62445b8673
commit d7e790dd07

View File

@@ -246,8 +246,6 @@ IPA.host_provisioning_status_widget = function (spec) {
var that = IPA.widget(spec); var that = IPA.widget(spec);
that.facet = spec.facet;
that.create = function(container) { that.create = function(container) {
that.widget_create(container); that.widget_create(container);
@@ -326,8 +324,11 @@ IPA.host_provisioning_status_widget = function (spec) {
var button = $('input[name=unprovision]', that.container); var button = $('input[name=unprovision]', that.container);
that.unprovision_button = IPA.button({ that.unprovision_button = IPA.button({
name: 'unprovision', name: 'unprovision',
'label': IPA.messages.objects.host.delete_key_unprovision, label: IPA.messages.objects.host.delete_key_unprovision,
'click': that.show_unprovision_dialog click: function() {
that.show_unprovision_dialog();
return false;
}
}); });
button.replaceWith(that.unprovision_button); button.replaceWith(that.unprovision_button);
@@ -336,8 +337,11 @@ IPA.host_provisioning_status_widget = function (spec) {
that.enroll_button = $('input[name=enroll]', that.container); that.enroll_button = $('input[name=enroll]', that.container);
button = IPA.button({ button = IPA.button({
name: 'enroll', name: 'enroll',
'label': IPA.messages.objects.host.set_otp, label: IPA.messages.objects.host.set_otp,
'click': that.set_otp click: function() {
that.set_otp();
return false;
}
}); });
that.enroll_button.replaceWith(button); that.enroll_button.replaceWith(button);
@@ -373,13 +377,12 @@ IPA.host_provisioning_status_widget = function (spec) {
dialog.init(); dialog.init();
dialog.open(that.container); dialog.open(that.container);
return false;
}; };
that.unprovision = function(on_success, on_error) { that.unprovision = function(on_success, on_error) {
var pkey = that.facet.get_primary_key(); var entity = IPA.get_entity(that.entity_name);
var pkey = entity.get_primary_key();
var command = IPA.command({ var command = IPA.command({
name: that.entity_name+'_disable_'+pkey, name: that.entity_name+'_disable_'+pkey,
@@ -396,7 +399,8 @@ IPA.host_provisioning_status_widget = function (spec) {
that.set_otp = function() { that.set_otp = function() {
var pkey = that.facet.get_primary_key(); var entity = IPA.get_entity(that.entity_name);
var pkey = entity.get_primary_key();
var otp = that.otp_input.val(); var otp = that.otp_input.val();
that.otp_input.val(''); that.otp_input.val('');