Commit 79a147c0 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'vis-move-mounted-fn-to-watchers' into 'master'

Move Ci pipeline graph mounted logic to an immediate watcher

See merge request gitlab-org/gitlab!51388
parents 3e96111d 2a1a4c45
...@@ -126,33 +126,22 @@ export default { ...@@ -126,33 +126,22 @@ export default {
}, },
}, },
watch: { watch: {
isPipelineDataEmpty: { pipelineData: {
immediate: true, immediate: true,
handler(isDataEmpty) { handler() {
if (isDataEmpty) { if (this.isPipelineDataEmpty) {
this.reportFailure(EMPTY_PIPELINE_DATA); this.reportFailure(EMPTY_PIPELINE_DATA);
} } else if (this.isInvalidCiConfig) {
},
},
isInvalidCiConfig: {
immediate: true,
handler(isInvalid) {
if (isInvalid) {
this.reportFailure(INVALID_CI_CONFIG); this.reportFailure(INVALID_CI_CONFIG);
} } else {
},
},
},
mounted() {
if (!this.isPipelineDataEmpty && !this.isInvalidCiConfig) {
// This guarantee that all sub-elements are rendered
// https://v3.vuejs.org/api/options-lifecycle-hooks.html#mounted
this.$nextTick(() => { this.$nextTick(() => {
this.getGraphDimensions(); this.computeGraphDimensions();
this.prepareLinkData(); this.prepareLinkData();
}); });
} }
}, },
},
},
methods: { methods: {
prepareLinkData() { prepareLinkData() {
try { try {
...@@ -194,7 +183,7 @@ export default { ...@@ -194,7 +183,7 @@ export default {
removeHighlightNeeds() { removeHighlightNeeds() {
this.highlightedJob = null; this.highlightedJob = null;
}, },
getGraphDimensions() { computeGraphDimensions() {
this.width = `${this.$refs[this.$options.CONTAINER_REF].scrollWidth}`; this.width = `${this.$refs[this.$options.CONTAINER_REF].scrollWidth}`;
this.height = `${this.$refs[this.$options.CONTAINER_REF].scrollHeight}`; this.height = `${this.$refs[this.$options.CONTAINER_REF].scrollHeight}`;
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment