summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Ivan Vargas <jvargas@gitlab.com>2017-03-29 10:10:30 -0600
committerJose Ivan Vargas <jvargas@gitlab.com>2017-04-03 10:38:16 -0500
commitd745876e23e48e7fdf1b569c7e10dd4e2ca2734a (patch)
tree0deb1858c55f5966b2b23172d9f3545fba3de820
parentb4795830026fc1fd361e2dace64a70abeb0cd7ae (diff)
downloadgitlab-ce-d745876e23e48e7fdf1b569c7e10dd4e2ca2734a.tar.gz
Code corrections with a helper and a variable
-rw-r--r--app/assets/javascripts/monitoring/prometheus_graph.js18
-rw-r--r--app/views/projects/environments/metrics.html.haml3
2 files changed, 10 insertions, 11 deletions
diff --git a/app/assets/javascripts/monitoring/prometheus_graph.js b/app/assets/javascripts/monitoring/prometheus_graph.js
index eb9e93dba09..a7608468a97 100644
--- a/app/assets/javascripts/monitoring/prometheus_graph.js
+++ b/app/assets/javascripts/monitoring/prometheus_graph.js
@@ -50,19 +50,19 @@ class PrometheusGraph {
}
plotValues(key) {
+ const graphSpecifics = this.graphSpecificProperties[key];
+
const x = d3.time.scale()
.range([0, this.width]);
const y = d3.scale.linear()
.range([this.height, 0]);
- this.graphSpecificProperties[key].xScale = x;
- this.graphSpecificProperties[key].yScale = y;
+ graphSpecifics.xScale = x;
+ graphSpecifics.yScale = y;
const prometheusGraphContainer = `${prometheusGraphsContainer}[graph-type=${key}]`;
- const graphSpecifics = this.graphSpecificProperties[key];
-
const chart = d3.select(prometheusGraphContainer)
.attr('width', this.width + this.margin.left + this.margin.right)
.attr('height', this.height + this.margin.bottom + this.margin.top)
@@ -142,9 +142,9 @@ class PrometheusGraph {
.attr('stroke-width', '1')
.attr({
x1: 10,
- y1: this.originalHeight - 80,
+ y1: this.originalHeight - this.margin.top,
x2: (this.originalWidth - this.margin.right) + 10,
- y2: this.originalHeight - 80,
+ y2: this.originalHeight - this.margin.top,
});
axisLabelContainer.append('line')
@@ -155,7 +155,7 @@ class PrometheusGraph {
x1: 10,
y1: 0,
x2: 10,
- y2: this.originalHeight - 80,
+ y2: this.originalHeight - this.margin.top,
});
axisLabelContainer.append('rect')
.attr('class', 'rect-axis-text')
@@ -167,7 +167,7 @@ class PrometheusGraph {
axisLabelContainer.append('text')
.attr('class', 'label-axis-text')
.attr('text-anchor', 'middle')
- .attr('transform', `translate(15, ${(this.originalHeight - 80) / 2}) rotate(-90)`)
+ .attr('transform', `translate(15, ${(this.originalHeight - this.margin.top) / 2}) rotate(-90)`)
.text(graphSpecifics.graph_legend_title);
axisLabelContainer.append('rect')
@@ -180,7 +180,7 @@ class PrometheusGraph {
axisLabelContainer.append('text')
.attr('class', 'label-axis-text')
.attr('x', (this.originalWidth / 2) - this.margin.right)
- .attr('y', this.originalHeight - 80)
+ .attr('y', this.originalHeight - this.margin.top)
.attr('dy', '.35em')
.text('Time');
diff --git a/app/views/projects/environments/metrics.html.haml b/app/views/projects/environments/metrics.html.haml
index 5627192c36c..92dc58cd38d 100644
--- a/app/views/projects/environments/metrics.html.haml
+++ b/app/views/projects/environments/metrics.html.haml
@@ -11,8 +11,7 @@
.col-sm-6
%h3.page-title
Environment:
- = link_to environment_path(@environment) do
- = @environment.name
+ = link_to @environment.name, environment_path(@environment)
.col-sm-6
.nav-controls