All files / app/assets/javascripts/environments/components container.vue

50% Statements 1/2
100% Branches 0/0
0% Functions 0/1
50% Lines 1/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 522x                                                                                                      
<!-- eslint-disable vue/multi-word-component-names -->
<script>
import { GlLoadingIcon } from '@gitlab/ui';
import TablePagination from '~/vue_shared/components/pagination/table_pagination.vue';
import EnvironmentTable from './environments_table.vue';
 
export default {
  components: {
    EnvironmentTable,
    TablePagination,
    GlLoadingIcon,
  },
  props: {
    isLoading: {
      type: Boolean,
      required: true,
    },
    environments: {
      type: Array,
      required: true,
    },
    pagination: {
      type: Object,
      required: true,
    },
  },
  methods: {
    onChangePage(page) {
      this.$emit('onChangePage', page);
    },
  },
};
</script>
 
<template>
  <div class="environments-container">
    <gl-loading-icon v-if="isLoading" size="lg" class="gl-mt-3" label="Loading environments" />
 
    <slot name="empty-state"></slot>
 
    <div v-if="!isLoading && environments.length > 0" class="table-holder">
      <environment-table :environments="environments" />
 
      <table-pagination
        v-if="pagination && pagination.totalPages > 1"
        :change="onChangePage"
        :page-info="pagination"
      />
    </div>
  </div>
</template>