feature #3748: Add template general tab

This commit is contained in:
Daniel Molina committed 2015-05-27 12:00:45 +02:00
1 parent afdae0c213
commit 465b741b9b
6 files changed
+190 -7

No files matched your search

+10 -2
View File
@@ -45,7 +45,10 @@ require.config({
'flot.stack': '../bower_components/flot/jquery.flot.stack',
'flot.resize': '../bower_components/flot/jquery.flot.resize',
'flot.time': '../bower_components/flot/jquery.flot.time',
'flot.tooltip': '../bower_components/flot.tooltip/js/jquery.flot.tooltip.min'
'flot.tooltip': '../bower_components/flot.tooltip/js/jquery.flot.tooltip.min',
/* noUiSlider */
'nouislider': '../vendor/4.0/nouislider/jquery.nouislider.min'
},
shim: {
/* jQuery */
@@ -143,7 +146,12 @@ require.config({
},
'flot.tooltip': {
deps: ['flot']
}
},
/* noUiSlider */
'nouislider': {
deps: ['jquery']
},
}
});
@@ -93,7 +93,7 @@ define(function(require) {
function _setup(context) {
$.each(this.wizardTabs, function(index, wizardTab) {
wizardTab.setup();
wizardTab.setup(context);
});
context.foundation('reflow', 'tab');
@@ -101,7 +101,7 @@ define(function(require) {
}
function _onShow() {
}
function _submitWizard() {
@@ -0,0 +1,93 @@
define(function(require) {
/*
DEPENDENCIES
*/
var Locale = require('utils/locale');
var Tips = require('utils/tips');
var CapacityInputs = require('./general/capacity-inputs');
/*
TEMPLATES
*/
var TemplateHTML = require('hbs!./general/html');
/*
CONSTANTS
*/
var WIZARD_TAB_ID = require('./general/wizardTabId');
var LOGOS = [
{'path': "images/logos/arch.png", 'title': Locale.tr("Arch Linux")},
{'path': "images/logos/centos.png", 'title': Locale.tr("CentOS")},
{'path': "images/logos/debian.png", 'title': Locale.tr("Debian")},
{'path': "images/logos/fedora.png", 'title': Locale.tr("Fedora")},
{'path': "images/logos/linux.png", 'title': Locale.tr("Linux")},
{'path': "images/logos/redhat.png", 'title': Locale.tr("Redhat")},
{'path': "images/logos/ubuntu.png", 'title': Locale.tr("Ubuntu")},
{'path': "images/logos/windowsxp.png", 'title': Locale.tr("Windows XP/2003")},
{'path': "images/logos/windows8.png", 'title': Locale.tr("Windows 8")}
]
/*
CONSTRUCTOR
*/
function WizardTab() {
this.wizardTabId = WIZARD_TAB_ID;
this.icon = 'fa-laptop';
this.title = Locale.tr("General");
}
WizardTab.prototype.constructor = WizardTab;
WizardTab.prototype.html = _html;
WizardTab.prototype.setup = _setup;
WizardTab.prototype.onShow = _onShow;
WizardTab.prototype.retrieve = _retrieve;
WizardTab.prototype.fill = _fill;
return WizardTab;
/*
FUNCTION DEFINITIONS
*/
function _html() {
return TemplateHTML({
'capacityInputsHTML': CapacityInputs.html(),
'logos': LOGOS
});
}
function _onShow() {
}
function _setup(context) {
Tips.setup(context);
context.on("change", "#LOGO", function() {
$("#template_create_logo", context).show();
$("#template_create_logo", context).html('<span class="">' +
'<img src="' + $(this).val() + '">' +
'</span>');
});
context.on("change", "input[name='hypervisor']", function() {
var context = $(this).closest("#create_template_form_wizard");
$(".hypervisor", context).hide();
$(".only_" + this.value, context).show();
});
CapacityInputs.setup(context);
}
function _retrieve() {
}
function _fill() {
}
});
@@ -0,0 +1,78 @@
<div class="row">
<div id="template_name_form" class="large-6 columns vm_param">
<label for="NAME">
{{tr "Name"}}
<span class="tip">{{tr "Name that the VM will get for description purposes."}}</span>
<input type="text" id="NAME" name="name" required/>
</label>
</div>
<div id="template_hypervisor_form" class="large-6 columns">
<label>{{tr "Hypervisor"}}</label>
<input type="radio" name="hypervisor" value="kvm" id="kvmRadio">
<label for="kvmRadio">{{tr "KVM"}}</label>
<input type="radio" name="hypervisor" value="vmware" id="vmwareRadio">
<label for="vmwareRadio">{{tr "VMware"}}</label>
<input type="radio" name="hypervisor" value="xen" id="xenRadio">
<label for="xenRadio">{{tr "Xen"}}</label>
<input type="radio" name="hypervisor" value="vcenter" id="vcenterRadio">
<label for="vcenterRadio">{{tr "vCenter"}}</label>
</div>
</div>
<div class="row vm_param">
<div class="large-6 columns">
<label for="DESCRIPTION">
{{tr "Description"}}
<span class="tip">{{tr "Description of the template"}}</span>
</label>
<textarea type="text" id="DESCRIPTION" name="DESCRIPTION" style="height: 70px;"/>
</div>
<div class="large-6 columns">
<div class="row">
<div class="large-6 columns">
<label for="LOGO">
{{tr "Logo"}}
<span class="tip">{{tr "Logo for the template."}}</span>
</label>
<select id="LOGO" name="LOGO">
<option value=""></option>
{{#each logos}}
<option value="{{path}}">{{title}}</option>
{{/each}}
</select>
</div>
<div id="template_create_logo" class="text-center large-6 columns" style="margin-bottom: 15px"></div>
<br></div>
</div>
</div>
<div class="row hypervisor only_vcenter" style="display: none;">
<div class="large-6 columns">
<label for="vcenter_template_uuid">
{{tr "vCenter Template UUID"}}
<span class="tip"></span>
</label>
<input type="text" id="vcenter_template_uuid" name="name"/>
</div>
</div>
{{{capacityInputsHTML}}}
<div class="row">
<div class="large-6 columns">
<input type="checkbox" id="sunstone_capacity_select" name="name"/>
<label for="sunstone_capacity_select">
{{tr "Do not allow to change capacity"}}
<span class="tip">
{{tr "Users using the cloud view will not be able to select a new capacity for this template"}}
</span>
</label>
</div>
</div>
<div class="row">
<div class="large-6 columns">
<input type="checkbox" id="sunstone_network_select" name="name"/>
<label for="sunstone_network_select">
{{tr "Do not allow to modify network configuration"}}
<span class="tip">
{{tr "Users using the cloud view will not be able to remove or add new NICs"}}
</span>
</label>
</div>
</div>
@@ -0,0 +1,3 @@
define(function(require){
return 'generalTab';
});
+4 -3
View File
@@ -126,9 +126,10 @@
<!-- end tabs -->
<link rel="stylesheet" href="bower_components/fontawesome/css/font-awesome.min.css?v=<%= OpenNebula::VERSION %>"></link>
<link href="bower_components/jgrowl/jquery.jgrowl.min.css?v=<%= OpenNebula::VERSION %>" rel="stylesheet" type="text/css"></link>
<link rel="stylesheet" href="bower_components/fontawesome/css/font-awesome.min.css?v=<%= OpenNebula::VERSION %>"></link>
<link href="bower_components/jgrowl/jquery.jgrowl.min.css?v=<%= OpenNebula::VERSION %>" rel="stylesheet" type="text/css"></link>
<link href="vendor/4.0/nouislider/nouislider.css?v=<%= OpenNebula::VERSION %>" rel="stylesheet" type="text/css"></link>
<script src="bower_components/requirejs/require.js" data-main="app/main"></script>