debian-mirror-gitlab/app/assets/javascripts/runner/components/runner_pagination.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
995 B
Vue
Raw Normal View History

2021-09-04 01:27:46 +05:30
<script>
2022-08-27 11:52:29 +05:30
import { GlKeysetPagination } from '@gitlab/ui';
2021-09-04 01:27:46 +05:30
export default {
components: {
2022-08-27 11:52:29 +05:30
GlKeysetPagination,
2021-09-04 01:27:46 +05:30
},
2022-08-27 11:52:29 +05:30
inheritAttrs: false,
2021-09-04 01:27:46 +05:30
props: {
pageInfo: {
required: false,
type: Object,
default: () => ({}),
},
},
computed: {
2022-08-27 11:52:29 +05:30
paginationProps() {
return { ...this.pageInfo, ...this.$attrs };
2021-09-04 01:27:46 +05:30
},
2022-08-27 11:52:29 +05:30
isShown() {
const { hasPreviousPage, hasNextPage } = this.pageInfo;
return hasPreviousPage || hasNextPage;
2021-09-04 01:27:46 +05:30
},
},
methods: {
2022-08-27 11:52:29 +05:30
prevPage() {
this.$emit('input', {
before: this.pageInfo.startCursor,
});
},
nextPage() {
this.$emit('input', {
after: this.pageInfo.endCursor,
});
2021-09-04 01:27:46 +05:30
},
},
};
</script>
<template>
2022-08-27 11:52:29 +05:30
<div v-if="isShown" class="gl-text-center">
<gl-keyset-pagination
v-bind="paginationProps"
:prev-text="s__('Pagination|Prev')"
:next-text="s__('Pagination|Next')"
@prev="prevPage"
@next="nextPage"
/>
</div>
2021-09-04 01:27:46 +05:30
</template>