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

132 lines
4.3 KiB
Vue
Raw Normal View History

2017-08-17 22:00:37 +05:30
<script>
2021-06-08 01:23:25 +05:30
import { GlEmptyState, GlButton } from '@gitlab/ui';
import { startCodeQualityWalkthrough, track } from '~/code_quality_walkthrough/utils';
import GitlabExperiment from '~/experimentation/components/gitlab_experiment.vue';
2021-09-04 01:27:46 +05:30
import ExperimentTracking from '~/experimentation/experiment_tracking';
2021-06-08 01:23:25 +05:30
import { getExperimentData } from '~/experimentation/utils';
2021-04-17 20:07:23 +05:30
import { helpPagePath } from '~/helpers/help_page_helper';
2021-03-08 18:12:59 +05:30
import { s__ } from '~/locale';
2021-04-29 21:17:54 +05:30
import PipelinesCiTemplates from './pipelines_ci_templates.vue';
2019-02-15 15:39:39 +05:30
2018-11-08 19:23:39 +05:30
export default {
2021-03-08 18:12:59 +05:30
i18n: {
2021-04-17 20:07:23 +05:30
title: s__('Pipelines|Build with confidence'),
description: s__(`Pipelines|GitLab CI/CD can automatically build,
test, and deploy your code. Let GitLab take care of time
consuming tasks, so you can spend more time creating.`),
2021-09-04 01:27:46 +05:30
aboutRunnersBtnText: s__('Pipelines|Learn about Runners'),
installRunnersBtnText: s__('Pipelines|Install GitLab Runners'),
2021-06-08 01:23:25 +05:30
codeQualityTitle: s__('Pipelines|Improve code quality with GitLab CI/CD'),
codeQualityDescription: s__(`Pipelines|To keep your codebase simple,
readable, and accessible to contributors, use GitLab CI/CD
to analyze your code quality with every push to your project.`),
codeQualityBtnText: s__('Pipelines|Add a code quality job'),
2021-04-17 20:07:23 +05:30
noCiDescription: s__('Pipelines|This project is not currently set up to run pipelines.'),
2021-03-08 18:12:59 +05:30
},
2018-11-08 19:23:39 +05:30
name: 'PipelinesEmptyState',
2019-02-15 15:39:39 +05:30
components: {
2021-04-17 20:07:23 +05:30
GlEmptyState,
2021-06-08 01:23:25 +05:30
GlButton,
GitlabExperiment,
2021-04-29 21:17:54 +05:30
PipelinesCiTemplates,
2019-02-15 15:39:39 +05:30
},
2018-11-08 19:23:39 +05:30
props: {
emptyStateSvgPath: {
type: String,
required: true,
},
canSetCi: {
type: Boolean,
required: true,
},
2021-06-08 01:23:25 +05:30
codeQualityPagePath: {
type: String,
required: false,
default: null,
},
2021-09-04 01:27:46 +05:30
ciRunnerSettingsPath: {
type: String,
required: false,
default: null,
},
2018-11-08 19:23:39 +05:30
},
2021-04-17 20:07:23 +05:30
computed: {
ciHelpPagePath() {
return helpPagePath('ci/quick_start/index.md');
},
2021-09-04 01:27:46 +05:30
isCodeQualityExperimentActive() {
return this.canSetCi && Boolean(getExperimentData('code_quality_walkthrough'));
},
isCiRunnerTemplatesExperimentActive() {
return this.canSetCi && Boolean(getExperimentData('ci_runner_templates'));
},
2021-06-08 01:23:25 +05:30
},
mounted() {
startCodeQualityWalkthrough();
},
methods: {
trackClick() {
track('cta_clicked');
},
2021-09-04 01:27:46 +05:30
trackCiRunnerTemplatesClick(action) {
const tracking = new ExperimentTracking('ci_runner_templates');
tracking.event(action);
},
2021-04-17 20:07:23 +05:30
},
2018-11-08 19:23:39 +05:30
};
2017-08-17 22:00:37 +05:30
</script>
<template>
2021-04-17 20:07:23 +05:30
<div>
2021-09-30 23:02:18 +05:30
<gitlab-experiment v-if="isCodeQualityExperimentActive" name="code_quality_walkthrough">
<template #control><pipelines-ci-templates /></template>
2021-04-29 21:17:54 +05:30
<template #candidate>
2021-06-08 01:23:25 +05:30
<gl-empty-state
:title="$options.i18n.codeQualityTitle"
:svg-path="emptyStateSvgPath"
:description="$options.i18n.codeQualityDescription"
>
<template #actions>
<gl-button :href="codeQualityPagePath" variant="confirm" @click="trackClick()">
{{ $options.i18n.codeQualityBtnText }}
</gl-button>
</template>
</gl-empty-state>
2021-04-29 21:17:54 +05:30
</template>
2021-06-08 01:23:25 +05:30
</gitlab-experiment>
2021-09-04 01:27:46 +05:30
<gitlab-experiment v-else-if="isCiRunnerTemplatesExperimentActive" name="ci_runner_templates">
2021-09-30 23:02:18 +05:30
<template #control><pipelines-ci-templates /></template>
2021-09-04 01:27:46 +05:30
<template #candidate>
<gl-empty-state
:title="$options.i18n.title"
:svg-path="emptyStateSvgPath"
:description="$options.i18n.description"
>
<template #actions>
<gl-button
:href="ciRunnerSettingsPath"
variant="confirm"
@click="trackCiRunnerTemplatesClick('install_runners_button_clicked')"
>
{{ $options.i18n.installRunnersBtnText }}
</gl-button>
<gl-button
:href="ciHelpPagePath"
variant="default"
@click="trackCiRunnerTemplatesClick('learn_button_clicked')"
>
{{ $options.i18n.aboutRunnersBtnText }}
</gl-button>
</template>
</gl-empty-state>
</template>
</gitlab-experiment>
2021-09-30 23:02:18 +05:30
<pipelines-ci-templates v-else-if="canSetCi" />
2021-06-08 01:23:25 +05:30
<gl-empty-state
v-else
title=""
:svg-path="emptyStateSvgPath"
:description="$options.i18n.noCiDescription"
/>
2017-08-17 22:00:37 +05:30
</div>
</template>