mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Better handling for list view header actions
This commit is contained in:
		
							parent
							
								
									093d37ddf9
								
							
						
					
					
						commit
						e30c346017
					
				| @ -162,12 +162,17 @@ | ||||
|                         message: messages.complete(args.data) | ||||
|                       }); | ||||
|                     } | ||||
| 
 | ||||
|                     if (options.complete) { | ||||
|                       options.complete(args); | ||||
|                     } | ||||
|                   }, | ||||
| 
 | ||||
|                   {}, | ||||
| 
 | ||||
|                   // Error
 | ||||
|                   function(args) { | ||||
|                     if (!isHeader) { | ||||
|                       if ($instanceRow.data('list-view-new-item')) { | ||||
|                         // For create forms
 | ||||
|                         $instanceRow.remove(); | ||||
| @ -182,13 +187,22 @@ | ||||
|                         ); | ||||
|                       } | ||||
|                     }                  | ||||
| 
 | ||||
|                     if (options.error) { | ||||
|                       options.error(args); | ||||
|                     } | ||||
|                   } | ||||
|                 ); | ||||
|               }, | ||||
|               error: function(message) { | ||||
|                 if (!isHeader) { | ||||
|                   if (($.isPlainObject(args.action.createForm) && args.action.addRow != 'false') || | ||||
|                       (!args.action.createForm && args.action.addRow == 'true')) { | ||||
|                     $instanceRow.remove();                   | ||||
|                   } | ||||
|                 } | ||||
| 
 | ||||
|                 if (options.error) options.error(message); | ||||
| 
 | ||||
|                 if (message) cloudStack.dialog.notice({ message: message }); | ||||
|               } | ||||
| @ -262,11 +276,21 @@ | ||||
|                   $form: args.$form | ||||
|                 }); | ||||
|               } else { | ||||
|                 var $loading = $('<div>').addClass('loading-overlay'); | ||||
| 
 | ||||
|                 $loading.appendTo($listView); | ||||
|                 performAction(args.data, { | ||||
|                   ref: args.ref, | ||||
|                   context: createFormContext, | ||||
|                   $form: args.$form, | ||||
|                   isHeader: isHeader | ||||
|                   isHeader: isHeader, | ||||
|                   complete: function(args) { | ||||
|                     $loading.remove(); | ||||
|                     $listView.listView('refresh'); | ||||
|                   }, | ||||
|                   error: function(args) { | ||||
|                     $loading.remove(); | ||||
|                   } | ||||
|                 }); | ||||
|               } | ||||
|             }, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user