@@ -576,16 +576,13 @@ function toggleTimeLogArrowColor(timeLog, color) {
576576
577577function nextTimeLog ( timeLog ) {
578578 let timeLogTableDiv = document . getElementById ( "time-log-table-div" ) ;
579+ timeLogTableDiv . innerHTML = '' ;
579580
580- let arrowHTML = `
581- <p id = "remain-ready" class = "arrow">→</p>
582- <p id = "ready-running" class = "arrow">⤺</p>
583- <p id = "running-ready" class = "arrow">⤺</p>
584- <p id = "running-terminate" class = "arrow">→</p>
585- <p id = "running-block" class = "arrow">→</p>
586- <p id = "block-ready" class = "arrow">→</p>
587- ` ;
588- timeLogTableDiv . innerHTML = arrowHTML ;
581+ let remainReady = `<p id = "remain-ready" class = "arrow">→</p>`
582+ let readyRunning = `<div><p id = "running-ready" class = "arrow">⤺</p><p id = "ready-running" class = "arrow">⤺</p></div>`
583+ let runningTerminate = `<p id = "running-terminate" class = "arrow">→</p>`
584+ let runningBlock = `<p id = "running-block" class = "arrow">→</p>`
585+ let blockReady = `<p id = "block-ready" class = "arrow">→</p>`
589586
590587 let remainTable = document . createElement ( "table" ) ;
591588 remainTable . id = "remain-table" ;
@@ -600,7 +597,6 @@ function nextTimeLog(timeLog) {
600597 let remainTableValue = remainTableBodyRow . insertCell ( 0 ) ;
601598 remainTableValue . innerHTML = 'P' + ( timeLog . remain [ i ] + 1 ) ;
602599 }
603- timeLogTableDiv . appendChild ( remainTable ) ;
604600
605601 let readyTable = document . createElement ( "table" ) ;
606602 readyTable . id = "ready-table" ;
@@ -615,7 +611,6 @@ function nextTimeLog(timeLog) {
615611 let readyTableValue = readyTableBodyRow . insertCell ( 0 ) ;
616612 readyTableValue . innerHTML = 'P' + ( timeLog . ready [ i ] + 1 ) ;
617613 }
618- timeLogTableDiv . appendChild ( readyTable ) ;
619614
620615 let runningTable = document . createElement ( "table" ) ;
621616 runningTable . id = "running-table" ;
@@ -630,7 +625,6 @@ function nextTimeLog(timeLog) {
630625 let runningTableValue = runningTableBodyRow . insertCell ( 0 ) ;
631626 runningTableValue . innerHTML = 'P' + ( timeLog . running [ i ] + 1 ) ;
632627 }
633- timeLogTableDiv . appendChild ( runningTable ) ;
634628
635629 let blockTable = document . createElement ( "table" ) ;
636630 blockTable . id = "block-table" ;
@@ -645,7 +639,6 @@ function nextTimeLog(timeLog) {
645639 let blockTableValue = blockTableBodyRow . insertCell ( 0 ) ;
646640 blockTableValue . innerHTML = 'P' + ( timeLog . block [ i ] + 1 ) ;
647641 }
648- timeLogTableDiv . appendChild ( blockTable ) ;
649642
650643 let terminateTable = document . createElement ( "table" ) ;
651644 terminateTable . id = "terminate-table" ;
@@ -660,15 +653,76 @@ function nextTimeLog(timeLog) {
660653 let terminateTableValue = terminateTableBodyRow . insertCell ( 0 ) ;
661654 terminateTableValue . innerHTML = 'P' + ( timeLog . terminate [ i ] + 1 ) ;
662655 }
663- timeLogTableDiv . appendChild ( terminateTable ) ;
656+
657+ const timeLogSkeletonTableConfig = [
658+ [
659+ { type : "blank" , content : '' } ,
660+ { type : "blank" , content : '' } ,
661+ { type : "blank" , content : '' } ,
662+ { type : "element" , content : terminateTable } ,
663+ { type : "blank" , content : '' } ,
664+ { type : "blank" , content : '' } ,
665+ { type : "blank" , content : '' } ,
666+ ] ,
667+ [
668+ { type : "blank" , content : '' } ,
669+ { type : "blank" , content : '' } ,
670+ { type : "html" , content : runningBlock , className : 'southwest-arrow' } ,
671+ { type : "blank" , content : '' } ,
672+ { type : "html" , content : blockReady , className : 'northwest-arrow' } ,
673+ { type : "blank" , content : '' } ,
674+ { type : "blank" , content : '' } ,
675+ ] ,
676+ [
677+ { type : "element" , content : blockTable } ,
678+ { type : "html" , content : runningTerminate } ,
679+ { type : "element" , content : runningTable } ,
680+ { type : "html" , content : readyRunning } ,
681+ { type : "element" , content : readyTable } ,
682+ { type : "html" , content : remainReady } ,
683+ { type : "element" , content : remainTable } ,
684+ ] ,
685+ ] ;
686+
687+ let timeLogSkeletonTable = document . createElement ( "table" ) ;
688+ timeLogSkeletonTable . id = "diagram-skeleton" ;
689+
690+ timeLogSkeletonTableConfig . forEach ( ( row ) => {
691+ let skeletonTableRow = timeLogSkeletonTable . insertRow ( 0 ) ;
692+ ( row || [ ] ) ?. forEach ( ( { type = 'blank' , content = '' , className = '' } ) => {
693+ let skeletonTableCell = skeletonTableRow . insertCell ( 0 ) ;
694+ let skeletonTableCellDiv = document . createElement ( "div" ) ;
695+
696+ if ( className ) {
697+ skeletonTableCellDiv . className = `diagram-cell ${ className } `
698+ } else {
699+ skeletonTableCellDiv . className = "diagram-cell" ;
700+ }
701+ skeletonTableCell . appendChild ( skeletonTableCellDiv ) ;
702+ switch ( type ) {
703+ case 'element' :
704+ skeletonTableCellDiv . appendChild ( content ) ;
705+ break ;
706+ case 'html' :
707+ skeletonTableCellDiv . innerHTML = content ;
708+ break ;
709+ default : {
710+ skeletonTableCellDiv . innerHTML = '' ;
711+ }
712+
713+ }
714+ } )
715+ } )
716+ timeLogTableDiv . appendChild ( timeLogSkeletonTable ) ;
717+
664718 document . getElementById ( "time-log-time" ) . innerHTML = "Time : " + timeLog . time ;
665719}
666720
667721function showTimeLog ( output , outputDiv ) {
668722 reduceTimeLog ( output . timeLog ) ;
669723 let timeLogDiv = document . createElement ( "div" ) ;
670724 timeLogDiv . id = "time-log-div" ;
671- timeLogDiv . style . height = ( 15 * process ) + 300 + "px" ;
725+ timeLogDiv . style . height = ( 20 * process ) + 300 + "px" ;
672726 let startTimeLogButton = document . createElement ( "button" ) ;
673727 startTimeLogButton . id = "start-time-log" ;
674728 startTimeLogButton . innerHTML = "Start Time Log" ;
0 commit comments