[Kimchi-devel] [PATCH V2] Fix Add Network window
Rodrigo Trujillo
rodrigo.trujillo at linux.vnet.ibm.com
Wed Feb 26 14:02:06 UTC 2014
VLans and Interfaces must only be available for selection if network
type Bridge is selected. This restriction was not implemented in the UI.
This patch fixes this problem.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
ui/js/src/kimchi.network.js | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index faf1285..0f8575b 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -210,11 +210,27 @@ kimchi.openNetworkDialog = function(okCallback) {
$("#networkConfig").dialog("open");
};
+kimchi.enableBridgeOptions = function(enable) {
+ $("#enableVlan").prop("disabled", !enable);
+ $("#networkInterface").prop("disabled", !enable);
+
+ if (!enable) {
+ $("#enableVlan").attr("checked", false);
+ $("#networkVlanID").prop("disabled", true);
+ $("#networkVlanID").val("");
+ $("#networkInterface").val("");
+ } else if (!$("#networkInterface").val()){
+ $("#networkInterface").prop("selectedIndex", 0);
+ }
+};
+
kimchi.setDefaultNetworkType = function(isInterfaceAvail) {
$("#networkTypeBri").prop("checked", isInterfaceAvail);
$("#networkTypeBri").prop("disabled", !isInterfaceAvail);
- $("#networkInterface").prop("disabled", !isInterfaceAvail);
$("#networkTypeNat").prop("checked", !isInterfaceAvail);
+ if (!isInterfaceAvail) {
+ kimchi.enableBridgeOptions(false);
+ }
};
kimchi.getNetworkDialogValues = function() {
@@ -250,12 +266,15 @@ kimchi.setupNetworkFormEvent = function() {
});
$("#networkTypeIso").on("click", function(event) {
$("#networkInterface").prop("disabled", true);
+ kimchi.enableBridgeOptions(false);
});
$("#networkTypeNat").on("click", function(event) {
$("#networkInterface").prop("disabled", true);
+ kimchi.enableBridgeOptions(false);
});
$("#networkTypeBri").on("click", function(event) {
$("#networkInterface").prop("disabled", false);
+ kimchi.enableBridgeOptions(true);
});
};
--
1.8.5.3
More information about the Kimchi-devel
mailing list