You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by we...@apache.org on 2013/10/30 15:25:34 UTC

[2/3] git commit: updated refs/heads/4.2 to 4b8d636

CLOUDSTACK-4831: allow create network by domain admin


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

Branch: refs/heads/4.2
Commit: 46e4cfd3c3c79e3bc3ec4a49c4ebae6c32240db3
Parents: 0d12e3e
Author: Wei Zhou <w....@leaseweb.com>
Authored: Wed Oct 30 15:12:32 2013 +0100
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Wed Oct 30 15:12:32 2013 +0100

----------------------------------------------------------------------
 ui/scripts/network.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46e4cfd3/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 53b78a6..8f548cd 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -542,6 +542,48 @@
                                     },
                                     networkDomain: {
                                         label: 'label.network.domain'
+                                    },
+                                    domain: {
+                                        label: 'label.domain',
+                                        select: function(args) {
+                                            var items = [];
+                                            $.ajax({
+                                                url: createURL("listDomains&listAll=true"),
+                                                dataType: "json",
+                                                async: false,
+                                                success: function(json) {
+                                                    var items = [];
+                                                    items.push({
+                                                        id: "",
+                                                        description: ""
+                                                    });
+                                                    var domainObjs = json.listdomainsresponse.domain;
+                                                    $(domainObjs).each(function() {
+                                                        items.push({
+                                                            id: this.id,
+                                                            description: this.path
+                                                        });
+                                                    });
+                                                    args.response.success({
+                                                        data: items
+                                                    });
+                                                }
+                                            });
+                                            args.$select.change(function() {
+                                                var $form = $(this).closest('form');
+                                                if ($(this).val() == "") {
+                                                    $form.find('.form-item[rel=account]').hide();
+                                                } else {
+                                                    $form.find('.form-item[rel=account]').css('display', 'inline-block');
+                                                }
+                                            });
+                                        },
+                                    },
+                                    account: {
+                                        label: 'label.account',
+                                        validation: {
+                                            required: true
+                                        },
                                     }
                                 }
                             },
@@ -581,6 +623,19 @@
                                     });
                                 }
 
+                                if (args.$form.find('.form-item[rel=domain]').css("display") != "none") {
+                                    if (args.data.domain != null && args.data.domain.length > 0) {
+                                        $.extend(dataObj, {
+                                            domainid: args.data.domain
+                                        });
+                                    }
+                                    if (args.data.account != null && args.data.account.length > 0) {
+                                        $.extend(dataObj, {
+                                            account: args.data.account
+                                        });
+                                    }
+                                }
+
                                 $.ajax({
                                     url: createURL('createNetwork'),
                                     data: dataObj,