From 3625a1e88afd26e3694d33f3a491824ba0d1f9e3 Mon Sep 17 00:00:00 2001 From: Adam Young Date: Fri, 28 Jan 2011 13:06:34 -0500 Subject: services list Declaritive Service definition Fixed a problem with multiple calls to create breaking the link between the select box and the text box swapped the select and the text https://fedorahosted.org/freeipa/ticket/442 --- install/ui/entity.js | 4 + install/ui/service.js | 240 ++++++++++++++++---------------------------------- install/ui/widget.js | 1 + 3 files changed, 82 insertions(+), 163 deletions(-) diff --git a/install/ui/entity.js b/install/ui/entity.js index 69dd444f8..ec4a2adc1 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -111,6 +111,10 @@ IPA.entity = function (spec) { }; that.add_dialog = function(dialog) { + return that.dialog(dialog); + } + + that.dialog = function(dialog) { dialog.entity_name = that.name; that.dialogs.push(dialog); that.dialogs_by_name[dialog.name] = dialog; diff --git a/install/ui/service.js b/install/ui/service.js index f67d755de..2352fa42d 100644 --- a/install/ui/service.js +++ b/install/ui/service.js @@ -25,143 +25,88 @@ IPA.entity_factories.service = function () { - var that = IPA.entity({ + return IPA.entity({ 'name': 'service' - }); - - that.init = function() { - - that.create_association({ + }). + association({ 'name': 'host', 'add_method': 'add_host', 'remove_method': 'remove_host' - }); + }). + dialog( + IPA.service_add_dialog({ + 'name': 'add', + 'title': 'Add New Service' + })). + facet( IPA.search_facet(). + column({name:'krbprincipalname'})). + facet( IPA.service_details_facet()). + facet( IPA.service_managedby_host_facet({ + 'name': 'managedby_host', + 'label': IPA.messages.association.managedby + +' '+IPA.metadata['host'].label, + 'other_entity': 'host' + })); +}; - var dialog = IPA.service_add_dialog({ - 'name': 'add', - 'title': 'Add New Service' - }); - that.add_dialog(dialog); - var facet = IPA.service_search_facet({ - 'name': 'search', - 'label': 'Search' - }); - that.add_facet(facet); +IPA.service_select_widget = function (spec){ - facet = IPA.service_details_facet({ - 'name': 'details' - }); - that.add_facet(facet); + var that = IPA.text_widget(spec); + var known_services = ["", "cifs", "DNS", "ftp", "HTTP","imap", "ldap", + "libvirt","nfs","qpidd","smtp"]; - facet = IPA.service_managedby_host_facet({ - 'name': 'managedby_host', - 'label': IPA.messages.association.managedby+' '+IPA.metadata['host'].label, - 'other_entity': 'host' - }); - that.add_facet(facet); + that.parent_create = that.create; - that.entity_init(); - }; + that.create = function(container) { + + var select_widget = $('