Reviewed and Tested by Yu Xin Huo.
On 8/20/2014 5:48 PM, Wen Wang wrote:
V1 -> V2:
1)Change the create button from "Creating..." to "Create" when error
occurs.
2)Disable input when creating a new network.
When network is generating, if the network is not up, we bring the
network up first, then we create the network. During the time we bring
the network up(less than 10s), we change the text as well as the layout
of the button to indicate this process is working.
Signed-off-by: Wen Wang <wenwang(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.network.js | 10 ++++++++++
ui/pages/i18n.json.tmpl | 1 +
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index c8f983f..4ee7249 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -207,6 +207,11 @@ kimchi.initNetworkCreation = function() {
network.persistent = result.persistent;
kimchi.addNetworkItem(network);
$("#networkConfig").dialog("close");
+ }, function(data) {
+ kimchi.message.error(data.responseJSON.reason);
+ $("#networkFormOk").button("enable");
+ $("#networkName").removeAttr("readonly");
+ $("#networkFormOk span").text(i18n.KCHAPI6005M);
});
});
});
@@ -270,6 +275,9 @@ kimchi.openNetworkDialog = function(okCallback) {
title : i18n.KCHNET6003M
});
$("#networkFormOk").on("click", function() {
+ $("#networkFormOk").button("disable");
+ $("#networkName").prop("readonly", "readonly");
+ $("#networkFormOk span").text(i18n.KCHAPI6008M);
okCallback();
});
$("#enableVlan").on("click", function() {
@@ -337,6 +345,8 @@ kimchi.cleanNetworkDialog = function() {
$("#networkDestinationLabel").text($("#networkDestinationID
li:first-child").text());
$("#networkFormOk").off("click");
$("#networkFormOk").button("disable");
+ $("#networkFormOk span").text(i18n.KCHAPI6005M);
+ $("#networkName").removeAttr("readonly");
$("#networkVlanID").toggle(false);
$("#labelNetworkVlanID").toggle(false);
$("#enableVlan").prop("checked", false);
diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
index ccfb081..cbcd077 100644
--- a/ui/pages/i18n.json.tmpl
+++ b/ui/pages/i18n.json.tmpl
@@ -49,6 +49,7 @@
"KCHAPI6005M": "$_("Create")",
"KCHAPI6006M": "$_("Warning")",
"KCHAPI6007M": "$_("Save")",
+ "KCHAPI6008M": "$_("Creating...")",
"KCHGRD6001M": "$_("Loading...")",
"KCHGRD6002M": "$_("An error occurs while checking for packages
update.")",