[Kimchi-devel] [PATCH] [Kimchi 2/2] Fixed issue #1076 s390x : n/w shows twice same interface while adding for template

Lucio Correia luciojhc at linux.vnet.ibm.com
Tue Nov 8 11:09:30 UTC 2016


On 08/11/2016 06:34, rajgupta at linux.vnet.ibm.com wrote:
> From: Rajat Gupta <rajat.triumph at gmail.com>
>
> fixed issue #1076 s390x : while editing template and adding an interface,
> drop down for Network should show unique interfaces no repeats.
>
> Signed-off-by: Rajat Gupta <rajat.triumph at gmail.com>
> ---
>  ui/js/src/kimchi.template_edit_main.js | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
> index 9992c93..5ec2b64 100644
> --- a/ui/js/src/kimchi.template_edit_main.js
> +++ b/ui/js/src/kimchi.template_edit_main.js
> @@ -558,8 +558,9 @@ kimchi.template_edit_main = function() {
>                          for (var i = 0; i < origmacvtapNetworks.length; i++) {
>                              if (networkName === origmacvtapNetworks[i].name) {
>                                  networkOptions += '<option selected="selected">' + origmacvtapNetworks[i].name + '</option>';
> +                            }else{
> +                                networkOptions += '<option>' + origmacvtapNetworks[i].name + '</option>';
>                              }
> -                            networkOptions += '<option>' + origmacvtapNetworks[i].name + '</option>';
>                          }
>                          $('select', '#form-template-interface-s390x #networkID' + networkItemNum + ' span.network').append(networkOptions);
>
> @@ -576,8 +577,9 @@ kimchi.template_edit_main = function() {
>                          for (var i = 0; i < origovsNetworks.length; i++) {
>                              if (networkName === origovsNetworks[i]) {
>                                  networkOptions += '<option selected="selected">' + origovsNetworks[i] + '</option>';
> +                            }else{
> +                                networkOptions += '<option>' + origovsNetworks[i] + '</option>';
>                              }
> -                            networkOptions += '<option>' + origovsNetworks[i] + '</option>';
>                          }
>                          $('select', '#form-template-interface-s390x #networkID' + networkItemNum + ' span.network').append(networkOptions);
>
> @@ -591,8 +593,7 @@ kimchi.template_edit_main = function() {
>                          for (var i = 0; i < result.length; i++) {
>                              if (networkName === result[i].name) {
>                                  networkOptions += '<option selected="selected">' + result[i].name + '</option>';
> -                            }
> -                            if (result[i].state === "active" && networkName !== result[i].name) {
> +                            }else if (result[i].state === "active" && networkName !== result[i].name) {

You don't need the second test (networkName !== result[i].name) since 
"else" implies it.


>                                  networkOptions += '<option>' + result[i].name + '</option>';
>                              }
>                          }
>


-- 
Lucio Correia
Software Engineer
IBM LTC Brazil




More information about the Kimchi-devel mailing list