2019-07-07 11:18:12 +05:30
|
|
|
|
<script>
|
2021-11-18 22:05:49 +05:30
|
|
|
|
import { GlLink, GlModal, GlSprintf } from '@gitlab/ui';
|
2021-03-11 19:13:27 +05:30
|
|
|
|
import { isEmpty } from 'lodash';
|
2021-01-03 14:25:43 +05:30
|
|
|
|
import { __, s__, sprintf } from '~/locale';
|
2021-03-11 19:13:27 +05:30
|
|
|
|
import CiIcon from '~/vue_shared/components/ci_icon.vue';
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Pipeline Stop Modal.
|
|
|
|
|
*
|
|
|
|
|
* Renders the modal used to confirm stopping a pipeline.
|
|
|
|
|
*/
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
2021-01-03 14:25:43 +05:30
|
|
|
|
GlModal,
|
2019-07-07 11:18:12 +05:30
|
|
|
|
GlLink,
|
2021-11-18 22:05:49 +05:30
|
|
|
|
GlSprintf,
|
2019-07-07 11:18:12 +05:30
|
|
|
|
CiIcon,
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
pipeline: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true,
|
|
|
|
|
deep: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
modalTitle() {
|
|
|
|
|
return sprintf(
|
|
|
|
|
s__('Pipeline|Stop pipeline #%{pipelineId}?'),
|
|
|
|
|
{
|
|
|
|
|
pipelineId: `${this.pipeline.id}`,
|
|
|
|
|
},
|
|
|
|
|
false,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
modalText() {
|
2021-11-18 22:05:49 +05:30
|
|
|
|
return s__(`Pipeline|You’re about to stop pipeline #%{pipelineId}.`);
|
2019-07-07 11:18:12 +05:30
|
|
|
|
},
|
|
|
|
|
hasRef() {
|
2020-03-13 15:44:24 +05:30
|
|
|
|
return !isEmpty(this.pipeline.ref);
|
2019-07-07 11:18:12 +05:30
|
|
|
|
},
|
2021-01-03 14:25:43 +05:30
|
|
|
|
primaryProps() {
|
|
|
|
|
return {
|
|
|
|
|
text: s__('Pipeline|Stop pipeline'),
|
|
|
|
|
attributes: [{ variant: 'danger' }],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
cancelProps() {
|
|
|
|
|
return {
|
|
|
|
|
text: __('Cancel'),
|
|
|
|
|
};
|
|
|
|
|
},
|
2019-07-07 11:18:12 +05:30
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
emitSubmit(event) {
|
|
|
|
|
this.$emit('submit', event);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<template>
|
|
|
|
|
<gl-modal
|
2021-01-03 14:25:43 +05:30
|
|
|
|
modal-id="confirmation-modal"
|
|
|
|
|
:title="modalTitle"
|
|
|
|
|
:action-primary="primaryProps"
|
|
|
|
|
:action-cancel="cancelProps"
|
|
|
|
|
@primary="emitSubmit($event)"
|
2019-07-07 11:18:12 +05:30
|
|
|
|
>
|
2021-11-18 22:05:49 +05:30
|
|
|
|
<p>
|
|
|
|
|
<gl-sprintf :message="modalText">
|
|
|
|
|
<template #pipelineId>
|
|
|
|
|
<strong>{{ pipeline.id }}</strong>
|
|
|
|
|
</template>
|
|
|
|
|
</gl-sprintf>
|
|
|
|
|
</p>
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
|
|
<p v-if="pipeline">
|
|
|
|
|
<ci-icon
|
|
|
|
|
v-if="pipeline.details"
|
|
|
|
|
:status="pipeline.details.status"
|
|
|
|
|
class="vertical-align-middle"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<span class="font-weight-bold">{{ __('Pipeline') }}</span>
|
|
|
|
|
|
|
|
|
|
<a :href="pipeline.path" class="js-pipeline-path link-commit qa-pipeline-path"
|
|
|
|
|
>#{{ pipeline.id }}</a
|
|
|
|
|
>
|
|
|
|
|
<template v-if="hasRef">
|
|
|
|
|
{{ __('from') }}
|
|
|
|
|
<a :href="pipeline.ref.path" class="link-commit ref-name">{{ pipeline.ref.name }}</a>
|
|
|
|
|
</template>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<template v-if="pipeline.commit">
|
|
|
|
|
<p>
|
|
|
|
|
<span class="font-weight-bold">{{ __('Commit') }}</span>
|
|
|
|
|
|
|
|
|
|
<gl-link :href="pipeline.commit.commit_path" class="js-commit-sha commit-sha link-commit">
|
|
|
|
|
{{ pipeline.commit.short_id }}
|
|
|
|
|
</gl-link>
|
|
|
|
|
</p>
|
|
|
|
|
<p>{{ pipeline.commit.title }}</p>
|
|
|
|
|
</template>
|
|
|
|
|
</gl-modal>
|
|
|
|
|
</template>
|