~terceiro/lava-scheduler/better-logging

« back to all changes in this revision

Viewing changes to lava_scheduler_app/views.py

  • Committer: Andy Doan
  • Date: 2013-01-15 20:53:29 UTC
  • mfrom: (234.2.1 lava-scheduler)
  • Revision ID: andy.doan@linaro.org-20130115205329-67gfpcyrc57p48yn
add a re-submit button to jobs in UI

Show diffs side-by-side

added added

removed removed

Lines of Context:
560
560
 
561
561
    data = {
562
562
        'job': job,
563
 
        'show_cancel': job.status <= TestJob.RUNNING and job.can_cancel(request.user),
564
 
        'show_failure': job.status > TestJob.COMPLETE and job.can_annotate(request.user),
 
563
        'show_cancel': job.can_cancel(request.user),
 
564
        'show_failure': job.can_annotate(request.user),
 
565
        'show_resubmit': job.can_resubmit(request.user),
565
566
        'bread_crumb_trail': BreadCrumbTrail.leading_to(job_detail, pk=pk),
566
567
        'show_reload_page': job.status <= TestJob.RUNNING,
567
568
    }
728
729
            "you cannot cancel this job", content_type="text/plain")
729
730
 
730
731
 
 
732
@post_only
 
733
def job_resubmit(request, pk):
 
734
    job = get_restricted_job(request.user, pk)
 
735
    if job.can_resubmit(request.user):
 
736
        definition = job.definition
 
737
        job = TestJob.from_json_and_user(definition, request.user)
 
738
        return redirect(job)
 
739
    else:
 
740
        return HttpResponseForbidden(
 
741
            "you cannot re-submit this job", content_type="text/plain")
 
742
 
 
743
 
731
744
class FailureForm(forms.ModelForm):
732
745
    class Meta:
733
746
        model = TestJob