diff options
author | Adam Young <ayoung@redhat.com> | 2011-03-18 16:43:54 -0400 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-03-31 17:29:33 -0400 |
commit | 4270e26adb56b6d1b7a9e80433581b82519d9eec (patch) | |
tree | dcb0982b741d92c0be37e262e70b7cd0969e06d0 /install/ui/host.js | |
parent | db91321fd2c94680361ae8196ba9227615f92c39 (diff) | |
download | freeipa-4270e26adb56b6d1b7a9e80433581b82519d9eec.tar.gz freeipa-4270e26adb56b6d1b7a9e80433581b82519d9eec.tar.xz freeipa-4270e26adb56b6d1b7a9e80433581b82519d9eec.zip |
define entities using builder and more declarative syntax
merged hbac and sudo in to single files
associaton facet and table supports linking
Diffstat (limited to 'install/ui/host.js')
-rw-r--r-- | install/ui/host.js | 241 |
1 files changed, 61 insertions, 180 deletions
diff --git a/install/ui/host.js b/install/ui/host.js index 7d9e8f018..3f9c05d1d 100644 --- a/install/ui/host.js +++ b/install/ui/host.js @@ -26,90 +26,70 @@ IPA.entity_factories.host = function () { - var that = IPA.entity({ - 'name': 'host' - }); - - that.init = function() { - - var facet = IPA.host_search_facet({ - 'name': 'search', - 'label': IPA.messages.facets.search - }); - that.add_facet(facet); - - var dialog = IPA.host_add_dialog({ - 'name': 'add', - 'title': IPA.messages.objects.host.add - }); - facet.dialog(dialog); - - facet = IPA.host_details_facet({ - 'name': 'details' - }); - that.add_facet(facet); - - facet = IPA.host_managedby_host_facet({ + 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 + }], + add_fields: ['fqdn', {factory:IPA.force_host_add_checkbox_widget}] + }). + details_facet([ + { + section:'details', + fields: [ + 'fqdn', + 'krbprincipalname', + { + factory: IPA.text_widget, + name: 'cn', + label: IPA.messages.objects.host.cn, + read_only: true + }, + 'description' ] + }, + { + section:'enrollment', + fields:[ + { + factory: IPA.host_provisioning_status_widget, + 'name': 'provisioning_status', + label: IPA.messages.objects.host.status + } + ] + }, + { + section :'certificate', + fields:[ + { + factory: IPA.host_certificate_status_widget, + 'name': 'certificate_status', + label: IPA.messages.objects.host.status + } + ] + }]). + facet(IPA.host_managedby_host_facet({ name: 'managedby_host' - }); - that.add_facet(facet); - - facet = IPA.association_facet({ + })). + association_facet({ name: 'memberof_hostgroup', associator: IPA.serial_associator - }); - that.add_facet(facet); - - facet = IPA.association_facet({ + }). + association_facet({ name: 'memberof_netgroup', associator: IPA.serial_associator - }); - that.add_facet(facet); - - facet = IPA.association_facet({ + }). + association_facet({ name: 'memberof_role', associator: IPA.serial_associator - }); - that.add_facet(facet); - - that.create_association_facets(); - - that.entity_init(); - }; - - return that; + }). + standard_associations(). + build(); }; -IPA.host_add_dialog = function (spec) { - - spec = spec || {}; - - var that = IPA.add_dialog(spec); - - that.init = function() { - - that.add_field(IPA.text_widget({ - name: 'fqdn', - size: 40, - undo: false - })); - - var param_info = IPA.get_method_param('host_add', 'force'); - - that.add_field(IPA.checkbox_widget({ - name: 'force', - label: param_info.label, - tooltip: param_info.doc, - undo: false - })); - - that.add_dialog_init(); - }; - - return that; -}; - /* Take an LDAP format date in UTC and format it */ IPA.utc_date_column_format = function(value){ if (!value) { @@ -137,115 +117,16 @@ IPA.utc_date_column_format = function(value){ return formated; }; -IPA.host_search_facet = function (spec) { - - spec = spec || {}; - - var that = IPA.search_facet(spec); - - that.init = function() { - - that.create_column({name:'fqdn'}); - that.create_column({name:'description'}); - //TODO use the value of this field to set enrollment status - that.create_column({ - name: 'krblastpwdchange', - label: IPA.messages.objects.host.enrolled, - format: IPA.utc_date_column_format - }); - that.create_column({name:'nshostlocation'}); - that.search_facet_init(); - }; - - return that; -}; - - -IPA.host_details_facet = function (spec) { - - spec = spec || {}; - - var that = IPA.details_facet(spec); - - that.init = function() { - - var section = IPA.details_list_section({ - name: 'details', - label: IPA.messages.objects.host.details - }); - that.add_section(section); - - section.text({ - name: 'fqdn', - label: IPA.messages.objects.host.fqdn - }); - - section.text({'name': 'krbprincipalname'}); - - section.text({ - name: 'cn', - label: IPA.messages.objects.host.cn, - read_only: true - }); - - section.text({'name': 'description'}); - - section = IPA.details_list_section({ - name: 'enrollment', - label: IPA.messages.objects.host.enrollment - }); - that.add_section(section); - - section.add_field(IPA.host_provisioning_status_widget({ - 'name': 'provisioning_status', - label: IPA.messages.objects.host.status, - 'facet': that - })); - - section = IPA.details_list_section({ - name: 'certificate', - label: IPA.messages.objects.host.status - }); - that.add_section(section); - - section.add_field(IPA.host_certificate_status_widget({ - 'name': 'certificate_status', - label: IPA.messages.objects.host.status - })); - - that.details_facet_init(); - }; - - that.refresh = function() { - - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - - var command = IPA.command({ - 'name': that.entity_name+'_show_'+pkey, - 'method': that.entity_name+'_show', - 'args': [pkey], - 'options': { 'all': true, 'rights': true } - }); - - command.on_success = function(data, text_status, xhr) { - that.load(data.result.result); - }; - - command.on_error = function(xhr, text_status, error_thrown) { - var details = $('.details', that.container).empty(); - details.append('<p>Error: '+error_thrown.name+'</p>'); - details.append('<p>'+error_thrown.title+'</p>'); - details.append('<p>'+error_thrown.message+'</p>'); - }; - - command.execute(); - }; - - return that; +IPA.force_host_add_checkbox_widget = function (spec){ + var param_info = IPA.get_method_param('host_add', 'force'); + spec.name = 'force'; + spec.label = param_info.label; + spec.tooltip = param_info.doc; + spec.undo = false; + return IPA.checkbox_widget(spec); }; - IPA.host_provisioning_status_widget = function (spec) { spec = spec || {}; |