Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-08 12:09:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-08 12:09:43 +0300
commitf5050253469fc0961c02deec0e698ad62bdd9de5 (patch)
tree30bbd8f8b556fd5b730f0123921138ee1d6bdaa2 /app/assets/javascripts/pipelines
parentf6cdec670b9b757fc2225a2c6627ab79765e5b8a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/pipelines')
-rw-r--r--app/assets/javascripts/pipelines/components/graph/graph_component.vue24
-rw-r--r--app/assets/javascripts/pipelines/mixins/graph_pipeline_bundle_mixin.js25
-rw-r--r--app/assets/javascripts/pipelines/pipeline_details_bundle.js8
-rw-r--r--app/assets/javascripts/pipelines/stores/pipeline_store.js12
4 files changed, 37 insertions, 32 deletions
diff --git a/app/assets/javascripts/pipelines/components/graph/graph_component.vue b/app/assets/javascripts/pipelines/components/graph/graph_component.vue
index 6a836adba01..ef3f4d0e3f6 100644
--- a/app/assets/javascripts/pipelines/components/graph/graph_component.vue
+++ b/app/assets/javascripts/pipelines/components/graph/graph_component.vue
@@ -99,7 +99,17 @@ export default {
downstreamNode.classList.contains('child-pipeline') ? 15 : 30,
);
- this.$emit('onClickTriggered', this.pipeline, pipeline);
+ /**
+ * If the expanded trigger is defined and the id is different than the
+ * pipeline we clicked, then it means we clicked on a sibling downstream link
+ * and we want to reset the pipeline store. Triggering the reset without
+ * this condition would mean not allowing downstreams of downstreams to expand
+ */
+ if (this.expandedTriggered?.id !== pipeline.id) {
+ this.$emit('onResetTriggered', this.pipeline, pipeline);
+ }
+
+ this.$emit('onClickTriggered', pipeline);
},
calculateMarginTop(downstreamNode, pixelDiff) {
return `${downstreamNode.offsetTop - downstreamNode.offsetParent.offsetTop - pixelDiff}px`;
@@ -136,9 +146,7 @@ export default {
:pipeline="expandedTriggeredBy"
:is-linked-pipeline="true"
:mediator="mediator"
- @onClickTriggeredBy="
- (parentPipeline, pipeline) => clickTriggeredByPipeline(parentPipeline, pipeline)
- "
+ @onClickTriggeredBy="clickTriggeredByPipeline"
@refreshPipelineGraph="requestRefreshPipelineGraph"
/>
@@ -148,9 +156,7 @@ export default {
:column-title="__('Upstream')"
:project-id="pipelineProjectId"
graph-position="left"
- @linkedPipelineClick="
- linkedPipeline => $emit('onClickTriggeredBy', pipeline, linkedPipeline)
- "
+ @linkedPipelineClick="$emit('onClickTriggeredBy', $event)"
/>
<ul
@@ -197,9 +203,7 @@ export default {
:is-linked-pipeline="true"
:style="{ 'margin-top': downstreamMarginTop }"
:mediator="mediator"
- @onClickTriggered="
- (parentPipeline, pipeline) => clickTriggeredPipeline(parentPipeline, pipeline)
- "
+ @onClickTriggered="clickTriggeredPipeline"
@refreshPipelineGraph="requestRefreshPipelineGraph"
/>
</div>
diff --git a/app/assets/javascripts/pipelines/mixins/graph_pipeline_bundle_mixin.js b/app/assets/javascripts/pipelines/mixins/graph_pipeline_bundle_mixin.js
index 1d9366f26df..f987c8f1dd4 100644
--- a/app/assets/javascripts/pipelines/mixins/graph_pipeline_bundle_mixin.js
+++ b/app/assets/javascripts/pipelines/mixins/graph_pipeline_bundle_mixin.js
@@ -27,9 +27,9 @@ export default {
* @param {String} resetStoreKey Store key for the visible pipeline that will need to be reset
* @param {Object} pipeline The clicked pipeline
*/
- clickPipeline(parentPipeline, pipeline, openMethod, closeMethod) {
+ clickPipeline(pipeline, openMethod, closeMethod) {
if (!pipeline.isExpanded) {
- this.mediator.store[openMethod](parentPipeline, pipeline);
+ this.mediator.store[openMethod](pipeline);
this.mediator.store.toggleLoading(pipeline);
this.mediator.poll.stop();
@@ -41,21 +41,14 @@ export default {
this.mediator.poll.enable({ data: this.mediator.getExpandedParameters() });
}
},
- clickTriggeredByPipeline(parentPipeline, pipeline) {
- this.clickPipeline(
- parentPipeline,
- pipeline,
- 'openTriggeredByPipeline',
- 'closeTriggeredByPipeline',
- );
+ resetTriggeredPipelines(parentPipeline, pipeline) {
+ this.mediator.store.resetTriggeredPipelines(parentPipeline, pipeline);
},
- clickTriggeredPipeline(parentPipeline, pipeline) {
- this.clickPipeline(
- parentPipeline,
- pipeline,
- 'openTriggeredPipeline',
- 'closeTriggeredPipeline',
- );
+ clickTriggeredByPipeline(pipeline) {
+ this.clickPipeline(pipeline, 'openPipeline', 'closePipeline');
+ },
+ clickTriggeredPipeline(pipeline) {
+ this.clickPipeline(pipeline, 'openPipeline', 'closePipeline');
},
requestRefreshPipelineGraph() {
// When an action is clicked
diff --git a/app/assets/javascripts/pipelines/pipeline_details_bundle.js b/app/assets/javascripts/pipelines/pipeline_details_bundle.js
index c901971be50..d76425c96b7 100644
--- a/app/assets/javascripts/pipelines/pipeline_details_bundle.js
+++ b/app/assets/javascripts/pipelines/pipeline_details_bundle.js
@@ -42,10 +42,10 @@ export default () => {
},
on: {
refreshPipelineGraph: this.requestRefreshPipelineGraph,
- onClickTriggeredBy: (parentPipeline, pipeline) =>
- this.clickTriggeredByPipeline(parentPipeline, pipeline),
- onClickTriggered: (parentPipeline, pipeline) =>
- this.clickTriggeredPipeline(parentPipeline, pipeline),
+ onResetTriggered: (parentPipeline, pipeline) =>
+ this.resetTriggeredPipelines(parentPipeline, pipeline),
+ onClickTriggeredBy: pipeline => this.clickTriggeredByPipeline(pipeline),
+ onClickTriggered: pipeline => this.clickTriggeredPipeline(pipeline),
},
});
},
diff --git a/app/assets/javascripts/pipelines/stores/pipeline_store.js b/app/assets/javascripts/pipelines/stores/pipeline_store.js
index 69e3579a3c7..1ef73760e02 100644
--- a/app/assets/javascripts/pipelines/stores/pipeline_store.js
+++ b/app/assets/javascripts/pipelines/stores/pipeline_store.js
@@ -54,16 +54,24 @@ export default class PipelineStore {
*/
parseTriggeredByPipelines(oldPipeline = {}, newPipeline) {
// keep old value in case it's opened because we're polling
-
Vue.set(newPipeline, 'isExpanded', oldPipeline.isExpanded || false);
// add isLoading property
Vue.set(newPipeline, 'isLoading', false);
+ // Because there can only ever be one `triggered_by` for any given pipeline,
+ // the API returns an object for the value instead of an Array. However,
+ // it's easier to deal with an array in the FE so we convert it.
if (newPipeline.triggered_by) {
if (!Array.isArray(newPipeline.triggered_by)) {
Object.assign(newPipeline, { triggered_by: [newPipeline.triggered_by] });
}
- this.parseTriggeredByPipelines(oldPipeline, newPipeline.triggered_by[0]);
+
+ if (newPipeline.triggered_by?.length > 0) {
+ newPipeline.triggered_by.forEach(el => {
+ const oldTriggeredBy = oldPipeline.triggered_by?.find(element => element.id === el.id);
+ this.parseTriggeredPipelines(oldTriggeredBy, el);
+ });
+ }
}
}