debian-mirror-gitlab/app/assets/javascripts/pipelines/components/pipeline_tabs.vue

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

94 lines
2.6 KiB
Vue
Raw Normal View History

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';
2022-07-16 23:28:13 +05:30
import { failedJobsTabName, jobsTabName, needsTabName, testReportTabName } from '../constants';
2022-06-21 17:19:12 +05:30
import PipelineGraphWrapper from './graph/graph_component_wrapper.vue';
import Dag from './dag/dag.vue';
2022-07-23 23:45:48 +05:30
import FailedJobsApp from './jobs/failed_jobs_app.vue';
2022-06-21 17:19:12 +05:30
import JobsApp from './jobs/jobs_app.vue';
import TestReports from './test_reports/test_reports.vue';
export default {
i18n: {
tabs: {
failedJobsTitle: __('Failed Jobs'),
jobsTitle: __('Jobs'),
needsTitle: __('Needs'),
pipelineTitle: __('Pipeline'),
testsTitle: __('Tests'),
},
},
2022-07-16 23:28:13 +05:30
tabNames: {
needs: needsTabName,
jobs: jobsTabName,
failures: failedJobsTabName,
tests: testReportTabName,
},
2022-06-21 17:19:12 +05:30
components: {
Dag,
2022-07-23 23:45:48 +05:30
GlBadge,
2022-06-21 17:19:12 +05:30
GlTab,
GlTabs,
JobsApp,
2022-07-23 23:45:48 +05:30
FailedJobsApp,
2022-06-21 17:19:12 +05:30
PipelineGraphWrapper,
TestReports,
},
2022-07-23 23:45:48 +05:30
inject: ['defaultTabValue', 'failedJobsCount', 'failedJobsSummary', 'totalJobCount'],
computed: {
showFailedJobsTab() {
return this.failedJobsCount > 0;
},
},
2022-07-16 23:28:13 +05:30
methods: {
isActive(tabName) {
return tabName === this.defaultTabValue;
},
},
2022-06-21 17:19:12 +05:30
};
</script>
<template>
<gl-tabs>
2022-07-16 23:28:13 +05:30
<gl-tab ref="pipelineTab" :title="$options.i18n.tabs.pipelineTitle" data-testid="pipeline-tab">
2022-06-21 17:19:12 +05:30
<pipeline-graph-wrapper />
</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-06-21 17:19:12 +05:30
<dag />
</gl-tab>
2022-07-23 23:45:48 +05:30
<gl-tab :active="isActive($options.tabNames.jobs)" data-testid="jobs-tab" lazy>
<template #title>
<span class="gl-mr-2">{{ $options.i18n.tabs.jobsTitle }}</span>
<gl-badge size="sm" data-testid="builds-counter">{{ totalJobCount }}</gl-badge>
</template>
2022-06-21 17:19:12 +05:30
<jobs-app />
</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
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>
<failed-jobs-app :failed-jobs-summary="failedJobsSummary" />
2022-06-21 17:19:12 +05:30
</gl-tab>
2022-07-16 23:28:13 +05:30
<gl-tab
:title="$options.i18n.tabs.testsTitle"
:active="isActive($options.tabNames.tests)"
data-testid="tests-tab"
>
2022-06-21 17:19:12 +05:30
<test-reports />
</gl-tab>
<slot></slot>
</gl-tabs>
</template>