<commit_before>_                = require("lodash")
app              = require("app")
marionette       = require("backbone.marionette")
ListTreeItemView = require("./list_tree_item_view")

class ListTreeView extends Backbone.Marionette.CompositeView

  id : "tree-navbar"
  className : "flex-column"
  template : _.template("""
    <div>
      <div class="btn-group">
        <button class="btn btn-default" id="tree-create-button"><i class="fa fa-plus"></i>Create tree</button>
        <button class="btn btn-default" id="tree-delete-button"><i class="fa fa-trash-o"></i>Delete tree</button>
      </div>
      <div class="btn-group pull-right">
        <button class="btn btn-default" id="tree-color-shuffle" title="Change color"><i class="fa fa-adjust"></i></button>
        <button class="btn btn-default" id="tree-color-shuffle-all" title="Shuffle all Colors"><i class="fa fa-random"></i></button>
        <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" id="tree-sort-button" title="Sort">
          <i class="fa fa-sort-alpha-asc"></i>
        </button>
        <ul class="dropdown-menu pull-right" id="tree-sort">
          <li>
            <a href="#" data-sort="name">by name
              <i class="fa fa-check" id="sort-name-icon"></i>
            </a>
          </li>
          <li>
            <a href="#" data-sort="time">by creation time
              <i class="fa fa-check" id= "sort-time-icon"></i>
            </a>
          </li>
        </ul>
      </div>
    </div>
    <div class="input-group">
      <span class="input-group-btn">
        <button class="btn btn-default" id="tree-prev-button"><i class="fa fa-arrow-left"></i></button>
      </span>
      <input name="name" id="tree-name-input" class="form-control" maxlength="30" type="text" autocomplete="off">
      <span class="input-group-btn">
        <button class="btn btn-default" id="tree-next-button"><i class="fa fa-arrow-right"></i></button>
      </span>
    </div>
    <ul id="tree-list" class="flex-overflow"></ul>
    """)

  childView : ListTreeItemView
  childViewContainer : "ul#tree-list"
  childViewOptions : ->
    parent : @
    activeTreeId : @getActiveTree().treeId


  events :
    "change #tree-name-input" : "setTreeName"
    "click #tree-prev-button" : "selectPreviousTree"
    "click #tree-next-button" : "selectNextTree"
    "click #tree-create-button" : "createNewTree"
    "click #tree-delete-button" : "deleteTree"
    "click #tree-color-shuffle" : "shuffleTreeColor"
    "click #tree-color-shuffle-all" : "shuffleAllTreeColors"
    "click a[data-sort]" : "sortTrees"

  ui :
    "treeNameInput" : "#tree-name-input"
    "sortNameIcon" : "#sort-name-icon"
    "sortTimeIcon" : "#sort-time-icon"


  initialize : (options) ->


    @listenTo(@, "render", @updateSortIndicator)
    @refresh()

    @listenTo(@model.skeletonTracing, "deleteTree", @refresh)
    @listenTo(@model.skeletonTracing, "mergeTree", @refresh)
    @listenTo(@model.skeletonTracing, "newTree", @refresh)
    @listenTo(@model.skeletonTracing, "newTreeName", @refresh)
    @listenTo(@model.skeletonTracing, "reloadTrees", @refresh)
    @listenTo(@model.skeletonTracing, "deleteActiveNode", @updateTreesDebounced)
    @listenTo(@model.skeletonTracing, "newNode", @updateTreesDebounced)
    @listenTo(@model.skeletonTracing, "newTreeColor", @updateTreesDebounced)
    @listenTo(@model.skeletonTracing, "newActiveTree", @updateTreesDebounced)
    @listenTo(@model.skeletonTracing, "newActiveNode", @_renderChildren)


  setTreeName : (evt) ->
    @model.skeletonTracing.setTreeName(evt.target.value)


  selectPreviousTree : ->
    @selectNextTree(false)


  selectNextTree : ->
    @selectNextTree(true)


  createNewTree : ->
    @model.skeletonTracing.createNewTree()


  deleteTree : ->
    @model.skeletonTracing.deleteTree(true)


  shuffleTreeColor : ->
    @model.skeletonTracing.shuffleTreeColor()
<commit_msg>fix #914 update tree colors in tree list on change<commit_after>_                = require("lodash")
app              = require("app")
marionette       = require("backbone.marionette")
ListTreeItemView = require("./list_tree_item_view")

class ListTreeView extends Backbone.Marionette.CompositeView

  id : "tree-navbar"
  className : "flex-column"
  template : _.template("""
    <div>
      <div class="btn-group">
        <button class="btn btn-default" id="tree-create-button"><i class="fa fa-plus"></i>Create tree</button>
        <button class="btn btn-default" id="tree-delete-button"><i class="fa fa-trash-o"></i>Delete tree</button>
      </div>
      <div class="btn-group pull-right">
        <button class="btn btn-default" id="tree-color-shuffle" title="Change color"><i class="fa fa-adjust"></i></button>
        <button class="btn btn-default" id="tree-color-shuffle-all" title="Shuffle all Colors"><i class="fa fa-random"></i></button>
        <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" id="tree-sort-button" title="Sort">
          <i class="fa fa-sort-alpha-asc"></i>
        </button>
        <ul class="dropdown-menu pull-right" id="tree-sort">
          <li>
            <a href="#" data-sort="name">by name
              <i class="fa fa-check" id="sort-name-icon"></i>
            </a>
          </li>
          <li>
            <a href="#" data-sort="time">by creation time
              <i class="fa fa-check" id= "sort-time-icon"></i>
            </a>
          </li>
        </ul>
      </div>
    </div>
    <div class="input-group">
      <span class="input-group-btn">
        <button class="btn btn-default" id="tree-prev-button"><i class="fa fa-arrow-left"></i></button>
      </span>
      <input name="name" id="tree-name-input" class="form-control" maxlength="30" type="text" autocomplete="off">
      <span class="input-group-btn">
        <button class="btn btn-default" id="tree-next-button"><i class="fa fa-arrow-right"></i></button>
      </span>
    </div>
    <ul id="tree-list" class="flex-overflow"></ul>
    """)

  childView : ListTreeItemView
  childViewContainer : "ul#tree-list"
  childViewOptions : ->
    parent : @
    activeTreeId : @getActiveTree().treeId


  events :
    "change #tree-name-input" : "setTreeName"
    "click #tree-prev-button" : "selectPreviousTree"
    "click #tree-next-button" : "selectNextTree"
    "click #tree-create-button" : "createNewTree"
    "click #tree-delete-button" : "deleteTree"
    "click #tree-color-shuffle" : "shuffleTreeColor"
    "click #tree-color-shuffle-all" : "shuffleAllTreeColors"
    "click a[data-sort]" : "sortTrees"

  ui :
    "treeNameInput" : "#tree-name-input"
    "sortNameIcon" : "#sort-name-icon"
    "sortTimeIcon" : "#sort-time-icon"


  initialize : (options) ->


    @listenTo(@, "render", @updateSortIndicator)
    @refresh()

    @listenTo(@model.skeletonTracing, "deleteTree", @refresh)
    @listenTo(@model.skeletonTracing, "mergeTree", @refresh)
    @listenTo(@model.skeletonTracing, "newTree", @refresh)
    @listenTo(@model.skeletonTracing, "newTreeName", @refresh)
    @listenTo(@model.skeletonTracing, "reloadTrees", @refresh)
    @listenTo(@model.skeletonTracing, "deleteActiveNode", @updateTreesDebounced)
    @listenTo(@model.skeletonTracing, "newNode", @updateTreesDebounced)
    @listenTo(@model.skeletonTracing, "newTreeColor", @refresh)
    @listenTo(@model.skeletonTracing, "newActiveTree", @updateTreesDebounced)
    @listenTo(@model.skeletonTracing, "newActiveNode", @_renderChildren)


  setTreeName : (evt) ->
    @model.skeletonTracing.setTreeName(evt.target.value)


  selectPreviousTree : ->
    @selectNextTree(false)


  selectNextTree : ->
    @selectNextTree(true)


  createNewTree : ->
    @model.skeletonTracing.createNewTree()


  deleteTree : ->
    @model.skeletonTracing.deleteTree(true)


  shuffleTreeColor : ->
    @model.skeletonTracing.shuffleTreeColor()

{'fraction_non_alphanumeric': 0.16972243442831678, 'fraction_numerical': 0.00089126559714795, 'mean_word_length': 3.325440528634361, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 133, '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': '379881', 'n_tokens_mistral': 2610, 'n_tokens_neox': 2551, 'n_words': 445}