Overview
Comment: | refactor of dashboard completed, now for a redesign :) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | refactor-dashboard |
Files: | files | file ages | folders |
SHA1: |
c6b6fec4f4ba3b932b902a17c260ebc0 |
User & Date: | mrwellan on 2011-06-26 23:37:09 |
Other Links: | branch diff | manifest | tags |
Context
2011-06-26
| ||
23:38 | Merged refactor of dashboard to trunk check-in: d73b2c1642 user: mrwellan tags: trunk | |
23:37 | refactor of dashboard completed, now for a redesign :) Closed-Leaf check-in: c6b6fec4f4 user: mrwellan tags: refactor-dashboard | |
16:00 | Sped up the left labels a bit check-in: 49eeb8afc8 user: mrwellan tags: refactor-dashboard | |
Changes
Modified dashboard-tests.scm from [53ef169052] to [de9bfb12d2].
︙ | ︙ | |||
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | (store-label "RunDuration" (iup:label (conc (db:test-get-run_duration testdat)) #:expand "HORIZONTAL") (lambda (testdat)(conc (db:test-get-run_duration testdat)))) (store-label "CPULoad" (iup:label (conc (db:test-get-final_logf testdat)) #:expand "HORIZONTAL") (lambda (testdat)(conc (db:test-get-final_logf testdat))))))))) ;;====================================================================== ;; Set fields ;;====================================================================== (define (set-fields-panel test-id testdat) (let ((newcomment #f) (newstatus #f) (newstate #f)) (iup:frame #:title "Set fields" (iup:vbox (iup:hbox (iup:label "Comment:") (iup:textbox #:action (lambda (val a b) (set! newcomment b)) #:value (db:test-get-comment testdat) #:expand "YES")) | > > > > > > > > > > > | | > > > | > | < | < | > | > > > > > > | > | | | < < < < < < < < < | | | | > | < < < > > | < | < < | > > > > > | > | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | (store-label "RunDuration" (iup:label (conc (db:test-get-run_duration testdat)) #:expand "HORIZONTAL") (lambda (testdat)(conc (db:test-get-run_duration testdat)))) (store-label "CPULoad" (iup:label (conc (db:test-get-final_logf testdat)) #:expand "HORIZONTAL") (lambda (testdat)(conc (db:test-get-final_logf testdat))))))))) ;; use a global for setting the buttons colors ;; state status teststeps (define *state-status* (vector #f #f #f)) (define (update-state-status-buttons testdat) (let* ((state (db:test-get-state testdat)) (status (db:test-get-status testdat)) (color (get-color-for-state-status state status))) ((vector-ref *state-status* 0) state color) ((vector-ref *state-status* 1) status color))) ;;====================================================================== ;; Set fields ;;====================================================================== (define (set-fields-panel test-id testdat) (let ((newcomment #f) (newstatus #f) (newstate #f)) (iup:frame #:title "Set fields" (iup:vbox (iup:hbox (iup:label "Comment:") (iup:textbox #:action (lambda (val a b) (db:test-set-state-status-by-id *db* test-id #f #f b) (set! newcomment b)) #:value (db:test-get-comment testdat) #:expand "YES")) (apply iup:hbox (iup:label "STATE:" #:size "30x") (let* ((btns (map (lambda (state) (let ((btn (iup:button state #:expand "YES" #:size "70x" #:action (lambda (x) (db:test-set-state-status-by-id *db* test-id state #f #f) (db:test-set-state! testdat state))))) btn)) (list "COMPLETED" "NOT_STARTED" "RUNNING" "REMOTEHOSTSTART" "KILLED" "KILLREQ")))) (vector-set! *state-status* 0 (lambda (state color) (for-each (lambda (btn) (let* ((name (iup:attribute btn "TITLE")) (newcolor (if (equal? name state) color "192 192 192"))) (if (not (colors-similar? newcolor (iup:attribute btn "BGCOLOR"))) (iup:attribute-set! btn "BGCOLOR" newcolor)))) btns))) btns)) (apply iup:hbox (iup:label "STATUS:" #:size "30x") (let* ((btns (map (lambda (status) (let ((btn (iup:button status #:expand "YES" #:size "70x" #:action (lambda (x) (db:test-set-state-status-by-id *db* test-id #f status #f) (db:test-set-status! testdat status))))) btn)) (list "PASS" "WARN" "FAIL" "CHECK" "n/a" "WAIVED")))) (vector-set! *state-status* 1 (lambda (status color) (for-each (lambda (btn) (let* ((name (iup:attribute btn "TITLE")) (newcolor (if (equal? name status) color "192 192 192"))) (if (not (colors-similar? newcolor (iup:attribute btn "BGCOLOR"))) (iup:attribute-set! btn "BGCOLOR" newcolor)))) btns))) btns)))))) ;;====================================================================== ;; ;;====================================================================== (define (examine-test db test-id mx1) ;; run-id run-key origtest) (let* ((testdat (db:get-test-data-by-id db test-id)) (run-id (if testdat (db:test-get-run_id testdat) #f)) (keydat (if testdat (keys:get-key-val-pairs db run-id) #f)) (rundat (if testdat (db:get-run-info db run-id) #f)) (runname (if testdat (db:get-value-by-header (db:get-row rundat) (db:get-header rundat) "runname") #f)) ;(teststeps (if testdat (db:get-steps-for-test db test-id) #f)) (logfile "/this/dir/better/not/exist") (rundir logfile) (testfullname (if testdat (db:test-get-fullname testdat) "Gathering data ...")) (viewlog (lambda (x) (if (file-exists? logfile) (system (conc "firefox " logfile "&")) (message-window (conc "File " logfile " not found"))))) |
︙ | ︙ | |||
208 209 210 211 212 213 214 | (set! testdat newtestdat) (set! teststeps (db:get-steps-for-test db test-id)) (set! logfile (conc (db:test-get-rundir testdat) "/" (db:test-get-final_logf testdat))) (set! rundir (db:test-get-rundir testdat)) (set! testfullname (db:test-get-fullname testdat)) (mutex-unlock! mx1)) (begin | | | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | (set! testdat newtestdat) (set! teststeps (db:get-steps-for-test db test-id)) (set! logfile (conc (db:test-get-rundir testdat) "/" (db:test-get-final_logf testdat))) (set! rundir (db:test-get-rundir testdat)) (set! testfullname (db:test-get-fullname testdat)) (mutex-unlock! mx1)) (begin (db:test-set-testname! testdat "DEAD OR DELETED TEST")))))) (widgets (make-hash-table)) (self #f) (store-label (lambda (name lbl cmd) (hash-table-set! widgets name (lambda (testdat) (let ((newval (cmd testdat)) (oldval (iup:attribute lbl "TITLE"))) |
︙ | ︙ | |||
238 239 240 241 242 243 244 | (iup:vbox ; #:expand "YES" ;; The run and test info (iup:hbox ; #:expand "YES" (run-info-panel keydat testdat runname) (test-info-panel testdat store-label widgets)) (host-info-panel testdat store-label) ;; The controls | | | < | < | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | (iup:vbox ; #:expand "YES" ;; The run and test info (iup:hbox ; #:expand "YES" (run-info-panel keydat testdat runname) (test-info-panel testdat store-label widgets)) (host-info-panel testdat store-label) ;; The controls (iup:frame #:title "Actions" (iup:hbox (iup:button "View Log" #:action viewlog #:size "120x") (iup:button "Start Xterm" #:action xterm #:size "120x") (iup:button "Close" #:action (lambda (x)(exit)) #:size "120x"))) (set-fields-panel test-id testdat) (iup:frame #:title "Test Steps" (let ((stepsdat (iup:label "Test steps ........................................." #:expand "YES" #:size "200x150" #:alignment "ALEFT:ATOP"))) (hash-table-set! widgets "Test Steps" (lambda (testdat) (let* ((currval (iup:attribute stepsdat "TITLE")) (fmtstr "~15a~8a~8a~20a") (newval (string-intersperse (append (list (format #f fmtstr "Stepname" "State" "Status" "Event Time") (format #f fmtstr "========" "=====" "======" "==========")) (map (lambda (x) ;; take advantage of the \n on time->string (format #f fmtstr (db:step-get-stepname x) (db:step-get-state x) (db:step-get-status x) (time->string (seconds->local-time (db:step-get-event_time x))))) (db:get-steps-for-test db test-id))) "\n"))) (if (not (equal? currval newval)) (iup:attribute-set! stepsdat "TITLE" newval))))) stepsdat))))) (iup:show self) ;; Now start keeping the gui updated from the db (let loop ((i 0)) (thread-sleep! 0.1) (refreshdat) ;; update from the db here ;(thread-suspend! other-thread) ;; update the gui elements here (for-each (lambda (key) ;; (print "Updating " key) ((hash-table-ref widgets key) testdat)) (hash-table-keys widgets)) (update-state-status-buttons testdat) ; (iup:refresh self) (iup:main-loop-flush) (if *exit-started* (set! *exit-started* 'ok) (loop i))))))) ;; |
︙ | ︙ |
Modified dashboard.scm from [912915ad20] to [0947d7ca7f].
︙ | ︙ | |||
156 157 158 159 160 161 162 | (loop (+ i 1))))))) (define (get-color-for-state-status state status) (case (string->symbol state) ((COMPLETED) (if (equal? status "PASS") "70 249 73" | | > > | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | (loop (+ i 1))))))) (define (get-color-for-state-status state status) (case (string->symbol state) ((COMPLETED) (if (equal? status "PASS") "70 249 73" (if (or (equal? status "WARN") (equal? status "WAIVED")) "255 172 13" "223 33 49"))) ;; greenish orangeish redish ((LAUNCHED) "101 123 142") ((CHECK) "255 100 50") ((REMOTEHOSTSTART) "50 130 195") ((RUNNING) "9 131 232") ((KILLREQ) "39 82 206") ((KILLED) "234 101 17") ((NOT_STARTED) "240 240 240") (else "192 192 192"))) (define (update-buttons uidat numruns numtests) (let* ((runs (if (> (length *allruns*) numruns) (take-right *allruns* numruns) (pad-list *allruns* numruns))) (lftcol (vector-ref uidat 0)) (tableheader (vector-ref uidat 1)) |
︙ | ︙ | |||
311 312 313 314 315 316 317 | (iup:textbox #:size "60x15" #:fontsize "10" #:value "%" #:action (lambda (obj unk val) (update-search "item-name" val))) (iup:button "Quit" #:action (lambda (obj)(sqlite3:finalize! *db*)(exit))) (iup:button "<- Left" #:action (lambda (obj)(set! *start-run-offset* (+ *start-run-offset* 1)))) (iup:button "Up ^" #:action (lambda (obj)(set! *start-test-offset* (if (> *start-test-offset* 0)(- *start-test-offset* 1) 0)))) (iup:button "Down v" #:action (lambda (obj)(set! *start-test-offset* (if (>= *start-test-offset* (length *alltestnamelst*))(length *alltestnamelst*)(+ *start-test-offset* 1))))) | | > > > > | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | (iup:textbox #:size "60x15" #:fontsize "10" #:value "%" #:action (lambda (obj unk val) (update-search "item-name" val))) (iup:button "Quit" #:action (lambda (obj)(sqlite3:finalize! *db*)(exit))) (iup:button "<- Left" #:action (lambda (obj)(set! *start-run-offset* (+ *start-run-offset* 1)))) (iup:button "Up ^" #:action (lambda (obj)(set! *start-test-offset* (if (> *start-test-offset* 0)(- *start-test-offset* 1) 0)))) (iup:button "Down v" #:action (lambda (obj)(set! *start-test-offset* (if (>= *start-test-offset* (length *alltestnamelst*))(length *alltestnamelst*)(+ *start-test-offset* 1))))) (iup:button "Right ->" #:action (lambda (obj)(set! *start-run-offset* (if (> *start-run-offset* 0)(- *start-run-offset* 1) 0)))) ;(iup:button "inc rows" #:action (lambda (obj)(set! *num-tests* (+ *num-tests* 1)))) ;(iup:button "dec rows" #:action (lambda (obj)(set! *num-tests* (if (> *num-tests* 0)(- *num-tests* 1) 0)))) ) ) ;; create the left most column for the run key names and the test names (set! lftlst (list (apply iup:vbox (map (lambda (x) (let ((res (iup:hbox (iup:label x #:size "40x15" #:fontsize "10") ;; #:expand "HORIZONTAL") (iup:textbox #:size "60x15" #:fontsize "10" #:value "%" ;; #:expand "HORIZONTAL" |
︙ | ︙ | |||
434 435 436 437 438 439 440 | (begin (print "ERROR: runid is not a number " (args:get-arg "-run")) (exit 1))))) ((args:get-arg "-test") (let ((testid (string->number (args:get-arg "-test")))) (if testid (set! *job* (lambda (mx1) | < < < < < < < < < < < | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | (begin (print "ERROR: runid is not a number " (args:get-arg "-run")) (exit 1))))) ((args:get-arg "-test") (let ((testid (string->number (args:get-arg "-test")))) (if testid (set! *job* (lambda (mx1) (examine-test *db* testid mx1))) (begin (print "ERROR: testid is not a number " (args:get-arg "-test")) (exit 1))))) (else (set! uidat (make-dashboard-buttons *num-runs* *num-tests* dbkeys)) (set! *job* (lambda (mtx1)(run-update mtx1))))) |
︙ | ︙ |
Modified db.scm from [4531d1ac51] to [3d2cc63ab7].
︙ | ︙ | |||
192 193 194 195 196 197 198 | (define-inline (db:test-get-item-path vec) (vector-ref vec 11)) (define-inline (db:test-get-run_duration vec) (vector-ref vec 12)) (define-inline (db:test-get-final_logf vec) (vector-ref vec 13)) (define-inline (db:test-get-comment vec) (vector-ref vec 14)) (define-inline (db:test-get-fullname vec) (conc (db:test-get-testname vec) "/" (db:test-get-item-path vec))) | | > > | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | (define-inline (db:test-get-item-path vec) (vector-ref vec 11)) (define-inline (db:test-get-run_duration vec) (vector-ref vec 12)) (define-inline (db:test-get-final_logf vec) (vector-ref vec 13)) (define-inline (db:test-get-comment vec) (vector-ref vec 14)) (define-inline (db:test-get-fullname vec) (conc (db:test-get-testname vec) "/" (db:test-get-item-path vec))) (define-inline (db:test-set-testname! vec val)(vector-set! vec 2 val)) (define-inline (db:test-set-state! vec val)(vector-set! vec 3 val)) (define-inline (db:test-set-status! vec val)(vector-set! vec 4 val)) (define (db-get-tests-for-run db run-id . params) (let ((res '()) (testpatt (if (or (null? params)(not (car params))) "%" (car params))) (itempatt (if (> (length params) 1)(cadr params) "%"))) (sqlite3:for-each-row (lambda (id run-id testname state status event-time host cpuload diskfree uname rundir item-path run-duration final-logf comment) |
︙ | ︙ |