{% extends 'creme_core/bricks/base/paginated-table.html' %} {% load i18n creme_bricks %}{% load is_ajax url url_join from creme_core_tags %} {% block brick_extra_class %}{{block.super}} creme_core-jobs-brick{% endblock %} {% block brick_script %}{# TODO: in .js ?? #} {% if not request|is_ajax %} {% endif %} {% endblock %} {% block brick_header_title %} {% brick_header_title title=_('{count} Job') plural=_('{count} Jobs') empty=verbose_name %} {% endblock %} {% block brick_table_columns %} {% brick_table_column title=_('App') class='job-app' %} {% brick_table_column title=_('Type') class='job-type' %} {% brick_table_column title=_('Owner') class='job-owner' %} {% brick_table_column title=_('Periodicity') class='job-periodicity' %} {% brick_table_column title=_('Last run') class='job-lastrun' %} {% brick_table_column title=_('Status') class='job-status' %} {% brick_table_column title=_('Actions') status='action' colspan=4 %} {% endblock %} {% block brick_before_content %} {% if not_finished_user_jobs_count >= MAX_JOBS_PER_USER %}
{% if not_finished_user_jobs_count == 1 %} {% translate 'You must wait that your job is finished in order to create a new one.' %} {% else %} {% translate 'You must wait that one of your jobs is finished in order to create a new one.' %} {% endif %}
{% endif %} {% endblock %} {% block brick_table_rows %} {% for job in page.object_list %} {{job.type.app_config.verbose_name|default:'?'}} {{job.type|default:'?'}} {% if job.user %}{{job.user}}{% else %}{% endif %} {% with periodic=job.type.periodic %} {% if periodic != NOT_PERIODIC %} {% endif %} {% endwith %} {% if job.last_run %}{{job.last_run}}{% else %}{% endif %} {{job.get_status_display}} {% if not job.is_finished %}{{job.progress.render}}{% endif %} {% if not job.user %} {% if job.enabled %} {% brick_table_action id='update' url='creme_core__disable_job'|url:job.id label=_('Disable') display='text' enabled=user.is_superuser %} {% else %} {% brick_table_action id='update' url='creme_core__enable_job'|url:job.id label=_('Enable') display='text' enabled=user.is_superuser %} {% endif %} {% endif %} {% if job.get_config_form_class %} {% brick_table_action id='edit' url=job.get_edit_absolute_url label=_('Edit this job') %} {% endif %} {% if job.type %} {% url_join job.get_absolute_url list_url=request.path as view_uri %} {% brick_table_action id='redirect' url=view_uri label=_('View this job') type='view' %} {% endif %} {% if job.type and job.is_finished and job.user_id %} {% brick_table_action id='delete' url=job.get_delete_absolute_url label=_('Delete this job') %} {% endif %} {% endfor %} {% endblock %} {% block brick_table_empty %} {% translate 'No job for the moment' %} {% endblock %}