[Kimchi-devel] [PATCH] Bugfix#426: When no interface available, creating network popup error

Aline Manera alinefm at linux.vnet.ibm.com
Wed Sep 17 00:07:23 UTC 2014


Hi Wen Wang,

Just a suggestion.
Maybe should be good to add a label with the message "No interfaces 
found" to warn the user why the "bridged"  option is disabled.

On 09/16/2014 07:59 AM, Wen Wang wrote:
> From: Wen Wang <wenwang at linux.vnet.ibm.com>
>
> This patch fix the the issue when creating a network that lack of
> interface options pops up errors
>
> Signed-off-by: Wen Wang <wenwang at linux.vnet.ibm.com>
> ---
>   ui/js/src/kimchi.network.js |    9 ++++-----
>   1 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
> index 4ee7249..7b0743f 100644
> --- a/ui/js/src/kimchi.network.js
> +++ b/ui/js/src/kimchi.network.js
> @@ -247,17 +247,16 @@ kimchi.openNetworkDialog = function(okCallback) {
>       kimchi.getInterfaces(function(result) {
>           var options = [];
>           $('#networkDestinationID').selectMenu();
> -        $("#networkDestinationID").on('click',function(){
> -        });
>           var nics = {};
>           for (var i = 0; i < result.length; i++) {
>               options.push({label:result[i].name,value:result[i].name});
>               nics[result[i].name] = result[i];
>           }
> -        $("#networkDestinationID").selectMenu("setData", options);
> +        result.length>0 && $("#networkDestinationID").selectMenu("setData", options);
>           onChange = function() {
>               $("#networkDestinationLabel").text($("#networkDestinationID li:first-child").text());
> -            if (nics[$("#networkDestinationLabel").text()].type === "bridge") {
> +            $("#networkDestinationID li:first-child").addClass("active");
> +            if (result.length>0 && nics[$("#networkDestinationLabel").text()].type === "bridge") {
>                   $("#enableVlan").prop("checked", false);
>                   $("#enableVlan").prop("disabled", true);
>                   $("#networkVlanID").val("");
> @@ -268,8 +267,8 @@ kimchi.openNetworkDialog = function(okCallback) {
>               }
>           };
>           $("#networkDestinationLabel").on("change", onChange);
> -        onChange();
>           kimchi.setDefaultNetworkType(result.length!==0);
> +        onChange();
>       });
>       $("#networkConfig").dialog({
>           title : i18n.KCHNET6003M




More information about the Kimchi-devel mailing list