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 2012/08/08 01:03:11 UTC
[7/7] git commit: List view: support external link actions
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
}
}
}
}
}
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/8630891c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/8630891c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/8630891c
Branch: refs/heads/master
Commit: 8630891c0755a985f9042a22d4f5c44812132aa0
Parents: a617ccc
Author: Brian Federle <br...@citrix.com>
Authored: Tue Aug 7 15:43:02 2012 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Tue Aug 7 15:58:57 2012 -0700
----------------------------------------------------------------------
ui/scripts/ui/widgets/listView.js | 45 +++++++++++++++++++++++++++++--
1 files changed, 42 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8630891c/ui/scripts/ui/widgets/listView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js
index 9497a8d..a601eac 100644
--- a/ui/scripts/ui/widgets/listView.js
+++ b/ui/scripts/ui/widgets/listView.js
@@ -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) {