From c8386c400df44d122e89b6d4c1888c3f69600481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 18 Aug 2016 10:51:18 +0200 Subject: [PATCH] Add support in Sunstone for opennebula-hybrid drivers See https://github.com/OpenNebula/addon-opennebula-hybrid --- .../form-panels/create/wizard-tabs/hybrid.js | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js index 179f9ec7ca..60c04aebc8 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js @@ -33,6 +33,7 @@ define(function(require) { var TemplateHTML = require('hbs!./hybrid/html'); var EC2HTML = require('hbs!./hybrid/ec2'); var AzureHTML = require('hbs!./hybrid/azure'); + var OpenNebulaHTML = require('hbs!./hybrid/opennebula'); /* CONSTANTS @@ -52,6 +53,19 @@ define(function(require) { this.wizardTabId = WIZARD_TAB_ID + UniqueId.id(); this.icon = 'fa-cloud'; this.title = Locale.tr("Hybrid"); + + this.oneEnabled = false; + + var mads = Config.onedConf.VM_MAD; + if (! (mads instanceof Array)){ + mads = [mads]; + } + + var i = 0; + while (!this.oneEnabled && i < mads.length){ + this.oneEnabled = mads[i].NAME == "opennebula"; + i++; + } } WizardTab.prototype.constructor = WizardTab; @@ -107,6 +121,10 @@ define(function(require) { hash["TYPE"] = hybrid.toUpperCase(); publicCloudJSON.push(hash); break; + case 'opennebula': + hash["TYPE"] = "opennebula"; + publicCloudJSON.push(hash); + break; } }; }); @@ -139,12 +157,19 @@ define(function(require) { function _addProviderTab(provider_id, context) { var htmlId = 'provider' + provider_id + UniqueId.id(); + var oneInput = ""; + + if (this.oneEnabled){ + oneInput = ''; + } + // Append the new div containing the tab and add the tab to the list var html_tab_content = '
' + '
' + '
' + '' + '' + + oneInput + '
' + '
' + '
' + @@ -190,8 +215,10 @@ define(function(require) { if (this.value == "ec2"){ $(".hybrid_inputs", providerSection).append(EC2HTML()); - } else { + } else if (this.value == "azure"){ $(".hybrid_inputs", providerSection).append(AzureHTML()); + } else if (this.value == "opennebula"){ + $(".hybrid_inputs", providerSection).append(OpenNebulaHTML()); } Tips.setup(providerSection);