gitlab-org--gitlab-foss/app/assets/javascripts/environments/components/container.vue

55 lines
1.2 KiB
Vue
Raw Normal View History

2017-11-23 07:04:03 -05:00
<script>
2018-11-16 14:29:11 -05:00
import { GlLoadingIcon } from '@gitlab/ui';
import TablePagination from '~/vue_shared/components/pagination/table_pagination.vue';
import EnvironmentTable from './environments_table.vue';
2017-11-23 07:04:03 -05:00
export default {
components: {
EnvironmentTable,
TablePagination,
GlLoadingIcon,
},
props: {
isLoading: {
type: Boolean,
required: true,
2018-01-05 09:31:01 -05:00
},
environments: {
type: Array,
required: true,
2017-11-23 07:04:03 -05:00
},
pagination: {
type: Object,
required: true,
2017-11-23 07:04:03 -05:00
},
canReadEnvironment: {
type: Boolean,
required: true,
},
},
methods: {
onChangePage(page) {
this.$emit('onChangePage', page);
},
},
};
2017-11-23 07:04:03 -05:00
</script>
<template>
<div class="environments-container">
<gl-loading-icon v-if="isLoading" size="md" class="gl-mt-3" label="Loading environments" />
2017-11-23 07:04:03 -05:00
<slot name="empty-state"></slot>
2017-11-23 07:04:03 -05:00
2018-11-16 15:07:38 -05:00
<div v-if="!isLoading && environments.length > 0" class="table-holder">
<environment-table :environments="environments" :can-read-environment="canReadEnvironment" />
2017-11-23 07:04:03 -05:00
<table-pagination
v-if="pagination && pagination.totalPages > 1"
:change="onChangePage"
2018-01-05 09:31:01 -05:00
:page-info="pagination"
/>
2017-11-23 07:04:03 -05:00
</div>
</div>
</template>