import Ember from 'ember'; export default Ember.Controller.extend({ applicationController: Ember.inject.controller('application'), stats: Ember.computed.reads('applicationController'), config: Ember.computed.reads('applicationController.config'), cachedLogin: Ember.computed('login', { get() { return this.get('login') || Ember.$.cookie('login'); }, set(key, value) { Ember.$.cookie('login', value); this.set('model.login', value); return value; } }), chartOptions: Ember.computed("model.hashrate", { get() { var e = this, t = e.getWithDefault("stats.model.poolCharts"), a = { chart: { backgroundColor: "rgba(0, 0, 0, 0.1)", type: "spline", height: 300, marginRight: 10, events: { load: function() { var series = this.series[0]; setInterval(function() { var x = (new Date()).getTime(), y = e.getWithDefault("model.Hashrate") / 1000000; series.addPoint([x, y], true, true); }, 1090000000); } } }, title: { text: "Our pool's hashrate", style: { color: "#ccc" } }, xAxis: { labels: { style: { color: "#ccc" } }, ordinal: false, type: "datetime" }, yAxis: { title: { text: "HASHRATE", style: { color: "#ccc" } }, min: 0, labels: { style: { color: "#ccc" } } }, plotLines: [{ value: 0, width: 1, color: "#ccc" }], legend: { enabled: false }, tooltip: { formatter: function() { return this.y > 1000000000000 ? "" + this.point.d + "
Hashrate " + (this.y / 1000000000000).toFixed(2) + " TH/s
" : this.y > 1000000000 ? "" + this.point.d + "
Hashrate " + (this.y / 1000000000).toFixed(2) + " GH/s
" : this.y > 1000000 ? "" + this.point.d + "
Hashrate " + (this.y / 1000000).toFixed(2) + " MH/s
" : "" + this.point.d + "
Hashrate " + this.y.toFixed(2) + " H/s"; }, useHTML: true }, exporting: { enabled: false }, series: [{ color: "#15BD27", name: "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].y; a.push({ x: r, d: l, y: n }); } } else { a.push({ x: 0, d: 0, y: 0 }); } return a; }() }] }; return a; } }) });