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/12/13 10:28:09 UTC

git commit: updated refs/heads/4.3 to 5cec27c

Updated Branches:
  refs/heads/4.3 11c7fad53 -> 5cec27c85


CLOUDSTACK-5481: fix ui bug when regular user add isolated network


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

Branch: refs/heads/4.3
Commit: 5cec27c858456875bf9fd64f5546eb0e2ba0fdff
Parents: 11c7fad
Author: Wei Zhou <w....@leaseweb.com>
Authored: Fri Dec 13 10:28:00 2013 +0100
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Fri Dec 13 10:28:00 2013 +0100

----------------------------------------------------------------------
 ui/scripts/network.js | 70 +++++++++++++++++++++++++++++-----------------
 1 file changed, 44 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5cec27c8/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 6539452..84932e0 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -539,35 +539,47 @@
                                     },
                                     domain: {
                                         label: 'label.domain',
+                                        isHidden: function(args) {
+                                            if (isAdmin() || isDomainAdmin())
+                                                return false;
+                                            else
+                                                return true;
+                                        },
                                         select: function(args) {
-                                            $.ajax({
-                                                url: createURL("listDomains&listAll=true"),
-                                                success: function(json) {
-                                                    var items = [];
-                                                    items.push({
-                                                        id: "",
-                                                        description: ""
-                                                    });
-                                                    var domainObjs = json.listdomainsresponse.domain;
-                                                    $(domainObjs).each(function() {
+                                            if (isAdmin() || isDomainAdmin()) {
+                                                $.ajax({
+                                                    url: createURL("listDomains&listAll=true"),
+                                                    success: function(json) {
+                                                        var items = [];
                                                         items.push({
-                                                            id: this.id,
-                                                            description: this.path
+                                                            id: "",
+                                                            description: ""
                                                         });
-                                                    });
-                                                    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');
-                                                }
-                                            });
+                                                        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');
+                                                    }
+                                                });
+                                            } else {
+                                                args.response.success({
+                                                data: null
+                                                });
+                                            }
                                         },
                                     },
                                     account: {
@@ -575,6 +587,12 @@
                                         validation: {
                                             required: true
                                         },
+                                        isHidden: function(args) {
+                                            if (isAdmin() || isDomainAdmin())
+                                                return false;
+                                            else
+                                                return true;
+                                        }
                                     }
                                 }
                             },