[PATCH] [Kimchi] Bug fix: Inform user there is no interface available when creating a network

When there is no interface available, the user will not be able to create some networks so inform that to user using the existing drop down menu instead of a label message fixed in the dialog (which was displayed even though for network not requiring an interface). Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- ui/js/src/kimchi.network_add_main.js | 7 +++---- ui/pages/network-add.html.tmpl | 7 ++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ui/js/src/kimchi.network_add_main.js b/ui/js/src/kimchi.network_add_main.js index e1fdf13..c990e89 100644 --- a/ui/js/src/kimchi.network_add_main.js +++ b/ui/js/src/kimchi.network_add_main.js @@ -1,7 +1,7 @@ /* * Project Kimchi * - * Copyright IBM Corp, 2015-2016 + * Copyright IBM Corp, 2015-2017 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,9 +79,8 @@ kimchi.setDefaultNetworkType = function(isInterfaceAvail, bEdit) { if (!bEdit) { kimchi.enableBridgeOptions(false); } - $("#networkBriDisabledLabel").removeClass('hidden'); - } else { - $("#networkBriDisabledLabel").remove(); + $("#destinationList button").addClass("disabled"); + $("#networkDestinationID").attr("title", "No interface available"); } }; diff --git a/ui/pages/network-add.html.tmpl b/ui/pages/network-add.html.tmpl index 14373ff..47be6f3 100644 --- a/ui/pages/network-add.html.tmpl +++ b/ui/pages/network-add.html.tmpl @@ -1,7 +1,7 @@ #* * Project Kimchi * - * Copyright IBM Corp, 2015-2016 + * Copyright IBM Corp, 2015-2017 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,11 +46,8 @@ <option value="bridge">$_("Bridged: Virtual machines are connected through a network bridge")</option> </select> </div> - <div id="networkBriDisabledLabel" class="form-group hidden"> - <p>$_("(No interfaces found)")</p> - </div> <div id="bridgedContent"> - <div class="form-group"> + <div id="destinationList" class="form-group"> <label for="networkDestinationID">$_("Destination"): </label> <select id="networkDestinationID" data-size="5" class="selectpicker col-md-12 col-lg-12 form-control" data-none-selected-text="$_('Select an Interface')"> </select> -- 2.9.3

Reviewed-by: Daniel Barboza <danielhb@linux.vnet.ibm.com> On 03/27/2017 11:41 AM, Aline Manera wrote:
When there is no interface available, the user will not be able to create some networks so inform that to user using the existing drop down menu instead of a label message fixed in the dialog (which was displayed even though for network not requiring an interface).
Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- ui/js/src/kimchi.network_add_main.js | 7 +++---- ui/pages/network-add.html.tmpl | 7 ++----- 2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/ui/js/src/kimchi.network_add_main.js b/ui/js/src/kimchi.network_add_main.js index e1fdf13..c990e89 100644 --- a/ui/js/src/kimchi.network_add_main.js +++ b/ui/js/src/kimchi.network_add_main.js @@ -1,7 +1,7 @@ /* * Project Kimchi * - * Copyright IBM Corp, 2015-2016 + * Copyright IBM Corp, 2015-2017 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,9 +79,8 @@ kimchi.setDefaultNetworkType = function(isInterfaceAvail, bEdit) { if (!bEdit) { kimchi.enableBridgeOptions(false); } - $("#networkBriDisabledLabel").removeClass('hidden'); - } else { - $("#networkBriDisabledLabel").remove(); + $("#destinationList button").addClass("disabled"); + $("#networkDestinationID").attr("title", "No interface available"); } };
diff --git a/ui/pages/network-add.html.tmpl b/ui/pages/network-add.html.tmpl index 14373ff..47be6f3 100644 --- a/ui/pages/network-add.html.tmpl +++ b/ui/pages/network-add.html.tmpl @@ -1,7 +1,7 @@ #* * Project Kimchi * - * Copyright IBM Corp, 2015-2016 + * Copyright IBM Corp, 2015-2017 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,11 +46,8 @@ <option value="bridge">$_("Bridged: Virtual machines are connected through a network bridge")</option> </select> </div> - <div id="networkBriDisabledLabel" class="form-group hidden"> - <p>$_("(No interfaces found)")</p> - </div> <div id="bridgedContent"> - <div class="form-group"> + <div id="destinationList" class="form-group"> <label for="networkDestinationID">$_("Destination"): </label> <select id="networkDestinationID" data-size="5" class="selectpicker col-md-12 col-lg-12 form-control" data-none-selected-text="$_('Select an Interface')"> </select>
participants (2)
-
Aline Manera
-
Daniel Henrique Barboza