           }
         ]
 
+  ###*
+   * walk through stacks and create a dump
+   * @param  {boolean} asYaml = no [returns dump as yAML formatted if true]
+   * @return {object} JSON or yAML dump of stack
+  ###
   getStackDump: (asYaml = no) ->
+
     {containers, connections} = @scene
     dump = {}
 
-    dump.config = "[...]"  if @getOptions().stack.meta?.config
+    dump.config = "[...]"  if @stack.config
 
     for i, container of containers
       name = EnvironmentScene.containerMap[container.constructor.name]

      'Clone this stack'   :
        callback           : =>
          stackDump        = @getStackDump()
          stackDump.config = @getOptions().stack.meta?.config or ""
          @emit "CloneStackRequested", stackDump
      'Delete stack'       :
        callback           : @bound "confirmStackDelete"

    delete items['Delete stack']  if @getOptions().isDefault

    return items

  confirmStackDelete: ->
    stackMeta  = @getOptions().stack.meta or {}
    stackTitle = stackMeta.title or ""
    stackSlug  = stackMeta.slug  or "confirm"

    modal      = new VmDangerModalView
      name     : stackTitle
      action   : "DELETE MY STACK"
      title    : "Delete your #{stackTitle} stack"
      width    : 650
      content  : """
          <div class='modalformline'>
            <p><strong>CAUTION! </strong>This will destroy your #{stackTitle} stack including</strong>
            all VMs and domains inside this stack. You will also lose all your data in your VMs. This action <strong>CANNOT</strong> be undone.</p><br><p>
            Please enter <strong>#{stackSlug}</strong> into the field below to continue: </p>
          </div>
        """
      callback : =>
        modal.destroy()
        @deleteStack()
    , stackSlug

  deleteDomains: (callback = noop) ->
    domainDias    = @domains.dias
    domainDiaKeys = Object.keys domainDias
    domainCouter  = 0
    domainQueue   = domainDiaKeys.map (key) =>=>
      domainDias[key].data.domain.remove (err, res) =>
        domainCouter++
        domainQueue.next()
        @progressModal?.error()  if err
        @progressModal?.next()
        callback()  if domainCouter is domainDiaKeys.length

    Bongo.daisy domainQueue

  deleteVms: (callback = noop) ->
    vmc       = KD.getSingleton "vmController"
    vmDias    = @vms.dias
    vmDiaKeys = Object.keys vmDias
    vmCounter = 0
    vmQueue   = vmDiaKeys.map (key) =>=>
      vmc.deleteVmByHostname vmDias[key].data.hostnameAlias, (err) =>
        vmCounter++
        vmQueue.next()
        @progressModal?.next()
        @progressModal?.error()  if err
        callback()  if vmCounter is vmDiaKeys.length
      , no

    Bongo.daisy vmQueue

  deleteJStack: ->
    {stack} = @getOptions()
    stack.remove (err, res) =>
      return KD.showError err  if err
      @destroy()
      @progressModal?.destroy()

  deleteStack: ->
    hasDomain = Object.keys(@domains.dias).length
    hasVm     = Object.keys(@vms.dias).length

    @createProgressModal hasDomain, hasVm  if hasVm and hasDomain

    if hasDomain
      @deleteDomains =>
        if hasVm
          @deleteVms =>
            @deleteJStack()
        else
          @deleteJStack()
    else if hasVm
      @deleteVms =>
        @deleteJStack()
    else
      @deleteJStack()

  createProgressModal: (hasDomain, hasVm) ->
    listData = {}

    if hasDomain
      arr = listData["Deleting Domains"] = []
      for key, domain of @domains.dias
        arr.push domain.data.title

    if hasVm
      arr = listData["Deleting VMs"] = []
      for key, vm of @vms.dias
        arr.push vm.data.title

    @progressModal = new StackProgressModal {}, listData

  createHeaderElements: ->
    {stack} = @getOptions()
    group   = KD.getGroup().title
    title   = "#{stack.meta?.title or 'a'} stack on #{group}"

    @addSubView title = new KDView
      cssClass : 'stack-title'


    return if asYaml then jsyaml.dump dump else dump


  ### UI Helpers ###


  getProperHeight:->
    (Math.max.apply null, \
      (box.diaCount() for box in @scene.containers)) * 45 + 170


  getMenuItems: ->
    items =
