https://fedorahosted.org/freeipa/ticket/1319
From 2b9b2fefaf250c7d58e35a9d0e9ca33bd865743e Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Tue, 14 Jun 2011 12:34:56 -0400
Subject: [PATCH] dns multiple records show multiple records that share the
 same dnsname

---
 install/ui/dns.js                        |   34 ++++++----
 install/ui/test/data/dnsrecord_find.json |  109 ++++++++++++++++--------------
 2 files changed, 78 insertions(+), 65 deletions(-)

diff --git a/install/ui/dns.js b/install/ui/dns.js
index 55feaa034df471cde43894693f5cea17b78afd97..1d6b81813904d1604bccf5a76781686766f2269a 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -421,28 +421,33 @@ IPA.records_facet = function(spec) {
         that.set_title(this.container, title);
     };
 
-    that.get_record = function(result, index) {
-        var record = {};
 
+    that.get_records = function(result) {
+        var idnsname;
         if (result.idnsname) {
-            record.idnsname = result.idnsname[0];
+            idnsname = result.idnsname[0];
         } else {
-            record.idnsname = result.dn.split(',')[0].split('=')[1];
+            idnsname = result.dn.split(',')[0].split('=')[1];
         }
 
+        var records = [];
         for (var i=0; i<record_types.length; i++){
             var type = record_types[i];
-            var data = result[type+'record'];
-            if (data) {
-                record.type = type;
-                record.data = data[0];
-                break;
+            var data = result[type+'record'] || [];
+            for (var j =0 ; j < data.length; j+=1){
+                var record = {
+                    idnsname: idnsname,
+                    type : type,
+                    data : data[j]
+                };
+                records.unshift(record);
             }
         }
 
-        return record;
+        return records;
     };
 
+
     that.refresh = function() {
 
         function on_success(data, text_status, xhr) {
@@ -451,8 +456,12 @@ IPA.records_facet = function(spec) {
 
             var result = data.result.result;
             for (var i = 0; i<result.length; i++) {
-                var record = that.get_record(result[i], 0);
-                that.table.add_record(record);
+                var records = that.get_records(result[i]);
+
+                for (var j =0; j < records.length; j +=1){
+                    var record = records[j];
+                    that.table.add_record(record);
+                }
             }
 
             var summary = $('span[name=summary]', that.table.tfoot);
@@ -509,4 +518,3 @@ IPA.records_facet = function(spec) {
 
     return that;
 };
-
diff --git a/install/ui/test/data/dnsrecord_find.json b/install/ui/test/data/dnsrecord_find.json
index 1d64b3abb1deb5bc74ae620c18c3239ff195bc79..fa103d1098a039927dc8b66500fcf60349de26a2 100644
--- a/install/ui/test/data/dnsrecord_find.json
+++ b/install/ui/test/data/dnsrecord_find.json
@@ -1,110 +1,115 @@
 {
     "error": null,
-    "id": 10,
+    "id": null,
     "result": {
         "count": 11,
         "result": [
             {
-                "dn": "idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+                "dn": "idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
                 "idnsname": [
                     "@"
                 ],
                 "nsrecord": [
-                    "ipa.ayoung.boston.devel.redhat.com."
+                    "server15.ayoung.boston.devel.redhat.com."
                 ]
             },
             {
-                "arecord": [
-                    "192.168.122.81"
-                ],
-                "dn": "idnsname=ipa,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
-                "idnsname": [
-                    "ipa"
-                ]
-            },
-            {
-                "dn": "idnsname=_ldap._tcp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
-                "idnsname": [
-                    "_ldap._tcp"
-                ],
-                "srvrecord": [
-                    "0 100 389 ipa"
-                ]
-            },
-            {
-                "dn": "idnsname=_kerberos,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+                "dn": "idnsname=_kerberos,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
                 "idnsname": [
                     "_kerberos"
                 ],
                 "txtrecord": [
-                    "AYOUNG.BOSTON.DEVEL.REDHAT.COM"
+                    "SERVER15.AYOUNG.BOSTON.DEVEL.REDHAT.COM"
                 ]
             },
             {
-                "dn": "idnsname=_kerberos._tcp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
-                "idnsname": [
-                    "_kerberos._tcp"
-                ],
-                "srvrecord": [
-                    "0 100 88 ipa"
-                ]
-            },
-            {
-                "dn": "idnsname=_kerberos._udp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
-                "idnsname": [
-                    "_kerberos._udp"
-                ],
-                "srvrecord": [
-                    "0 100 88 ipa"
-                ]
-            },
-            {
-                "dn": "idnsname=_kerberos-master._tcp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+                "dn": "idnsname=_kerberos-master._tcp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
                 "idnsname": [
                     "_kerberos-master._tcp"
                 ],
                 "srvrecord": [
-                    "0 100 88 ipa"
+                    "0 100 88 server15"
                 ]
             },
             {
-                "dn": "idnsname=_kerberos-master._udp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+                "dn": "idnsname=_kerberos-master._udp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
                 "idnsname": [
                     "_kerberos-master._udp"
                 ],
                 "srvrecord": [
-                    "0 100 88 ipa"
+                    "0 100 88 server15"
                 ]
             },
             {
-                "dn": "idnsname=_kpasswd._tcp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+                "dn": "idnsname=_kerberos._tcp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+                "idnsname": [
+                    "_kerberos._tcp"
+                ],
+                "srvrecord": [
+                    "0 100 88 server15"
+                ]
+            },
+            {
+                "dn": "idnsname=_kerberos._udp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+                "idnsname": [
+                    "_kerberos._udp"
+                ],
+                "srvrecord": [
+                    "0 100 88 server15"
+                ]
+            },
+            {
+                "dn": "idnsname=_kpasswd._tcp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
                 "idnsname": [
                     "_kpasswd._tcp"
                 ],
                 "srvrecord": [
-                    "0 100 464 ipa"
+                    "0 100 464 server15"
                 ]
             },
             {
-                "dn": "idnsname=_kpasswd._udp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+                "dn": "idnsname=_kpasswd._udp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
                 "idnsname": [
                     "_kpasswd._udp"
                 ],
                 "srvrecord": [
-                    "0 100 464 ipa"
+                    "0 100 464 server15"
                 ]
             },
             {
-                "dn": "idnsname=_ntp._udp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+                "dn": "idnsname=_ldap._tcp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+                "idnsname": [
+                    "_ldap._tcp"
+                ],
+                "srvrecord": [
+                    "0 100 389 server15"
+                ]
+            },
+            {
+                "dn": "idnsname=_ntp._udp,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
                 "idnsname": [
                     "_ntp._udp"
                 ],
                 "srvrecord": [
-                    "0 100 123 ipa"
+                    "0 100 123 server15"
+                ]
+            },
+            {
+                "aaaarecord": [
+                    "00::11",
+                    "00::112"
+                ],
+                "arecord": [
+                    "192.168.122.28",
+                    "1.2.3.4"
+                ],
+                "dn": "idnsname=server15,idnsname=ayoung.boston.devel.redhat.com,cn=dns,dc=server15,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+                "idnsname": [
+                    "server15"
                 ]
             }
         ],
         "summary": null,
         "truncated": false
     }
-}
\ No newline at end of file
+}
-- 
1.7.5.2

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

Reply via email to