[Kimchi-devel] [PATCH V2 2/2] Bug Fix #282: Handle toggleNetwork error returns
Adam King
rak at linux.vnet.ibm.com
Tue Mar 4 04:11:22 UTC 2014
Reviewed-by: Adam King <rak at linux.vnet.ibm.com>
Tested-by: Adam King <rak at linux.vnet.ibm.com>
On 02/28/2014 08:14 AM, Rodrigo Trujillo wrote:
> This patch restores the UI to previous state if function toggleNetwork
> returns an error, when user tries to start/stop a network.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
> ui/js/src/kimchi.network.js | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
> index 7cedc01..d68697a 100644
> --- a/ui/js/src/kimchi.network.js
> +++ b/ui/js/src/kimchi.network.js
> @@ -93,6 +93,12 @@ kimchi.addNetworkActions = function(network) {
> $("[nwAct='start']", menu).removeClass("ui-state-disabled");
> $("[nwAct='stop']", menu).removeClass("hide-action-item");
> $(".network-state", $("#" + network.name)).switchClass("nw-loading", "up");
> + }, function(err) {
> + $(".network-state", $("#" + network.name)).switchClass("nw-loading","down");
> + $("[nwAct='start']", menu).removeClass("ui-state-disabled");
> + $("[nwAct='delete']", menu).removeClass("ui-state-disabled");
> + $(":first-child", $("[nwAct='delete']", menu)).removeAttr("disabled");
> + kimchi.message.error(err.responseJSON.reason);
> });
> } else if ($(evt.currentTarget).attr("nwAct") === "stop") {
> $(".network-state", $("#" + network.name)).switchClass("up", "nw-loading");
> @@ -104,6 +110,10 @@ kimchi.addNetworkActions = function(network) {
> $("[nwAct='delete']", menu).removeClass("ui-state-disabled");
> $(":first-child", $("[nwAct='delete']", menu)).removeAttr("disabled");
> $(".network-state", $("#" + network.name)).switchClass("nw-loading", "down");
> + }, function(err) {
> + $(".network-state", $("#" + network.name)).switchClass("nw-loading", "up");
> + $("[nwAct='stop']", menu).removeClass("ui-state-disabled");
> + kimchi.message.error(err.responseJSON.reason);
> });
> } else if ($(evt.currentTarget).attr("nwAct") === "delete") {
> kimchi.confirm({
--
Adam King <rak at linux.vnet.ibm.com>
IBM CSI
More information about the Kimchi-devel
mailing list