mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-04 00:02:37 +01:00
bug 12551
-Add configure swift dialog, which shows when swift is enabled in config -Enable support for toolbar actions in list view status 12551: resolved fixed
This commit is contained in:
parent
82d76dadc8
commit
3a1202cf96
@ -2047,7 +2047,8 @@ div.toolbar div.button.search:hover {
|
||||
div.toolbar div.button.add,
|
||||
div.toolbar div.button.refresh,
|
||||
div.toolbar div.button.add,
|
||||
div.toolbar div.button.main-action {
|
||||
div.toolbar div.button.main-action,
|
||||
.toolbar div.button.header-action {
|
||||
/*+placement:shift 0px 5px;*/
|
||||
position: relative;
|
||||
left: 0px;
|
||||
@ -2077,7 +2078,8 @@ div.toolbar div.button.main-action {
|
||||
|
||||
div.toolbar div.button.add:hover,
|
||||
div.toolbar div.button.refresh:hover,
|
||||
div.toolbar div.button.main-action:hover {
|
||||
div.toolbar div.button.main-action:hover,
|
||||
.toolbar div.button.header-action:hover {
|
||||
background-position: 0 -132px;
|
||||
border-left: 1px solid #585D60;
|
||||
}
|
||||
@ -7056,12 +7058,14 @@ div.panel.ui-dialog div.list-view div.fixed-header {
|
||||
}
|
||||
|
||||
.create .icon,
|
||||
.createTemplate .icon {
|
||||
.createTemplate .icon,
|
||||
.enableSwift .icon {
|
||||
background-position: -69px -63px;
|
||||
}
|
||||
|
||||
.create:hover .icon,
|
||||
.createTemplate:hover .icon {
|
||||
.createTemplate:hover .icon,
|
||||
.enableSwift:hover .icon {
|
||||
background-position: -69px -645px;
|
||||
}
|
||||
|
||||
|
||||
@ -3012,6 +3012,60 @@
|
||||
}
|
||||
},
|
||||
|
||||
// Enable swift
|
||||
enableSwift: {
|
||||
label: 'Configure Swift',
|
||||
isHeader: true,
|
||||
preFilter: function(args) {
|
||||
var swiftEnabled = false;
|
||||
|
||||
$.ajax({
|
||||
url: createURL('listConfigurations'),
|
||||
data: {
|
||||
name: 'swift.enable'
|
||||
},
|
||||
async: false,
|
||||
success: function(json) {
|
||||
swiftEnabled = json.listconfigurationsresponse.configuration[0].value == 'true' ?
|
||||
true : false;
|
||||
}
|
||||
});
|
||||
|
||||
return swiftEnabled;
|
||||
},
|
||||
messages: {
|
||||
notification: function(args) {
|
||||
return 'Enabled Swift support';
|
||||
}
|
||||
},
|
||||
createForm: {
|
||||
desc: 'Please fill in the following information to enable support for Swift',
|
||||
fields: {
|
||||
url: { label: 'URL', validation: { required: true } },
|
||||
account: { label: 'Account' },
|
||||
username: { label: 'Username' },
|
||||
key: { label: 'Key' }
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('addSwift'),
|
||||
data: {
|
||||
url: args.data.url,
|
||||
account: args.data.account,
|
||||
username: args.data.username,
|
||||
key: args.data.key
|
||||
},
|
||||
success: function(json) {
|
||||
args.response.success();
|
||||
},
|
||||
error: function(json) {
|
||||
args.response.error(parseXMLHttpResponse(json));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
enable: {
|
||||
label: 'Enable zone',
|
||||
messages: {
|
||||
@ -7602,7 +7656,7 @@
|
||||
//action filters (begin)
|
||||
var zoneActionfilter = function(args) {
|
||||
var jsonObj = args.context.item;
|
||||
var allowedActions = [];
|
||||
var allowedActions = ['enableSwift'];
|
||||
allowedActions.push("edit");
|
||||
if(jsonObj.allocationstate == "Disabled")
|
||||
allowedActions.push("enable");
|
||||
|
||||
@ -278,6 +278,7 @@
|
||||
performAction();
|
||||
else {
|
||||
var addRow = args.action.addRow == "false" ? false : true;
|
||||
var isHeader = args.action.isHeader;
|
||||
var createFormContext = $.extend({}, context);
|
||||
|
||||
if (args.action.createForm) {
|
||||
@ -285,26 +286,35 @@
|
||||
form: args.action.createForm,
|
||||
after: function(args) {
|
||||
var $newItem;
|
||||
if (addRow != false) {
|
||||
$newItem = $listView.listView('prependItem', {
|
||||
data: [
|
||||
$.extend(args.data, {
|
||||
state: 'Creating',
|
||||
status: 'Creating',
|
||||
allocationstate: 'Creating'
|
||||
})
|
||||
]
|
||||
|
||||
if (!isHeader) {
|
||||
if (addRow != false) {
|
||||
$newItem = $listView.listView('prependItem', {
|
||||
data: [
|
||||
$.extend(args.data, {
|
||||
state: 'Creating',
|
||||
status: 'Creating',
|
||||
allocationstate: 'Creating'
|
||||
})
|
||||
]
|
||||
});
|
||||
} else {
|
||||
$newItem = $instanceRow;
|
||||
}
|
||||
|
||||
performAction(args.data, {
|
||||
ref: args.ref,
|
||||
context: createFormContext,
|
||||
$item: $newItem,
|
||||
$form: args.$form
|
||||
});
|
||||
} else {
|
||||
$newItem = $instanceRow;
|
||||
performAction(args.data, {
|
||||
ref: args.ref,
|
||||
context: createFormContext,
|
||||
$form: args.$form
|
||||
});
|
||||
}
|
||||
|
||||
performAction(args.data, {
|
||||
ref: args.ref,
|
||||
context: createFormContext,
|
||||
$item: $newItem,
|
||||
$form: args.$form
|
||||
});
|
||||
},
|
||||
ref: listViewArgs.ref,
|
||||
context: createFormContext
|
||||
@ -314,7 +324,7 @@
|
||||
message: messages.confirm(messageArgs),
|
||||
action: function() {
|
||||
var $newItem;
|
||||
if (addRow != false) {
|
||||
if (addRow != false && !action.isHeader) {
|
||||
$newItem = $listView.listView('prependItem', {
|
||||
data: [
|
||||
$.extend(args.data, {
|
||||
@ -324,6 +334,8 @@
|
||||
})
|
||||
]
|
||||
});
|
||||
} else if (action.isHeader) {
|
||||
$newItem = $('<div>');
|
||||
} else {
|
||||
$newItem = $instanceRow;
|
||||
}
|
||||
@ -602,7 +614,7 @@
|
||||
var allowedActions = options.allowedActions;
|
||||
|
||||
$.each(actions, function(actionName, action) {
|
||||
if (actionName == 'add')
|
||||
if (actionName == 'add' || action.isHeader)
|
||||
return true;
|
||||
|
||||
if (action.type == 'radio') {
|
||||
@ -943,7 +955,7 @@
|
||||
$table.dataTable(null, { noSelect: uiCustom });
|
||||
|
||||
setTimeout(function() {
|
||||
$table.dataTable('refresh');
|
||||
$table.dataTable('refresh');
|
||||
});
|
||||
},
|
||||
error: function(args) {
|
||||
@ -1104,6 +1116,28 @@
|
||||
);
|
||||
}
|
||||
|
||||
// List view header actions
|
||||
if (listViewData.actions) {
|
||||
$.each(listViewData.actions, function(actionName, action) {
|
||||
if (!action.isHeader || (
|
||||
action.preFilter && !action.preFilter({
|
||||
context: listViewData.context ? listViewData.context : cloudStack.context
|
||||
})
|
||||
)) return true;
|
||||
|
||||
$toolbar
|
||||
.append(
|
||||
$('<div>')
|
||||
.addClass('button action main-action reduced-hide').addClass(actionName)
|
||||
.data('list-view-action-id', actionName)
|
||||
.append($('<span>').addClass('icon'))
|
||||
.append($('<span>').html(action.label))
|
||||
);
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
$('<tbody>').appendTo($table);
|
||||
|
||||
createHeader(listViewData.fields, $table, actions, { reorder: reorder });
|
||||
@ -1208,7 +1242,7 @@
|
||||
infScrollTimer = setTimeout(function() {
|
||||
var loadMoreData = $listView.scrollTop() >= ($table.height() - $listView.height()) - $listView.height() / 4;
|
||||
var context = $listView.data('view-args').context;
|
||||
|
||||
|
||||
if (loadMoreData) {
|
||||
page = page + 1;
|
||||
|
||||
@ -1292,7 +1326,8 @@
|
||||
// Action icons
|
||||
if (!$target.closest('td.actions').hasClass('reorder') &&
|
||||
($target.closest('td.actions').size() ||
|
||||
$target.closest('.action.add').size())) {
|
||||
$target.closest('.action.add').size() ||
|
||||
$target.closest('.action.main-action').size())) {
|
||||
var actionID = $target.closest('.action').data('list-view-action-id');
|
||||
var $tr;
|
||||
|
||||
@ -1300,7 +1335,8 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($target.closest('.action.add').size()) {
|
||||
if ($target.closest('.action.add').size() ||
|
||||
$target.closest('.action.main-action').size()) {
|
||||
$tr = $target.closest('div.list-view').find('tr:first'); // Dummy row
|
||||
} else {
|
||||
$tr = $target.closest('tr');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user