From 4f5d3118482389c5557af7c431b937739c2a184b Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Wed, 3 Apr 2013 17:55:39 -0700 Subject: [PATCH] WIP - Implement/style NIC actions --- ui/css/cloudstack3.css | 25 +++++++++++++++++++++++++ ui/scripts/instances.js | 19 +++++++++++++++++++ ui/scripts/ui/widgets/detailView.js | 17 ++++++++++++++++- 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index a0b86025136..68050608cd7 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -2009,6 +2009,31 @@ div.detail-group.actions td { vertical-align: middle; } +.details.group-multiple div.detail-group.actions { + float: right; + max-width: 75%; + height: 23px; + position: relative; + margin: -15px 0 -5px; +} + +.details.group-multiple div.detail-group.actions .detail-actions { + display: block; + height: 35px; + padding: 0; +} + +.details.group-multiple div.detail-group.actions .detail-actions td { +} + +.details.group-multiple div.detail-group.actions .detail-actions .action { + float: right; + /*+placement:shift 2px 7px;*/ + position: relative; + left: 2px; + top: 7px; +} + .detail-group table td.detail-actions { width: 59%; height: 26px; diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index ddb562251e8..d4cc57f57b9 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -1281,6 +1281,25 @@ }); }, notification: { poll: pollAsyncJobResult } + }, + + // Remove NIC/Network from VM + remove: { + label: 'label.action.delete.network', + messages: { + confirm: function(args) { + return 'message.action.delete.network'; + }, + notification: function(args) { + return 'label.action.delete.network'; + } + }, + action: function(args) { + args.response.success(); + }, + notification: { + poll: function(args) { args.complete(); } + } } }, fields: [ diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js index 427010af0a8..ddb62f02fde 100644 --- a/ui/scripts/ui/widgets/detailView.js +++ b/ui/scripts/ui/widgets/detailView.js @@ -698,7 +698,10 @@ $.each(actions, function(key, value) { if ($.inArray(key, allowedActions) == -1 || - (key == 'edit' && options.compact)) return true; + (options.ignoreAddAction && key == 'add') || + (key == 'edit' && options.compact)) { + return true; + } var $action = $('
') .addClass('action').addClass(key) @@ -1073,6 +1076,18 @@ }) ); } + + // Add action bar + if (tabData.actions) { + var $actions = makeActionButtons(tabData.actions, { + actionFilter: tabData.actions.actionFilter, + data: item, + context: $detailView.data('view-args').context, + ignoreAddAction: true + }); + + $fieldContent.find('th').append($actions); + } }); // Add item action