1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
<script>
import { memoize } from 'lodash';
import { reportToSentry } from '~/ci/utils';
import { parseData } from '~/ci/pipeline_details/utils/parsing_utils';
import LinksInner from '~/ci/pipeline_details/graph/components/links_inner.vue';
const parseForLinksBare = (pipeline) => {
const arrayOfJobs = pipeline.flatMap(({ groups }) => groups);
return parseData(arrayOfJobs).links;
};
const parseForLinks = memoize(parseForLinksBare);
export default {
name: 'LinksLayer',
components: {
LinksInner,
},
props: {
containerMeasurements: {
type: Object,
required: true,
},
pipelineData: {
type: Array,
required: true,
},
linksData: {
type: Array,
required: false,
default: () => [],
},
showLinks: {
type: Boolean,
required: false,
default: true,
},
},
computed: {
containerZero() {
return !this.containerMeasurements.width || !this.containerMeasurements.height;
},
getLinksData() {
if (this.linksData.length > 0) {
return this.linksData;
}
return parseForLinks(this.pipelineData);
},
showLinkedLayers() {
return this.showLinks && !this.containerZero;
},
},
errorCaptured(err, _vm, info) {
reportToSentry(this.$options.name, `error: ${err}, info: ${info}`);
},
};
</script>
<template>
<links-inner
v-if="showLinkedLayers"
:container-measurements="containerMeasurements"
:links-data="getLinksData"
:pipeline-data="pipelineData"
v-bind="$attrs"
v-on="$listeners"
>
<slot></slot>
</links-inner>
<div v-else>
<div class="gl-display-flex gl-relative">
<slot></slot>
</div>
</div>
</template>
|