[Kimchi-devel] [PATCH] Addendum to [PATCH v2 0/4] Host Repository Management Support
Hongliang Wang
hlwang at linux.vnet.ibm.com
Thu Mar 13 02:35:43 UTC 2014
On 03/13/2014 07:53 AM, 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.
Yes. I believe enable/disable a repository is one of the basic
requirements for repository management.
@Aline & Paulo, please take a look at it.
>
> Signed-off-by: Adam King <rak at linux.vnet.ibm.com>
> ---
> 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)) {
> delete formData[p];
> }
> }
> @@ -61,6 +61,7 @@ kimchi.repository_add_main = function() {
> formData[f] = false;
> break;
> default:
> + formData[f] = false;
> 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;
> - }
> - });
> + 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" />
> <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">
More information about the Kimchi-devel
mailing list