On 03/13/2014 02:02 AM, Hongliang Wang wrote:
On 03/13/2014 12:11 PM, Adam King wrote:
> 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 <rak(a)linux.vnet.ibm.com>
> ---
> ui/js/src/kimchi.grid.js | 2 +-
> ui/js/src/kimchi.repository_edit_main.js | 17 ++---------------
> ui/pages/repository-add.html.tmpl | 2 +-
> ui/pages/repository-edit.html.tmpl | 22 ----------------------
> 4 files changed, 4 insertions(+), 39 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];
Cleanup
> $('<td><div class="cell-text-wrapper"'
+
> (field['makeTitle'] === true
> ? ' title="' + value + '"'
> 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;
> - }
> - });
> + formData["is_mirror"] =
(formData["is_mirror"]=="true") ?
> true : false;
> + formData["gpgcheck"] = (formData["gpgkey"])? true :
false;
>
> 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"
Regarding to API.md, this is_mirror field is optional so I checked
neither of them by default to provide an "untouched" option for the user.
> />
> <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">
OK. I'll include "enable/disable" in the grid.
> <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">
@Paulo & Aline, the relationship between GPGCheck and GPGKey.
From rpm doc:
/|gpgcheck|/
It can be '1 'or '0'. This tells yum whether or not to perform a GPG
signature verification on packages obtained from this repository.
/|gpgkey|/
A URL that points to a file containing ASCII GPG key for the
repository. This option is used if yum needs a public key to verify
the packages and the required key has not been imported into the RPM
database. If this option is placed yum will automatically import the
key specified by the URL. yum will ask for confirmation before
installing the key unless you specify /|assumeyes|/. Also you can
list multiple URLs in the same way as it was done for baseurl.
(
http://docs.fedoraproject.org/en-US/Fedora/14/html/Software_Management_Gu...)
So yes, they are different things.
We can not associate one with other.
> <label
> for="repository-edit-gpgkey-textbox">$_("GPG
Key")</label>
> </div>
> <div class="repository-edit-wrapper-controls">
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel