From 9b81c91e316b08c8fbcb3446fa4f900da8ee8bb8 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 18 Sep 2013 11:39:37 -0700 Subject: [PATCH] CLOUDSTACK-4700: UI > Instances > Reset VM action > if the template from which vm is created is password-enabled, pop up "Password hsa been reset to xxxxxxx" dialog. --- ui/scripts/instances.js | 32 ++++++++++++++++++----------- ui/scripts/ui/widgets/detailView.js | 8 +++++--- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index 20d3d9a606d..cf8aca5b485 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -605,6 +605,12 @@ }, notification: function(args) { return 'Reset VM'; + }, + complete: function(args) { + if (args.password != null && args.password.length > 0) + return 'Password has been reset to ' + args.password; + else + return null; } }, @@ -613,24 +619,26 @@ url: createURL("restoreVirtualMachine&virtualmachineid=" + args.context.instances[0].id), dataType: "json", async: true, - success: function(json) { - var item = json.restorevmresponse; - args.response.success({ - data: item - }); + success: function(json) { + var jid = json.restorevmresponse.jobid; + args.response.success({ + _custom: { + jobId: jid, + getUpdatedItem: function(json) { + return json.queryasyncjobresultresponse.jobresult.virtualmachine; + }, + getActionFilter: function() { + return vmActionfilter; + } + } + }); } }); }, notification: { - poll: function(args) { - args.complete({ - data: { - state: 'Stopped' - } - }); - } + poll: pollAsyncJobResult } }, diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js index 3a59d4104f9..0e975e41706 100644 --- a/ui/scripts/ui/widgets/detailView.js +++ b/ui/scripts/ui/widgets/detailView.js @@ -223,9 +223,11 @@ } if (messages.complete) { - cloudStack.dialog.notice({ - message: messages.complete(args2.data) - }); + if( messages.complete(args2.data) != null && messages.complete(args2.data).length > 0) { + cloudStack.dialog.notice({ + message: messages.complete(args2.data) + }); + } } if (additional && additional.complete) additional.complete($.extend(true, args, { $detailView: $detailView