 showError                 = require 'app/util/showError'
 checkFlag                 = require 'app/util/checkFlag'
 StacksModal               = require 'app/stacks/stacksmodal'
-EnvironmentList           = require './environmentlist'
 KDCustomScrollView        = kd.CustomScrollView
 EnvironmentListController = require './environmentlistcontroller'
 

    @wrapper.addSubView controller.getView()

    listView.on 'ModalDestroyRequested', @bound 'destroyModal'

    { computeController, appManager, router } = kd.singletons

    listView.on 'StackDeleteRequested', (stack) =>

      computeController.destroyStack stack, (err) =>
        return  if showError err

        new kd.NotificationView
          title : 'Stack deleted'

        computeController.reset yes, -> router.handleRoute '/IDE'
        @destroy()


    listView.on 'StackReinitRequested', (stack) =>
      computeController.once 'RenderStacks', => @destroyModal yes, yes

    whoami().isEmailVerified? (err, verified) ->
      if err or not verified
        for item in controller.getListItems()
          item.emit 'ManagedMachineIsNotAllowed'

    computeController.on 'RenderStacks', controller.bound 'loadItems'


  destroyModal: (goBack = yes, dontChangeRoute = no) ->


    super options, data

    controller  = new EnvironmentListController { selected : options.selected }
    listView    = controller.getListView()

    if checkFlag 'super-admin' and isKoding()

