1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Feature #4353: Show IDs of the resources created after export a Marketplace App

This commit is contained in:
Daniel Molina 2016-02-22 13:13:43 +01:00
parent 3caccf6439
commit 63d0c13059
2 changed files with 36 additions and 2 deletions

View File

@ -72,7 +72,29 @@ module OpenNebulaJSON
def export(params=Hash.new)
dsid = params['dsid'] ? params['dsid'].to_i : params['dsid']
name = params['name']
super({:dsid => dsid, :name => name})
rc = super({:dsid => dsid, :name => name})
if OpenNebula.is_error?(rc)
return rc
else
response = {}
if rc[:image]
response['IMAGE'] = []
rc[:image].each { |image_id|
image = ImageJSON.new_with_id(image_id, @client)
response['IMAGE'] << image.to_hash['IMAGE']
}
end
if rc[:vmtemplate]
response['VMTEMPLATE'] = []
rc[:vmtemplate].each { |vmtemplate_id|
vmtemplate = TemplateJSON.new_with_id(vmtemplate_id, @client)
response['VMTEMPLATE'] << vmtemplate.to_hash['VMTEMPLATE']
}
end
return response
end
end
def chown(params=Hash.new)

View File

@ -54,7 +54,19 @@ define(function(require) {
"MarketPlaceApp.export" : {
type: "multiple",
call: OpenNebulaResource.export,
callback: function(req) {
callback: function(req, response) {
if (response['IMAGE'] !== undefined) {
$.each(response['IMAGE'], function(i, image) {
Notifier.notifyCustom(Locale.tr("Image created"), " ID: " + image.ID, false);
});
};
if (response['VMTEMPLATE'] !== undefined) {
$.each(response['VMTEMPLATE'], function(i, vmTempalte) {
Notifier.notifyCustom(Locale.tr("VM Template created"), " ID: " + vmTempalte.ID, false);
});
};
Sunstone.hideFormPanel(TAB_ID);
OpenNebulaAction.clear_cache("IMAGE");
OpenNebulaAction.clear_cache("VMTEMPLATE");