You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/06/10 02:53:51 UTC

[02/50] [abbrv] git commit: updated refs/heads/vmsync to aaa16af

List view widget: Support 'listView' selection for actions


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

Branch: refs/heads/vmsync
Commit: 88a62ab890346c3fe5fe0963dcda92cca1560d47
Parents: 5fa1ad5
Author: Brian Federle <br...@citrix.com>
Authored: Wed Jun 5 16:20:05 2013 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Wed Jun 5 16:20:05 2013 -0700

----------------------------------------------------------------------
 ui/scripts/ui/widgets/listView.js | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88a62ab8/ui/scripts/ui/widgets/listView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js
index d68f91f..ba4d288 100644
--- a/ui/scripts/ui/widgets/listView.js
+++ b/ui/scripts/ui/widgets/listView.js
@@ -25,6 +25,7 @@
       var messages = args.action ? args.action.messages : {};
       var preAction = args.action ? args.action.preAction : {};
       var action = args.action ? args.action.action : {};
+      var needsRefresh = args.action.needsRefresh;
       var section;
       var data = {
         id: $instanceRow.data('list-view-item-id'),
@@ -142,6 +143,12 @@
             $item: $instanceRow
           });
         } else {
+          if (needsRefresh) {
+            var $loading = $('<div>').addClass('loading-overlay');
+            
+            $listView.prepend($loading);
+          }
+          
           var actionArgs = {
             data: data,
             ref: options.ref,
@@ -206,6 +213,15 @@
                                                 $instanceRow.data('json-obj'),
                                                 actionFilter);
                         }
+
+                        if (needsRefresh) {
+                          if ($listView.closest('.detail-view').size()) {
+                            $('.detail-view:last .button.refresh').click();
+                          } else {                            
+                            $loading.remove();
+                            $listView.listView('refresh');
+                          }
+                        }
                       }
 
                       if (additional && additional.complete)
@@ -293,7 +309,8 @@
       if (!args.action.action.externalLink &&
           !args.action.createForm &&
           args.action.addRow != 'true' &&
-          !action.custom && !action.uiCustom) {
+          !action.custom && !action.uiCustom &&
+          !args.action.listView) {
         cloudStack.dialog.confirm({
           message: messages.confirm(messageArgs),
           action: function() {
@@ -306,6 +323,14 @@
         });
       } else if (action.custom || action.uiCustom) {
         performAction();
+      } else if (args.action.listView) {
+        cloudStack.dialog.listView({
+          context: context,
+          listView: args.action.listView,
+          after: function(args) {
+            performAction(null, { context: args.context });
+          }
+        });
       } else {
         var addRow = args.action.addRow == "false" ? false : true;
         var isHeader = args.action.isHeader;