diff options
Diffstat (limited to 'install/ui')
-rw-r--r-- | install/ui/dialog.js | 19 | ||||
-rw-r--r-- | install/ui/dns.js | 5 | ||||
-rw-r--r-- | install/ui/entity.js | 87 | ||||
-rw-r--r-- | install/ui/group.js | 6 | ||||
-rw-r--r-- | install/ui/hbac.js | 5 | ||||
-rw-r--r-- | install/ui/host.js | 5 | ||||
-rw-r--r-- | install/ui/search.js | 10 | ||||
-rw-r--r-- | install/ui/service.js | 29 | ||||
-rw-r--r-- | install/ui/sudo.js | 5 |
9 files changed, 103 insertions, 68 deletions
diff --git a/install/ui/dialog.js b/install/ui/dialog.js index 17e78af6d..964d5f5fc 100644 --- a/install/ui/dialog.js +++ b/install/ui/dialog.js @@ -265,6 +265,25 @@ IPA.dialog = function(spec) { that.dialog_setup = that.setup; that.dialog_open = that.open; + var fields = spec.fields || []; + for (var i=0; i<fields.length; i++) { + var field_spec = fields[i]; + var field; + + if (field_spec instanceof Object) { + if (field_spec.factory) { + field = field_spec.factory(field_spec); + } else { + field = IPA.text_widget(field_spec); + } + } else { + var field_name = field_spec; + field = IPA.text_widget({ name: field_name, undo: false }); + } + + that.add_field(field); + } + return that; }; diff --git a/install/ui/dns.js b/install/ui/dns.js index 36ee2d6ef..d7175a140 100644 --- a/install/ui/dns.js +++ b/install/ui/dns.js @@ -48,10 +48,11 @@ IPA.entity_factories.dnszone = function() { 'dnsclass', 'idnsallowdynupdate', 'idnsupdatepolicy']}]}). - facet(IPA.records_facet({ + facet({ + factory: IPA.records_facet, 'name': 'records', 'label': IPA.metadata.objects.dnsrecord.label - })). + }). standard_association_facets(). build(); }; diff --git a/install/ui/entity.js b/install/ui/entity.js index 75ec32cfa..4db58465d 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -539,7 +539,7 @@ IPA.entity_builder = function(){ var that = {}; var entity = null; - var current_facet = null; + var facet = null; function section(spec){ var current_section = null; @@ -555,7 +555,7 @@ IPA.entity_builder = function(){ }else{ current_section = IPA.details_list_section(spec); } - current_facet.add_section(current_section); + facet.add_section(current_section); var fields = spec.fields; if (fields){ var i; @@ -581,8 +581,14 @@ IPA.entity_builder = function(){ return that; }; - that.dialog = function(value){ - current_facet.dialog(value); + that.dialog = function(spec) { + var dialog; + if (spec.factory) { + dialog = spec.factory(spec); + } else { + dialog = IPA.dialog(spec); + } + facet.dialog(dialog); return that; }; @@ -590,8 +596,8 @@ IPA.entity_builder = function(){ var sections = spec.sections; spec.sections = null; spec.entity_name = entity.name; - current_facet =IPA.details_facet(spec); - entity.facet(current_facet); + facet =IPA.details_facet(spec); + entity.facet(facet); var i; for ( i =0; i < sections.length; i += 1){ @@ -601,27 +607,19 @@ IPA.entity_builder = function(){ return that; }; - that.facet = function (facet){ - current_facet = facet; + that.facet = function(spec) { + facet = spec.factory(spec); entity.facet(facet); return that; }; that.search_facet = function (spec){ - current_facet = IPA.search_facet({ - entity_name:entity.name, - search_all: spec.search_all || false + facet = IPA.search_facet({ + entity_name: entity.name, + search_all: spec.search_all || false, + columns: spec.columns }); - var columns = spec.columns; - var i; - for (i = 0; i < columns.length; i +=1){ - if(columns[i] instanceof Object){ - current_facet.column(columns[i]); - }else{ - current_facet.column({name:columns[i]}); - } - } var current_dialog = IPA.add_dialog({ 'name': 'add', @@ -629,35 +627,38 @@ IPA.entity_builder = function(){ entity_name: entity.name }); - current_facet.dialog(current_dialog); + facet.dialog(current_dialog); var add_fields = spec.add_fields; - for (i = 0; i < add_fields.length; i += 1){ - var field = add_fields[i]; - if (field instanceof Object){ - /* This is a bit of a hack ,and is here to support ACI - permissions. The target section is a group of secveral - widgets together. It makes more sense to do them as a - seciont than as a widgit. However, since they can be mixed - into the flow with the other widgets, the section needs to - be definied here with the fields to get the order correct.*/ - var factory; - if (field.section){ - factory = field.factory; - field.factory = null; - field.name = field.section; - field.section = null; - current_dialog.add_section(factory(field)); + if (add_fields) { + for (var i = 0; i < add_fields.length; i += 1){ + var field = add_fields[i]; + if (field instanceof Object){ + /* This is a bit of a hack ,and is here to support ACI + permissions. The target section is a group of secveral + widgets together. It makes more sense to do them as a + seciont than as a widgit. However, since they can be mixed + into the flow with the other widgets, the section needs to + be definied here with the fields to get the order correct.*/ + var factory; + if (field.section){ + factory = field.factory; + field.factory = null; + field.name = field.section; + field.section = null; + current_dialog.add_section(factory(field)); + }else{ + field.entity_name = entity.name; + factory = field.factory || IPA.text_widget; + current_dialog.field(factory(field)); + } }else{ - field.entity_name = entity.name; - factory = field.factory; - current_dialog.field(factory(field)); + current_dialog.text(add_fields[i]); } - }else{ - current_dialog.text(add_fields[i]); } } - entity.facet(current_facet); + + entity.facet(facet); return that; }; diff --git a/install/ui/group.js b/install/ui/group.js index 7c7488f10..fb07a8cb3 100644 --- a/install/ui/group.js +++ b/install/ui/group.js @@ -47,8 +47,8 @@ IPA.entity_factories.group = function () { name:'details', fields:['cn','description','gidnumber'] }]}). - facet( IPA.association_facet({ - 'name': 'member_user', + association_facet({ + name: 'member_user', columns:[ { name: 'uid', @@ -72,7 +72,7 @@ IPA.entity_factories.group = function () { } ] - })). + }). association_facet({ name: 'memberof_group', associator: IPA.serial_associator diff --git a/install/ui/hbac.js b/install/ui/hbac.js index a0c353af3..fa824ab82 100644 --- a/install/ui/hbac.js +++ b/install/ui/hbac.js @@ -42,9 +42,10 @@ IPA.entity_factories.hbacrule = function () { }], 'undo': false }]}). - facet(IPA.hbacrule_details_facet({ + facet({ + factory: IPA.hbacrule_details_facet, 'name': 'details' - })). + }). build(); }; diff --git a/install/ui/host.js b/install/ui/host.js index dc1c0ee15..c7424fbe5 100644 --- a/install/ui/host.js +++ b/install/ui/host.js @@ -70,9 +70,10 @@ IPA.entity_factories.host = function () { } ] }]}). - facet(IPA.host_managedby_host_facet({ + facet({ + factory: IPA.host_managedby_host_facet, name: 'managedby_host' - })). + }). association_facet({ name: 'memberof_hostgroup', associator: IPA.serial_associator diff --git a/install/ui/search.js b/install/ui/search.js index bd2c0f166..ad74b812a 100644 --- a/install/ui/search.js +++ b/install/ui/search.js @@ -410,6 +410,16 @@ IPA.search_facet = function(spec) { that.search_facet_create_content = that.create_content; that.search_facet_setup = that.setup; + var columns = spec.columns || []; + for (var i=0; i<columns.length; i++) { + var column = columns[i]; + if (column instanceof Object) { + var factory = column.factory || IPA.column; + that.add_column(factory(column)); + } else { + that.create_column({ name: column }); + } + } return that; }; diff --git a/install/ui/service.js b/install/ui/service.js index 363152518..dc89ec08e 100644 --- a/install/ui/service.js +++ b/install/ui/service.js @@ -27,15 +27,15 @@ IPA.entity_factories.service = function() { return IPA.entity_builder(). entity('service'). - facet( - IPA.search_facet(). - column({name: 'krbprincipalname'}). - dialog( - IPA.service_add_dialog({ - name: 'add', - title: IPA.messages.objects.service.add, - width: '450px' - }))). + search_facet({ + columns: [ 'krbprincipalname' ] + }). + dialog({ + factory: IPA.service_add_dialog, + name: 'add', + title: IPA.messages.objects.service.add, + width: '450px' + }). details_facet({sections:[ { name: 'details', @@ -69,11 +69,12 @@ IPA.entity_factories.service = function() { label: IPA.messages.objects.service.status }] }]}). - facet(IPA.service_managedby_host_facet({ - name: 'managedby_host', - add_method: 'add_host', - remove_method: 'remove_host' - })). + facet({ + factory: IPA.service_managedby_host_facet, + name: 'managedby_host', + add_method: 'add_host', + remove_method: 'remove_host' + }). standard_association_facets(). build(); }; diff --git a/install/ui/sudo.js b/install/ui/sudo.js index 0f2e8491e..d0fe7528c 100644 --- a/install/ui/sudo.js +++ b/install/ui/sudo.js @@ -31,9 +31,10 @@ IPA.entity_factories.sudorule = function () { columns:['cn','description','cmdcategory'], add_fields:['cn'] }). - facet(IPA.sudorule_details_facet({ + facet({ + factory: IPA.sudorule_details_facet, 'name': 'details' - })). + }). build(); }; |