{{secret-list-header isCertTab=(eq tab "certs") model=backendModel baseKey=baseKey backendCrumb=backendCrumb}}

{{#with (options-for-backend backendType tab) as |options|}}
  <div class="box is-sideless has-background-grey-lighter has-short-padding is-marginless">
    <div class="level">
      <div class="level-left">
        {{navigate-input
           enterpriseProduct="vault"
           filterFocusDidChange=(action "setFilterFocus")
           filterDidChange=(action "setFilter")
           filter=filter
           filterMatchesKey=filterMatchesKey
           firstPartialMatch=firstPartialMatch
           baseKey=(get baseKey "id")
           shouldNavigateTree=options.navigateTree
           placeholder=options.searchPlaceholder
           mode=(if (eq tab 'certs') 'secrets-cert' 'secrets')
         }}
         {{#if filterFocused}}
          {{#if filterMatchesKey}}
            {{#unless filterIsFolder}}
              <p class="input-hint">
                <kbd>Enter</kbd> to view {{filter}}
              </p>
            {{/unless}}
          {{/if}}
          {{#if firstPartialMatch}}
            <p class="input-hint">
              <kbd>Tab</kbd> to autocomplete
            </p>
          {{/if}}
        {{/if}}
      </div>
    </div>
  </div>
  {{#if model.meta.total}}
    {{#each model as |item|}}
      {{partial options.listItemPartial}}
    {{else}}
      <div class="box is-sideless">
        {{#if filterFocused}}
          There are no {{pluralize options.item}} matching <code>{{filter}}</code>, press <kbd>ENTER</kbd> to add one.
        {{else}}
          There are no {{pluralize options.item}} matching <code>{{filter}}</code>.
        {{/if}}
      </div>
    {{/each}}
  {{else}}
    <div class="box is-bottomless has-background-white-bis">
      <div class="columns is-centered">
        <div class="column is-half has-text-centered">
          <div class="box is-shadowless has-background-white-bis">
            <p class="has-text-grey">
              {{#if (eq baseKey.id '')}}
                There are currently no {{pluralize options.item}} in this backend.
              {{else}}
                {{#if filterIsFolder}}
                    {{#if (eq filter baseKey.id)}}
                      There are no {{pluralize options.item}} under <code>{{or filter}}</code>.
                    {{else}}
                      We couldn't find a folder matching <code>{{filter}}</code>.
                    {{/if}}
                {{/if}}
              {{/if}}
            </p>
          </div>
        </div>
      </div>
    </div>
  {{/if}}
{{/with}}
{{#if (gt model.meta.lastPage 1) }}
  {{list-pagination
    page=model.meta.currentPage
    lastPage=model.meta.lastPage
    link=(concat "vault.cluster.secrets.backend.list" (if (not baseKey.id) "-root"))
    model=(compact (array backend (if baseKey.id baseKey.id)))
  }}
{{/if}}
