You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/11/28 15:13:45 UTC

[2/7] git commit: updated refs/heads/master to 2ae3e0c

Add select template dropdown when reinstall VM


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6e5a05d5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6e5a05d5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6e5a05d5

Branch: refs/heads/master
Commit: 6e5a05d5c97f96afa656596016fb11df6c222dfb
Parents: 7a77ddc
Author: Wei Zhou <w....@tech.leaseweb.com>
Authored: Fri Jan 16 13:53:19 2015 +0100
Committer: Wei Zhou <w....@tech.leaseweb.com>
Committed: Sat Nov 21 21:36:09 2015 +0100

----------------------------------------------------------------------
 ui/scripts/instances.js | 48 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e5a05d5/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index 5096297..56d05a0 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -858,10 +858,56 @@
                                     return null;
                             }
                         },
+                        createForm: {
+                            title: 'label.reinstall.vm',
+                            desc: 'message.reinstall.vm',
+                            isWarning: true,
+                            fields: {
+                                template: {
+                                    label: 'label.select.a.template',
+                                    select: function(args) {
+                                        var data = {
+                                            templatefilter: 'featured'
+                                        };
+                                        $.ajax({
+                                            url: createURL('listTemplates'),
+                                            data: data,
+                                            async: false,
+                                            success: function(json) {
+                                                var templates = json.listtemplatesresponse.template;
+                                                var items = [{
+                                                    id: -1,
+                                                    description: ''
+                                                }];
+                                                $(templates).each(function() {
+                                                    items.push({
+                                                        id: this.id,
+                                                        description: this.name
+                                                    });
+                                                });
+                                                args.response.success({
+                                                    data: items
+                                                });
+                                            }
+                                        });
+                                    }
+                                }
+                            }
+                        },
 
                         action: function(args) {
+                            var dataObj = {
+                                virtualmachineid: args.context.instances[0].id
+                            };
+                            if (args.data.template != -1) {
+                                $.extend(dataObj, {
+                                    templateid: args.data.template
+                                });
+                            }
+
                             $.ajax({
-                                url: createURL("restoreVirtualMachine&virtualmachineid=" + args.context.instances[0].id),
+                                url: createURL("restoreVirtualMachine"),
+                                data: dataObj,
                                 dataType: "json",
                                 async: true,
                                 success: function(json) {