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

Feature #4352: Show ID of the new resource in clone actions

This commit is contained in:
Daniel Molina 2016-02-22 13:56:17 +01:00
parent 63d0c13059
commit 94d3203049
4 changed files with 25 additions and 4 deletions

View File

@ -108,9 +108,15 @@ module OpenNebulaJSON
def clone(params=Hash.new)
if params['target_ds']
super(params['name'], params['target_ds'].to_i)
rc = super(params['name'], params['target_ds'].to_i)
else
super(params['name'])
rc = super(params['name'])
end
if OpenNebula.is_error?(rc)
return rc
else
return ImageJSON.new_with_id(rc, @client)
end
end

View File

@ -118,7 +118,13 @@ module OpenNebulaJSON
end
def clone(params=Hash.new)
super(params['name'])
rc = super(params['name'])
if OpenNebula.is_error?(rc)
return rc
else
return TemplateJSON.new_with_id(rc, @client)
end
end
def rename(params=Hash.new)

View File

@ -19,6 +19,7 @@ define(function(require) {
var Notifier = require('utils/notifier');
var Locale = require('utils/locale');
var OpenNebulaResource = require('opennebula/image');
var OpenNebulaAction = require('opennebula/action');
var CommonActions = require('utils/common-actions');
var RESOURCE = "Image";
@ -61,7 +62,7 @@ define(function(require) {
function(formPanelInstance, context) {
var selectedNodes = Sunstone.getDataTable(TAB_ID).elements();
if (selectedNodes.length !== 1) {
Notifier.notifyMessage('Please select one (and just one) Image to export.');
Notifier.notifyMessage(Locale.tr("Please select one (and just one) Image to export."));
return false;
}
@ -80,6 +81,10 @@ define(function(require) {
"Image.clone" : {
type: "single",
call: OpenNebulaResource.clone,
callback: function(request, response) {
OpenNebulaAction.clear_cache("IMAGE");
Notifier.notifyCustom(Locale.tr("Image created"), " ID: " + response.IMAGE.ID, false);
},
error: Notifier.onError,
notify: true
}

View File

@ -106,6 +106,10 @@ define(function(require) {
"Template.clone" : {
type: "single",
call: OpenNebulaResource.clone,
callback: function(request, response) {
OpenNebulaAction.clear_cache("VMTEMPLATE");
Notifier.notifyCustom(Locale.tr("VM Template created"), " ID: " + response.VMTEMPLATE.ID, false);
},
error: Notifier.onError,
notify: true
}