Re: [Freeipa-devel] [PATCH] admiyo-0175-services-list

2011-01-28 Thread Endi Sukma Dewata

On 1/28/2011 1:52 PM, Adam Young wrote:




ACK and pushed to master.

--
Endi S. Dewata

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] admiyo-0175-services-list

2011-01-28 Thread Adam Young

On 01/28/2011 02:32 PM, Adam Young wrote:

On 01/28/2011 02:04 PM, Adam Young wrote:



___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel



___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


From 6ed009ff684a3c486ce928a6a74936944b8484ec Mon Sep 17 00:00:00 2001
From: Adam Young 
Date: Fri, 28 Jan 2011 13:06:34 -0500
Subject: [PATCH] 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 |  248 -
 install/ui/widget.js  |1 +
 3 files changed, 86 insertions(+), 167 deletions(-)

diff --git a/install/ui/entity.js b/install/ui/entity.js
index 69dd444f83c9ae32a88f8ae53b0995f1033627a0..ec4a2adc1baf23e5355c8ae2fe4f2a24ee750b0d 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 f67d755def899cac912431cc7b468756d31ba310..2352fa42d09c44aec28311150c645ae039f1ce1d 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'
-});
-
-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);
-
-facet = IPA.service_details_facet({
-'name': 'details'
-});
-that.add_facet(facet);
-
-facet = IPA.service_managedby_host_facet({
+}).
+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,
+'label': IPA.messages.association.managedby
++' '+IPA.metadata['host'].label,
 'other_entity': 'host'
-});
-that.add_facet(facet);
-
-that.entity_init();
-};
-
-return that;
+}));
 };
 
 
+IPA.service_select_widget = function (spec){
+
+var that = IPA.text_widget(spec);
+var known_services = ["", "cifs", "DNS", "ftp", "HTTP","imap", "ldap",
+  "libvirt","nfs","qpidd","smtp"];
+
+that.parent_create = that.create;
+
+that.create = function(container) {
+
+var select_widget = $('');
+for (var i = 0; i < known_services.length; i += 1){
+select_widget.append($('',{
+text: known_services[i],
+click: function(){
+that.input.val(this.value);
+}
+}));
+}
+container.append(select_widget);
+that.parent_create(container);
+}
+
+return that;
+
+}
+
+
+/*TODO: the following labels etc. all need to be replaced with I18N strings */
+
 IPA.service_add_dialog = function (spec) {
 
 spec = spec || {};
 
-var that = IPA.add_dialog(spec);
-
-that.init = function() {
-
-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
-}));

Re: [Freeipa-devel] [PATCH] admiyo-0175-services-list

2011-01-28 Thread Adam Young

On 01/28/2011 02:04 PM, Adam Young wrote:



___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


From 70cb968ffd8cda67e7be1cf5422e6ec906ad619a Mon Sep 17 00:00:00 2001
From: Adam Young 
Date: Fri, 28 Jan 2011 13:06:34 -0500
Subject: [PATCH] services list

Declaritive Service definition

https://fedorahosted.org/freeipa/ticket/442
---
 install/ui/entity.js  |4 +
 install/ui/service.js |  249 -
 install/ui/widget.js  |1 +
 3 files changed, 87 insertions(+), 167 deletions(-)

diff --git a/install/ui/entity.js b/install/ui/entity.js
index 69dd444f83c9ae32a88f8ae53b0995f1033627a0..ec4a2adc1baf23e5355c8ae2fe4f2a24ee750b0d 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 f67d755def899cac912431cc7b468756d31ba310..44c411c56c75c53441ddc75b1d803999a24e3653 100644
--- a/install/ui/service.js
+++ b/install/ui/service.js
@@ -25,143 +25,89 @@
 
 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'
-});
-
-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);
-
-facet = IPA.service_details_facet({
-'name': 'details'
-});
-that.add_facet(facet);
-
-facet = IPA.service_managedby_host_facet({
+}).
+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,
+'label': IPA.messages.association.managedby
++' '+IPA.metadata['host'].label,
 'other_entity': 'host'
-});
-that.add_facet(facet);
-
-that.entity_init();
-};
-
-return that;
+}));
 };
 
 
+IPA.service_select_widget = function (spec){
+
+var that = IPA.text_widget(spec);
+var known_services = ["", "cifs", "DNS", "ftp", "HTTP","imap", "ldap",
+  "libvirt","nfs","qpidd","smtp"];
+
+var select_widget = $('');
+for (var i = 0; i < known_services.length; i += 1){
+select_widget.append($('',{
+text: known_services[i],
+click: function(){
+that.input.val(this.value);
+}
+
+}));
+}
+
+that.parent_create = that.create;
+
+that.create = function(container) {
+that.parent_create(container);
+container.append(select_widget);
+}
+
+return that;
+
+}
+
+
+/*TODO: the following labels etc. all need to be replaced with I18N strings */
+
 IPA.service_add_dialog = function (spec) {
 
 spec = spec || {};
 
-var that = IPA.add_dialog(spec);
-
-that.init = function() {
-
-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 = func