From: Wen Wang <wenwang@linux.vnet.ibm.com>
V1 -> V2:
Add an indicator "(No interfaces found)" in "bridged" option under
Network tab when there exists no bridged interface.
This patch fix the the issue when creating a network that lack of
interface options pops up errors
Signed-off-by: Wen Wang <wenwang@linux.vnet.ibm.com>
---
ui/css/theme-default/network.css | 6 ++++++
ui/js/src/kimchi.network.js | 11 ++++++-----
ui/pages/tabs/network.html.tmpl | 9 +++++++--
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/ui/css/theme-default/network.css b/ui/css/theme-default/network.css
index 6f690ed..5d07468 100644
--- a/ui/css/theme-default/network.css
+++ b/ui/css/theme-default/network.css
@@ -170,6 +170,12 @@
height: 200px;
}
+.network-config .section-container .bridged-inline {
+ display: inline-block;
+ vertical-align: top;
+ max-width: 520px;
+}
+
.network-config .section-header {
font-weight: bold;
font-size: 14px;
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index 4ee7249..9e2e3aa 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
@@ -318,10 +317,12 @@ kimchi.setDefaultNetworkType = function(isInterfaceAvail) {
$("#networkTypeNat").prop("checked", !isInterfaceAvail);
if (!isInterfaceAvail) {
kimchi.enableBridgeOptions(false);
+ $("#networkBriDisabledLabel").prop("style","display");