2022-02-15 13:14:39 -05:00
|
|
|
<script>
|
2022-05-31 11:09:02 -04:00
|
|
|
import { GlSkeletonLoader } from '@gitlab/ui';
|
2022-02-15 13:14:39 -05:00
|
|
|
import { createAlert } from '~/flash';
|
2022-05-11 14:07:55 -04:00
|
|
|
import runnerJobsQuery from '../graphql/show/runner_jobs.query.graphql';
|
2022-02-15 13:14:39 -05:00
|
|
|
import { I18N_FETCH_ERROR, I18N_NO_JOBS_FOUND, RUNNER_DETAILS_JOBS_PAGE_SIZE } from '../constants';
|
|
|
|
import { captureException } from '../sentry_utils';
|
|
|
|
import { getPaginationVariables } from '../utils';
|
|
|
|
import RunnerJobsTable from './runner_jobs_table.vue';
|
|
|
|
import RunnerPagination from './runner_pagination.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'RunnerJobs',
|
|
|
|
components: {
|
2022-05-31 11:09:02 -04:00
|
|
|
GlSkeletonLoader,
|
2022-02-15 13:14:39 -05:00
|
|
|
RunnerJobsTable,
|
|
|
|
RunnerPagination,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
runner: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
jobs: {
|
|
|
|
items: [],
|
|
|
|
pageInfo: {},
|
|
|
|
},
|
|
|
|
pagination: {
|
|
|
|
page: 1,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
apollo: {
|
|
|
|
jobs: {
|
2022-03-01 10:22:06 -05:00
|
|
|
query: runnerJobsQuery,
|
2022-02-15 13:14:39 -05:00
|
|
|
variables() {
|
|
|
|
return this.variables;
|
|
|
|
},
|
|
|
|
update({ runner }) {
|
|
|
|
return {
|
|
|
|
items: runner?.jobs?.nodes || [],
|
|
|
|
pageInfo: runner?.jobs?.pageInfo || {},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
error(error) {
|
|
|
|
createAlert({ message: I18N_FETCH_ERROR });
|
2022-02-23 04:12:16 -05:00
|
|
|
captureException({ error, component: this.$options.name });
|
2022-02-15 13:14:39 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
variables() {
|
|
|
|
const { id } = this.runner;
|
|
|
|
return {
|
|
|
|
id,
|
|
|
|
...getPaginationVariables(this.pagination, RUNNER_DETAILS_JOBS_PAGE_SIZE),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
loading() {
|
|
|
|
return this.$apollo.queries.jobs.loading;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
I18N_NO_JOBS_FOUND,
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="gl-pt-3">
|
2022-05-31 11:09:02 -04:00
|
|
|
<div v-if="loading" class="gl-py-5">
|
|
|
|
<gl-skeleton-loader />
|
|
|
|
</div>
|
2022-02-15 13:14:39 -05:00
|
|
|
<runner-jobs-table v-else-if="jobs.items.length" :jobs="jobs.items" />
|
|
|
|
<p v-else>{{ $options.I18N_NO_JOBS_FOUND }}</p>
|
|
|
|
|
|
|
|
<runner-pagination v-model="pagination" :disabled="loading" :page-info="jobs.pageInfo" />
|
|
|
|
</div>
|
|
|
|
</template>
|