Merge branch 'adriel-add-deployment-data' into 'master'
Add deployment data to metrics graphs See merge request gitlab-org/gitlab-ce!24650
This commit is contained in:
commit
74abc77503
2 changed files with 43 additions and 0 deletions
|
@ -33,6 +33,11 @@ export default {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
deploymentData: {
|
||||||
|
type: Array,
|
||||||
|
required: false,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
alertData: {
|
alertData: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: false,
|
required: false,
|
||||||
|
@ -79,6 +84,43 @@ export default {
|
||||||
legend: {
|
legend: {
|
||||||
formatter: this.xAxisLabel,
|
formatter: this.xAxisLabel,
|
||||||
},
|
},
|
||||||
|
series: this.scatterSeries,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
earliestDatapoint() {
|
||||||
|
return Object.values(this.chartData).reduce((acc, data) => {
|
||||||
|
const [[timestamp]] = data.sort(([a], [b]) => {
|
||||||
|
if (a < b) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return a > b ? 1 : 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
return timestamp < acc || acc === null ? timestamp : acc;
|
||||||
|
}, null);
|
||||||
|
},
|
||||||
|
recentDeployments() {
|
||||||
|
return this.deploymentData.reduce((acc, deployment) => {
|
||||||
|
if (deployment.created_at >= this.earliestDatapoint) {
|
||||||
|
acc.push({
|
||||||
|
id: deployment.id,
|
||||||
|
createdAt: deployment.created_at,
|
||||||
|
sha: deployment.sha,
|
||||||
|
commitUrl: `${this.projectPath}/commit/${deployment.sha}`,
|
||||||
|
tag: deployment.tag,
|
||||||
|
tagUrl: deployment.tag ? `${this.tagsPath}/${deployment.ref.name}` : null,
|
||||||
|
ref: deployment.ref.name,
|
||||||
|
showDeploymentFlag: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
},
|
||||||
|
scatterSeries() {
|
||||||
|
return {
|
||||||
|
type: 'scatter',
|
||||||
|
data: this.recentDeployments.map(deployment => [deployment.createdAt, 0]),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
xAxisLabel() {
|
xAxisLabel() {
|
||||||
|
|
|
@ -190,6 +190,7 @@ export default {
|
||||||
v-for="(graphData, graphIndex) in groupData.metrics"
|
v-for="(graphData, graphIndex) in groupData.metrics"
|
||||||
:key="graphIndex"
|
:key="graphIndex"
|
||||||
:graph-data="graphData"
|
:graph-data="graphData"
|
||||||
|
:deployment-data="store.deploymentData"
|
||||||
:alert-data="getGraphAlerts(graphData.id)"
|
:alert-data="getGraphAlerts(graphData.id)"
|
||||||
:container-width="elWidth"
|
:container-width="elWidth"
|
||||||
group-id="monitor-area-chart"
|
group-id="monitor-area-chart"
|
||||||
|
|
Loading…
Reference in a new issue