Skip to content

Commit

Permalink
Minor error on Metrics Graphs on Safari
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnestOrt committed Aug 10, 2017
1 parent cf9e6c7 commit 49b7ed5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 26 deletions.
69 changes: 44 additions & 25 deletions trampoline/src/main/resources/static/js/backend.requests.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var metricsCharts;
function setMavenBinaryLocation(){
if($("#input-mavenbinarylocation").val() == ''){
$("#form-group-mavenbinarylocation").addClass("has-error");
Expand Down Expand Up @@ -114,31 +115,23 @@ function showMetrics(instanceId, name, port){
dataMemoryFree.push(value.freeMemoryKB);
usedHeapKB.push(value.usedHeapKB)
});
var ctx = document.getElementById('myChart').getContext('2d');
new Chart(ctx, {
// The type of chart we want to create
type: 'line',

// The data for our dataset
data: {
labels: dates,
datasets: [{
label: "Memory Free KB",
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgba(255, 99, 132, 1)',
data: dataMemoryFree,
},
{
label: "Heap Used KB",
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderColor: 'rgba(54, 162, 235, 1)',
data: usedHeapKB,
}]
},

// Configuration options go here
options: {}
});
metricsCharts.config.data = {
labels: dates,
datasets: [{
label: "Memory Free KB",
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgba(255, 99, 132, 1)',
data: dataMemoryFree,
},
{
label: "Heap Used KB",
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderColor: 'rgba(54, 162, 235, 1)',
data: usedHeapKB,
}]
}

metricsCharts.update();
}
});
}
Expand Down Expand Up @@ -199,4 +192,30 @@ setInterval(updateStatusInstances, 15000);

$( document ).ready(function() {
updateStatusInstances();

var ctx = document.getElementById('myChart').getContext('2d');
metricsCharts = new Chart(ctx, {
// The type of chart we want to create
type: 'line',

// The data for our dataset
data: {
labels: [],
datasets: [{
label: "Memory Free KB",
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgba(255, 99, 132, 1)',
data: [],
},
{
label: "Heap Used KB",
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderColor: 'rgba(54, 162, 235, 1)',
data: [],
}]
},

// Configuration options go here
options: {}
});
});
2 changes: 1 addition & 1 deletion trampoline/src/main/resources/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ <h4>
<div class="modal-header">
<h4 class="modal-title"><span id="metrics-title"></span></h4>
</div>
<div class="modal-body">
<div class="modal-body" id="#canvas-wrapper">
<canvas id="myChart" width="400" height="400"></canvas>
</div>
<div class="modal-footer">
Expand Down

0 comments on commit 49b7ed5

Please sign in to comment.