<commit_before><template>
  <aside>
    <ul v-if="!canSearchIndex()" class="side-nav fixed leftside-navigation ps-container ps-active-y">
      <li class="unauthorized">
        <ul class="indexes">
          <li>
            <i class="fa fa-lock" aria-hidden="true"></i>
            <em>You are not allowed to list indexes</em>
          </li>
        </ul>
      </li>
    </ul>
    <ul v-if="canSearchIndex()" class="side-nav fixed leftside-navigation ps-container ps-active-y">
      <li>
        <nav>
          <div class="nav-wrapper">
            <form>
              <div class="input-field">
                <input id="search" type="search" v-model="filter" placeholder="Search index &amp; collection">
                <label for="search"><i class="fa fa-search"></i></label>
              </div>
            </form>
          </div>
        </nav>
      </li>
      <li>
        <ul class="indexes">
          <li
            v-for="indexName in orderedFilteredIndices(filter)">
            <index-branch
              :force-open="indexCount === 1"
              :index-name="indexName"
              :route-name="routeName"
              :collections="indexesAndCollections[indexName]"
              :current-index="index"
              :filter="filter"
              :current-collection="collection">
            </index-branch>
          </li>
        </ul>
      </li>
    </ul>
  </aside>
</template>

<script>
  import {canSearchIndex} from '../../../services/userAuthorization'
  import IndexBranch from './IndexBranch'
  import {filterIndexesByKeyword} from '../../../services/data'
  import orderBy from 'lodash/orderBy'

  export default {
    name: 'Treeview',
    props: {
      index: String,
      collection: String,
      routeName: String
    },
    components: {
      IndexBranch
    },
    data () {
      return {
        filter: ''
      }
    },
    methods: {
      canSearchIndex,
      orderedFilteredIndices (order) {
        if (order) {
          return orderBy(this.filteredIndices, order)
        }
        return this.filteredIndices
      }
    },
    computed: {
      filteredIndices () {
        return filterIndexesByKeyword(this.$store.getters.indexes, this.$store.state.data.indexesAndCollections, this.filter)
      },
      indexesAndCollections () {<commit_msg>fix #228<commit_after><template>
  <aside>
    <ul v-if="!canSearchIndex()" class="side-nav fixed leftside-navigation ps-container ps-active-y">
      <li class="unauthorized">
        <ul class="indexes">
          <li>
            <i class="fa fa-lock" aria-hidden="true"></i>
            <em>You are not allowed to list indexes</em>
          </li>
        </ul>
      </li>
    </ul>
    <ul v-if="canSearchIndex()" class="side-nav fixed leftside-navigation ps-container ps-active-y">
      <li>
        <nav>
          <div class="nav-wrapper">
            <form>
              <div class="input-field">
                <input id="search" type="search" v-model="filter" placeholder="Search index &amp; collection">
                <label for="search"><i class="fa fa-search"></i></label>
              </div>
            </form>
          </div>
        </nav>
      </li>
      <li>
        <ul class="indexes">
          <li
            v-for="indexName in orderedFilteredIndices">
            <index-branch
              :force-open="indexCount === 1"
              :index-name="indexName"
              :route-name="routeName"
              :collections="indexesAndCollections[indexName]"
              :current-index="index"
              :filter="filter"
              :current-collection="collection">
            </index-branch>
          </li>
        </ul>
      </li>
    </ul>
  </aside>
</template>

<script>
  import {canSearchIndex} from '../../../services/userAuthorization'
  import IndexBranch from './IndexBranch'
  import {filterIndexesByKeyword} from '../../../services/data'

  export default {
    name: 'Treeview',
    props: {
      index: String,
      collection: String,
      routeName: String
    },
    components: {
      IndexBranch
    },
    data () {
      return {
        filter: ''
      }
    },
    methods: {
      canSearchIndex
    },
    computed: {
      filteredIndices () {
        return [...filterIndexesByKeyword(this.$store.getters.indexes, this.$store.state.data.indexesAndCollections, this.filter)]
      },
      orderedFilteredIndices () {
        return this.filteredIndices.sort()
      },
      indexesAndCollections () {
{'fraction_non_alphanumeric': 0.14755555555555555, 'fraction_numerical': 0.0011111111111111111, 'mean_word_length': 1.8184095178459612, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 87, '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': '5382800', 'n_tokens_mistral': 1305, 'n_tokens_neox': 1305, 'n_words': 259}