 kd                 = require 'kd'
-globals            = require 'globals'
 KDCustomHTMLView   = kd.CustomHTMLView
-
-EnvironmentsModal  = require 'app/environment/environmentsmodal'
 SidebarMachineList = require './sidebarmachinelist'
-
+curryIn            = require 'app/util/curryIn'
 
 module.exports = class SidebarOwnMachinesList extends SidebarMachineList
 

      tagName  : 'cite'
      cssClass : 'count hidden'
      partial  : '1'

    kd.singletons.computeController.on 'StackRevisionChecked', (stack) =>

      return  if @isDestroyed # This needs to be investigated ~ GG
                              # We're creating instances of this multiple times
                              # but somehow we're not cleaning up them correctly

      {_revisionStatus} = stack
      if not _revisionStatus?.error? and {status} = _revisionStatus
        @unreadCount.show()  if status?.code > 0


  headerClickHandler: -> new EnvironmentsModal


    options.title      ?= 'Your VMs'
    options.hasPlusIcon = yes

    curryIn options, cssClass: 'my-machines'

    super options, data

