Megatest

Check-in [f7eea52531]
Login
Overview
Comment:added filter to runs page
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.64
Files: files | file ages | folders
SHA1: f7eea52531b1753b7e824e297fc8639572b4e8b3
User & Date: pjhatwal on 2017-03-08 18:52:08
Other Links: branch diff | manifest | tags
Context
2017-03-15
21:14
bug squashing frenzy using overriding of handle-exceptions to expose problems. partial progress snapshot check-in: 8e70f505b7 user: matt tags: v1.64-bug-sqlish
17:32
added flag to allow adding prefix to target check-in: 1fee8d8e98 user: srehman tags: v1.64
2017-03-08
18:52
added filter to runs page check-in: f7eea52531 user: pjhatwal tags: v1.64
10:47
Typos check-in: 6f6ebb3edd user: matt tags: v1.64
Changes

Modified cgisetup/models/pgdb.scm from [ea892855e8] to [c3a02037dc].

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
		"SELECT DISTINCT target FROM runs WHERE target LIKE ? AND ttype_id=?;" target-patt tt-id))
	 ))
     ttypes)))

(define (pgdb:get-targets-of-type dbh ttype-id target-patt)
  (dbi:get-rows dbh "SELECT DISTINCT target FROM runs WHERE target LIKE ? AND ttype_id=?;" target-patt ttype-id))

(define (pgdb:get-runs-by-target dbh targets)
   (dbi:get-rows dbh "SELECT r.run_name, t.test_name, t.status, t.item_path, t.id, t.rundir, t.final_logf FROM runs as r INNER JOIN tests AS t ON t.run_id=r.id  
                          WHERE t.state='COMPLETED' AND r.target like ?;" targets)
)

(define (pgdb:get-test-by-id dbh id)
  (dbi:get-rows dbh "SELECT t.test_name, t.item_path, t.rundir, t.final_logf FROM runs as r INNER JOIN tests AS t ON t.run_id=r.id  
                          WHERE t.id = ?;" id)
)








|

|







198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
		"SELECT DISTINCT target FROM runs WHERE target LIKE ? AND ttype_id=?;" target-patt tt-id))
	 ))
     ttypes)))

(define (pgdb:get-targets-of-type dbh ttype-id target-patt)
  (dbi:get-rows dbh "SELECT DISTINCT target FROM runs WHERE target LIKE ? AND ttype_id=?;" target-patt ttype-id))

(define (pgdb:get-runs-by-target dbh targets run-patt)
   (dbi:get-rows dbh "SELECT r.run_name, t.test_name, t.status, t.item_path, t.id, t.rundir, t.final_logf FROM runs as r INNER JOIN tests AS t ON t.run_id=r.id  
                          WHERE t.state='COMPLETED' AND r.target like ? AND  r.run_name like ?;" targets run-patt)
)

(define (pgdb:get-test-by-id dbh id)
  (dbi:get-rows dbh "SELECT t.test_name, t.item_path, t.rundir, t.final_logf FROM runs as r INNER JOIN tests AS t ON t.run_id=r.id  
                          WHERE t.id = ?;" id)
)

Modified cgisetup/pages/home_view.scm from [79736d1aeb] to [0d15bde503].

114
115
116
117
118
119
120
121
122
123
124
125
126
					    (failper (- 100 passper))
					    (run-key ;; (string-substitute ;; %2F = /
						     ;; "-" "%2D"
						      ;;(string-substitute "/" "%2F" (conc col-key "/" row-key) 'all)
						      (string-substitute "[/]" "_x_" (conc col-key "/" row-key) 'all)
						      ;; 'all)))
						      ))
				       (s:td 'style (conc "background: linear-gradient(to right, green " passper "%, red " failper "%);")
					     (s:a 'href (s:link-to "run" 'target run-key)
						  (conc total "/" pass "/" fail "/" other))))
				     (s:td ""))))
			     a-keys)))
		    b-keys))))))))







|
|




114
115
116
117
118
119
120
121
122
123
124
125
126
					    (failper (- 100 passper))
					    (run-key ;; (string-substitute ;; %2F = /
						     ;; "-" "%2D"
						      ;;(string-substitute "/" "%2F" (conc col-key "/" row-key) 'all)
						      (string-substitute "[/]" "_x_" (conc col-key "/" row-key) 'all)
						      ;; '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 'href (s:link-to "run" 'target run-key)
						  (conc total "/" pass "/" fail "/" other))))
				     (s:td ""))))
			     a-keys)))
		    b-keys))))))))

Modified cgisetup/pages/run_ctrl.scm from [4336cde456] to [b5550ef418].

9
10
11
12
13
14
15
16



17
18
19
;;  PURPOSE.
;;======================================================================

;; a function <pagename>-action is called on POST

(define (run-action action)
  (case (string->symbol action)
    ((dosomething)



     (dosomething))))









|
>
>
>
|


9
10
11
12
13
14
15
16
17
18
19
20
21
22
;;  PURPOSE.
;;======================================================================

;; a function <pagename>-action is called on POST

(define (run-action action)
  (case (string->symbol action)
    ((filter)
     (let ((run-name-filter (s:get-input 'run-name-filter))
            (target (s:get-input 'target)))
     (s:set! "run-name-filter" run-name-filter)
     (s:set! "target" target)))))


Modified cgisetup/pages/run_view.scm from [c77bd39564] to [8edac034a0].

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
;;======================================================================
;; 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:run session db shared)
  (let* ((dbh         (s:db))






	 (target      (string-substitute  "_x_"  "/" (s:get-param 'target) 'all))


         (runs (pgdb:get-runs-by-target dbh target))
         (ordered-runs (pgdb:runs-to-hash runs)))
   
    (s:div 'class "col_12"
















	   (s:fieldset
	   (conc "Show a runs for Target: " target)
             (let* ((a-keys (sort (hash-table-keys ordered-runs) string>=?))
		   (b-keys (delete-duplicates(sort (apply
				  append
				  (map (lambda (sub-key)
					 (let ((subdat (hash-table-ref ordered-runs sub-key)))
					   (hash-table-keys subdat)))
				       a-keys))
				 string>=?))))
  
              (s:table
		   (s:tr (s:td "")(map s:td 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-runs col-key #f)))
					    (if ht (hash-table-ref/default ht row-key #f)))))










<


>
>
>
>
>
>
|
>
>
|



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










|

|







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
;;======================================================================
;; 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:run session db shared)
  (let* ((dbh         (s:db))
	 (target-param       (s:get-param 'target))   
         (target1      (if  (s:get "target") 
                       (s:get "target")
                       (s:get-param 'target)))
         (target (if (equal? target1 #f)
                     "%"
                    (string-substitute  "_x_"  "/" target1 'all)     
                    )) 
         (run-filter (or (s:get "run-name-filter") "%"))  
         (runs (pgdb:get-runs-by-target dbh target run-filter))
         (ordered-runs (pgdb:runs-to-hash runs)))
   
    (s:div 'class "col_12"
            (s:fieldset
	    "Run filter"
	    (s:form
	     'action "run.filter" 'method "post"
	     (s:div 'class "col_12"
		     (s:div 'class "col_6"
                           ;(s:p (conc "param" (s:get-param 'target)) )
                           ; (s:p (conc "get" (s:get "target")) )
                           ;(s:p target1)
			   (s:input-preserve 'name "run-name-filter" 'placeholder "Filter by run names")
                           (s:input 'type "hidden" 'value target 'name "target" ))

		    (s:div 'class "col_6"
			   (s:input 'type "submit" 'name "set-filter-vals" 'value "Submit")))
	     	     ))

	   (s:fieldset
	   (conc "Show a runs for Target: " target)
             (let* ((a-keys (sort (hash-table-keys ordered-runs) string>=?))
		   (b-keys (delete-duplicates(sort (apply
				  append
				  (map (lambda (sub-key)
					 (let ((subdat (hash-table-ref ordered-runs sub-key)))
					   (hash-table-keys subdat)))
				       a-keys))
				 string>=?))))
              
              (s:table
		   (s:tr  (s:th "") (map s:th 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-runs col-key #f)))
					    (if ht (hash-table-ref/default ht row-key #f)))))