qualityfolio/test-cases-full-list.sql

              SELECT 'dynamic' AS component, sqlpage.run_sql('shell/shell.sql') AS properties;
              -- not including breadcrumbs from sqlpage_aide_navigation
              -- not including page title from sqlpage_aide_navigation
              

               select
 'breadcrumb' as component;
 select
 'Home' as title,
   sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/' as link;
 select
 'Test Management System' as title,
   sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/index.sql' as link;
 select
 'Test Cases' as title;  
 

SELECT 'html' as component,
   '<style>
    tr td.State {
   color: blue!important; /* Default to blue */
 }
 tr.rowClass - passed td.State {
   color: green!important; /* Default to red */
 }
 tr.rowClass - failed td.State {
   color: red!important; /* Default to red */
 }

     tr td.Statealign - middle {
   color: blue!important; /* Default to blue */
 }
 tr.rowClass - passed td.Statealign - middle {
   color: green!important; /* Default to red */
 }
 tr.rowClass - failed td.Statealign - middle {
   color: red!important; /* Default to red */
 }

     
     .btn - list {
   display: flex;
   justify - content: flex - end;
 }
 </style>

 ' as html;
 select
 'button' as component;
 select
 'Generate Report' as title,
   'download-full_list.sql' as link;
SET total_rows = (SELECT COUNT(*) FROM test_cases );
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 'table' as component,
   TRUE AS sort,
     TRUE AS search,
       'URL' AS align_left,
         'title' AS align_left,
           'group' as markdown,
           'id' as markdown,
           "status_new" as markdown,
           'count' as markdown;
 SELECT
 '[' || test_case_id || '](' || sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/test-detail.sql?tab=actual-result&id='|| test_case_id || ')' as id,
   test_case_title AS "title",
     group_name AS "group",
     case when test_status is not null then test_status
     else 'TODO' END AS "State",
   'rowClass-' || test_status as _sqlpage_css_class,
   created_by as "Created By",
   formatted_test_case_created_at as "Created On",
   priority as "Priority"
 FROM test_cases t
  LIMIT $limit
   OFFSET $offset;
   SELECT 'text' AS component,
    (SELECT CASE WHEN CAST($current_page AS INTEGER) > 1 THEN '[Previous](?limit=' || $limit || '&offset=' || ($offset - $limit) || ')' ELSE '' END)
    || ' '
    || '(Page ' || $current_page || ' of ' || $total_pages || ") "
    || (SELECT CASE WHEN CAST($current_page AS INTEGER) < CAST($total_pages AS INTEGER) THEN '[Next](?limit=' || $limit || '&offset=' || ($offset + $limit) || ')' ELSE '' END)
    AS contents_md
;
        ;
            

;