<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<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"><rak@linux.vnet.ibm.com></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 = $('<tr></tr>').appendTo(tbody);
$.each(fields, function(fi, field) {
var fieldName = field['name'];
- var value = row[fieldName];
+ var value = row[fieldName]==null ? '' : row[fieldName];
$('<td><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 <input type="text"> 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 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 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 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 @@
<div class="textbox-wrapper">
<input type="radio" id="isMirrorRadioTrue" name="is_mirror" value="true" />
<label for="isMirrorRadioTrue">$_("Yes")</label>
- <input type="radio" id="isMirrorRadioFalse" name="is_mirror" value="false" />
+ <input type="radio" id="isMirrorRadioFalse" checked="checked" name="is_mirror" value="false" />
<label for="isMirrorRadioFalse">$_("No")</label>
</div>
</div>
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 @@
</div>
<div>
<div class="repository-edit-wrapper-label">
- <label>$_("Enabled")</label>
- </div>
- <div class="repository-edit-wrapper-controls">
- <input id="repository-edit-enabled-radio-true" name="enabled" type="radio" value="true" disabled="disabled" />
- <label for="repository-edit-enabled-radio-true">$_("Yes")</label>
- <input id="repository-edit-enabled-radio-false" name="enabled" type="radio" value="false" disabled="disabled" />
- <label for="repository-edit-enabled-radio-false">$_("No")</label>
- </div>
- </div>
- <div>
- <div class="repository-edit-wrapper-label">
<label for="repository-edit-baseurl-textbox">$_("Base URL")</label>
</div>
<div class="repository-edit-wrapper-controls">
@@ -88,17 +77,6 @@
</div>
<div>
<div class="repository-edit-wrapper-label">
- <label>$_("GPG Check")</label>
- </div>
- <div class="repository-edit-wrapper-controls">
- <input id="repository-edit-gpgcheck-radio-true" name="gpgcheck" type="radio" value="true" />
- <label for="repository-edit-gpgcheck-radio-true">$_("Yes")</label>
- <input id="repository-edit-gpgcheck-radio-false" name="gpgcheck" type="radio" value="false" />
- <label for="repository-edit-gpgcheck-radio-false">$_("No")</label>
- </div>
- </div>
- <div>
- <div class="repository-edit-wrapper-label">
<label for="repository-edit-gpgkey-textbox">$_("GPG Key")</label>
</div>
<div class="repository-edit-wrapper-controls">
</pre>
</blockquote>
<br>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Adam King <a class="moz-txt-link-rfc2396E" href="mailto:rak@linux.vnet.ibm.com"><rak@linux.vnet.ibm.com></a>
IBM CSI</pre>
</body>
</html>