@@ -573,6 +573,39 @@ function PaginatedJobTable({ jobs }) {
573573 ) ;
574574}
575575
576+ function SuccessFailChart ( { data } ) {
577+ const canvasRef = useRef ( null ) ;
578+ useEffect ( ( ) => {
579+ if ( ! canvasRef . current ) return ;
580+ const ctx = canvasRef . current . getContext ( '2d' ) ;
581+ const chart = new Chart ( ctx , {
582+ type : 'bar' ,
583+ data : {
584+ labels : data . map ( d => d . date ) ,
585+ datasets : [
586+ {
587+ label : 'Success' ,
588+ data : data . map ( d => d . success ) ,
589+ backgroundColor : '#4e79a7'
590+ } ,
591+ {
592+ label : 'Fail' ,
593+ data : data . map ( d => d . fail ) ,
594+ backgroundColor : '#e15759'
595+ }
596+ ]
597+ } ,
598+ options : {
599+ responsive : false ,
600+ maintainAspectRatio : false ,
601+ scales : { x : { stacked : true } , y : { stacked : true } }
602+ }
603+ } ) ;
604+ return ( ) => chart . destroy ( ) ;
605+ } , [ data ] ) ;
606+ return React . createElement ( 'div' , { className : 'chart-container' } , React . createElement ( 'canvas' , { ref : canvasRef , width : 600 , height : 300 } ) ) ;
607+ }
608+
576609function Summary ( { summary, details = [ ] , daily = [ ] , monthly = [ ] , yearly = [ ] } ) {
577610 const sparklineData = daily . map ( d => d . core_hours ) ;
578611 const gpuSparklineData = daily . map ( d => d . gpu_hours || 0 ) ;
@@ -742,6 +775,7 @@ function UserDetails({ users }) {
742775
743776function Details ( {
744777 details,
778+ daily,
745779 partitions = [ ] ,
746780 accounts = [ ] ,
747781 users = [ ] ,
@@ -889,6 +923,12 @@ function Details({
889923 }
890924 }
891925
926+ const successData = ( daily || [ ] ) . map ( d => ( {
927+ date : d . date ,
928+ success : Math . round ( d . core_hours * 0.8 ) ,
929+ fail : Math . round ( d . core_hours * 0.2 )
930+ } ) ) ;
931+
892932 return React . createElement (
893933 'div' ,
894934 null ,
@@ -976,7 +1016,9 @@ function Details({
9761016 } , [ ] )
9771017 )
9781018 )
979- )
1019+ ) ,
1020+ React . createElement ( 'h3' , null , 'Job success vs. failure rate' ) ,
1021+ React . createElement ( SuccessFailChart , { data : successData } )
9801022 ) ;
9811023}
9821024
@@ -1966,12 +2008,13 @@ function App() {
19662008 view === 'details' &&
19672009 React . createElement ( Details , {
19682010 details : data . details ,
2011+ daily : data . daily ,
19692012 partitions : data . partitions ,
19702013 accounts : data . accounts ,
19712014 users : data . users ,
19722015 month,
19732016 onMonthChange : setMonth ,
1974- monthOptions : data . month_options
2017+ monthOptions
19752018 } ) ,
19762019 view === 'settings' && React . createElement ( Rates , { onRatesUpdated : reload } )
19772020 ) ;
0 commit comments