{% extends 'creme_core/bricks/base/table.html' %} {% load i18n creme_bricks %}{% load is_ajax url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} creme_core-job-brick{% endblock %} {% block brick_script %}{# TODO: in .js ?? #} {% if not request|is_ajax and not job.is_finished %} {% endif %} {% endblock %} {% block brick_header_title %} {% brick_header_title title=verbose_name %}{# TODO: change icon ? icon by job type ? #} {% endblock %} {% block brick_header_actions %} {% if job.get_config_form_class %} {% brick_header_action id='edit' url=job.get_edit_absolute_url label=_("Edit the job's configuration") %} {% endif %} {% if job.is_finished and job.user %} {% brick_header_action id='update-redirect' url=job.get_delete_absolute_url type='delete' label=_('Delete the job') __back_url=list_url %} {% endif %} {% if not job.user %} {% if job.enabled %} {% brick_header_action id='update' url='creme_core__disable_job'|url:job.id label=_('Disable') icon='cancel' enabled=user.is_superuser %} {% else %} {% brick_header_action id='update' url='creme_core__enable_job'|url:job.id label=_('Enable') icon='ok' enabled=user.is_superuser %} {% endif %} {% endif %} {% endblock %} {% block brick_table_head %}{% endblock %} {% block brick_before_content %} {% if job.enabled and not job.user and user.is_superuser and job.status == JOB_WAIT %}
{% translate 'Disabling takes effect only after the current execution.' %}
{% endif %} {% endblock %} {% block brick_table_rows %} {% translate 'Type' %} {{job.type}} {% translate 'App' %} {{job.type.app_config.verbose_name}} {% if job.user %} {% translate 'User' %} {{job.user}} {% endif %} {% translate 'Description' %} {% with description=job.description %}{# TODO: factorise #} {% if description|length > 1 %} {% else %} {{description.0}} {% endif %} {% endwith %} {% if job.type.periodic != NOT_PERIODIC %} {% translate 'Periodicity' %} {% endif %} {% translate 'Last run' %} {{job.last_run|default:_('Not run yet')}} {% translate 'Status' %} {{job.get_status_display}} {% if not job.is_finished %}{{job.progress.render}}{% endif %} {% if job.status == JOB_OK %} {% translate 'Statistics' %} {% with stats=job.stats %}{# TODO: factorise #} {% if stats|length > 1 %} {% else %} {{stats.0}} {% endif %} {% endwith %} {% elif job.status == JOB_ERROR %} {% translate 'Error' %} {{job.error}} {% endif %} {% endblock %}