Overview
Comment: | updates for paging |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.64-envdebug |
Files: | files | file ages | folders |
SHA1: |
69de53020b4238018753906ffa97c478 |
User & Date: | pjhatwal on 2017-04-07 11:58:28 |
Other Links: | branch diff | manifest | tags |
Context
2017-04-10
| ||
19:08 | added tabbed view check-in: 1a6243bbfb user: pjhatwal tags: v1.64-envdebug | |
2017-04-07
| ||
11:58 | updates for paging check-in: 69de53020b user: pjhatwal tags: v1.64-envdebug | |
2017-04-06
| ||
11:20 | Capturing merge of misc-changes-please-integrate into v1.64-envdebug check-in: e62592f0fe user: mrwellan tags: v1.64-envdebug | |
Changes
Modified cgisetup/models/pgdb.scm from [add2d5c9c3] to [9e0fc9a7e5].
︙ | ︙ | |||
195 196 197 198 199 200 201 202 203 204 205 206 207 208 | "SELECT r.target,COUNT(*) AS total, SUM(CASE WHEN t.status='PASS' THEN 1 ELSE 0 END) AS pass, SUM(CASE WHEN t.status='FAIL' THEN 1 ELSE 0 END) AS fail, SUM(CASE WHEN t.status IN ('PASS','FAIL') THEN 0 ELSE 1 END) AS other FROM tests AS t INNER JOIN runs AS r ON t.run_id=r.id WHERE t.state='COMPLETED' AND r.target LIKE ? GROUP BY r.target;" target-patt)) (define (pgdb:get-latest-run-stats-given-target dbh ttype-id target-patt) (dbi:get-rows dbh ;; "SELECT COUNT(t.id),t.status,r.target FROM tests AS t INNER JOIN runs AS r ON t.run_id=r.id ;; WHERE t.state='COMPLETED' AND ttype_id=? AND r.target LIKE ? GROUP BY r.target,t.status;" "SELECT r.target,COUNT(*) AS total, | > | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | "SELECT r.target,COUNT(*) AS total, SUM(CASE WHEN t.status='PASS' THEN 1 ELSE 0 END) AS pass, SUM(CASE WHEN t.status='FAIL' THEN 1 ELSE 0 END) AS fail, SUM(CASE WHEN t.status IN ('PASS','FAIL') THEN 0 ELSE 1 END) AS other FROM tests AS t INNER JOIN runs AS r ON t.run_id=r.id WHERE t.state='COMPLETED' AND r.target LIKE ? GROUP BY r.target;" target-patt)) (define (pgdb:get-latest-run-stats-given-target dbh ttype-id target-patt) (dbi:get-rows dbh ;; "SELECT COUNT(t.id),t.status,r.target FROM tests AS t INNER JOIN runs AS r ON t.run_id=r.id ;; WHERE t.state='COMPLETED' AND ttype_id=? AND r.target LIKE ? GROUP BY r.target,t.status;" "SELECT r.target,COUNT(*) AS total, |
︙ | ︙ | |||
225 226 227 228 229 230 231 | SUM(CASE WHEN t.status='FAIL' THEN 1 ELSE 0 END) AS fail, SUM(CASE WHEN t.status IN ('PASS','FAIL') THEN 0 ELSE 1 END) AS other FROM tests AS t INNER JOIN runs AS r ON t.run_id=r.id WHERE t.state like '%' AND ttype_id=? AND r.target LIKE ? GROUP BY r.run_name;" ttype-id target-patt )) | | | | | > > > | > > > > > > > | > > > > > > > > > > > > > | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | SUM(CASE WHEN t.status='FAIL' THEN 1 ELSE 0 END) AS fail, SUM(CASE WHEN t.status IN ('PASS','FAIL') THEN 0 ELSE 1 END) AS other FROM tests AS t INNER JOIN runs AS r ON t.run_id=r.id WHERE t.state like '%' AND ttype_id=? AND r.target LIKE ? GROUP BY r.run_name;" ttype-id target-patt )) (define (pgdb:get-all-run-stats-target-slice dbh target-patt limit offset) (dbi:get-rows dbh "SELECT r.target, r.run_name,r.event_time, COUNT(*) AS total, SUM(CASE WHEN t.status='PASS' THEN 1 ELSE 0 END) AS pass, SUM(CASE WHEN t.status='FAIL' THEN 1 ELSE 0 END) AS fail, SUM(CASE WHEN t.status IN ('PASS','FAIL') THEN 0 ELSE 1 END) AS other FROM tests AS t INNER JOIN runs AS r ON t.run_id=r.id WHERE r.target LIKE ? GROUP BY r.target,r.run_name, r.event_time order by r.target,r.event_time desc limit ? offset ? ;" target-patt limit offset)) (define (pgdb:get-count-data-stats-target-slice dbh target-patt) (dbi:get-rows dbh "SELECT count(*) from (SELECT r.target, r.run_name,r.event_time, COUNT(*) AS total FROM tests AS t INNER JOIN runs AS r ON t.run_id=r.id WHERE r.target LIKE ? GROUP BY r.target,r.run_name, r.event_time ) as x;" target-patt)) (define (pgdb:get-slice-cnt dbh target-patt) (let* ((cnt-result (pgdb:get-count-data-stats-target-slice dbh target-patt)) ;(cnt-row (car (cnt-result))) (cnt 0) ) (for-each (lambda (row) (set! cnt (vector-ref row 0 ))) cnt-result) cnt)) (define (pgdb:get-target-types dbh) (dbi:get-rows dbh "SELECT id,target_spec FROM ttype;")) (define (pgdb:get-distict-target-slice dbh) (dbi:get-rows dbh " select distinct on (split_part (target, '/', 1)) (split_part (target, '/', 1)) from runs;")) |
︙ | ︙ | |||
377 378 379 380 381 382 383 | (let* ((data (make-hash-table))) (for-each (lambda (run) (let* ((run-name (vector-ref run 0))) (hash-table-set! data run-name run))) runs) data)) | > > > > > > > > > > | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | (let* ((data (make-hash-table))) (for-each (lambda (run) (let* ((run-name (vector-ref run 0))) (hash-table-set! data run-name run))) runs) data)) (define (pgdb:get-pg-lst tab2-pages) (let loop ((i 1) (lst `())) (cond ((> i tab2-pages ) lst) (else (loop (+ i 1) (append lst (list i))))))) |
Modified cgisetup/pages/home_ctrl.scm from [e5b104a203] to [41e384af97].
︙ | ︙ | |||
13 14 15 16 17 18 19 | (define (home-action action) (case (string->symbol action) ((filter) (let ((target-type (s:get-input 'target-type)) (target-filter (s:get-input 'tfilter)) (target (s:get-input 'target)) | | | > > > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | (define (home-action action) (case (string->symbol action) ((filter) (let ((target-type (s:get-input 'target-type)) (target-filter (s:get-input 'tfilter)) (target (s:get-input 'target)) (row-or-col (s:get-input 'row-or-col))) ;; ;; s:set! is a page local var. Better than s:session-var-set! but still not a good idea. ;; (s:set! "row-or-col" (if (list? row-or-col) (string-intersperse row-or-col ",") row-or-col)) (s:set! "target-type" target-type) (s:set! "tfilter" target-filter) (s:set! "target" target) (s:set! "target-filter" target-filter) )) ((filter2) (let ((tslice-select (s:get-input 'tslice-select)) (page (s:get-input 'page)) (t-slice-filter (s:get-input 't-slice-filter))) ;; ;; s:set! is a page local var. Better than s:session-var-set! but still not a good idea. ;; ;(s:set! "var" "xyz") (s:set! "tslice" tslice-select) (s:set! "page" page) (s:set! "t-slice-patt" t-slice-filter))) )) |
Modified cgisetup/pages/home_view.scm from [4f70880903] to [974b5d0835].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ;;====================================================================== ;; Copyright 2017, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. ;;====================================================================== (define (pages:home session db shared) (let* ((dbh (s:db)) (ttypes (pgdb:get-target-types dbh)) (selected (string->number (or (s:get "target-type") "-1"))) (target-slice (pgdb:get-distict-target-slice dbh)) | > > > > > > > | > > > > > | > > > > | > > > > > > > > | | | > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | ;;====================================================================== ;; Copyright 2017, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. ;;====================================================================== (define (pages:home session db shared) (let* ((dbh (s:db)) (tab2-limit 15) (tab2-page (if (or (equal? (s:get-param "page") "") (equal? (s:get-param "page") #f)) 1 (string->number (s:get-param "page")))) (tab2-offset (- (* tab2-limit tab2-page) tab2-limit)) (ttypes (pgdb:get-target-types dbh)) (selected (string->number (or (s:get "target-type") "-1"))) (target-slice (pgdb:get-distict-target-slice dbh)) (selected-slice (if (s:get "tslice") (s:get "tslice") (if (s:get-param "tslice") (s:get-param "tslice") ""))) (curr-trec (filter (lambda (x)(eq? selected (vector-ref x 0))) ttypes)) (curr-ttype (if (and selected (not (null? curr-trec))) (vector-ref (car curr-trec) 1) #f)) (all-parts (if curr-ttype (append (string-split curr-ttype "/") '("runname" "testname")) '())) (tfilter (or (s:get "target-filter") "%")) (tslice-filter (if (s:get "t-slice-patt") (s:get "t-slice-patt") (if (s:get-param "patt") (string-substitute "x_x" "%" (s:get-param "patt") 'all) "%") )) (target-patt (if (or (equal? selected-slice "") (equal? tslice-filter "" )) "" (conc selected-slice "/" tslice-filter ))) (tab2-data (if (equal? target-patt "") `() (pgdb:get-all-run-stats-target-slice dbh target-patt tab2-limit tab2-offset))) (tab2-cnt (if (equal? target-patt "") 0 (pgdb:get-slice-cnt dbh target-patt))) (tab2-pages (round (/ tab2-cnt tab2-limit))) (tab2-page-lst (pgdb:get-pg-lst tab2-pages)) (tab2-ordered-data (pgdb:coalesce-runs-by-slice tab2-data selected-slice)) (targets (pgdb:get-targets-of-type dbh selected tfilter)) (row-or-col (string-split (or (s:get "row-or-col") "") ",")) (all-data (if (and selected (not (eq? selected -1))) (pgdb:get-latest-run-stats-given-target dbh selected tfilter) '() ; (pgdb:get-stats-given-type-target dbh selected tfilter) ; (pgdb:get-stats-given-target dbh tfilter) )) (ordered-data (pgdb:coalesce-runs dbh all-data all-parts row-or-col 0))) (s:div 'class "col_12" (s:ul 'class "tabs left" (s:li (s:a 'href "#tabr1" "Sliced Filter")) (s:li (s:a 'href "#tabr2" "Genral Filter"))) (s:div 'id "tabr1" 'class "tab-content" (s:div 'class "col_11" (s:fieldset "Filter Targets by slice" (s:form 'action "home.filter2" 'method "post" 'name "form1" (s:div 'class "col_12" (s:div 'class "col_6" (s:select (map (lambda (x) (let ((t-slice (vector-ref x 0))) (if (equal? t-slice selected-slice) (list t-slice t-slice t-slice #t) (list t-slice t-slice t-slice #f)))) target-slice) 'name 'tslice-select)) (s:div 'class "col_4" (s:input 'type "text" 'name "t-slice-filter" 'value tslice-filter)) (s:div 'class "col_2" (s:input 'type "submit" 'name "set-filter-vals" 'value "Submit"))))) (s:br) ; (s:p (conc tslice-filter selected-slice tab2-page)) (s:p (map (lambda (i) (s:span (s:a 'href (s:link-to "home" 'page i 'patt (string-substitute "%" "x_x" tslice-filter 'all) 'tslice selected-slice) "PAGE " i )" | ")) tab2-page-lst)) (s:p " Result Format: total / pass / fail / other") (s:fieldset (conc "Runs data for " target-patt) (let* ((target-keys (hash-table-keys tab2-ordered-data)) (run-keys (delete-duplicates (apply append (map (lambda (sub-key) (let ((subdat (hash-table-ref tab2-ordered-data sub-key))) (hash-table-keys subdat))) target-keys))))) |
︙ | ︙ |
Modified cgisetup/pages/index.scm from [5f74568a94] to [33603d85dd].
1 2 3 4 5 6 7 8 9 10 11 12 13 | ;;====================================================================== ;; Copyright 2017, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. ;;====================================================================== (use regex) ;; (load "models/pgdb.scm") | > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ;;====================================================================== ;; Copyright 2017, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. ;;====================================================================== (use regex) ;; (load "models/pgdb.scm") (include "pages/index_ctrl.scm") (include "pages/index_view.scm") |