cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [2/7] git commit: updated refs/heads/master to 2ae3e0c
Date Sat, 28 Nov 2015 14:13:45 GMT
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.zhou@tech.leaseweb.com>
Authored: Fri Jan 16 13:53:19 2015 +0100
Committer: Wei Zhou <w.zhou@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) {


Mime
View raw message