Index: dashboard-new-runs-view.scm ================================================================== --- dashboard-new-runs-view.scm +++ dashboard-new-runs-view.scm @@ -59,31 +59,35 @@ ;;====================================================================== ;; The "new" runs browser, this one sets up the view and registers the ;; updater ;; (define (dashboard:runs-browse commondat tabdat #!key (tab-num 5)) - (let* ((rdat (make-dboard:rdat))) + (let* ((rdat (make-dboard:rdat)) + (runsmtx (dboard:runs-new-matrix commondat rdat)) + (itemsmtx (dboard:runs-new-matrix commondat rdat))) + (dboard:rdat-runs-mtx-set! rdat runsmtx) + (dboard:rdat-items-mtx-set! rdat itemsmtx) (dboard:commondat-add-updater commondat (lambda () (dashboard:new-runs-updater commondat tabdat rdat)) tab-num: tab-num) (iup:split #:orientation "VERTICAL" - #:value 10 + #:value 100 + #:shrink "YES" (iup:vbox (dboard:runs-tree-new-view-browser commondat rdat)) (iup:split #:orientation "VERTICAL" - #:value 10 + #:value 100 + (iup:vbox runsmtx) (iup:vbox - (dboard:runs-new-matrix commondat rdat)) - (iup:hbox (iup:split #:orientation "VERTICAL" - #:value 10 - (dboard:runs-new-matrix commondat rdat) + #:value 500 + itemsmtx (dboard:test-info-matrix commondat rdat) )))))) (define (dashboard:new-runs-updater commondat tabdat rdat) (let* ((runnum (dboard:rdat-runnum rdat)) @@ -103,28 +107,13 @@ (loop newrn))))) (if (>= (dboard:rdat-runnum rdat) tot-runs) (dboard:rdat-runnum-set! rdat 0)) ;; (dboard:rdat-runnum-set! rdat rn))) ;; not needed as it is set above ;; (dboard:rdat-last-update-set! rdat (- (current-seconds) 10)) + (dashboard:update-new-runs-view-runs-matrix commondat rdat) '())) -#;(define (make-runs-view commondat rdat tab-num) - ;; register an updater - (dboard:commondat-add-updater - commondat - (lambda () - (new-runs-updater commondat rdat)) - tab-num: tab-num) - - (iup:vbox - (iup:split - #:orientation "VERTICAL" ;; "HORIZONTAL" - #:value 100 - (dboard:runs-tree-new-browser commondat rdat) - (dboard:runs-new-matrix commondat rdat) - ))) - ;; NOTE: runnum is NOT the run-id, it is a pointer into the runsbynum vector ;; (define (dashboard:update-run-data runnum rdat) (let* ((curr-time (current-seconds)) (runrec (vector-ref (dboard:rdat-runsbynum rdat) runnum)) @@ -137,24 +126,53 @@ (test-status-sql-filt (dboard:rdat-test-status-sql-filt rdat)) ;; not used yet (tests (rmt:get-tests-for-run-state-status run-id testname-sql-filt last-update ;; last-update ))) + (debug:print 0 *default-log-port* "tests: " tests) (sparse-vector-set! (dboard:rdat-last-updates rdat) run-id (- curr-time 1)) + (sparse-vector-set! (dboard:rdat-run-tests rdat) run-id + (delete-duplicates + (append tests (sparse-vector-ref (dboard:rdat-run-tests rdat) run-id)) + (lambda (a b) + (eq? (vector-ref a 0)(vector-ref b 0))))) ;; de-duplicate based on test id (debug:print 0 *default-log-port* "Got " (length tests) " tests for run-id " - run-id " testname-sql-filt " testname-sql-filt " and last-update " last-update) + run-id " testname-sql-filt " testname-sql-filt " and last-update " last-update + " first test info: " tests) ;; (if (not (null? tests))(car tests) '())) (length tests))) + +(define (dashboard:update-new-runs-view-runs-matrix commondat rdat) + (let* ((run-tests-data (dboard:rdat-run-tests rdat)) ;; from dbmod.scm (define-record simple-run target id runname state status owner event_time) + (run-tests-mtx (dboard:rdat-runs-mtx rdat)) + (runs-by-num (dboard:rdat-runsbynum rdat)) ;; this is the sequence num + ) + (let loop ((col-num 0)) + (let* ((runrec (vector-ref runs-by-num col-num)) + (run-id (simple-run-id runrec)) + (run-tests (sparse-vector-ref run-tests-data run-id))) + (if (null? run-tests) ;; empty run + (if (< col-num 10) ;; NOT CORRECT + (loop (+ col-num))) + (let testloop ((row-num 0) + (tail run-tests)) + (let* ((test-dat (car run-tests)) + (tname (db:test-get-testname test-dat))) + (iup:attribute-set! run-tests-mtx (conc col-num ":" row-num) tname) + (if (not (null? tail)) + (testloop (+ row-num 1)(cdr tail)) + (if (< col-num 10) + (loop (+ col-num 1))))))))))) (define (dboard:runs-new-matrix commondat rdat) (iup:matrix #:alignment1 "ALEFT" - ;; #:expand "YES" ;; "HORIZONTAL" + #:expand "YES" ;; "HORIZONTAL" #:scrollbar "YES" #:numcol 100 #:numlin 200 #:numcol-visible 3 ;; (min 8) - #:numlin-visible 1 + #:numlin-visible 10 #:widthdef 20 #:click-cb (lambda (obj row col status) (let* ((cell (conc row ":" col))) #f)) @@ -184,11 +202,11 @@ ("Owner" . 3) ("Reviewed" . 4) ("Tags" . 5) ("Description" . 6))) (remhost-run-info-fields - '(("Remote host/Run info" . 1) + '(("Host/run info" . 1) ("Hostname" . 2) ("Disk free" . 3) ("CPU Load" . 4) ("Run duration" . 5) ("Logfile" . 6) @@ -200,12 +218,13 @@ ;; #:expand "YES" ;; "HORIZONTAL" #:scrollbar "YES" #:numcol 1 #:numlin (length cfgdat) #:numcol-visible 1 ;; (min 8) - #:numlin-visible 1 + #:numlin-visible (length cfgdat) #:widthdef 50 + #:width0 50 #:click-cb (lambda (obj row col status) (let* ((cell (conc row ":" col))) #f))))) (for-each (lambda (finfo) @@ -217,15 +236,19 @@ mtx))) (runmtx (mk-matrix run-fields)) (testmtx (mk-matrix test-fields)) (metamtx (mk-matrix test-meta-fields)) (remhostmtx (mk-matrix remhost-run-info-fields))) + ;; (dboard:rdat-runs-mtx-set! rdat runmtx) + ;; (dboard:rdat-items-mtx-set! rdat testmtx) + ;; ( (iup:vbox - (iup:hbox - runmtx testmtx) - (iup:hbox - metamtx remhostmtx)))) + #:expandchildren #t + #:expand #f + runmtx testmtx + metamtx remhostmtx + ))) ;; browse runs as a tree. Used in both "Runs" tab and ;; in the runs control panel. ;; ;; THIS IS THE NEW ONE @@ -244,11 +267,11 @@ #;(dashboard:update-run-command tabdat)) "command-testname-selector tb action")) ;; #:value (dboard:test-patt->lines ;; This seems like it was wrong, BUG in code where it was copied from? ;; (dboard:tabdat-test-patts-use tabdat)) #:expand "HORIZONTAL" - ;; #:size "10x30" + ;; #:size "10x" )) (tb (iup:treebox #:value 0 #:title "Runs" ;; was #:name -- iup 3.19 changed @@ -257,11 +280,11 @@ ;; NAMEid from IupTree to avoid ;; conflict with the common attribute ;; NAME. Use the TITLEid attribute." #:expand "YES" #:addexpanded "YES" - #:size "10x" + #:size "120x" #:selection-cb (lambda (obj id state) (debug:catch-and-dump (lambda () (let* ((run-path (tree:node->path obj id)) Index: dashboard.scm ================================================================== --- dashboard.scm +++ dashboard.scm @@ -73,21 +73,21 @@ ;; (declare (uses dbmod.import)) (declare (uses servermod)) (import servermod) -;; This is the new runs view -(include "dashboard-new-runs-view.scm") - (include "common_records.scm") (include "db_records.scm") (include "run_records.scm") (include "task_records.scm") (include "megatest-version.scm") ;; (include "megatest-fossil-hash.scm") (include "vg_records.scm") +;; This is the new runs view +(include "dashboard-new-runs-view.scm") + (define help (conc "Megatest Dashboard, documentation at http://www.kiatoa.com/fossils/megatest version " megatest-version " license GPL, Copyright (C) Matt Welland 2012-2017 @@ -199,11 +199,11 @@ ;; (hash-table-set! args:arg-hash "-use-db-cache" #t)));;;) ;;) ;; data common to all tabs in dboard:commondat struct moved to dcommonmod ;; data from sql db -(keys (rmt:get-keys)) ;; to be removed when targets handling is r +;; (keys (rmt:get-keys)) ;; to be removed when targets handling is r ;; RA => returns the tabdat stored at hashkey passed in commondat-tabdats table (e.g. 0 gives summary) ;; (define (dboard:common-get-tabdat commondat #!key (tab-num #f)) (let* ((tnum (or tab-num @@ -2541,10 +2541,11 @@ ;; now assemble the hdrlst and bdylst and kick off the dialog (iup:show (iup:dialog #:title (conc "Megatest dashboard " (current-user-name) ":" *toppath*) #:menu (dcommon:main-menu) + #:shrink "YES" (let* ((runs-view (iup:vbox (iup:split #:orientation "VERTICAL" ;; "HORIZONTAL" #:value 100 (dboard:runs-tree-browser commondat runs-dat) @@ -2590,10 +2591,11 @@ (let ((order-a (or (any->number (configf:lookup views-cfgdat a "order")) 999)) (order-b (or (any->number (configf:lookup views-cfgdat b "order")) 999))) (> order-a order-b))))) result)) (tabs (apply iup:tabs + #:shrink "YES" #:tabchangepos-cb (lambda (obj curr prev) (debug:catch-and-dump (lambda () (let* ((tab-num (dboard:commondat-curr-tab-num commondat)) (tabdat (dboard:common-get-tabdat commondat tab-num: tab-num))) Index: dcommonmod.scm ================================================================== --- dcommonmod.scm +++ dcommonmod.scm @@ -189,15 +189,16 @@ (leftcol 0) ;; number of the leftmost visible column (toprow 0) ;; topmost visible row (numcols 24) ;; number of columns visible (numrows 20) ;; number of rows visible -efactored - (runs (make-sparse-vector)) ;; id => runrec - (runsbynum (make-vector 100 #f)) ;; vector num => runrec - (targ-runid (make-hash-table)) ;; area/target/runname => run-id ;; not sure this will be needed - (tests (make-hash-table)) ;; test[/itempath] => list of test rec + ;; efactored <=== merge detritus + (runs (make-sparse-vector #f)) ;; id => runrec + (run-tests (make-sparse-vector '())) ;; id => list of tests + (runsbynum (make-vector 100 #f)) ;; vector num => runrec + (targ-runid (make-hash-table)) ;; area/target/runname => run-id ;; not sure this will be needed + (tests (make-hash-table)) ;; test[/itempath] => list of test rec ;; run sql filters (targ-sql-filt "%") (runname-sql-filt "%") (run-state-sql-filt "%") @@ -219,11 +220,14 @@ ;; various (prev-run-ids '()) ;; push previously looked at runs on this (view-changed #f) ;; widgets - (runs-tree #f) ;; + (runs-tree #f) ;; + (runs-mtx #f) ;; runs displayed here + (items-mtx #f) ;; items displayed here + ;; info widgets here ) (define (dboard:rdat-push-run-id rdat run-id) (dboard:rdat-prev-run-ids-set! rdat (cons run-id (dboard:rdat-prev-run-ids rdat))))