You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/04/25 20:08:55 UTC

[37/43] git commit: updated refs/heads/master to 5ce2890

detailView UI: Fix quickview actions not updating list view row


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

Branch: refs/heads/master
Commit: e5cea0204b36e3634e173fb7d510bc79ac40e478
Parents: 2be8368
Author: Brian Federle <br...@citrix.com>
Authored: Mon Apr 22 11:52:52 2013 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Mon Apr 22 11:52:52 2013 -0700

----------------------------------------------------------------------
 ui/scripts/ui/widgets/detailView.js |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e5cea020/ui/scripts/ui/widgets/detailView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js
index 4b520f9..0146b36 100644
--- a/ui/scripts/ui/widgets/detailView.js
+++ b/ui/scripts/ui/widgets/detailView.js
@@ -15,8 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 (function($, cloudStack, _l) {
-  var replaceListViewItem = function($detailView, newData) {
-    var $row = $detailView.data('list-view-row');
+  var replaceListViewItem = function($detailView, newData, options) {
+    var $row = $detailView ? $detailView.data('list-view-row') :
+      options.$row;
 
     if (!$row) return;
 
@@ -32,7 +33,9 @@
         $row: $row,
         data: $.extend(jsonObj, newData),
         after: function($newRow) {
-          $detailView.data('list-view-row', $newRow);
+          if ($detailView) {
+            $detailView.data('list-view-row', $newRow);
+          }
 
           setTimeout(function() {
             $('.data-table').dataTable('selectRow', $newRow.index());
@@ -42,11 +45,13 @@
     }
 
     // Refresh detail view context
-    $.extend(
-      $detailView.data('view-args').context[
-        $detailView.data('view-args').section
-      ][0], newData
-    );
+    if ($detailView) {
+      $.extend(
+        $detailView.data('view-args').context[
+          $detailView.data('view-args').section
+        ][0], newData
+      );
+    }
   };
 
   /**
@@ -125,6 +130,7 @@
               args = args ? args : {};
 
               var $item = args.$item;
+              var $row = $detailView.data('list-view-row');
 
               notification.desc = messages.notification(args.messageArgs);
               notification._custom = $.extend(args._custom ? args._custom : {}, {
@@ -140,11 +146,14 @@
                     viewArgs.onActionComplete();
                   }
 
-                  if (!$detailView.parents('html').size()) return;
+                  if (!$detailView.parents('html').size()) {
+                    replaceListViewItem(null, args.data, { $row: $row });
+                    return;
+                  }
 
+                  replaceListViewItem($detailView, args.data);
                   $loading.remove();
                   $detailView.removeClass('detail-view-loading-state');
-                  replaceListViewItem($detailView, args.data);
 
                   if (!noRefresh) {
                     updateTabContent(args.data);