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

134 lines
2.9 KiB
Vue
Raw Normal View History

2017-09-10 17:25:29 +05:30
<script>
2018-11-08 19:23:39 +05:30
import Modal from '~/vue_shared/components/gl_modal.vue';
import { s__, sprintf } from '~/locale';
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,
Modal,
},
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 {
pipelineId: '',
endpoint: '',
cancelingPipeline: null,
};
},
computed: {
modalTitle() {
return sprintf(
s__('Pipeline|Stop pipeline #%{pipelineId}?'),
{
pipelineId: `${this.pipelineId}`,
},
false,
);
2018-03-27 19:54:05 +05:30
},
2018-11-08 19:23:39 +05:30
modalText() {
return sprintf(
s__('Pipeline|Youre about to stop pipeline %{pipelineId}.'),
{
pipelineId: `<strong>#${this.pipelineId}</strong>`,
},
false,
);
2018-03-27 19:54:05 +05:30
},
2018-11-08 19:23:39 +05:30
},
created() {
eventHub.$on('openConfirmationModal', this.setModalData);
},
beforeDestroy() {
eventHub.$off('openConfirmationModal', this.setModalData);
},
methods: {
setModalData(data) {
this.pipelineId = data.pipelineId;
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">
<div
class="gl-responsive-table-row table-row-header"
2018-03-17 18:26:18 +05:30
role="row"
>
2017-09-10 17:25:29 +05:30
<div
class="table-section section-10 js-pipeline-status pipeline-status"
2018-03-17 18:26:18 +05:30
role="rowheader"
>
2017-09-10 17:25:29 +05:30
Status
</div>
<div
class="table-section section-15 js-pipeline-info pipeline-info"
2018-03-17 18:26:18 +05:30
role="rowheader"
>
2017-09-10 17:25:29 +05:30
Pipeline
</div>
<div
2018-03-17 18:26:18 +05:30
class="table-section section-20 js-pipeline-commit pipeline-commit"
role="rowheader"
>
2017-09-10 17:25:29 +05:30
Commit
</div>
<div
2018-03-17 18:26:18 +05:30
class="table-section section-20 js-pipeline-stages pipeline-stages"
role="rowheader"
>
2017-09-10 17:25:29 +05:30
Stages
</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
/>
2018-11-08 19:23:39 +05:30
<modal
2018-03-27 19:54:05 +05:30
id="confirmation-modal"
2018-11-08 19:23:39 +05:30
:header-title-text="modalTitle"
:footer-primary-button-text="s__('Pipeline|Stop pipeline')"
footer-primary-button-variant="danger"
2018-03-27 19:54:05 +05:30
@submit="onSubmit"
>
2018-11-08 19:23:39 +05:30
<span v-html="modalText"></span>
</modal>
2017-09-10 17:25:29 +05:30
</div>
</template>