Jobs Table

Last Updated: August 10, 2015

class tethys_sdk.gizmos.JobsTable(jobs, column_fields, status_actions=True, run_btn=True, delete_btn=True, results_url='', hover=False, striped=False, bordered=False, condensed=False, attributes={}, classes='', refresh_interval=5000, delay_loading_status=True)

A jobs table can be used to display users' jobs. The JobsTable gizmo takes the same formatting options as the table view gizmo, but does not allow the columns to be edited. Additional attributes for the jobs table allows for a dynamically updating status field, and action buttons.

jobs

A list/tuple of TethysJob objects.

Type

tuple or list, required

column_fields

A tuple or list of strings that represent TethysJob object attributes to show in the columns.

Type

tuple or list, required

status_actions

Add a column to the table to show dynamically updating status, and action buttons. If this is false then the values for run_btn, delete_btn, and results_url will be ignored. Default is True.

Type

bool

run_btn

Add a button to run the job when job status is "Pending". Default is True.

Type

bool

delete_btn

Add a button to delete jobs. Default is True.

Type

bool

results_url

A string representing the namespaced path to a controller to that displays job results (e.g. app_name:results_controller)

Type

str

hover

Illuminate rows on hover (does not work on striped tables)

Type

bool

striped

Stripe rows

Type

bool

bordered

Add borders and rounded corners

Type

bool

condensed

A more tightly packed table

Type

bool

attributes

A dictionary representing additional HTML attributes to add to the primary element (e.g. {"onclick": "run_me();"}).

Type

dict

classes

Additional classes to add to the primary HTML element (e.g. "example-class another-class").

Type

str

refresh_interval

The refresh interval for the runtime and status fields in milliseconds. Default is 5000.

Type

int

Controller Example

from tethys_apps.sdk.gizmos import JobsTable

jobs_table_options = JobsTable(
                               jobs=jobs,
                               column_fields=('id', 'name', 'description', 'creation_time', 'execute_time'),
                               hover=True,
                               striped=False,
                               bordered=False,
                               condensed=False,
                               results_url='app_name:results_controller',
                             )
context = {
            'jobs_table_options': jobs_table_options,
          }

Template Example

{% load tethys_gizmos %}

{% gizmo jobs_table_options %}