mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
Feature #565: VM creation - template creation
Finished converting VM creation into template creation. Added a dialog to create a VM given a name and a template. Modified the server to support this.
This commit is contained in:
parent
49c78d7bd1
commit
7bbf3ae933
src/sunstone
models/OpenNebulaJSON
public/js
templates
@ -21,13 +21,13 @@ module OpenNebulaJSON
|
||||
include JSONUtils
|
||||
|
||||
def create(template_json)
|
||||
template_hash = parse_json(template_json, 'template')
|
||||
template_hash = parse_json(template_json, 'vmtemplate')
|
||||
if OpenNebula.is_error?(template_hash)
|
||||
return template_hash
|
||||
end
|
||||
|
||||
if template_hash['template_raw']
|
||||
template = vm_hash['template_raw']
|
||||
template = template_hash['template_raw']
|
||||
else
|
||||
template = template_to_str(template_hash)
|
||||
end
|
||||
|
@ -28,6 +28,12 @@ module OpenNebulaJSON
|
||||
|
||||
if vm_hash['vm_raw']
|
||||
template = vm_hash['vm_raw']
|
||||
elsif vm_hash['template_id']
|
||||
template_id = vm_hash['template_id']
|
||||
|
||||
template = "TEMPLATE_ID = #{template_id}"
|
||||
template << "\nNAME = #{vm_hash[:vm_name]}" if vm_hash[:vm_name]
|
||||
|
||||
else
|
||||
template = template_to_str(vm_hash)
|
||||
end
|
||||
@ -55,7 +61,7 @@ module OpenNebulaJSON
|
||||
when "restart" then self.restart
|
||||
when "saveas" then self.save_as(action_hash['params'])
|
||||
when "shutdown" then self.shutdown
|
||||
when "resubmit" then self.resubmit
|
||||
when "resubmit" then self.resubmit
|
||||
else
|
||||
error_msg = "#{action_hash['perform']} action not " <<
|
||||
" available for this resource"
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -93,6 +93,7 @@ function tableCheckboxesListener(dataTable){
|
||||
last_action_b.button("disable");
|
||||
};
|
||||
$('.create_dialog_button',context).button("enable");
|
||||
$('.alwaysActive',context).button("enable");
|
||||
|
||||
//listen to changes in the visible inputs
|
||||
$('tbody input',dataTable).live("change",function(){
|
||||
@ -127,6 +128,7 @@ function tableCheckboxesListener(dataTable){
|
||||
|
||||
//any case the create dialog buttons should always be enabled.
|
||||
$('.create_dialog_button',context).button("enable");
|
||||
$('.alwaysActive',context).button("enable");
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -448,6 +448,10 @@ function insertButtonsInTab(tab_name){
|
||||
|
||||
}
|
||||
|
||||
if (button.alwaysActive) {
|
||||
button_code = $(button_code).addClass("alwaysActive");
|
||||
}
|
||||
|
||||
$('div#'+tab_name+' .action_blocks').append(button_code);
|
||||
|
||||
}//for each button in tab
|
||||
|
@ -25,10 +25,10 @@
|
||||
<script type="text/javascript" src="/js/sunstone-util.js"></script>
|
||||
<script type="text/javascript" src="/js/plugins/dashboard-tab.js"></script>
|
||||
<script type="text/javascript" src="/js/plugins/hosts-tab.js"></script>
|
||||
<script type="text/javascript" src="/js/plugins/templates-tab.js"></script>
|
||||
<script type="text/javascript" src="/js/plugins/vms-tab.js"></script>
|
||||
<script type="text/javascript" src="/js/plugins/vnets-tab.js"></script>
|
||||
<script type="text/javascript" src="/js/plugins/images-tab.js"></script>
|
||||
<script type="text/javascript" src="/js/plugins/templates-tab.js"></script>
|
||||
<script type="text/javascript" src="/js/plugins/users-tab.js"></script>
|
||||
|
||||
<!--<script type="text/javascript" src="/js/plugins/dummy-plugin.js"></script>-->
|
||||
|
Loading…
x
Reference in New Issue
Block a user