<commit_before>kd                     = require 'kd'
JView                  = require 'app/jview'
isKoding               = require 'app/util/isKoding'
checkFlag              = require 'app/util/checkFlag'

MachinesList           = require './machineslist'
MachinesListController = require './machineslistcontroller'

ComputeHelpers         = require '../providers/computehelpers'
ComputeController_UI   = require '../providers/computecontroller.ui'


module.exports = class EnvironmentListItem extends kd.ListItemView

  JView.mixin @prototype

  constructor: (options = {}, data) ->

    options.cssClass = kd.utils.curry 'environment-item', options.cssClass

    super options, data

    { machines, _revisionStatus } = stack = @getData()
    delegate = @getDelegate()

    @reinitButton = new kd.ButtonView
      cssClass    : if isKoding() then 'hidden' else ''
      icon        : yes
      iconOnly    : yes
      iconClass   : 'reinit'
      tooltip     :
        title     : 'Re-init Stack'
      callback    : ->
        ComputeController_UI.askFor 'reinitStack', {}, ->
          delegate.emit 'StackReinitRequested', stack

    addVMMenu = {}

    if isKoding()
      addVMMenu['Create Koding VM'] = callback: @generateMenuCallback 'koding'

    addVMMenu['Add Your own VM']  = callback: @generateMenuCallback 'managed'


    @addVMButton  = new kd.ButtonView
      icon        : yes
      iconOnly    : yes
      iconClass   : 'add'
      cssClass    : 'add-vm-button'
      tooltip     :
        title     : 'Add new VM'
      callback    : =>
        @_menu = new kd.ContextMenu
          cssClass    : 'add-new-vm-menu'
          delegate    : @addVMButton
          y           : @addVMButton.getY() + 25
          x           : @addVMButton.getX() + @addVMButton.getWidth() / 2 - 120
          width       : 240
          arrow       :<commit_msg>managed: Add your own machine vs vm<commit_after>kd                     = require 'kd'
JView                  = require 'app/jview'
isKoding               = require 'app/util/isKoding'
checkFlag              = require 'app/util/checkFlag'

MachinesList           = require './machineslist'
MachinesListController = require './machineslistcontroller'

ComputeHelpers         = require '../providers/computehelpers'
ComputeController_UI   = require '../providers/computecontroller.ui'


module.exports = class EnvironmentListItem extends kd.ListItemView

  JView.mixin @prototype

  constructor: (options = {}, data) ->

    options.cssClass = kd.utils.curry 'environment-item', options.cssClass

    super options, data

    { machines, _revisionStatus } = stack = @getData()
    delegate = @getDelegate()

    @reinitButton = new kd.ButtonView
      cssClass    : if isKoding() then 'hidden' else ''
      icon        : yes
      iconOnly    : yes
      iconClass   : 'reinit'
      tooltip     :
        title     : 'Re-init Stack'
      callback    : ->
        ComputeController_UI.askFor 'reinitStack', {}, ->
          delegate.emit 'StackReinitRequested', stack

    addVMMenu = {}

    if isKoding()
      addVMMenu['Create Koding VM'] = callback: @generateMenuCallback 'koding'

    addVMMenu['Add Your Own Machine']  = callback: @generateMenuCallback 'managed'


    @addVMButton  = new kd.ButtonView
      icon        : yes
      iconOnly    : yes
      iconClass   : 'add'
      cssClass    : 'add-vm-button'
      tooltip     :
        title     : 'Add new VM'
      callback    : =>
        @_menu = new kd.ContextMenu
          cssClass    : 'add-new-vm-menu'
          delegate    : @addVMButton
          y           : @addVMButton.getY() + 25
          x           : @addVMButton.getX() + @addVMButton.getWidth() / 2 - 120
          width       : 240
          arrow       :
{'fraction_non_alphanumeric': 0.10199733688415447, 'fraction_numerical': 0.004793608521970706, 'mean_word_length': 1.9551534225019669, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4818880', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1077, 'n_words': 252}