<div v-if="filteredScheduledReindexes.length">
  <a data-toggle="collapse" href="#collapseScheduledReindexes" aria-expanded="false" aria-controls="collapseScheduledReindexes">
    <i class="fa fa-clock-o"></i>
    {{! filteredScheduledReindexes.length }} scheduled reindexes
  </a>
  <ul class="list list-unstyled collapse border rounded p-1" id="collapseScheduledReindexes">
    <li v-for="scheduledReindex in filteredScheduledReindexes" class="pb-1 text-muted">
      <pre class="mb-0 text-truncate"><code class="bg-light small">REINDEX<span v-if="!scheduledReindex.table && !scheduledReindex.index"> DATABASE {{! scheduledReindex.dbname }}</span><span v-if="scheduledReindex.table"> TABLE <a :href="'/server/{{instance.agent_address}}/{{ instance.agent_port}}/maintenance/{{database}}/schema/' + scheduledReindex.schema">{{! scheduledReindex.schema }}</a>.<a :href="'/server/{{instance.agent_address}}/{{ instance.agent_port}}/maintenance/{{database}}/schema/' + scheduledReindex.schema + '/table/' + scheduledReindex.table">{{! scheduledReindex.table }}</a></span><span v-if="scheduledReindex.index"> INDEX <a :href="'/server/{{instance.agent_address}}/{{ instance.agent_port}}/maintenance/{{database}}/schema/' + scheduledReindex.schema">{{! scheduledReindex.schema }}</a>.{{! scheduledReindex.index }}</span></code></pre>
      <template v-if="scheduledReindex.status == 'todo'">
        <em>
          scheduled
          <span :title="scheduledReindex.datetime.toString()">{{! scheduledReindex.datetime | relative_time(false) }}</span>
        </em>
        <button class="btn btn-sm btn-outline-secondary py-0" v-on:click="cancelReindex(scheduledReindex.id)" v-if="scheduledReindex.status == 'todo'">Cancel</button>
      </template>
      <template v-else-if="scheduledReindex.status == 'doing'">
        <em>
          <img id="loadingIndicator" src="/images/ring-alt.svg" class="fa-fw">
          in progress
        </em>
      </template>
      <template v-else-if="scheduledReindex.status == 'canceled'">
        <em>canceled</em>
      </template>
      <template v-else>
        <em>{{! scheduledReindex.status }}</em>
      </template>
    </li>
  </ul>
</div>
