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 2013/02/25 20:06:46 UTC
git commit: refs/heads/ui-multiple-nics - Implement view all behavior
for multi-items
Updated Branches:
refs/heads/ui-multiple-nics 4c0fd582d -> b652d2e4b
Implement view all behavior for multi-items
-Call viewAll() on click to open new panel with corresponding view
-Pass context of selected item (such as nic object) to panel
-Allow custom title for panel
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/b652d2e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/b652d2e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/b652d2e4
Branch: refs/heads/ui-multiple-nics
Commit: b652d2e4baacc764a85b88723f191e4c029334f3
Parents: 4c0fd58
Author: Brian Federle <br...@citrix.com>
Authored: Mon Feb 25 11:05:42 2013 -0800
Committer: Brian Federle <br...@citrix.com>
Committed: Mon Feb 25 11:05:42 2013 -0800
----------------------------------------------------------------------
ui/scripts/instances.js | 7 ++++++-
ui/scripts/ui/widgets/detailView.js | 23 ++++++++++++++++++-----
2 files changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b652d2e4/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index 5b448e3..8240581 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -1244,7 +1244,12 @@
],
viewAll: {
path: 'network.ipAddresses',
- attachTo: 'ipaddress'
+ attachTo: 'ipaddress',
+ title: function(args) {
+ var title = _l('label.menu.ipaddresses') + ' - ' + args.context.nics[0].name;
+
+ return title;
+ }
},
dataProvider: function(args) {
$.ajax({
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b652d2e4/ui/scripts/ui/widgets/detailView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js
index 69743a9..9a9ba02 100644
--- a/ui/scripts/ui/widgets/detailView.js
+++ b/ui/scripts/ui/widgets/detailView.js
@@ -587,7 +587,8 @@
var $listView;
var isCustom = $.isFunction(viewAllID.custom);
var updateContext = options.updateContext;
-
+ var customTitle = options.title;
+
if (isCustom) {
$browser.cloudBrowser('addPanel', {
title: _l(viewAllID.label),
@@ -644,7 +645,7 @@
// Make panel
var $panel = $browser.cloudBrowser('addPanel', {
- title: _l(listViewArgs.title),
+ title: customTitle ? customTitle({ context: context }) : _l(listViewArgs.title),
data: '',
noSelectPanel: true,
maximizeIfSelected: true,
@@ -970,7 +971,7 @@
var tabs = args.tabs[targetTabID];
var dataProvider = tabs.dataProvider;
var isMultiple = tabs.multiple || tabs.isMultiple;
- var viewAll = args.viewAll;
+ var viewAllArgs = args.viewAll;
var $detailView = $tabContent.closest('.detail-view');
var jsonObj = $detailView.data('view-args').jsonObj;
@@ -1024,6 +1025,8 @@
if (isMultiple) {
$(data).each(function() {
+ var item = this;
+
var $fieldContent = makeFieldContent(
$.extend(true, {}, tabs, {
id: targetTabID
@@ -1036,12 +1039,22 @@
).appendTo($tabContent);
if (tabData.viewAll) {
- $tabContent.find('tr')
+ $fieldContent.find('tr')
.filter('.' + tabData.viewAll.attachTo).find('td.value')
.append(
$('<div>').addClass('view-all').append(
$('<span>').html(_l('label.view.all'))
- )
+ ).click(function() {
+ viewAll(
+ tabData.viewAll.path,
+ {
+ updateContext: function(args) {
+ return { nics: [item] };
+ },
+ title: tabData.viewAll.title
+ }
+ );
+ })
);
}
});