         @subview 'console', new ConsoleView()
 
       @div class: 'actions', =>
-        @div class: 'pull-left',outlet:"cancelbutton", =>
-          @button 'Cancel', click: 'CancelFun', class: 'inline-block-tight btn'
-        @div class: 'pull-left',outlet:"closebutton",style:"display:none", =>
-          @button 'Close', click: 'CloseFun', class: 'inline-block-tight btn'
+        @div class: 'pull-left',outlet:"closebutton", =>
+          @button 'Close', click: 'destroy', class: 'inline-block-tight btn'
+        
         @div class: 'pull-right',outlet:"refreshbutton", =>
           @button 'Refresh', click: 'refreshTaskState', class: 'inline-block-tight btn'
+        @div class: 'pull-right',outlet:"cancelbutton", =>
+          @button 'Cancel', click: 'cancel', class: 'inline-block-tight btn'
 
   initialize: ->
 

    @socket.on 'stderr', (out) => @console.append(out, 'text-error')

  destroy: ->
    if @task and @task.state != 'complete'
      puzzleClient.deleteTask @task.id
      .then ->
        console.log "task #{@task.id} deleted."
      .catch ->
        console.error "failed to delete task #{@task.id}"

    @detach()

  setTask: (@task) ->
    @find('.task-id').text @task.id

        console.log "status:#{status}"
      )

  CancelFun:->
    if @task and @task.state != 'complete'
      puzzleClient.deleteTask @task.id
      .then ->
        console.log "task #{@task.id} deleted."
      .catch ->
        console.error "failed to delete task #{@task.id}"
    
