diff options
author | Adam Young <ayoung@redhat.com> | 2011-01-28 13:06:34 -0500 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2011-01-28 14:57:06 -0500 |
commit | 3625a1e88afd26e3694d33f3a491824ba0d1f9e3 (patch) | |
tree | 0ba206e017aef8b2e47b7133d03f3ce931d5052a | |
parent | b96138ba56d33fb3b84d992a731d797c2c8492be (diff) | |
download | freeipa-3625a1e88afd26e3694d33f3a491824ba0d1f9e3.tar.gz freeipa-3625a1e88afd26e3694d33f3a491824ba0d1f9e3.tar.xz freeipa-3625a1e88afd26e3694d33f3a491824ba0d1f9e3.zip |
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
-rw-r--r-- | install/ui/entity.js | 4 | ||||
-rw-r--r-- | install/ui/service.js | 240 | ||||
-rw-r--r-- | 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 = $('<select/>'); + for (var i = 0; i < known_services.length; i += 1){ + select_widget.append($('<option/>',{ + text: known_services[i], + click: function(){ + that.input.val(this.value); + } + })); + } + container.append(select_widget); + that.parent_create(container); + } return that; -}; +} -IPA.service_add_dialog = function (spec) { - spec = spec || {}; +/*TODO: the following labels etc. all need to be replaced with I18N strings */ - var that = IPA.add_dialog(spec); +IPA.service_add_dialog = function (spec) { - that.init = function() { + spec = spec || {}; - that.add_field(IPA.widget({ + var that = IPA.add_dialog(spec). + field(IPA.widget({ name: 'krbprincipalname' - })); - - // TODO: Replace with i18n label - that.add_field(IPA.text_widget({ + })). + field(IPA.service_select_widget({ 'name': 'service', 'label': 'Service', 'size': 20, 'undo': false - })); - - // TODO: Replace with i18n label - that.add_field(IPA.text_widget({ + })). + field(IPA.text_widget({ 'name': 'host', 'label': 'Host Name', 'size': 40, 'undo': false - })); - - // TODO: Replace with i18n label - that.add_field(IPA.checkbox_widget({ + })). + field(IPA.checkbox_widget({ name: 'force', label: 'Force', tooltip: 'force principal name even if not in DNS', undo: false })); - that.add_dialog_init(); - }; - - that.create = function() { - - var table = $('<table/>').appendTo(that.container); - - var field = that.get_field('service'); - - var tr = $('<tr/>').appendTo(table); - - var td = $('<td/>', { - style: 'vertical-align: top;', - title: field.label - }).appendTo(tr); - td.append(field.label+': '); - - td = $('<td/>', { - 'style': 'vertical-align: top;' - }).appendTo(tr); - - var span = $('<span/>', { 'name': 'service' }).appendTo(td); - field.create(span); - - field = that.get_field('host'); - - tr = $('<tr/>').appendTo(table); - - td = $('<td/>', { - style: 'vertical-align: top;', - title: field.label - }).appendTo(tr); - td.append(field.label+': '); - - td = $('<td/>', { - 'style': 'vertical-align: top;' - }).appendTo(tr); - - span = $('<span/>', { 'name': 'host' }).appendTo(td); - field.create(span); - - field = that.get_field('force'); - - tr = $('<tr/>').appendTo(table); - - td = $('<td/>', { - style: 'vertical-align: top;', - title: field.label - }).appendTo(tr); - td.append(field.label+': '); - - td = $('<td/>', { - 'style': 'vertical-align: top;' - }).appendTo(tr); - - span = $('<span/>', { 'name': 'force' }).appendTo(td); - field.create(span); - }; that.save = function(record) { @@ -181,78 +126,47 @@ IPA.service_add_dialog = function (spec) { }; -IPA.service_search_facet = function (spec) { - - spec = spec || {}; - - var that = IPA.search_facet(spec); - - that.init = function() { - - that.create_column({name:'krbprincipalname'}); - that.search_facet_init(); - }; - - return that; -}; - - IPA.service_details_facet = function (spec) { spec = spec || {}; - var that = IPA.details_facet(spec); - - that.init = function() { - - var section = IPA.details_list_section({ + var that = IPA.details_facet(spec). + section(IPA.stanza({ name: 'details', label: 'Service Settings' - }); - that.add_section(section); - - section.create_field({ + }). + input({ name: 'krbprincipalname' - }); - - // TODO: Replace with i18n label - section.create_field({ + }). + input({ name: 'service', label: 'Service', load: service_service_load - }); - - // TODO: Replace with i18n label - section.create_field({ + }). + input({ name: 'host', label: 'Host Name', load: service_host_load - }); - - section = IPA.details_list_section({ - name: 'provisioning', - label: 'Provisioning' - }); - that.add_section(section); - - section.add_field(service_provisioning_status_widget({ - name: 'provisioning_status', - label: 'Status' - })); + })). + section( + IPA.stanza({ + name: 'provisioning', + label: 'Provisioning' + }). + custom_input(service_provisioning_status_widget({ + name: 'provisioning_status', + label: 'Status' + }))). + section( + IPA.stanza({ + name: 'certificate', + label: 'Service Certificate' + }). + custom_input((service_certificate_status_widget({ + name: 'certificate_status', + label: 'Status' + })))); - section = IPA.details_list_section({ - name: 'certificate', - label: 'Service Certificate' - }); - that.add_section(section); - - section.add_field(service_certificate_status_widget({ - name: 'certificate_status', - label: 'Status' - })); - - that.details_facet_init(); - }; return that; }; diff --git a/install/ui/widget.js b/install/ui/widget.js index 3bb5c0f5a..19dc4d121 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -262,6 +262,7 @@ IPA.text_widget = function(spec) { undo.click(function() { that.reset(); }); + that.input = input; }; that.load = function(record) { |