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

102 lines
2.6 KiB
Vue
Raw Normal View History

2017-09-10 17:25:29 +05:30
<script>
2019-07-31 22:56:46 +05:30
import { GlTooltipDirective } from '@gitlab/ui';
2018-11-08 19:23:39 +05:30
import PipelinesTableRowComponent from './pipelines_table_row.vue';
2019-07-07 11:18:12 +05:30
import PipelineStopModal from './pipeline_stop_modal.vue';
2018-11-08 19:23:39 +05:30
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-07-07 11:18:12 +05:30
PipelineStopModal,
2018-11-08 19:23:39 +05:30
},
2019-07-31 22:56:46 +05:30
directives: {
GlTooltip: GlTooltipDirective,
},
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,
2019-07-07 11:18:12 +05:30
pipeline: {},
2018-11-08 19:23:39 +05:30
endpoint: '',
cancelingPipeline: null,
};
},
2019-09-30 21:07:59 +05:30
watch: {
pipelines() {
this.cancelingPipeline = null;
},
},
2018-11-08 19:23:39 +05:30
created() {
eventHub.$on('openConfirmationModal', this.setModalData);
},
beforeDestroy() {
eventHub.$off('openConfirmationModal', this.setModalData);
},
methods: {
setModalData(data) {
2019-07-07 11:18:12 +05:30
this.pipelineId = data.pipeline.id;
this.pipeline = data.pipeline;
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">
2019-07-31 22:56:46 +05:30
<div class="table-section section-10 js-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-07-31 22:56:46 +05:30
<div class="table-section section-10 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-07-31 22:56:46 +05:30
<div class="table-section section-10 js-triggerer-info triggerer-info" role="rowheader">
{{ s__('Pipeline|Triggerer') }}
</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-07-31 22:56:46 +05:30
<div class="table-section section-15 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-07-07 11:18:12 +05:30
<pipeline-stop-modal :pipeline="pipeline" @submit="onSubmit" />
2017-09-10 17:25:29 +05:30
</div>
</template>