Boot menu toggle button for vm-detail view
Issue: #439
-
Added 1 commit:
- d6175317 - dashboard, vm: add boot menu toggle button for vm-detail view and add toggle_boot_menu permission
Toggle commit list -
252 252 return e.preventDefault(); 253 253 }); 254 254 255 $("#id_boot_menu").change(function(){ -
Owner
how about
$("#id_boot_menu").change(function(ev){ ev.target.parents("form").submit(); });
?
-
Owner
-
-
Status changed to closed
Toggle commit list -
Status changed to reopened
Toggle commit list -
Added 47 commits:
-
d989daf2...3cff165b - 45 commits from branch
master
- 01f0294e - Merge branch 'master' into issue_439
- 5bf0da3b - vm: add ToggleBootMenuOperation and VmToggleBootMenuUpdate morph to VmOperationView
Toggle commit list -
d989daf2...3cff165b - 45 commits from branch
-
612 592 *args, **kwargs) 613 593 614 594 595 class VmToggleBootMenuUpdate(VmOperationView): 596 op = 'toggle_bootmenu' 597 icon = "save" 598 show_in_toolbar = False 599 wait_for_result = 0.5 600 601 def post(self, request, extra=None, *args, **kwargs): 602 if extra is None: -
Owner
extra
is unused
-
-
612 592 *args, **kwargs) 613 593 614 594 595 class VmToggleBootMenuUpdate(VmOperationView): 596 op = 'toggle_bootmenu' 597 icon = "save" -
Owner
select a better icon (eg. fa-cog, fa-cogs, fa-wrench)
-
-
Owner
add an entry to
circle/dashboard/views/vm.py/vm_ops
for the operation -
circle/dashboard/views/vm.py
609 for f in form.errors: 610 messages.error(request, "<strong>%s</strong>: %s" % ( 611 f, form.errors[f].as_text() 612 )) 613 if request.is_ajax(): # this is not too nice 614 store = messages.get_messages(request) 615 store.used = True 616 return JsonResponse({'success': False, 617 'messages': [unicode(m) for m in store]}) 618 else: 619 return HttpResponseRedirect(instance.get_absolute_url() + 620 "#resources") 621 else: 622 extra = form.cleaned_data 623 return super(VmToggleBootMenuUpdate, self).post(request, extra, 624 *args, **kwargs) -
Owner
~
this code is almost the same as~VmResourcesChangeView
's, might be a good idea to make a mixin for itsee: !362 (comment 3997)
-
-
1403 1403 1404 1404 1405 1405 @register_operation 1406 class ToggleBootMenuOperation(InstanceOperation): 1407 id = 'toggle_bootmenu' 1408 name = _("toggle boot menu") -
Owner
With or without space?:D
-
-
circle/dashboard/views/vm.py
602 instance = get_object_or_404(Instance, pk=kwargs['pk']) 603 604 form = ToggleBootMenuForm(request.POST, instance=instance) 605 if not form.is_valid(): 606 for f in form.errors: 607 messages.error(request, "<strong>%s</strong>: %s" % ( 608 f, form.errors[f].as_text() 609 )) 610 if request.is_ajax(): # this is not too nice 611 store = messages.get_messages(request) 612 store.used = True 613 return JsonResponse({'success': False, 614 'messages': [unicode(m) for m in store]}) 615 else: 616 return HttpResponseRedirect(instance.get_absolute_url() + 617 "#resources") -
Owner
Is it even possible to send this from as invalid (while using site as intended)?
-
-
Owner
Doesn't work without Javascript.
Would be better imho to drop bootstrap-toggle (extra css and js file just for this button is kinda meh). A simple checkbox is enough, add a Save button and remove it with Javascript, this without JS there is a manual save button, with JS it's the same as now.