<template>
  <data-table-template
    icon="fas fa-gamepad"
    title="Virtual Instances"
    service="v-instances"
    class="my-sticky-header-table"
    card-container-class="grid-content"
    :rows-per-page-options="[5, 12, 25, 50, 100, 200, 0]"
    :columns-to-show-first="['name', 'instance', 'createdAt', 'updatedAt']"
    :search-by-props="['name',]"
    :limit="5"
    :form-fields="formFields"
    table-header-class="text-h2 bg-grey-3 text-bolder"
    :fast-join-resolver-query="fastJoinHookResolversQuery"
  />
</template>

<script>
  import DataTableTemplate from '../components/common/substance/tables/DataTableTemplate';

  export default {
    name: 'v-instances-page',
    components: {DataTableTemplate},
    data() {
      return {
        formFields: [
          {
            name: 'q-input',
            path: 'name',
            $attrs: {
              outlined: true,
            },
            rules: [
              val => !!val || '* Required',
              val => val.length > 2 || 'Name should be at least 3 characters long',
            ],
          },
          {
            name: 's-select',
            path: 'instance',
            $attrs: {
              outlined: true,
              service: 'instances',
            },
            rules: [
              val => !!val || '* Required',
            ],
          },
        ],
        fastJoinHookResolversQuery: {
          instance: true,
          domains: [
            undefined,
            {
              domains_fJoinHookResolversQuery: {
                hosts: true,
              },
            },
          ],
        },
      };
    },
  };
</script>
