diff --git a/www/app/controllers/account/index.js b/www/app/controllers/account/index.js index 5d3d694..583f638 100644 --- a/www/app/controllers/account/index.js +++ b/www/app/controllers/account/index.js @@ -1,13 +1,13 @@ import Ember from 'ember'; export default Ember.Controller.extend({ - applicationController: Ember.inject.controller('application'), - netstats: Ember.computed.reads('applicationController'), - stats: Ember.computed.reads('applicationController.model.stats'), - config: Ember.computed.reads('applicationController.config'), - hashrate: Ember.computed.reads('applicationController.hashrate'), + applicationController: Ember.inject.controller('application'), + netstats: Ember.computed.reads('applicationController'), + stats: Ember.computed.reads('applicationController.model.stats'), + config: Ember.computed.reads('applicationController.config'), + hashrate: Ember.computed.reads('applicationController.hashrate'), - chartOptions: Ember.computed("model.hashrate", { + chartOptions: Ember.computed("model.hashrate", { get() { var e = this, t = e.getWithDefault("model.minerCharts"), @@ -18,9 +18,9 @@ export default Ember.Controller.extend({ marginRight: 10, height: 290, events: { - load: function() { + load: function () { var series = this.series[0]; - setInterval(function() { + setInterval(function () { var x = (new Date()).getTime(), y = e.getWithDefault("model.currentHashrate") / 1000000; series.addPoint([x, y], true, true); @@ -31,60 +31,60 @@ export default Ember.Controller.extend({ title: { text: "" }, - ////// - rangeSelector : { - enabled: true, - selected: 4, - allButtonsEnabled: true, - inputDateFormat: '%Y/%m/%d %H:%M', - inputEditDateFormat: '%Y/%m/%d %H:%M', - inputEnabled: false, - buttons: [{ - type: 'hour', - count: 1, - text: '1h' - }, - { - type: 'hour', - count: 2, - text: '2h' - }, - { - type: 'hour', - count: 4, - text: '4h' - }, - { - type: 'hour', - count: 6, - text: '6h' - }, - { - type: 'hour', - count: 12, - text: '12h' - }, - { - type: 'all', - text: 'All' - } - ], - }, - navigator: { - enabled: true - }, - credits: { - enabled: false, - position: { - align: 'right', - x: -10, - verticalAlign: 'bottom', - y: -5 - }, - href: "https://highcharts.com", - text: "Highcharts" - }, - /////// + ////// + rangeSelector: { + enabled: true, + selected: 4, + allButtonsEnabled: true, + inputDateFormat: '%Y/%m/%d %H:%M', + inputEditDateFormat: '%Y/%m/%d %H:%M', + inputEnabled: false, + buttons: [{ + type: 'hour', + count: 1, + text: '1h' + }, + { + type: 'hour', + count: 2, + text: '2h' + }, + { + type: 'hour', + count: 4, + text: '4h' + }, + { + type: 'hour', + count: 6, + text: '6h' + }, + { + type: 'hour', + count: 12, + text: '12h' + }, + { + type: 'all', + text: 'All' + } + ], + }, + navigator: { + enabled: true + }, + credits: { + enabled: false, + position: { + align: 'right', + x: -10, + verticalAlign: 'bottom', + y: -5 + }, + href: "https://highcharts.com", + text: "Highcharts" + }, + /////// xAxis: { ordinal: false, labels: { @@ -127,12 +127,12 @@ export default Ember.Controller.extend({ legend: { enabled: true, itemStyle: - { + { color: "#000" - }, + }, }, tooltip: { - formatter: function() { + 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"; }, @@ -145,7 +145,7 @@ export default Ember.Controller.extend({ series: [{ color: "#15BD27", name: "3 hours average hashrate", - data: function() { + data: function () { var e, a = []; if (null != t) { for (e = 0; e <= t.length - 1; e += 1) { @@ -163,9 +163,9 @@ export default Ember.Controller.extend({ } } else { a.push({ - x: 0, - d: 0, - y: 0 + x: 0, + d: 0, + y: 0 }); } return a; @@ -173,7 +173,7 @@ export default Ember.Controller.extend({ }, { name: "30 minutes average hashrate", color: "#E99002", - data: function() { + data: function () { var e, a = []; if (null != t) { for (e = 0; e <= t.length - 1; e += 1) { @@ -198,14 +198,14 @@ export default Ember.Controller.extend({ } return a; }() - + }] }; return a; } }), - - shareChart: Ember.computed("model.hashrate", { + + shareChart: Ember.computed("model.hashrate", { get() { var e = this, t = e.getWithDefault("model.shareCharts"), @@ -215,21 +215,21 @@ export default Ember.Controller.extend({ type: "column", marginRight: 10, height: 180 - // events: { - /* load: function() { - var series = this.series[0]; - setInterval(function() { - var x = (new Date()).getTime(), - y = e.getWithDefault("model.workersOnline") / 1000000; - series.addPoint([x, y], true, true); - }, 1090000000); - } */ - // } + // events: { + /* load: function() { + var series = this.series[0]; + setInterval(function() { + var x = (new Date()).getTime(), + y = e.getWithDefault("model.workersOnline") / 1000000; + series.addPoint([x, y], true, true); + }, 1090000000); + } */ + // } }, title: { text: "" }, - xAxis: { + xAxis: { ordinal: false, labels: { style: { @@ -248,16 +248,16 @@ export default Ember.Controller.extend({ year: "%Y" } }, - //rangeSelector: { - // selected: 1, - // }, + //rangeSelector: { + // selected: 1, + // }, yAxis: { title: { text: "Shares", style: { color: "#000" }, - }, + }, labels: { style: { color: "#000" @@ -267,20 +267,20 @@ export default Ember.Controller.extend({ //softMax: e.getWithDefault("model.currentHashrate") / 1000000, }, plotOptions: { - series: { - marginleft: 0, - pointWidth: 10 - // marker: { - // enabled: false - // } + series: { + marginleft: 0, + pointWidth: 10 + // marker: { + // enabled: false + // } }, - column: { + column: { stacking: 'normal', grouping: false //shadow: false //borderWidth: 0 - } - }, + } + }, plotLines: [{ value: 0, width: 1, @@ -289,25 +289,25 @@ export default Ember.Controller.extend({ legend: { enabled: true, itemStyle: - { + { color: "#000" - }, + }, }, tooltip: { - formatter: function() { + formatter: function () { return this.y > 1000000000000 ? "" + this.point.d + "
Shares " + (this.y / 1000000000000) + "
" : this.y > 1000000000 ? "" + this.point.d + "
Shares " + (this.y / 1000000000) + "
" : this.y > 1000000 ? "" + this.point.d + "
Shares " + (this.y / 1000000) + "
" : "" + this.point.d + "
Shares " + this.y + ""; }, useHTML: true }, - exporting: { - enabled: false - }, + exporting: { + enabled: false + }, series: [{ color: "#15BD27", name: "Valid share", - data: function() { + data: function () { var e, a = []; if (null != t) { for (e = 0; e <= t.length - 1; e += 1) { @@ -325,19 +325,19 @@ export default Ember.Controller.extend({ } } else { a.push({ - x: 0, - d: 0, - y: 0 + x: 0, + d: 0, + y: 0 }); } return a; }() - + }, { - + name: "Stale share", color: "#E99002", - data: function() { + data: function () { var e, a = []; if (null != t) { for (e = 0; e <= t.length - 1; e += 1) { @@ -362,45 +362,76 @@ export default Ember.Controller.extend({ } return a; }() - - /* }, { - - name: "Workers", - color: "#FF0000", - type: 'spline', - plotLines: [{ - // value: 0, - width: 1, - color: "#aaaaaa" - }], - 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].workerOnline; - a.push({ - x: r, - d: l, - y: n - }); - } - } else { - a.push({ - x: 0, - d: 0, - y: 0 - }); - } - return a; - }() */ + + /* }, { + + name: "Workers", + color: "#FF0000", + type: 'spline', + plotLines: [{ + // value: 0, + width: 1, + color: "#aaaaaa" + }], + 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].workerOnline; + a.push({ + x: r, + d: l, + y: n + }); + } + } else { + a.push({ + x: 0, + d: 0, + y: 0 + }); + } + return a; + }() */ }] }; return a; } - }) -}); \ No newline at end of file + }), + earnPerHour: Ember.computed('model', { + get() { + return 1 * 60 * 60 / this.get('config').BlockTime * this.get('config').BlockReward * + this.getWithDefault('model.hashrate') / this.get('hashrate'); + } + }), + earnPerHour12: Ember.computed('model', { + get() { + return 12 * 60 * 60 / this.get('config').BlockTime * this.get('config').BlockReward * + this.getWithDefault('model.hashrate') / this.get('hashrate'); + } + }), + earnPerDay: Ember.computed('model', { + get() { + return 24 * 60 * 60 / this.get('config').BlockTime * this.get('config').BlockReward * + this.getWithDefault('model.hashrate') / this.get('hashrate'); + } + }), + earnPerWeek: Ember.computed('model', { + get() { + return 168 * 60 * 60 / this.get('config').BlockTime * this.get('config').BlockReward * + this.getWithDefault('model.hashrate') / this.get('hashrate'); + } + }), + earnPerMonth: Ember.computed('model', { + get() { + return 672 * 60 * 60 / this.get('config').BlockTime * this.get('config').BlockReward * + this.getWithDefault('model.hashrate') / this.get('hashrate'); + } + }), + +}); \ No newline at end of file diff --git a/www/app/templates/account/index.hbs b/www/app/templates/account/index.hbs index 0957828..9fa69ba 100644 --- a/www/app/templates/account/index.hbs +++ b/www/app/templates/account/index.hbs @@ -1,6 +1,36 @@
{{high-charts mode=chartMode chartOptions=chartOptions content=chartData}} {{high-charts mode=chartMode chartOptions=shareChart content=chartData}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TimeAmount
Last 60 minutes{{format-number earnPerHour maximumFractionDigits='8'}}
Last 12 hours{{format-number earnPerHour12 maximumFractionDigits='8'}}
Last 24 hours{{format-number earnPerDay maximumFractionDigits='8'}}
Last 7 days{{format-number earnPerWeek maximumFractionDigits='8'}}
Last 30 days{{format-number earnPerMonth maximumFractionDigits='8'}}
{{#if model.workers}}

Your Workers