console/content/view/orchestration_session_by_device.auto.sql

SELECT 'dynamic' AS component, sqlpage.run_sql('shell/shell.sql') AS properties;

              SELECT 'breadcrumb' AS component;
              SELECT 'Home' as title,sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/' AS link;
              SELECT 'Console' as title,sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/console' AS link;
              SELECT 'Content' as title,sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/console/content' AS link;
              SELECT 'orchestration_session_by_device view' as title, '#' AS link;

              SELECT 'title' AS component, 'orchestration_session_by_device (view) Content' as contents;

              SET total_rows = (SELECT COUNT(*) FROM orchestration_session_by_device);
              SET limit = COALESCE($limit, 50);
              SET offset = COALESCE($offset, 0);
              SET total_pages = ($total_rows + $limit - 1) / $limit;
              SET current_page = ($offset / $limit) + 1;

              SELECT 'text' AS component, '[orchestration_session_by_device (view) Schema](console/info-schema/view.sql?name=orchestration_session_by_device&stats=yes)' AS contents_md
              SELECT 'text' AS component,
                '- Start Row: ' || $offset || '
' ||
                '- Rows per Page: ' || $limit || '
' ||
                '- Total Rows: ' || $total_rows || '
' ||
                '- Current Page: ' || $current_page || '
' ||
                '- Total Pages: ' || $total_pages as contents_md
              WHERE $stats IS NOT NULL;

              -- Display uniform_resource table with pagination
              SELECT 'table' AS component,
                    TRUE AS sort,
                    TRUE AS search,
                    TRUE AS hover,
                    TRUE AS striped_rows,
                    TRUE AS small;
            SELECT * FROM orchestration_session_by_device
            LIMIT $limit
            OFFSET $offset;

            SELECT 'text' AS component,
                (SELECT CASE WHEN $current_page > 1 THEN '[Previous](?limit=' || $limit || '&offset=' || ($offset - $limit) || ')' ELSE ' END) || ' ' ||
                '(Page ' || $current_page || ' of ' || $total_pages || ') ' ||
                (SELECT CASE WHEN $current_page < $total_pages THEN '[Next](?limit=' || $limit || '&offset=' || ($offset + $limit) || ')' ELSE ' END)
                AS contents_md;