mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
B #~: Can't Import vCenter VMs to Marketplace (#1004)
Signed-off-by: Frederick Borges <fborges@opennebula.io>
This commit is contained in:
parent
6ffc05d107
commit
6b270d26ea
@ -843,7 +843,8 @@ define(function(require) {
|
||||
"promiseGetVm" : _promiseGetVm,
|
||||
"getName": function(id){
|
||||
return OpenNebulaAction.getName(id, RESOURCE);
|
||||
}
|
||||
},
|
||||
"isvCenterVM": isVCenterVM,
|
||||
};
|
||||
|
||||
function _promiseGetVm({ id, success, async = true } = {}) {
|
||||
@ -1165,15 +1166,16 @@ define(function(require) {
|
||||
return actionEnabled && vncSupported
|
||||
}
|
||||
|
||||
function isVCenterVM(element = {}){
|
||||
return Boolean(element.USER_TEMPLATE &&
|
||||
String(element.USER_TEMPLATE.HYPERVISOR).toLowerCase() === 'vcenter');
|
||||
}
|
||||
|
||||
function isVMRCSupported(element = {}) {
|
||||
var actionEnabled = Config.isTabActionEnabled('vms-tab', 'VM.startvmrc')
|
||||
var vmrcSupported = graphicSupported(element, 'vnc')
|
||||
var isVCenter = Boolean(
|
||||
element.USER_TEMPLATE &&
|
||||
String(element.USER_TEMPLATE.HYPERVISOR).toLowerCase() === 'vcenter'
|
||||
)
|
||||
|
||||
return actionEnabled && vmrcSupported && isVCenter
|
||||
return actionEnabled && vmrcSupported && isVCenterVM(element);
|
||||
}
|
||||
|
||||
function isSPICESupported(element = {}) {
|
||||
|
@ -33,7 +33,6 @@ define(function(require) {
|
||||
var WizardFields = require("utils/wizard-fields");
|
||||
var OpenNebula = require("opennebula");
|
||||
var OpenNebulaAction = require("opennebula/action");
|
||||
var OpenNebulaVM = require('opennebula/vm');
|
||||
|
||||
/*
|
||||
TEMPLATES
|
||||
@ -107,7 +106,7 @@ define(function(require) {
|
||||
{ "select": true,
|
||||
"selectOptions": {
|
||||
"filter_fn": function(vm) {
|
||||
return String(OpenNebulaVM.STATES.POWEROFF) === vm.STATE;
|
||||
return String(OpenNebula.VM.STATES.POWEROFF) === vm.STATE;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -424,32 +423,27 @@ define(function(require) {
|
||||
},
|
||||
timeout: true,
|
||||
success: function (_, vmTemplate) {
|
||||
if (vmTemplate &&
|
||||
vmTemplate.VM &&
|
||||
vmTemplate.VM.USER_TEMPLATE &&
|
||||
vmTemplate.VM.USER_TEMPLATE.HYPERVISOR &&
|
||||
vmTemplate.VM.USER_TEMPLATE.HYPERVISOR !== "vcenter"){
|
||||
|
||||
OpenNebula.VM.save_as_template({
|
||||
data: template,
|
||||
success: function(_, templateId) {
|
||||
Notifier.notifyMessage(Locale.tr("VM Template") + ' ' + marketPlaceJSON.NAME + ' ' + Locale.tr("saved successfully"));
|
||||
|
||||
var newTemplate = $.extend(marketPlaceJSON, { ORIGIN_ID: String(templateId) });
|
||||
|
||||
Sunstone.runAction("MarketPlaceApp.import_vm_template", marketplaceIdSelected, newTemplate);
|
||||
},
|
||||
error: function(request, response) {
|
||||
Sunstone.hideFormPanelLoading(TAB_ID);
|
||||
Notifier.onError(request, response);
|
||||
}
|
||||
});
|
||||
|
||||
if ( OpenNebula.VM.isvCenterVM(vmTemplate.VM)){
|
||||
Notifier.notifyError(
|
||||
Locale.tr("Import error: Can't import vCenter VMs to a marketplace, only vCenter VM templates.")
|
||||
);
|
||||
}
|
||||
else{
|
||||
OpenNebula.VM.save_as_template({
|
||||
data: template,
|
||||
success: function(_, templateId) {
|
||||
Notifier.notifyMessage(Locale.tr("VM Template") + ' ' + marketPlaceJSON.NAME + ' ' + Locale.tr("saved successfully"));
|
||||
|
||||
var newTemplate = $.extend(marketPlaceJSON, { ORIGIN_ID: String(templateId) });
|
||||
|
||||
Sunstone.runAction("MarketPlaceApp.import_vm_template", marketplaceIdSelected, newTemplate);
|
||||
},
|
||||
error: function(request, response) {
|
||||
Sunstone.hideFormPanelLoading(TAB_ID);
|
||||
Notifier.onError(request, response);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
Notifier.notifyError(
|
||||
Locale.tr("Import error: Can't import vCenter VMs to a marketplace, only vCenter VM templates.")
|
||||
);
|
||||
|
||||
},
|
||||
error: function(request, response) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user