<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 03/13/2014 12:14 PM, Adam King
      wrote:<br>
    </div>
    <blockquote cite="mid:5321309C.8060903@linux.vnet.ibm.com"
      type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">On 03/12/2014 11:24 PM, Hongliang
        Wang wrote:<br>
      </div>
      <blockquote cite="mid:532124F2.1020208@linux.vnet.ibm.com"
        type="cite">
        <meta content="text/html; charset=ISO-8859-1"
          http-equiv="Content-Type">
        <div class="moz-cite-prefix">On 03/13/2014 07:53 AM, Adam King
          wrote:<br>
        </div>
        <blockquote
          cite="mid:1394668383-29552-1-git-send-email-rak@linux.vnet.ibm.com"
          type="cite">
          <pre wrap="">This patch addendum addresses the remaining issues with Repository management
UI except providing the ability to enable/disable a repository.
Reviewing API.md I found that "enabled" is not a valid parameter as input to
the PUT method of a repository. We need to add enable/disable actions to the
menu, and invoke the appropriate POST action on the selected repo.

Signed-off-by: Adam King <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:rak@linux.vnet.ibm.com">&lt;rak@linux.vnet.ibm.com&gt;</a>
---
 ui/js/src/kimchi.grid.js                 |  2 +-
 ui/js/src/kimchi.repository_add_main.js  |  3 ++-
 ui/js/src/kimchi.repository_edit_main.js | 17 ++---------------
 ui/pages/repository-add.html.tmpl        |  2 +-
 ui/pages/repository-edit.html.tmpl       | 22 ----------------------
 5 files changed, 6 insertions(+), 40 deletions(-)

diff --git a/ui/js/src/kimchi.grid.js b/ui/js/src/kimchi.grid.js
index 215d6ea..4cc7807 100644
--- a/ui/js/src/kimchi.grid.js
+++ b/ui/js/src/kimchi.grid.js
@@ -158,7 +158,7 @@ kimchi.widget.Grid = function(params) {
             var rowNode = $('&lt;tr&gt;&lt;/tr&gt;').appendTo(tbody);
             $.each(fields, function(fi, field) {
                 var fieldName = field['name'];
-                var value = row[fieldName];
+                var value = row[fieldName]==null ? '' : row[fieldName];
                 $('&lt;td&gt;&lt;div class="cell-text-wrapper"' +
                      (field['makeTitle'] === true
                          ? ' title="' + value + '"'
diff --git a/ui/js/src/kimchi.repository_add_main.js b/ui/js/src/kimchi.repository_add_main.js
index 75b785e..1e57214 100644
--- a/ui/js/src/kimchi.repository_add_main.js
+++ b/ui/js/src/kimchi.repository_add_main.js
@@ -47,7 +47,7 @@ kimchi.repository_add_main = function() {

         var formData = $(addForm).serializeObject();
         for(var p in formData) {
-            if(formData[p] == '') {
+            if((formData[p] == '') || (formData[p] == null)) {</pre>
        </blockquote>
        Value of &lt;input type="text"&gt; will <b>always be</b> the
        empty string '', other than null. Checking for null is
        unnecessary here.<br>
      </blockquote>
      I was trying to get rid of some nulls that were appearing in the
      object. Turned out they were coming form the backend, and I forgot
      <br>
      to come back and clean up. Fixed in v2 of the addendum.<br>
    </blockquote>
    OK<br>
    <blockquote cite="mid:5321309C.8060903@linux.vnet.ibm.com"
      type="cite">
      <blockquote cite="mid:532124F2.1020208@linux.vnet.ibm.com"
        type="cite">
        <blockquote
          cite="mid:1394668383-29552-1-git-send-email-rak@linux.vnet.ibm.com"
          type="cite">
          <pre wrap="">                 delete formData[p];
             }
         }
@@ -61,6 +61,7 @@ kimchi.repository_add_main = function() {
                 formData[f] = false;
                 break;
             default:
</pre>
        </blockquote>
        <br>
        <blockquote
          cite="mid:1394668383-29552-1-git-send-email-rak@linux.vnet.ibm.com"
          type="cite">
          <pre wrap="">+                formData[f] = false;</pre>
        </blockquote>
        What's the purpose? This field is to be deleted in next line.<br>
      </blockquote>
      Same as above:<br>
      I was trying to get rid of some nulls that were appearing in the
      object. Turned out they were coming form the backend, and I forgot
      <br>
      to come back and clean up. Fixed in v2 of the addendum.<br>
    </blockquote>
    OK<br>
    <blockquote cite="mid:5321309C.8060903@linux.vnet.ibm.com"
      type="cite">
      <blockquote cite="mid:532124F2.1020208@linux.vnet.ibm.com"
        type="cite">
        <blockquote
          cite="mid:1394668383-29552-1-git-send-email-rak@linux.vnet.ibm.com"
          type="cite">
          <pre wrap="">                 delete formData[f];
                 break;
             }
diff --git a/ui/js/src/kimchi.repository_edit_main.js b/ui/js/src/kimchi.repository_edit_main.js
index 0ab008e..6083327 100644
--- a/ui/js/src/kimchi.repository_edit_main.js
+++ b/ui/js/src/kimchi.repository_edit_main.js
@@ -47,24 +47,11 @@ kimchi.repository_edit_main = function() {
         });
     });

-    var booleanFields = ['is_mirror', 'gpgcheck'];
-
     var editRepository = function(event) {
         var formData = $(editForm).serializeObject();

-        $(booleanFields).each(function(i, f) {
-            switch(formData[f]) {
-            case 'true':
-                formData[f] = true;
-                break;
-            case 'false':
-                formData[f] = false;
-                break;
-            default:
-                delete formData[f];
-                break;
-            }
-        });</pre>
        </blockquote>
        <br>
        <blockquote
          cite="mid:1394668383-29552-1-git-send-email-rak@linux.vnet.ibm.com"
          type="cite">
          <pre wrap="">+        formData["is_mirror"] = (formData["is_mirror"]=="true") ? true : false;
+        formData["gpgcheck"] = (formData["gpgkey"])? true : false;</pre>
        </blockquote>
        Leave it as it was. Unnecessary to change. If there are new
        Boolean fields added, we can simply add the field names in the
        array an no need to write new lines.<br>
      </blockquote>
      This is actually intentional. gpgcheck is now calculated based on
      gpgkey. Its not simply read from the form input anymore.<br>
    </blockquote>
    As we discussed last time, these 2 fields seem mean different
    things. GPGCheck is for signature, and GPGKey is for public key.<br>
    @Paulo &amp; Aline, could you make a detailed explanation of the 2
    fields about their relationship?<br>
    <blockquote cite="mid:5321309C.8060903@linux.vnet.ibm.com"
      type="cite">
      <blockquote cite="mid:532124F2.1020208@linux.vnet.ibm.com"
        type="cite">
        <blockquote
          cite="mid:1394668383-29552-1-git-send-email-rak@linux.vnet.ibm.com"
          type="cite">
          <pre wrap="">         kimchi.updateRepository(kimchi.selectedRepository, formData, function() {
             kimchi.topic('kimchi/repositoryUpdated').publish();
diff --git a/ui/pages/repository-add.html.tmpl b/ui/pages/repository-add.html.tmpl
index a170f1d..4a97fd3 100644
--- a/ui/pages/repository-add.html.tmpl
+++ b/ui/pages/repository-add.html.tmpl
@@ -62,7 +62,7 @@
                     &lt;div class="textbox-wrapper"&gt;
                         &lt;input type="radio" id="isMirrorRadioTrue" name="is_mirror" value="true" /&gt;
                         &lt;label for="isMirrorRadioTrue"&gt;$_("Yes")&lt;/label&gt;
-                        &lt;input type="radio" id="isMirrorRadioFalse" name="is_mirror" value="false" /&gt;
+                        &lt;input type="radio" id="isMirrorRadioFalse" checked="checked" name="is_mirror" value="false" /&gt;
                         &lt;label for="isMirrorRadioFalse"&gt;$_("No")&lt;/label&gt;
                     &lt;/div&gt;
                 &lt;/div&gt;
diff --git a/ui/pages/repository-edit.html.tmpl b/ui/pages/repository-edit.html.tmpl
index 9adf0a1..d6baf2f 100644
--- a/ui/pages/repository-edit.html.tmpl
+++ b/ui/pages/repository-edit.html.tmpl
@@ -48,17 +48,6 @@
                 &lt;/div&gt;
                 &lt;div&gt;
                     &lt;div class="repository-edit-wrapper-label"&gt;
-                        &lt;label&gt;$_("Enabled")&lt;/label&gt;
-                    &lt;/div&gt;
-                    &lt;div class="repository-edit-wrapper-controls"&gt;
-                        &lt;input id="repository-edit-enabled-radio-true" name="enabled" type="radio" value="true" disabled="disabled" /&gt;
-                        &lt;label for="repository-edit-enabled-radio-true"&gt;$_("Yes")&lt;/label&gt;
-                        &lt;input id="repository-edit-enabled-radio-false" name="enabled" type="radio" value="false" disabled="disabled" /&gt;
-                        &lt;label for="repository-edit-enabled-radio-false"&gt;$_("No")&lt;/label&gt;
-                    &lt;/div&gt;
-                &lt;/div&gt;
-                &lt;div&gt;
-                    &lt;div class="repository-edit-wrapper-label"&gt;
                         &lt;label for="repository-edit-baseurl-textbox"&gt;$_("Base URL")&lt;/label&gt;
                     &lt;/div&gt;
                     &lt;div class="repository-edit-wrapper-controls"&gt;
@@ -88,17 +77,6 @@
                 &lt;/div&gt;
                 &lt;div&gt;
                     &lt;div class="repository-edit-wrapper-label"&gt;
-                        &lt;label&gt;$_("GPG Check")&lt;/label&gt;
-                    &lt;/div&gt;
-                    &lt;div class="repository-edit-wrapper-controls"&gt;
-                        &lt;input id="repository-edit-gpgcheck-radio-true" name="gpgcheck" type="radio" value="true" /&gt;
-                        &lt;label for="repository-edit-gpgcheck-radio-true"&gt;$_("Yes")&lt;/label&gt;
-                        &lt;input id="repository-edit-gpgcheck-radio-false" name="gpgcheck" type="radio" value="false" /&gt;
-                        &lt;label for="repository-edit-gpgcheck-radio-false"&gt;$_("No")&lt;/label&gt;
-                    &lt;/div&gt;
-                &lt;/div&gt;
-                &lt;div&gt;
-                    &lt;div class="repository-edit-wrapper-label"&gt;
                         &lt;label for="repository-edit-gpgkey-textbox"&gt;$_("GPG Key")&lt;/label&gt;
                     &lt;/div&gt;
                     &lt;div class="repository-edit-wrapper-controls"&gt;
</pre>
        </blockquote>
        <br>
      </blockquote>
      <br>
      <br>
      <pre class="moz-signature" cols="72">-- 
Adam King <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:rak@linux.vnet.ibm.com">&lt;rak@linux.vnet.ibm.com&gt;</a>
IBM CSI</pre>
    </blockquote>
    <br>
  </body>
</html>