[Kimchi-devel] [PATCH 2/2] Bug #265 fix: Avoid remove 'default' network
Rodrigo Trujillo
rodrigo.trujillo at linux.vnet.ibm.com
Thu Dec 19 17:31:18 UTC 2013
This patch disables the "Remove" button if the network is the
'default'.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
ui/js/src/kimchi.network.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index f7b7eed..5b718a2 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -70,8 +70,8 @@ kimchi.getNetworkItemHtml = function(network) {
addrSpace : network.addrSpace,
startClass : network.state === "up" ? "hide-action-item" : "",
stopClass : network.state === "down" ? "hide-action-item" : "",
- deleteClass : network.state === "up" ? "ui-state-disabled" : "",
- deleteDisabled: network.state === "up" ? "disabled" : ""
+ deleteClass : (network.state === "up" || network.name === "default") ? "ui-state-disabled" : "",
+ deleteDisabled: (network.state === "up" || network.name === "default") ? "disabled" : ""
});
return networkItem;
};
@@ -98,8 +98,10 @@ kimchi.addNetworkActions = function(network) {
kimchi.toggleNetwork(network.name, false, function() {
$("[nwAct='start']", menu).removeClass("hide-action-item");
$("[nwAct='stop']", menu).addClass("hide-action-item");
- $("[nwAct='delete']", menu).removeClass("ui-state-disabled");
- $(":first-child", $("[nwAct='delete']", menu)).removeAttr("disabled");
+ if ("default" != network.name) {
+ $("[nwAct='delete']", menu).removeClass("ui-state-disabled");
+ $(":first-child", $("[nwAct='delete']", menu)).removeAttr("disabled");
+ }
$(".network-state", $("#" + network.name)).switchClass("up", "down");
});
} else if ($(evt.currentTarget).attr("nwAct") === "delete") {
--
1.8.1.4
More information about the Kimchi-devel
mailing list