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:
Brian Federle 2012-08-07 15:43:02 -07:00
parent 629556c708
commit 310b24b285

View File

@ -66,7 +66,26 @@
listViewArgs.activeSection
] = [$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({
data: data,
ref: options.ref,
@ -254,7 +273,8 @@
listViewArgs.activeSection
] = [$instanceRow.data('jsonObj')];
if (!args.action.createForm &&
if (!args.action.action.externalLink &&
!args.action.createForm &&
args.action.addRow != 'true' &&
!action.custom && !action.uiCustom)
cloudStack.dialog.confirm({
@ -274,7 +294,26 @@
var isHeader = args.action.isHeader;
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({
form: args.action.createForm,
after: function(args) {