summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-08-25 14:03:48 -0500
committerEndi S. Dewata <edewata@redhat.com>2011-08-26 15:19:22 +0000
commit9dd689ff9d4e167f00802b39bea390b763a5a7e9 (patch)
treef6e8b1ad51273a94db2ce744b280e89c30ac58c3
parent79f5c5b2aefeb7f886a6e0f8a88d8fa8661188f7 (diff)
Fixed host keytab status after setting OTP.
The host details page has been modified to update the keytab status based on the data returned by the host-mod command for setting OTP. Ticket #1710
-rw-r--r--install/ui/details.js2
-rw-r--r--install/ui/host.js140
-rw-r--r--install/ui/test/data/host_mod.json2
3 files changed, 96 insertions, 48 deletions
diff --git a/install/ui/details.js b/install/ui/details.js
index 4550c1abf..a0a44e7b2 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -215,6 +215,8 @@ IPA.details_list_section = function(spec) {
}
};
+ that.list_section_create = that.create;
+
return that;
};
diff --git a/install/ui/host.js b/install/ui/host.js
index 52a0e8f92..d22f54887 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -29,54 +29,62 @@ IPA.entity_factories.host = function () {
return IPA.entity_builder().
entity('host').
search_facet({
- columns:['fqdn','description',{
- name: 'krblastpwdchange',
- label: IPA.messages.objects.host.enrolled,
- format: IPA.utc_date_column_format
- }]
+ columns: [
+ 'fqdn',
+ 'description',
+ {
+ name: 'krblastpwdchange',
+ label: IPA.messages.objects.host.enrolled,
+ format: IPA.utc_date_column_format
+ }
+ ]
+ }).
+ details_facet({
+ sections: [
+ {
+ name: 'details',
+ fields: [
+ {
+ factory: IPA.host_dnsrecord_entity_link_widget,
+ name: 'fqdn',
+ other_entity: 'dnsrecord'
+ },
+ 'krbprincipalname',
+ 'description',
+ 'l',
+ 'nshostlocation',
+ 'nshardwareplatform',
+ 'nsosversion'
+ ]
+ },
+ {
+ factory: IPA.host_enrollment_section,
+ name: 'enrollment',
+ fields: [
+ {
+ factory: IPA.host_keytab_widget,
+ name: 'has_keytab',
+ label: IPA.messages.objects.host.keytab
+ },
+ {
+ factory: IPA.host_password_widget,
+ name: 'has_password',
+ label: IPA.messages.objects.host.password
+ }
+ ]
+ },
+ {
+ name: 'certificate',
+ fields: [
+ {
+ factory: IPA.host_certificate_status_widget,
+ name: 'certificate_status',
+ label: IPA.messages.objects.host.status
+ }
+ ]
+ }
+ ]
}).
- details_facet({sections:[
- {
- name: 'details',
- fields: [
- {
- factory: IPA.host_dnsrecord_entity_link_widget,
- name: 'fqdn',
- other_entity:'dnsrecord'
- },
- 'krbprincipalname',
- 'description',
- 'l',
- 'nshostlocation',
- 'nshardwareplatform',
- 'nsosversion'
- ]
- },
- {
- name:'enrollment',
- fields:[
- {
- factory: IPA.host_keytab_widget,
- 'name': 'has_keytab',
- label: IPA.messages.objects.host.keytab
- },
- {
- factory: IPA.host_password_widget,
- 'name': 'has_password',
- label: IPA.messages.objects.host.password
- }
- ]
- },
- {
- name:'certificate',
- fields:[
- {
- factory: IPA.host_certificate_status_widget,
- 'name': 'certificate_status',
- label: IPA.messages.objects.host.status
- }
- ]
- }]}).
association_facet({
name: 'managedby_host',
add_method: 'add_managedby',
@@ -414,6 +422,42 @@ IPA.force_host_add_checkbox_widget = function(spec) {
return IPA.checkbox_widget(spec);
};
+IPA.host_enrollment_section = function(spec) {
+
+ spec = spec || {};
+
+ var that = IPA.details_list_section(spec);
+
+ that.create = function(container) {
+ that.list_section_create(container);
+
+ var keytab_field = that.get_field('has_keytab');
+ var password_field = that.get_field('has_password');
+
+ /**
+ * The set_password() in the password field is being customized to
+ * update the keytab field.
+ *
+ * The customization needs to be done here because the section
+ * doesn't create the fields. The IPA.entity_builder adds the fields
+ * after creating the section. This needs to be improved.
+ */
+ var super_set_password = password_field.set_password;
+ password_field.set_password = function(password, on_success, on_error) {
+ super_set_password.call(
+ this,
+ password,
+ function(data, text_status, xhr) {
+ keytab_field.load(data.result.result);
+ if (on_success) on_success.call(this, data, text_status, xhr);
+ },
+ on_error);
+ };
+ };
+
+ return that;
+};
+
IPA.host_keytab_widget = function(spec) {
spec = spec || {};
@@ -621,7 +665,7 @@ IPA.host_password_widget = function(spec) {
that.set_password(
new_password,
function(data, text_status, xhr) {
- set_status('present');
+ that.load(data.result.result);
dialog.close();
},
function(xhr, text_status, error_thrown) {
diff --git a/install/ui/test/data/host_mod.json b/install/ui/test/data/host_mod.json
index 3cb7d9ec5..2e34257e8 100644
--- a/install/ui/test/data/host_mod.json
+++ b/install/ui/test/data/host_mod.json
@@ -46,6 +46,8 @@
"fqdn": [
"test.example.com"
],
+ "has_keytab": false,
+ "has_password": true,
"ipauniqueid": [
"ac28dca0-f3b5-11df-879f-00163e72f2d9"
],