 KDButtonView         = kd.ButtonView
 KDTabPaneView        = kd.TabPaneView
 KDCustomHTMLView     = kd.CustomHTMLView
+KDNotificationView   = kd.NotificationView
 
 whoami               = require 'app/util/whoami'
 curryIn              = require 'app/util/curryIn'

      name : 'Stack Template'
      view : @stackTemplateView

    @variablesView                     = new VariablesView delegate: this
    @tabView.addPane variablesPane     = new KDTabPaneView
      name : 'Variables'
      view : @variablesView


  handleSave: ->

    unless @variablesView.isPassed()

      # Warn user if one is trying to save without
      # variables passed while in variables tab
      if @tabView.getActivePaneIndex() is 1
        new KDNotificationView title: 'Please check variables'

      # Switch to Variables tab
      @tabView.showPaneByIndex 1
      @saveButton.hideLoader()
      return

    @saveAndTestStackTemplate()


  saveAndTestStackTemplate: ->

    # Show default first pane.
    @tabView.showPaneByIndex 0
    @outputView.clear().raise()
