Overview
Comment: | added tabbed view |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.64-envdebug |
Files: | files | file ages | folders |
SHA1: |
1a6243bbfbb377ed519d24d7ea1804e1 |
User & Date: | pjhatwal on 2017-04-10 19:08:30 |
Other Links: | branch diff | manifest | tags |
Context
2017-04-10
| ||
22:42 | Added -prepend-contour when action is sync-prepend check-in: 7e035f2f93 user: matt tags: v1.64-envdebug | |
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 | |
Changes
Modified cgisetup/models/pgdb.scm from [9e0fc9a7e5] to [c47a2a291e].
︙ | ︙ | |||
197 198 199 200 201 202 203 | 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)) | | | | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 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 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | 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 limit offset) (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, 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, r.id 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 ? and r.id in (SELECT DISTINCT on (target) id from runs where target like ? AND ttype_id=? order by target,event_time desc) GROUP BY r.target,r.id order by r.event_time desc limit ? offset ? ;" ttype-id target-patt target-patt ttype-id limit offset)) (define (pgdb:get-latest-run-stats-given-pattern dbh patt limit offset) (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, 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, r.id FROM tests AS t INNER JOIN runs AS r ON t.run_id=r.id WHERE t.state like '%' AND r.target LIKE ? and r.id in (SELECT DISTINCT on (target) id from runs where target like ? order by target,event_time desc) GROUP BY r.target,r.id order by r.event_time desc limit ? offset ? ;" patt patt limit offset)) (define (pgdb:get-count-data-stats-target-latest dbh ttype-id target-patt) (dbi:get-rows dbh "SELECT count(*) from (SELECT DISTINCT on (target) id from runs where target like ? AND ttype_id = ? order by target, event_time desc ) as x;" target-patt ttype-id)) (define (pgdb:get-latest-run-cnt dbh ttype-id target-patt) (let* ((cnt-result (pgdb:get-count-data-stats-target-latest dbh ttype-id 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-count-data-stats-latest-pattern dbh patt) (dbi:get-rows dbh "SELECT count(*) from (SELECT DISTINCT on (target) id from runs where target like ? order by target, event_time desc ) as x;" patt)) (define (pgdb:get-latest-run-cnt-by-pattern dbh target-patt) (let* ((cnt-result (pgdb:get-count-data-stats-latest-pattern 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-run-stats-history-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.run_name,COUNT(*) AS total, |
︙ | ︙ | |||
269 270 271 272 273 274 275 | (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;")) | | > | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | (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;")) (define (pgdb:get-distict-target-slice3 dbh) (dbi:get-rows dbh " select distinct on (split_part (target, '/', 3)) (split_part (target, '/', 3)) from runs;")) ;; (define (pgdb:get-targets dbh target-patt) (let ((ttypes (pgdb:get-target-types dbh))) (map (lambda (ttype-dat) (let ((tt-id (vector-ref ttype-dat 0)) (ttype (vector-ref ttype-dat 1))) |
︙ | ︙ | |||
309 310 311 312 313 314 315 316 317 | ;; create a hash of hashes with keys extracted from all-parts ;; using row-or-col to choose row or column ;; ht{row key}=>ht{col key}=>data ;; ;; fnum is the field number in the tuples to be split ;; (define (pgdb:coalesce-runs dbh runs all-parts row-or-col fnum) (let* ((data (make-hash-table))) | > > > > > > > > > > > > > > | < > > > > > > > > > > > > > > > > > > | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | ;; create a hash of hashes with keys extracted from all-parts ;; using row-or-col to choose row or column ;; ht{row key}=>ht{col key}=>data ;; ;; fnum is the field number in the tuples to be split ;; (define (pgdb:mk-pattern dot type bp rel) (let* ((typ (if (equal? type "all") "%" type)) (dotprocess (if (equal? dot "all") "%" dot)) (rel-num (if (equal? rel "") "%" rel)) (pattern (conc "%/" bp "/" dotprocess "/" typ "_" rel-num))) pattern)) (define (pgdb:coalesce-runs dbh runs all-parts row-or-col fnum) (let* ((data (make-hash-table))) (for-each (lambda (run) (let* ((target (vector-ref run fnum)) (parts (string-split target "/")) (first (car parts)) (rest (string-intersperse (cdr parts) "/")) (coldat (hash-table-ref/default data first #f))) (if (not coldat)(let ((newht (make-hash-table))) (hash-table-set! data first newht) (set! coldat newht))) (hash-table-set! coldat rest run))) runs) data)) (define (pgdb:coalesce-runs1 runs ) (let* ((data (make-hash-table))) (for-each (lambda (run) (let* ((target (vector-ref run 0)) (parts (string-split target "/")) (first (car parts)) (rest (string-intersperse (cdr parts) "/")) (coldat (hash-table-ref/default data first #f))) (if (not coldat)(let ((newht (make-hash-table))) (hash-table-set! data first newht) (set! coldat newht))) (hash-table-set! coldat rest run))) |
︙ | ︙ |
Modified cgisetup/pages/home.scm from [25e1fcbe47] to [a4707fbef0].
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. ;;====================================================================== (use regex) (load "models/pgdb.scm") (include "pages/home_ctrl.scm") (include "pages/home_view.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/filter-defs.scm") (include "pages/home_ctrl.scm") (include "pages/home_view.scm") |
Modified cgisetup/pages/home_ctrl.scm from [41e384af97] to [64b5eee90a].
︙ | ︙ | |||
10 11 12 13 14 15 16 | ;;====================================================================== ;; a function <pagename>-action is called on POST (define (home-action action) (case (string->symbol action) ((filter) | | | | | | < < | | | | < < < < < < < < | < < < < | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ;;====================================================================== ;; a function <pagename>-action is called on POST (define (home-action action) (case (string->symbol action) ((filter) (let ((dot (s:get-input 'dot)) (type (s:get-input 'kit-type)) (rel (s:get-input 'rel-num)) (bp (s:get-input 'bp))) ;; ;; s:set! is a page local var. Better than s:session-var-set! but still not a good idea. ;; (s:set! "dot" dot) (s:set! "type" type) (s:set! "bp" bp) (s:set! "rel" rel))))) |
Modified cgisetup/pages/home_view.scm from [974b5d0835] to [dd03b255f8].
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. ;;====================================================================== (define (pages:home session db shared) (let* ((dbh (s:db)) | > | | | | | | < | | > | | > > | < < < < < < < | | | | < | < < < | < < | < < | < | | < | | | < < | | | > > > | < < < < < < < < < | | < < < | < < < < < < < < | < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | | | > | | < | | | | | > | > > > > > | < < < | < < < < < < < < < < < < < < < < | | > | | | | | | | 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | ;;====================================================================== ;; 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)) (limit 50) (curr-page (if (or (equal? (s:get-param "pg") "") (equal? (s:get-param "pg") #f)) 1 (string->number (s:get-param "pg")))) (offset (- (* limit curr-page) limit)) (dot (if (s:get-param "dot") (string->number (s:get-param "dot")) (if (and (s:get "dot") (not (equal? (s:get "dot") "all"))) (string->number (s:get "dot")) "all"))) (type (if (s:get-param "type") (s:get-param "type") (if (and (s:get "type") (not (equal? (s:get "type") "all"))) (s:get "type") "all"))) (bp (if (s:get-param "bp") (s:get-param "bp") (if (s:get "bp") (s:get "bp") "p1273"))) (rel (if (s:get-param "rel") (s:get-param "rel") (if (and (s:get "rel") (not (equal? (s:get "rel") "all"))) (s:get "rel") ""))) (pattern (pgdb:mk-pattern dot type bp rel)) ; (targets (pgdb:get-targets-of-type dbh selected tfilter)) (all-data (pgdb:get-latest-run-stats-given-pattern dbh pattern limit offset)) ;'() ) ; (pgdb:get-stats-given-type-target dbh selected tfilter) ; (pgdb:get-stats-given-target dbh tfilter) (cnt (pgdb:get-latest-run-cnt-by-pattern dbh pattern)) (total-pages (ceiling (/ cnt limit))) (page-lst (pgdb:get-pg-lst total-pages)) (ordered-data (pgdb:coalesce-runs1 all-data))) (s:div 'class "col_12" (s:ul 'class "tabs left" (map (lambda (x) (s:li (s:a 'href (conc "#" x) x))) *process*)) (map (lambda (x) (s:div 'id x 'class "tab-content" (s:div 'class "col_11" (s:fieldset "Area type and target filter" (s:form 'action (conc "home.filter#" x) 'method "post" (s:div 'class "col_12" (s:div 'class "col_3" (s:label "Release Type") (s:select (map (lambda (x) (list x )) *kit-types*) 'name "kit-type")) (s:div 'class "col_3" (s:label "Dot") (s:select (map (lambda (x) (list x )) *dots*) 'name "dot")) (s:div 'class "col_3" (s:input 'type "hidden" 'value x 'name "bp") (s:label "Release #") (s:input 'list "suggestions" 'name "rel-num")) (s:div 'class "col_2" (s:input 'type "submit" 'name "set-filter-vals" 'value "Submit"))))) (s:br) ; (s:p (conc bp (s:get-param "bp") (s:get "bp"))) (s:p (map (lambda (i) (s:span (s:a 'href (s:link-to "home" 'pg i ) "PAGE " i )" | ")) page-lst)) (s:p " Result Format: total / pass / fail / other") (s:fieldset (conc "Runs data for " pattern) (let* ((a-keys (pgdb:ordered-data->a-keys ordered-data)) (b-keys (pgdb:ordered-data->b-keys ordered-data a-keys))) (s:table 'class "striped" (s:tr (s:th 'class "heading" ) (map (lambda (th-key) (s:th 'class "heading" th-key )) a-keys)) (map (lambda (row-key) (s:tr (s:td row-key) (map (lambda (col-key) (let ((val (let* ((ht (hash-table-ref/default ordered-data col-key #f))) (if ht (hash-table-ref/default ht row-key #f))))) (if val (let* ((total (vector-ref val 2)) (event-time (vector-ref val 1)) (pass (vector-ref val 3)) (fail (vector-ref val 4)) (other (vector-ref val 5)) (id (vector-ref val 6)) (passper (round (* (/ pass total) 100))) (failper (- 100 passper)) (history (pgdb:get-run-stats-history-given-target dbh 1 (conc col-key "/" row-key))) (history-hash (pgdb:get-history-hash history)) (history-keys (sort (hash-table-keys history-hash) string>=?)) (run-key (string-substitute "[/]" "_x_" (conc col-key "/" row-key) 'all))) (s:td 'style (conc "background: -webkit-linear-gradient(left, green " passper "%, red); background: -o-linear-gradient(right, green " passper "%, red); background: -moz-linear-gradient(right, green " passper "%, red); background: linear-gradient(to right, green " passper "%, red);") (s:a 'class "white" 'href (s:link-to "run" 'target run-key) (conc "Latest:" total "/" pass "/" fail "/" other)) (s:span " | ") (s:a 'id id 'class "viewmodal" 'title "Click to see description" "History") (s:br) (s:div 'id (conc "myModal" id) 'class "modal" (s:div 'class "modal-content" (s:span 'id id 'class "close" "×") ;(s:p (conc "Modal " id "..")) (s:div (s:table (s:tr |
︙ | ︙ | |||
217 218 219 220 221 222 223 | (hpass (vector-ref history-row 2)) (hfail (vector-ref history-row 3)) (hother (vector-ref history-row 4)) (passper (round (* (/ hpass htotal) 100)))) (s:tr (s:td history-key) (s:td 'style (conc "background: -webkit-linear-gradient(left, green " passper "%, red); background: -o-linear-gradient(right, green " passper "%, red); background: -moz-linear-gradient(right, green " passper "%, red); background: linear-gradient(to right, green " passper "%, red);") (conc htotal "/" hpass "/" hfail "/" hother ))))) | | < < < | > | 135 136 137 138 139 140 141 142 143 144 145 146 147 | (hpass (vector-ref history-row 2)) (hfail (vector-ref history-row 3)) (hother (vector-ref history-row 4)) (passper (round (* (/ hpass htotal) 100)))) (s:tr (s:td history-key) (s:td 'style (conc "background: -webkit-linear-gradient(left, green " passper "%, red); background: -o-linear-gradient(right, green " passper "%, red); background: -moz-linear-gradient(right, green " passper "%, red); background: linear-gradient(to right, green " passper "%, red);") (conc htotal "/" hpass "/" hfail "/" hother ))))) history-keys))))))) (s:td "")))) a-keys))) b-keys)))) ))) *process*)))) |
Modified cgisetup/pages/index_view.scm from [7dcf5f509d] to [5626af0f40].
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 | (s:title (conc "Megatest")) (s:head index:kickstart-junk ) (s:body (s:div 'class "grid flex" 'id "top_of_page" ;; add visible to columns to help visualize them e.g. "col_12 visible" (case (string->symbol page-name) ((index) (s:call "home")) (else (s:call page-name)))) index:jquery index:javascript )))))) | > > > > > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | (s:title (conc "Megatest")) (s:head index:kickstart-junk ) (s:body (s:div 'class "grid flex" 'id "top_of_page" ;; add visible to columns to help visualize them e.g. "col_12 visible" (s:ul 'class "menu" (s:li (s:a 'href "" (s:i 'class "fa fa-inbox") "QA Summary") (s:ul (s:li (s:a 'href "/cgi-bin/megatest.sh/home" "Component Snapshot")) (s:li (s:a 'href "/cgi-bin/megatest.sh/kitprogress" "Kit/Contour progress")) ))) ;(s:li (s:a 'href (s:link-to "run" ) "Runs"))) (case (string->symbol page-name) ((index) (s:call "home")) (else (s:call page-name)))) index:jquery index:javascript )))))) |