You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
132 lines
5.3 KiB
132 lines
5.3 KiB
import Ember from 'ember'; |
|
|
|
export default Ember.Controller.extend({ |
|
applicationController: Ember.inject.controller('application'), |
|
config: Ember.computed.reads('applicationController.config'), |
|
stats: Ember.computed.reads('applicationController.model.stats'), |
|
chartOptions: Ember.computed("model.hashrate", { |
|
get() { |
|
var e = this, |
|
t = e.getWithDefault("model.minerCharts"), |
|
a = { |
|
chart: { |
|
backgroundColor: "rgba(255, 255, 255, 0.1)", |
|
type: "spline", |
|
marginRight: 10, |
|
height: 400, |
|
events: { |
|
load: function() { |
|
var series = this.series[0]; |
|
setInterval(function() { |
|
var x = (new Date).getTime(), |
|
y = e.getWithDefault("model.currentHashrate") / 1000000; |
|
series.addPoint([x, y], true, true) |
|
}, 109000000) |
|
} |
|
} |
|
}, |
|
title: { |
|
text: "" |
|
}, |
|
xAxis: { |
|
ordinal: false, |
|
type: "datetime", |
|
dateTimeLabelFormats: { |
|
millisecond: "%H:%M:%S", |
|
second: "%H:%M:%S", |
|
minute: "%H:%M", |
|
hour: "%H:%M", |
|
day: "%e. %b", |
|
week: "%e. %b", |
|
month: "%b '%y", |
|
year: "%Y" |
|
} |
|
}, |
|
yAxis: { |
|
title: { |
|
text: "HASHRATE" |
|
}, |
|
min: 0 |
|
}, |
|
plotLines: [{ |
|
value: 0, |
|
width: 1, |
|
color: "#808080" |
|
}], |
|
legend: { |
|
enabled: true |
|
}, |
|
tooltip: { |
|
formatter: function() { |
|
return this.y > 1000000000000 ? "<b>" + this.point.d + "<b><br>Hashrate " + (this.y / 1000000000000).toFixed(2) + " TH/s</b>" : this.y > 1000000000 ? "<b>" + this.point.d + "<b><br>Hashrate " + (this.y / 1000000000).toFixed(2) + " GH/s</b>" : this.y > 1000000 ? "<b>" + this.point.d + "<b><br>Hashrate " + (this.y / 1000000).toFixed(2) + " MH/s</b>" : "<b>" + this.point.d + "<b><br>Hashrate <b>" + this.y.toFixed(2) + " H/s</b>" |
|
|
|
}, |
|
|
|
useHTML: true |
|
}, |
|
exporting: { |
|
enabled: false |
|
}, |
|
series: [{ |
|
color: "#E99002", |
|
name: "Average hashrate", |
|
data: function() { |
|
var e, a = []; |
|
if (null != t) |
|
for (e = 0; e <= t.length - 1; e += 1) { |
|
var n = 0, |
|
r = 0, |
|
l = 0; |
|
r = new Date(1e3 * t[e].x), l = r.toLocaleString(), n = t[e].minerLargeHash, a.push({ |
|
x: r, |
|
d: l, |
|
y: n |
|
}) |
|
} else a.push({ |
|
x: 0, |
|
d: 0, |
|
y: 0 |
|
}); |
|
return a |
|
}() |
|
}, { |
|
name: "Current hashrate", |
|
data: function() { |
|
var e, a = []; |
|
if (null != t) |
|
for (e = 0; e <= t.length - 1; e += 1) { |
|
var n = 0, |
|
r = 0, |
|
l = 0; |
|
r = new Date(1e3 * t[e].x), l = r.toLocaleString(), n = t[e].minerHash, a.push({ |
|
x: r, |
|
d: l, |
|
y: n |
|
}) |
|
} else a.push({ |
|
x: 0, |
|
d: 0, |
|
y: 0 |
|
}); |
|
return a |
|
}() |
|
}] |
|
}; |
|
return a |
|
} |
|
}), |
|
|
|
roundPercent: Ember.computed('stats', 'model', { |
|
get() { |
|
var percent = this.get('model.roundShares') / this.get('stats.nShares'); |
|
if (!percent) { |
|
return 0; |
|
} |
|
if(percent>100){ |
|
return 100; |
|
} |
|
|
|
return percent; |
|
} |
|
}) |
|
});
|
|
|