diff --git a/src/sunstone/models/OpenNebulaJSON/MarketPlaceAppJSON.rb b/src/sunstone/models/OpenNebulaJSON/MarketPlaceAppJSON.rb index 054cfee17d..4e536b179c 100644 --- a/src/sunstone/models/OpenNebulaJSON/MarketPlaceAppJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/MarketPlaceAppJSON.rb @@ -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) diff --git a/src/sunstone/public/app/tabs/marketplaceapps-tab/actions.js b/src/sunstone/public/app/tabs/marketplaceapps-tab/actions.js index 530c033d1f..9da73ac506 100644 --- a/src/sunstone/public/app/tabs/marketplaceapps-tab/actions.js +++ b/src/sunstone/public/app/tabs/marketplaceapps-tab/actions.js @@ -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");