 isKoding                  = require 'app/util/isKoding'
 showError                 = require 'app/util/showError'
 showNotification          = require 'app/util/showNotification'
+isManagedVMStack          = require 'app/util/isManagedVMStack'
+hasManagedVMStack         = require 'app/util/hasManagedVMStack'
 
 remote                    = require('app/remote').getInstance()
 

    @addManagedButton  = new kd.CustomHTMLView cssClass: 'hidden'
    @deleteStackButton = new kd.CustomHTMLView cssClass: 'hidden'

    { title } = @getData()

    unless isKoding() or title is 'Managed VMs'
      @reinitButton = new kd.ButtonView

        cssClass   : 'add-vm-button solid green compact'
        callback   : => @handleMachineRequest 'koding'

    if hasManagedVMStack()
      if isManagedVMStack stack
        @createManagedButton()
      else
        @addManagedButton = new kd.CustomHTMLView
    else
      @createManagedButton()


  createManagedButton: ->

    @addManagedButton = new kd.ButtonView
      title           : 'Add Your Own Machine'
      cssClass        : 'add-managed-button solid green compact'
