       Object.keys(@shouldReloadMap).forEach @bound 'removeEditor'
 
 
-  openEditor: (stackTemplateId = no) ->
+  openEditor: (stackTemplateId = no, stackId) ->
     { mainController, groupsController, computeController } = kd.singletons
-    { setSelectedMachineId, setSelectedTemplateId } = EnvironmentFlux.actions
 
     unless groupsController.canEditGroup()
       mainController.tellChatlioWidget 'isShown', {}, (err, isShown) ->

        return if isShown
        mainController.tellChatlioWidget 'show', { expanded: no }

    setSelectedMachineId null

    if stackTemplateId
      setSelectedTemplateId stackTemplateId
      if @editors[stackTemplateId]
        return  @showView { _id: stackTemplateId }

      computeController.fetchStackTemplate stackTemplateId, (err, stackTemplate) =>

          return showError err

        editor = @showView stackTemplate

        { sidebar } = kd.singletons

        sidebar.setSelected
          templateId: stackTemplateId
          stackId: stackId
          machineId: null

        # If selected template is deleted, then redirect them to ide.
        # TODO: show an information modal to the user if he/she is admin. ~Umut
        stackTemplate.on 'deleteInstance', =>
