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.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f4066b51 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f4066b51 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f4066b51 Branch: refs/heads/4.2 Commit: f4066b51fbbeed3101e017050535f2796a3f0667 Parents: e49f14b Author: Jessica Wang <jessicaw...@apache.org> Authored: Wed Sep 18 11:39:37 2013 -0700 Committer: Jessica Wang <jessicaw...@apache.org> Committed: Wed Sep 18 11:41:30 2013 -0700 ---------------------------------------------------------------------- ui/scripts/instances.js | 32 ++++++++++++++++++++------------ ui/scripts/ui/widgets/detailView.js | 8 +++++--- 2 files changed, 25 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4066b51/ui/scripts/instances.js ---------------------------------------------------------------------- diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index 20d3d9a..cf8aca5 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 } }, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4066b51/ui/scripts/ui/widgets/detailView.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js index 3a59d41..0e975e4 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