As an operator, I want to be able to create classes, with all attributes.

- when changing class type, there shouldn't be flavors setup for storage
  ones - just quick messy inline javascript fix, as this won't be probably
  used later
- the max vms input should appear only after I check the checkbox  another
  javascript quickfix

Change-Id: I5269c8ffdc600bddede18160ddbcae0a9d52a4b8
This commit is contained in:
Ladislav Smola
2013-06-24 13:42:16 +02:00
committed by Tomas Sedovic
parent 569da84db0
commit 78cd7b32f8

View File

@@ -12,4 +12,45 @@
</tbody>
</table>
{{ flavors_table.render }}
<div id="id_resource_class_flavors_table">
{{ flavors_table.render }}
</div>
<script type="text/javascript">
// show the flavors table only when service_type is compute
var toggle_table = function(value){
if (value == 'compute'){
$('#id_resource_class_flavors_table').show();
}
else{
$('#id_resource_class_flavors_table').hide();
}
};
toggle_table($('#id_service_type').val())
$('#id_service_type').change(function(){
toggle_table($('#id_service_type').val())
});
var toggle_max_vms = function(check_box){
var checked = check_box.prop('checked');
var id = check_box.val();
if (checked){
$('input[name=flavors_object_ids__max_vms__' + id + "]").show();
}
else{
$('input[name=flavors_object_ids__max_vms__' + id + "]").hide();
}
};
$(".modal #flavors input[type=checkbox]").each(function() {
toggle_max_vms($(this));
});
$(".modal #flavors input[type=checkbox]").bind('click', function() {
toggle_max_vms($(this));
});
</script>