 class @AgentShowPage
   constructor: ->
-
     $(".agent-show #show-tabs a[href='#logs'], #logs .refresh").on "click", @fetchLogs
     $(".agent-show #logs .clear").on "click", @clearLogs
     $(".agent-show #memory .clear").on "click", @clearMemory

          $("#logs .refresh, #logs .clear").show()

  toggleMemory: ->

    if $('#memorypanel').hasClass('hidden')
      $('#memorypanel').removeClass 'hidden'
    else
      $('#memorypanel').addClass 'hidden'

  clearMemory: (e) ->

    if confirm("Are you sure you want to clear memory of this Agent?")
      agentId = $(e.target).closest("[data-agent-id]").data("agent-id")
      e.preventDefault()

        .fail ->
          $("#memory .spinner").fadeOut ->
            $("#memory .clear").css(display: 'inline-block')
          
$ ->
  Utils.registerPage(AgentShowPage, forPathsMatching: /^agents\/\d+/)
