Re: [Freeipa-devel] [PATCH] 152 Updated DNS interface.

2011-05-11 Thread Adam Young

On 05/10/2011 05:12 PM, Endi Sukma Dewata wrote:

The IPA.records_facet has been converted into a subclass of
IPA.search_facet. This helps remove duplicate table code and provide
consistent DOM element attributes for Selenium tests.


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

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

[Freeipa-devel] [PATCH] 152 Updated DNS interface.

2011-05-10 Thread Endi Sukma Dewata

The IPA.records_facet has been converted into a subclass of
IPA.search_facet. This helps remove duplicate table code and provide
consistent DOM element attributes for Selenium tests.

--
Endi S. Dewata
From 0982fd17fa0f5052c3249f5fd0f464dc19bafc5f Mon Sep 17 00:00:00 2001
From: Endi S. Dewata edew...@redhat.com
Date: Mon, 9 May 2011 20:46:52 -0500
Subject: [PATCH] Updated DNS interface.

The IPA.records_facet has been converted into a subclass of
IPA.search_facet. This helps remove duplicate table code and provide
consistent DOM element attributes for Selenium tests.
---
 install/ui/dns.js |  378 ++---
 install/ui/entitle.js |4 +-
 install/ui/search.js  |5 +-
 install/ui/widget.js  |7 +-
 4 files changed, 180 insertions(+), 214 deletions(-)

diff --git a/install/ui/dns.js b/install/ui/dns.js
index bd8d6e1858afc14013a91cdcd53a8ea11362c0ca..6784584b6bd8ab14aff4b1dd4bf2af0d79375530 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -26,36 +26,53 @@
 /* DNS */
 IPA.entity_factories.dnszone = function() {
 
-if (!IPA.dns_enabled){
+if (!IPA.dns_enabled) {
 throw DNS not enabled on server;
 }
 
-return  IPA.entity_builder().
+return IPA.entity_builder().
 entity('dnszone').
 search_facet({
 columns:['idnsname']
 }).
-details_facet({sections:[{
-name:'identity',
-fields:[
-'idnsname',
-'idnszoneactive',
-'idnssoamname',
-'idnssoarname',
-'idnssoaserial',
-'idnssoarefresh',
-'idnssoaretry',
-'idnssoaexpire',
-'idnssoaminimum',
-'dnsttl',
-'dnsclass',
-'idnsallowdynupdate',
-'idnsupdatepolicy']}]}).
+details_facet({
+sections:[{
+name:'identity',
+fields:[
+'idnsname',
+'idnszoneactive',
+'idnssoamname',
+'idnssoarname',
+'idnssoaserial',
+'idnssoarefresh',
+'idnssoaretry',
+'idnssoaexpire',
+'idnssoaminimum',
+'dnsttl',
+'dnsclass',
+'idnsallowdynupdate',
+'idnsupdatepolicy']}]
+}).
 facet({
 factory: IPA.records_facet,
-'name': 'records',
-'facet_group':'Member',
-'label': IPA.metadata.objects.dnsrecord.label
+name: 'records',
+facet_group:'Member',
+label: IPA.metadata.objects.dnsrecord.label,
+columns: [
+{
+name: 'idnsname',
+label: IPA.get_entity_param('dnsrecord', 'idnsname').label,
+primary_key: true
+},
+{
+name: 'type',
+label: 'Record Type'
+},
+{
+name: 'data',
+label: 'Data'
+}
+]
 }).
 standard_association_facets().
 adder_dialog({
@@ -68,7 +85,7 @@ IPA.entity_factories.dnszone = function() {
 build();
 };
 
-IPA.force_dnszone_add_checkbox_widget = function (spec){
+IPA.force_dnszone_add_checkbox_widget = function(spec) {
 var param_info = IPA.get_method_option('dnszone_add', 'force');
 spec.name = 'force';
 spec.label = param_info.label;
@@ -77,18 +94,44 @@ IPA.force_dnszone_add_checkbox_widget = function (spec){
 return  IPA.checkbox_widget(spec);
 };
 
-IPA.records_facet = function (spec){
+IPA.records_facet = function(spec) {
 
 spec = spec || {};
 
-var that = IPA.facet(spec);
+var that = IPA.search_facet(spec);
 
-that.record = null;
+var record_types = [
+'a', '', 'dname', 'cname', 'mx', 'ns', 'ptr',
+'srv', 'txt', 'a6', 'afsdb', 'cert', 'ds',
+'key', 'kx', 'loc',  'naptr', 'nsec',
+'rrsig', 'sshfp'
+];
 
-var record_types =[ 'a', '', 'dname', 'cname', 'mx', 'ns', 'ptr',
-'srv', 'txt', 'a6', 'afsdb', 'cert', 'ds',
-'key', 'kx', 'loc',  'naptr', 'nsec',
-'rrsig', 'sshfp'];
+that.init = function() {
+
+that.facet_init();
+
+that.table = IPA.table_widget({
+name: 'search',
+label: IPA.metadata.objects[that.entity_name].label,
+entity_name: that.entity_name
+});
+
+for (var i=0; ithat.columns.length; i++) {
+var column = that.columns[i];
+that.table.add_column(column);
+}
+
+that.table.select_changed = function() {
+that.select_changed();
+};
+
+