<commit_before>class EnvironmentsMainView extends JView

  constructor:->
    super cssClass : 'environment-content'

  viewAppended:->

    # # Main Header
    # @addSubView @header = new HeaderViewSection type : "big", title : "Environments"

    # Action Area for Domains
    @addSubView actionArea = new KDView cssClass : 'action-area'

    # Domain Creation form in actionArea
    actionArea.addSubView domainCreateForm = new DomainCreationForm

    # Domain Creation form connections
    domainCreateForm.on 'DomainCreationCancelled', => @scene.unsetClass 'out'
    domainCreateForm.on 'CloseClicked',            => @scene.unsetClass 'out'

    # Main scene for DIA
    @addSubView @scene = new EnvironmentScene

    # Domains Container
    domainsContainer = new EnvironmentDomainContainer
    @scene.addContainer domainsContainer
    domainsContainer.on "itemRemoved", domainCreateForm.bound "updateDomains"

    # VMs / Machines Container
    machinesContainer = new EnvironmentMachineContainer
    @scene.addContainer machinesContainer

    # After Domains and Machines container load finished
    # Call updateConnections to draw lines between corresponding objects
    @scene.whenItemsLoadedFor \
      [domainsContainer, machinesContainer], @scene.bound 'updateConnections'

    domainCreateForm.on 'DomainSaved', =>
      domainsContainer.once "DataLoaded", @scene.bound 'updateConnections'
      domainsContainer.loadItems()

    # Plus button on domainsContainer opens up the action area
    domainsContainer.on 'PlusButtonClicked', =>
      @scene.setClass 'out'
      domainCreateForm.emit 'DomainNameShouldFocus'
      # domainsContainer.loadItems()

    # Plus button on machinesContainer uses the vmController
    machinesContainer.on 'PlusButtonClicked', =>
      KD.getSingleton('vmController').createNewVM()

#  - DO NOT TOUCH BELOW

#   tabData = [
#     name        : 'Domains'
#     viewOptions :
#       viewClass : DomainsMainView
#   ,
#     name        : 'VMS'
#     viewOptions :
#       viewClass : VMsMainView
#   ,
#     name        : 'Kites'
#     viewOptions :
#       viewClass : KDView
#   ,
#     name        : 'Builder'
#     viewOptions :
#       viewClass : EnvironmentScene<commit_msg>Environments-newui: click scene to close domain form<commit_after>class EnvironmentsMainView extends JView

  constructor:->
    super cssClass : 'environment-content'

  viewAppended:->

    # # Main Header
    # @addSubView @header = new HeaderViewSection type : "big", title : "Environments"

    # Action Area for Domains
    @addSubView actionArea = new KDView cssClass : 'action-area'

    # Domain Creation form in actionArea
    actionArea.addSubView domainCreateForm = new DomainCreationForm

    # Domain Creation form connections
    domainCreateForm.on 'DomainCreationCancelled', => @scene.unsetClass 'out'
    domainCreateForm.on 'CloseClicked',            => @scene.unsetClass 'out'

    # Main scene for DIA
    @addSubView @scene = new EnvironmentScene

    # Domains Container
    domainsContainer = new EnvironmentDomainContainer
    @scene.addContainer domainsContainer
    domainsContainer.on "itemRemoved", domainCreateForm.bound "updateDomains"

    # VMs / Machines Container
    machinesContainer = new EnvironmentMachineContainer
    @scene.addContainer machinesContainer

    # After Domains and Machines container load finished
    # Call updateConnections to draw lines between corresponding objects
    @scene.whenItemsLoadedFor \
      [domainsContainer, machinesContainer], @scene.bound 'updateConnections'

    domainCreateForm.on 'DomainSaved', =>
      domainsContainer.once "DataLoaded", @scene.bound 'updateConnections'
      domainsContainer.loadItems()

    # Plus button on domainsContainer opens up the action area
    domainsContainer.on 'PlusButtonClicked', =>
      @scene.setClass 'out'
      domainCreateForm.emit 'DomainNameShouldFocus'
      @utils.defer =>
        @scene.on 'click', ->
          @unsetClass 'out'
          @setClass 'in'
          @off 'click'

      # domainsContainer.loadItems()

    # Plus button on machinesContainer uses the vmController
    machinesContainer.on 'PlusButtonClicked', =>
      KD.getSingleton('vmController').createNewVM()

#  - DO NOT TOUCH BELOW

#   tabData = [
#     name        : 'Domains'
#     viewOptions :
#       viewClass : DomainsMainView
#   ,
#     name        : 'VMS'
#     viewOptions :
#       viewClass : VMsMainView
#   ,
#     name        : 'Kites'
#     viewOptions :
#       viewClass : KDView
#   ,
#     name        : 'Builder'
#     viewOptions :
#       viewClass : EnvironmentScene
{'fraction_non_alphanumeric': 0.08387375702550799, 'fraction_numerical': 0.0, 'mean_word_length': 3.1647164716471647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '937438', 'n_tokens_mistral': 1285, 'n_tokens_neox': 1238, 'n_words': 324}