mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	List view: support external link actions
Support actions which point to an external link, primary to support
launching the console proxy.
Example:
listView: {
  actions: {
    viewConsole: {
      label: 'label.view.console',
      action: {
        externalLink: {
          url: function(args) {
            return clientConsoleUrl + '?cmd=access&vm=' + args.context.vpcTierInstances[0].id;
          },
          title: function(args) {
            return args.context.vpcTierInstances[0].id.substr(0,8);
          },
          width: 820,
          height: 640
        }
      }
    }
  }
}
			
			
This commit is contained in:
		
							parent
							
								
									629556c708
								
							
						
					
					
						commit
						310b24b285
					
				| @ -66,7 +66,26 @@ | |||||||
|           listViewArgs.activeSection |           listViewArgs.activeSection | ||||||
|         ] = [$instanceRow.data('jsonObj')]; |         ] = [$instanceRow.data('jsonObj')]; | ||||||
| 
 | 
 | ||||||
|         if (action.custom && !action.noAdd) { |         var externalLinkAction = action.externalLink; | ||||||
|  |         if (externalLinkAction) { | ||||||
|  |           // Show popup immediately, do not proceed through normal action process
 | ||||||
|  |           window.open( | ||||||
|  |             // URL
 | ||||||
|  |             externalLinkAction.url({ | ||||||
|  |               context: context | ||||||
|  |             }), | ||||||
|  | 
 | ||||||
|  |             // Title
 | ||||||
|  |             externalLinkAction.title({ | ||||||
|  |               context: context | ||||||
|  |             }), | ||||||
|  | 
 | ||||||
|  |             // Window options
 | ||||||
|  |             'menubar=0,resizable=0,' | ||||||
|  |               + 'width=' + externalLinkAction.width + ',' | ||||||
|  |               + 'height=' + externalLinkAction.height | ||||||
|  |           ); | ||||||
|  |         } else if (action.custom && !action.noAdd) { | ||||||
|           action.custom({ |           action.custom({ | ||||||
|             data: data, |             data: data, | ||||||
|             ref: options.ref, |             ref: options.ref, | ||||||
| @ -254,7 +273,8 @@ | |||||||
|         listViewArgs.activeSection |         listViewArgs.activeSection | ||||||
|       ] = [$instanceRow.data('jsonObj')]; |       ] = [$instanceRow.data('jsonObj')]; | ||||||
| 
 | 
 | ||||||
|       if (!args.action.createForm && |       if (!args.action.action.externalLink && | ||||||
|  |           !args.action.createForm && | ||||||
|           args.action.addRow != 'true' && |           args.action.addRow != 'true' && | ||||||
|           !action.custom && !action.uiCustom) |           !action.custom && !action.uiCustom) | ||||||
|         cloudStack.dialog.confirm({ |         cloudStack.dialog.confirm({ | ||||||
| @ -274,7 +294,26 @@ | |||||||
|         var isHeader = args.action.isHeader; |         var isHeader = args.action.isHeader; | ||||||
|         var createFormContext = $.extend({}, context); |         var createFormContext = $.extend({}, context); | ||||||
| 
 | 
 | ||||||
|         if (args.action.createForm) { |         var externalLinkAction = action.externalLink; | ||||||
|  |         if (externalLinkAction) { | ||||||
|  |           // Show popup immediately, do not proceed through normal action process
 | ||||||
|  |           window.open( | ||||||
|  |             // URL
 | ||||||
|  |             externalLinkAction.url({ | ||||||
|  |               context: context | ||||||
|  |             }), | ||||||
|  | 
 | ||||||
|  |             // Title
 | ||||||
|  |             externalLinkAction.title({ | ||||||
|  |               context: context | ||||||
|  |             }), | ||||||
|  | 
 | ||||||
|  |             // Window options
 | ||||||
|  |             'menubar=0,resizable=0,' | ||||||
|  |               + 'width=' + externalLinkAction.width + ',' | ||||||
|  |               + 'height=' + externalLinkAction.height | ||||||
|  |           ); | ||||||
|  |         } else if (args.action.createForm) { | ||||||
|           cloudStack.dialog.createForm({ |           cloudStack.dialog.createForm({ | ||||||
|             form: args.action.createForm, |             form: args.action.createForm, | ||||||
|             after: function(args) { |             after: function(args) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user