2017-09-10 17:25:29 +05:30
|
|
|
|
<script>
|
2019-05-30 16:15:17 +05:30
|
|
|
|
import Modal from '~/vue_shared/components/gl_modal.vue';
|
|
|
|
|
import { s__, sprintf } from '~/locale';
|
2018-11-08 19:23:39 +05:30
|
|
|
|
import PipelinesTableRowComponent from './pipelines_table_row.vue';
|
|
|
|
|
import eventHub from '../event_hub';
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
|
/**
|
|
|
|
|
* Pipelines Table Component.
|
|
|
|
|
*
|
|
|
|
|
* Given an array of objects, renders a table.
|
|
|
|
|
*/
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
PipelinesTableRowComponent,
|
2019-05-30 16:15:17 +05:30
|
|
|
|
Modal,
|
2018-11-08 19:23:39 +05:30
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
pipelines: {
|
|
|
|
|
type: Array,
|
|
|
|
|
required: true,
|
2018-03-17 18:26:18 +05:30
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
|
updateGraphDropdown: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
required: false,
|
|
|
|
|
default: false,
|
2017-09-10 17:25:29 +05:30
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
|
autoDevopsHelpPath: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true,
|
2018-03-27 19:54:05 +05:30
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
|
viewType: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true,
|
2018-03-27 19:54:05 +05:30
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2018-12-13 13:39:08 +05:30
|
|
|
|
pipelineId: 0,
|
2018-11-08 19:23:39 +05:30
|
|
|
|
endpoint: '',
|
|
|
|
|
cancelingPipeline: null,
|
|
|
|
|
};
|
|
|
|
|
},
|
2019-05-30 16:15:17 +05:30
|
|
|
|
computed: {
|
|
|
|
|
modalTitle() {
|
|
|
|
|
return sprintf(
|
|
|
|
|
s__('Pipeline|Stop pipeline #%{pipelineId}?'),
|
|
|
|
|
{
|
|
|
|
|
pipelineId: `${this.pipelineId}`,
|
|
|
|
|
},
|
|
|
|
|
false,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
modalText() {
|
|
|
|
|
return sprintf(
|
|
|
|
|
s__('Pipeline|You’re about to stop pipeline %{pipelineId}.'),
|
|
|
|
|
{
|
|
|
|
|
pipelineId: `<strong>#${this.pipelineId}</strong>`,
|
|
|
|
|
},
|
|
|
|
|
false,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
|
created() {
|
|
|
|
|
eventHub.$on('openConfirmationModal', this.setModalData);
|
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
eventHub.$off('openConfirmationModal', this.setModalData);
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
setModalData(data) {
|
2019-05-30 16:15:17 +05:30
|
|
|
|
this.pipelineId = data.pipelineId;
|
2018-11-08 19:23:39 +05:30
|
|
|
|
this.endpoint = data.endpoint;
|
2018-03-27 19:54:05 +05:30
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
|
onSubmit() {
|
|
|
|
|
eventHub.$emit('postAction', this.endpoint);
|
|
|
|
|
this.cancelingPipeline = this.pipelineId;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
2017-09-10 17:25:29 +05:30
|
|
|
|
</script>
|
|
|
|
|
<template>
|
|
|
|
|
<div class="ci-table">
|
2019-02-15 15:39:39 +05:30
|
|
|
|
<div class="gl-responsive-table-row table-row-header" role="row">
|
|
|
|
|
<div class="table-section section-10 js-pipeline-status pipeline-status" role="rowheader">
|
2018-12-13 13:39:08 +05:30
|
|
|
|
{{ s__('Pipeline|Status') }}
|
2017-09-10 17:25:29 +05:30
|
|
|
|
</div>
|
2019-02-15 15:39:39 +05:30
|
|
|
|
<div class="table-section section-15 js-pipeline-info pipeline-info" role="rowheader">
|
2018-12-13 13:39:08 +05:30
|
|
|
|
{{ s__('Pipeline|Pipeline') }}
|
2017-09-10 17:25:29 +05:30
|
|
|
|
</div>
|
2019-02-15 15:39:39 +05:30
|
|
|
|
<div class="table-section section-20 js-pipeline-commit pipeline-commit" role="rowheader">
|
2018-12-13 13:39:08 +05:30
|
|
|
|
{{ s__('Pipeline|Commit') }}
|
2017-09-10 17:25:29 +05:30
|
|
|
|
</div>
|
2019-02-15 15:39:39 +05:30
|
|
|
|
<div class="table-section section-20 js-pipeline-stages pipeline-stages" role="rowheader">
|
2018-12-13 13:39:08 +05:30
|
|
|
|
{{ s__('Pipeline|Stages') }}
|
2017-09-10 17:25:29 +05:30
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<pipelines-table-row-component
|
|
|
|
|
v-for="model in pipelines"
|
|
|
|
|
:key="model.id"
|
|
|
|
|
:pipeline="model"
|
|
|
|
|
:update-graph-dropdown="updateGraphDropdown"
|
2018-03-17 18:26:18 +05:30
|
|
|
|
:auto-devops-help-path="autoDevopsHelpPath"
|
|
|
|
|
:view-type="viewType"
|
2018-11-08 19:23:39 +05:30
|
|
|
|
:canceling-pipeline="cancelingPipeline"
|
2017-09-10 17:25:29 +05:30
|
|
|
|
/>
|
2019-05-30 16:15:17 +05:30
|
|
|
|
|
|
|
|
|
<modal
|
|
|
|
|
id="confirmation-modal"
|
|
|
|
|
:header-title-text="modalTitle"
|
|
|
|
|
:footer-primary-button-text="s__('Pipeline|Stop pipeline')"
|
|
|
|
|
footer-primary-button-variant="danger"
|
|
|
|
|
@submit="onSubmit"
|
|
|
|
|
>
|
|
|
|
|
<span v-html="modalText"></span>
|
|
|
|
|
</modal>
|
2017-09-10 17:25:29 +05:30
|
|
|
|
</div>
|
|
|
|
|
</template>
|