2022-06-21 17:19:12 +05:30
|
|
|
<script>
|
2022-07-23 23:45:48 +05:30
|
|
|
import { GlBadge, GlTabs, GlTab } from '@gitlab/ui';
|
2022-06-21 17:19:12 +05:30
|
|
|
import { __ } from '~/locale';
|
2023-01-13 00:05:48 +05:30
|
|
|
import {
|
|
|
|
failedJobsTabName,
|
|
|
|
jobsTabName,
|
|
|
|
needsTabName,
|
|
|
|
pipelineTabName,
|
|
|
|
testReportTabName,
|
|
|
|
} from '../constants';
|
2022-06-21 17:19:12 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
i18n: {
|
|
|
|
tabs: {
|
|
|
|
failedJobsTitle: __('Failed Jobs'),
|
|
|
|
jobsTitle: __('Jobs'),
|
|
|
|
needsTitle: __('Needs'),
|
|
|
|
pipelineTitle: __('Pipeline'),
|
|
|
|
testsTitle: __('Tests'),
|
|
|
|
},
|
|
|
|
},
|
2022-07-16 23:28:13 +05:30
|
|
|
tabNames: {
|
2023-01-13 00:05:48 +05:30
|
|
|
pipeline: pipelineTabName,
|
2022-07-16 23:28:13 +05:30
|
|
|
needs: needsTabName,
|
|
|
|
jobs: jobsTabName,
|
|
|
|
failures: failedJobsTabName,
|
|
|
|
tests: testReportTabName,
|
|
|
|
},
|
2022-06-21 17:19:12 +05:30
|
|
|
components: {
|
2022-07-23 23:45:48 +05:30
|
|
|
GlBadge,
|
2022-06-21 17:19:12 +05:30
|
|
|
GlTab,
|
|
|
|
GlTabs,
|
|
|
|
},
|
2022-08-27 11:52:29 +05:30
|
|
|
inject: [
|
|
|
|
'defaultTabValue',
|
|
|
|
'failedJobsCount',
|
|
|
|
'failedJobsSummary',
|
|
|
|
'totalJobCount',
|
|
|
|
'testsCount',
|
|
|
|
],
|
2023-01-13 00:05:48 +05:30
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
activeTab: this.defaultTabValue,
|
|
|
|
};
|
|
|
|
},
|
2022-07-23 23:45:48 +05:30
|
|
|
computed: {
|
|
|
|
showFailedJobsTab() {
|
|
|
|
return this.failedJobsCount > 0;
|
|
|
|
},
|
|
|
|
},
|
2023-01-13 00:05:48 +05:30
|
|
|
watch: {
|
|
|
|
$route(to) {
|
|
|
|
this.activeTab = to.name;
|
|
|
|
},
|
|
|
|
},
|
2022-07-16 23:28:13 +05:30
|
|
|
methods: {
|
|
|
|
isActive(tabName) {
|
2023-01-13 00:05:48 +05:30
|
|
|
return tabName === this.activeTab;
|
|
|
|
},
|
|
|
|
navigateTo(tabName) {
|
|
|
|
this.$router.push({ name: tabName });
|
2022-07-16 23:28:13 +05:30
|
|
|
},
|
|
|
|
},
|
2022-06-21 17:19:12 +05:30
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<gl-tabs>
|
2022-11-25 23:54:43 +05:30
|
|
|
<gl-tab
|
|
|
|
ref="pipelineTab"
|
|
|
|
:title="$options.i18n.tabs.pipelineTitle"
|
2023-01-13 00:05:48 +05:30
|
|
|
:active="isActive($options.tabNames.pipeline)"
|
2022-11-25 23:54:43 +05:30
|
|
|
data-testid="pipeline-tab"
|
|
|
|
lazy
|
2023-01-13 00:05:48 +05:30
|
|
|
@click="navigateTo($options.tabNames.pipeline)"
|
2022-11-25 23:54:43 +05:30
|
|
|
>
|
2023-01-13 00:05:48 +05:30
|
|
|
<router-view />
|
2022-06-21 17:19:12 +05:30
|
|
|
</gl-tab>
|
2022-07-16 23:28:13 +05:30
|
|
|
<gl-tab
|
|
|
|
ref="dagTab"
|
|
|
|
:title="$options.i18n.tabs.needsTitle"
|
|
|
|
:active="isActive($options.tabNames.needs)"
|
|
|
|
data-testid="dag-tab"
|
2022-11-25 23:54:43 +05:30
|
|
|
lazy
|
2023-01-13 00:05:48 +05:30
|
|
|
@click="navigateTo($options.tabNames.needs)"
|
2022-07-16 23:28:13 +05:30
|
|
|
>
|
2023-01-13 00:05:48 +05:30
|
|
|
<router-view />
|
2022-06-21 17:19:12 +05:30
|
|
|
</gl-tab>
|
2023-01-13 00:05:48 +05:30
|
|
|
<gl-tab
|
|
|
|
:active="isActive($options.tabNames.jobs)"
|
|
|
|
data-testid="jobs-tab"
|
|
|
|
lazy
|
|
|
|
@click="navigateTo($options.tabNames.jobs)"
|
|
|
|
>
|
2022-07-23 23:45:48 +05:30
|
|
|
<template #title>
|
|
|
|
<span class="gl-mr-2">{{ $options.i18n.tabs.jobsTitle }}</span>
|
|
|
|
<gl-badge size="sm" data-testid="builds-counter">{{ totalJobCount }}</gl-badge>
|
|
|
|
</template>
|
2023-01-13 00:05:48 +05:30
|
|
|
<router-view />
|
2022-06-21 17:19:12 +05:30
|
|
|
</gl-tab>
|
2022-07-16 23:28:13 +05:30
|
|
|
<gl-tab
|
2022-07-23 23:45:48 +05:30
|
|
|
v-if="showFailedJobsTab"
|
2022-07-16 23:28:13 +05:30
|
|
|
:title="$options.i18n.tabs.failedJobsTitle"
|
|
|
|
:active="isActive($options.tabNames.failures)"
|
|
|
|
data-testid="failed-jobs-tab"
|
2022-07-23 23:45:48 +05:30
|
|
|
lazy
|
2023-01-13 00:05:48 +05:30
|
|
|
@click="navigateTo($options.tabNames.failures)"
|
2022-07-16 23:28:13 +05:30
|
|
|
>
|
2022-07-23 23:45:48 +05:30
|
|
|
<template #title>
|
|
|
|
<span class="gl-mr-2">{{ $options.i18n.tabs.failedJobsTitle }}</span>
|
|
|
|
<gl-badge size="sm" data-testid="failed-builds-counter">{{ failedJobsCount }}</gl-badge>
|
|
|
|
</template>
|
2023-01-13 00:05:48 +05:30
|
|
|
<router-view :failed-jobs-summary="failedJobsSummary" />
|
2022-06-21 17:19:12 +05:30
|
|
|
</gl-tab>
|
2023-01-13 00:05:48 +05:30
|
|
|
<gl-tab
|
|
|
|
:active="isActive($options.tabNames.tests)"
|
|
|
|
data-testid="tests-tab"
|
|
|
|
lazy
|
|
|
|
@click="navigateTo($options.tabNames.tests)"
|
|
|
|
>
|
2022-08-27 11:52:29 +05:30
|
|
|
<template #title>
|
|
|
|
<span class="gl-mr-2">{{ $options.i18n.tabs.testsTitle }}</span>
|
|
|
|
<gl-badge size="sm" data-testid="tests-counter">{{ testsCount }}</gl-badge>
|
|
|
|
</template>
|
2023-01-13 00:05:48 +05:30
|
|
|
<router-view />
|
2022-06-21 17:19:12 +05:30
|
|
|
</gl-tab>
|
|
|
|
<slot></slot>
|
|
|
|
</gl-tabs>
|
|
|
|
</template>
|