incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [14/50] [abbrv] git commit: CS-15317: Fix operations with accounts on the Project tab after making another account project owner.
Date Fri, 27 Jul 2012 21:01:32 GMT
CS-15317: Fix operations with accounts on the Project tab after making another account project
owner.


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

Branch: refs/heads/vpc
Commit: 7fbd612d69a230cf594cc290858ba409113dea7f
Parents: 7fc3adb
Author: olgasmola <olya.smola@gmail.com>
Authored: Fri Jul 27 18:23:07 2012 +0300
Committer: olgasmola <olya.smola@gmail.com>
Committed: Fri Jul 27 18:23:07 2012 +0300

----------------------------------------------------------------------
 ui/scripts/projects.js              |   31 +++++++++++++++++-
 ui/scripts/ui/widgets/detailView.js |   50 +++++++++++++++++++++---------
 2 files changed, 64 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7fbd612d/ui/scripts/projects.js
----------------------------------------------------------------------
diff --git a/ui/scripts/projects.js b/ui/scripts/projects.js
index cbbb4ce..293a2b0 100644
--- a/ui/scripts/projects.js
+++ b/ui/scripts/projects.js
@@ -15,7 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 (function(cloudStack) {
-  var getProjectAdmin;
+  var getProjectAdmin, selectedProjectObj;
   cloudStack.projects = {
     requireInvitation: function(args) {
       return g_capabilities.projectinviterequired;
@@ -518,6 +518,9 @@
                     onComplete: function(){
                       setTimeout(function() {
                         $(window).trigger('cloudStack.fullRefresh');
+                        if (isUser()) {
+                          $(window).trigger('cloudStack.detailsRefresh');
+                        }
                       }, 500);
                     }
                   },
@@ -659,6 +662,30 @@
           },
 
           detailView: {
+            updateContext: function (args) {
+              var project;
+              var projectID = args.context.projects[0].id;
+              var url = 'listProjects';
+              if (isDomainAdmin()) {
+                url += '&domainid=' + args.context.users[0].domainid;
+              }
+              $.ajax({
+                url: createURL(url),
+                data: {
+                  listAll: true,
+                  id: projectID
+                },
+                async: false,
+                success: function(json) {
+                  project = json.listprojectsresponse.project[0]; // override project after
update owner
+                }
+              });
+              selectedProjectObj = project;
+
+              return {
+                projects: [project]
+              };
+            },
             actions: {
               edit: {
                 label: 'label.edit',
@@ -782,7 +809,7 @@
             },
 
             tabFilter: function(args) {
-              var project = args.context.projects[0];
+              var project = selectedProjectObj;
               var projectOwner = project.account;
               var currentAccount = args.context.users[0].account;
               var hiddenTabs = [];

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7fbd612d/ui/scripts/ui/widgets/detailView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js
index b792bcf..eb39b80 100644
--- a/ui/scripts/ui/widgets/detailView.js
+++ b/ui/scripts/ui/widgets/detailView.js
@@ -1038,7 +1038,7 @@
     );
   };
 
-  var replaceTabs = function($detailView, $newTabs, tabs, options) {
+  var replaceTabs = function($detailView, tabs, options) {
     var $detailViewElems = $detailView.find('ul.ui-tabs-nav, .detail-group');
     $detailView.tabs('destroy');
     $detailViewElems.remove();
@@ -1057,24 +1057,31 @@
       );
   };
 
-  $.fn.detailView = function(args) {
+  $.fn.detailView = function(args, options) {
     var $detailView = this;
+    
+    if (options == 'refresh') {
+      var $tabs = replaceTabs($detailView, args.tabs, {
+        context: args.context,
+        tabFilter: args.tabFilter
+      });
+    } else {
+      $detailView.addClass('detail-view');
+      $detailView.data('view-args', args);
 
-    $detailView.addClass('detail-view');
-    $detailView.data('view-args', args);
-
-    if (args.$listViewRow) {
-      $detailView.data('list-view-row', args.$listViewRow);
-    }
+      if (args.$listViewRow) {
+        $detailView.data('list-view-row', args.$listViewRow);
+      }
 
-    // Create toolbar
-    var $toolbar = makeToolbar().appendTo($detailView);
+      // Create toolbar
+      var $toolbar = makeToolbar().appendTo($detailView);
 
-    // Create tabs
-    var $tabs = makeTabs($detailView, args.tabs, {
-      context: args.context,
-      tabFilter: args.tabFilter
-    }).appendTo($detailView);
+      // Create tabs
+      var $tabs = makeTabs($detailView, args.tabs, {
+        context: args.context,
+        tabFilter: args.tabFilter
+      }).appendTo($detailView);
+    }
 
     $detailView.tabs();
 
@@ -1154,4 +1161,17 @@
 
     return true;
   });
+
+  // Detail view refresh handler
+  $(window).bind('cloudStack.detailsRefresh', function() {
+    var $detailView = $('.detail-view');
+
+    $detailView.each(function() {
+      var $detailView = $(this),
+      args = $detailView.data('view-args');
+
+      $detailView.detailView(args, 'refresh');
+    });
+  });
+
 }(window.jQuery, window.cloudStack, window._l));


Mime
View raw message