       $(".terminals .term-#{data.from} ul.shell-body").append "<li class='cursor'>#{msg}!</li>"
       $(".terminals .term-#{data.from} ul.shell-body").scrollTop($(".terminals .term-#{data.from} ul.shell-body")[0].scrollHeight)
 
+  headBar =
+    state: document.getElementsByClassName("tstate")[0]
+    count: document.getElementsByClassName("tsourceNum")[0]
+
   socket.on 'workerIn', (data) ->
     console.log "worker in",data
     if jobInfo.workers[data.from]

      jobInfo.flushDom data.from

    nodeCnt = (w for w,x of jobInfo.workers when x.active).length
    document.getElementsByClassName("tsourceNum")[0].innerHTML = nodeCnt
    activeCnt = (w for w,x of jobInfo.workers when x.active).length
    if activeCnt > 0
      document.getElementsByClassName("tstate")[0].innerHTML = 'running...'
    else
      document.getElementsByClassName("tstate")[0].innerHTML = 'task finished'    

  socket.on 'workerOut', (data) ->
    console.log "worker lost",data

    jobInfo.workers[data.from].doms.light.getElementsByClassName('twinkle')[0].classList.remove 'twinkle-on'

    nodeCnt = (w for w,x of jobInfo.workers when x.active).length
    headBar.count.innerHTML = nodeCnt
    activeCnt = (w for w,x of jobInfo.workers when x.active).length
    if activeCnt > 0
      headBar.state.innerHTML = 'running'
    else
      headBar.state.innerHTML = 'task finished'    


