mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Better handling for list view header actions
This commit is contained in:
parent
093d37ddf9
commit
e30c346017
@ -162,34 +162,48 @@
|
|||||||
message: messages.complete(args.data)
|
message: messages.complete(args.data)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.complete) {
|
||||||
|
options.complete(args);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
{},
|
{},
|
||||||
|
|
||||||
// Error
|
// Error
|
||||||
function(args) {
|
function(args) {
|
||||||
if ($instanceRow.data('list-view-new-item')) {
|
if (!isHeader) {
|
||||||
// For create forms
|
if ($instanceRow.data('list-view-new-item')) {
|
||||||
$instanceRow.remove();
|
// For create forms
|
||||||
} else {
|
$instanceRow.remove();
|
||||||
// For standard actions
|
} else {
|
||||||
replaceItem(
|
// For standard actions
|
||||||
$instanceRow,
|
replaceItem(
|
||||||
$.extend($instanceRow.data('json-obj'), args.data),
|
$instanceRow,
|
||||||
args.actionFilter ?
|
$.extend($instanceRow.data('json-obj'), args.data),
|
||||||
args.actionFilter :
|
args.actionFilter ?
|
||||||
$instanceRow.data('list-view-action-filter')
|
args.actionFilter :
|
||||||
);
|
$instanceRow.data('list-view-action-filter')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.error) {
|
||||||
|
options.error(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
error: function(message) {
|
error: function(message) {
|
||||||
if (($.isPlainObject(args.action.createForm) && args.action.addRow != 'false') ||
|
if (!isHeader) {
|
||||||
(!args.action.createForm && args.action.addRow == 'true')) {
|
if (($.isPlainObject(args.action.createForm) && args.action.addRow != 'false') ||
|
||||||
$instanceRow.remove();
|
(!args.action.createForm && args.action.addRow == 'true')) {
|
||||||
|
$instanceRow.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.error) options.error(message);
|
||||||
|
|
||||||
if (message) cloudStack.dialog.notice({ message: message });
|
if (message) cloudStack.dialog.notice({ message: message });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,11 +276,21 @@
|
|||||||
$form: args.$form
|
$form: args.$form
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
var $loading = $('<div>').addClass('loading-overlay');
|
||||||
|
|
||||||
|
$loading.appendTo($listView);
|
||||||
performAction(args.data, {
|
performAction(args.data, {
|
||||||
ref: args.ref,
|
ref: args.ref,
|
||||||
context: createFormContext,
|
context: createFormContext,
|
||||||
$form: args.$form,
|
$form: args.$form,
|
||||||
isHeader: isHeader
|
isHeader: isHeader,
|
||||||
|
complete: function(args) {
|
||||||
|
$loading.remove();
|
||||||
|
$listView.listView('refresh');
|
||||||
|
},
|
||||||
|
error: function(args) {
|
||||||
|
$loading.remove();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user