Example #1
0
def index(request: HttpRequest) -> HttpResponse:
    """Render the page with the list of workflows."""
    remove_workflow_from_session(request)

    workflows = (request.user.workflows_owner.all()
                 | request.user.workflows_shared.all())
    workflows = workflows.distinct()

    # Get the queryset for those with start and those without
    workflows_star = workflows.filter(star__in=[request.user])
    workflows_no_star = workflows.exclude(star__in=[request.user])

    # We include the table only if it is not empty.
    context = {
        'workflows_star': workflows_star.order_by('name'),
        'workflows': workflows_no_star.order_by('name'),
        'nwflows': len(workflows),
    }

    # Report if Celery is not running properly
    if request.user.is_superuser:
        # Verify that celery is running!
        if not celery_is_up():
            messages.error(
                request,
                _(
                    'WARNING: Celery is not currently running. ' +
                    'Please configure it correctly.', ),
            )

    return render(request, 'workflow/index.html', context)
Example #2
0
def athena_connection_admin_index(request: HttpRequest) -> HttpResponse:
    """Show and handle the connections.

    :param request: Request

    :return: Render the appropriate page.
    """
    remove_workflow_from_session(request)

    op_column = OperationsColumn(
        verbose_name='',
        template_file='dataops/includes/partial_connection_adminop.html',
        template_context=lambda record: {
            'id':
            record['id'],
            'view_url':
            reverse('dataops:athenaconn_view', kwargs={'pk': record['id']}),
            'clone_url':
            reverse('dataops:athenaconn_clone', kwargs={'pk': record['id']}),
            'delete_url':
            reverse('dataops:athenaconn_delete', kwargs={'pk': record['id']})
        })
    table = AthenaConnectionTableAdmin(
        AthenaConnection.objects.values('id', 'name', 'description_text',
                                        'enabled'),
        orderable=False,
        extra_columns=[('operations', op_column)])

    return render(
        request, 'dataops/connections_admin.html', {
            'table': table,
            'title': _('Athena Connections'),
            'data_url': reverse('dataops:athenaconn_add')
        })
Example #3
0
def plugin_admin(request: HttpRequest, ) -> HttpResponse:
    """Show the table of plugins and their status.

    :param request: HTTP Request

    :return:
    """
    remove_workflow_from_session(request)

    # Traverse the plugin folder and refresh the db content.
    refresh_plugin_data(request)

    return render(request, 'dataops/plugin_admin.html',
                  {'table': PluginAdminTable(Plugin.objects.all())})
def sqlconnection_admin_index(request: HttpRequest) -> HttpResponse:
    """Show and handle the SQL connections.

    :param request: Request

    :return: Render the appropriate page.
    """
    remove_workflow_from_session(request)

    return render(
        request,
        'dataops/sql_connections_admin.html',
        {
            'table':
            SQLConnectionTableAdmin(SQLConnection.objects.values(
                'id', 'name', 'description_text'),
                                    orderable=False)
        },
    )