Index: common.scm ================================================================== --- common.scm +++ common.scm @@ -170,10 +170,23 @@ (loop (car tala) (cdr tala) (car talb) (cdr talb))) #f))))) + +;; Needed for long lists to be sorted where (apply max ... ) dies +;; +(define (common:max inlst) + (let loop ((max-val (car inlst)) + (hed (car inlst)) + (tal (cdr inlst))) + (if (null? tal) + (loop (max hed max-val) + (car tal) + (cdr tal)) + (max hed max-val)))) + ;;====================================================================== ;; Munge data into nice forms ;;====================================================================== Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -875,15 +875,44 @@ ;; ;; General info about the run(s) and megatest area (define (dashboard:summary) (let ((rawconfig (read-config (conc *toppath* "/megatest.config") #f 'return-string))) (iup:vbox - (iup:frame - #:title "General Info" - (iup:hbox - (dcommon:general-info) - (dcommon:keys-matrix rawconfig))) + (iup:split + ;; #:value 500 + (iup:frame + #:title "General Info" + (iup:hbox + (dcommon:keys-matrix rawconfig) + (dcommon:general-info) + )) + (iup:frame + #:title "Server" + (iup:vbox + (iup:hbox + (iup:button "Start" + #:size "50x" + #:action (lambda (obj) + (let ((cmd (conc "xterm -geometry 180x20 -e \"" + "megatest -server -" + ";echo Press any key to continue;bash -c 'read -n 1 -s'\" &"))) + (system cmd)))) + (iup:button "Stop" + #:size "50x" + #:action (lambda (obj) + (let ((cmd (conc "xterm -geometry 180x20 -e \"" + "megatest -stop-server 0" + ";echo Press any key to continue;bash -c 'read -n 1 -s'\" &"))) + (system cmd)))) + (iup:button "Restart" + #:size "50x" + #:action (lambda (obj) + (let ((cmd (conc "xterm -geometry 180x20 -e \"" + "megatest -stop-server 0;megatest -server -" + ";echo Press any key to continue;bash -c 'read -n 1 -s'\" &"))) + (system cmd)))) + )))) (iup:frame #:title "Megatest config settings" (iup:hbox (dcommon:section-matrix rawconfig "setup" "Varname" "Value") (iup:vbox @@ -932,17 +961,23 @@ (runs-header (vector-ref runs-dat 0)) ;; 0 is header, 1 is list of records (run-id (dboard:data-get-curr-run-id *data*)) (tests-dat (let ((tdat (mt:get-tests-for-run run-id "%" '() '() qryvals: "id,testname,item_path,state,status"))) ;; get 'em all (sort tdat (lambda (a b) - (string<= (vector-ref a 2)(vector-ref b 2)))))) + (let* ((aval (vector-ref a 2)) + (bval (vector-ref b 2)) + (anum (string->number aval)) + (bnum (string->number bval))) + (if (and anum bnum) + (< anum bnum) + (string<= aval bval))))))) (tests-mindat (dcommon:minimize-test-data tests-dat)) (indices (common:sparse-list-generate-index tests-mindat)) ;; proc: set-cell)) (row-indices (cadr indices)) (col-indices (car indices)) - (max-row (if (null? row-indices) 1 (apply max (map cadr row-indices)))) - (max-col (if (null? col-indices) 1 (apply max (map cadr col-indices)))) + (max-row (if (null? row-indices) 1 (common:max (map cadr row-indices)))) + (max-col (if (null? col-indices) 1 (common:max (map cadr col-indices)))) (max-visible (max (- *num-tests* 15) 3)) ;; *num-tests* is proportional to the size of the window (numrows 1) (numcols 1) (changed #f) (runs-hash (let ((ht (make-hash-table))) Index: dcommon.scm ================================================================== --- dcommon.scm +++ dcommon.scm @@ -305,11 +305,12 @@ #:numlin (length key-vals) #:numcol-visible 1 #:numlin-visible (length key-vals) #:click-cb (lambda (obj lin col status) (print "obj: " obj " lin: " lin " col: " col " status: " status))))) - (iup:attribute-set! keys-matrix "0:0" "Run Keys") + ;; (iup:attribute-set! keys-matrix "0:0" "Run Keys") + (iup:attribute-set! keys-matrix "WIDTH0" 0) (iup:attribute-set! keys-matrix "0:1" "Key Name") ;; (iup:attribute-set! keys-matrix "WIDTH1" "100") ;; fill in keys (for-each (lambda (var) @@ -316,10 +317,11 @@ ;; (iup:attribute-set! keys-matrix "ADDLIN" (conc curr-row-num)) (iup:attribute-set! keys-matrix (conc curr-row-num ":0") curr-row-num) (iup:attribute-set! keys-matrix (conc curr-row-num ":1") var) (set! curr-row-num (+ 1 curr-row-num))) ;; (config-lookup *configdat* "fields" var))) key-vals) + (iup:attribute-set! keys-matrix "WIDTHDEF" "40") keys-matrix)) ;; Section to table (define (dcommon:section-matrix rawconfig sectionname varcolname valcolname #!key (title #f)) (let* ((curr-row-num 1) @@ -364,15 +366,16 @@ (iup:attribute-set! general-matrix "0:1" "About this Megatest area") ;; User (this is not always obvious - it is common to run as a different user (iup:attribute-set! general-matrix "1:0" "User") (iup:attribute-set! general-matrix "1:1" (current-user-name)) ;; Megatest area - (iup:attribute-set! general-matrix "2:0" "Megatest area") + (iup:attribute-set! general-matrix "2:0" "Area") (iup:attribute-set! general-matrix "2:1" *toppath*) ;; Megatest version - (iup:attribute-set! general-matrix "3:0" "Megatest version") + (iup:attribute-set! general-matrix "3:0" "Version") (iup:attribute-set! general-matrix "3:1" megatest-version) + general-matrix)) (define (dcommon:run-stats) (let* ((stats-matrix (iup:matrix expand: "YES")) (changed #f)