+
Overview
-
{{ title }}
-
{{#if connected}}Connected{{else}}Disconnected{{/if}}
+
+ - Hashrate:
+ - {{hashrate avgHashrate}}
+
+
+ - Hardware Errors:
+ - {{number hardwareErrors}}
+ - Hardware Error Rate:
+ - {{number hardwareErrorRate precision="2"}}%
+ - Uptime:
+ - {{timespan elapsed}}
+ - Software:
+ - {{description}}
+
+
+ - Accepted Shares:
+ - {{number shares.accepted}}
+ - Rejected Shares:
+ - {{number shares.rejected}}
+ - Stale Shares:
+ - {{number shares.stale}}
+ - Discarded Shares:
+ - {{number shares.discarded}}
+
+
+ - Difficulty Accepted:
+ - {{number difficulty.accepted precision="2"}}
+ - Difficulty Rejected:
+ - {{number difficulty.rejected precision="2"}}
+ - Difficulty Stale:
+ - {{number difficulty.stale precision="2"}}
+
-
- {{#if connected}}
-
-
Overview
-
-
- - Hashrate:
- - {{hashrate avgHashrate}}
-
-
- - Hardware Errors:
- - {{number hardwareErrors}}
- - Hardware Error Rate:
- - {{number hardwareErrorRate precision="2"}}%
- - Uptime:
- - {{timespan elapsed}}
- - Software:
- - {{description}}
-
-
- - Accepted Shares:
- - {{number shares.accepted}}
- - Rejected Shares:
- - {{number shares.rejected}}
- - Stale Shares:
- - {{number shares.stale}}
- - Discarded Shares:
- - {{number shares.discarded}}
-
-
- - Difficulty Accepted:
- - {{number difficulty.accepted precision="2"}}
- - Difficulty Rejected:
- - {{number difficulty.rejected precision="2"}}
- - Difficulty Stale:
- - {{number difficulty.stale precision="2"}}
-
+ {{#if pools}}
+
Pools
+
+
+
+ |
+ Priority |
+ Url |
+ Alive |
+ Active |
+ Last Share Submitted |
+
+ {{#each pools}}
+
+ Pool {{id}} |
+ {{priority}} |
+ {{url}} |
+ {{#if alive}}Yes{{else}}No{{/if}} |
+ {{#if active}}Yes{{else}}No{{/if}} |
+ {{#if lastShareTime}}{{time lastShareTime}}{{else}}Never{{/if}} |
+
+ {{/each}}
+
- {{#if pools}}
-
Pools
-
-
-
- |
- Priority |
- Url |
- Alive |
- Active |
- Last Share Submitted |
-
- {{#each pools}}
-
- Pool {{id}} |
- {{priority}} |
- {{url}} |
- {{#if alive}}Yes{{else}}No{{/if}} |
- {{#if active}}Yes{{else}}No{{/if}} |
- {{#if lastShareTime}}{{time lastShareTime}}{{else}}Never{{/if}} |
-
- {{/each}}
-
-
- {{/if}}
- {{#if devices}}
-
Devices
-
- {{#each devices}}
-
-
-
- Device {{id}} |
- {{description}} |
- {{hashrate avgHashrate}} |
- {{number hardwareErrorRate precision="2"}}% Hardware Error Rate |
-
-
-
- {{/each}}
-
- {{/if}}
-
-
- {{/if}}
-
\ No newline at end of file
+ {{/if}}
+ {{#if devices}}
+
Devices
+
+ {{#each devices}}
+
+
+
+ Device {{id}} |
+ {{description}} |
+ {{hashrate avgHashrate}} |
+ {{number hardwareErrorRate precision="2"}}% Hardware Error Rate |
+
+
+
+ {{/each}}
+
+ {{/if}}
+
+
+{{/if}}
\ No newline at end of file
diff --git a/templates/noData.hbs b/templates/noData.hbs
index 308418b..6bd2663 100644
--- a/templates/noData.hbs
+++ b/templates/noData.hbs
@@ -1,8 +1,6 @@
-
-
-
-
{{ title }}
-
No Data Yet.
-
-
-
\ No newline at end of file
+
+
+
{{ title }}
+
No Data Yet.
+
+
\ No newline at end of file
diff --git a/templates/revenue.hbs b/templates/revenue.hbs
index 6ace948..f17f477 100644
--- a/templates/revenue.hbs
+++ b/templates/revenue.hbs
@@ -1,12 +1,10 @@
-
-
-
- - Revenue:
- - {{number value}} {{currency}}/{{interval}}
-
-
-
\ No newline at end of file
+
+
+ - Revenue:
+ - {{number value}} {{currency}}/{{interval}}
+
+
\ No newline at end of file
diff --git a/templates/technical.hbs b/templates/technical.hbs
index e721bb8..f46e53f 100644
--- a/templates/technical.hbs
+++ b/templates/technical.hbs
@@ -1,28 +1,26 @@
-
-
-
-
- - Total Hashrate:
- - {{hashrate hash_rate}}
- - Difficulty:
- - {{number difficulty precision="2"}}
-
-
- - Blocks Mined:
- - {{number n_blocks_mined}}
- - Time between Blocks:
- - {{number minutes_between_blocks precision="2"}} Minutes
-
-
- - Number of Transactions:
- - {{number n_tx}}
- - Total Output Volume:
- - {{number total_btc_sent}} BTC
- - Estimated Transaction Volume:
- - {{number estimated_btc_sent precision="2"}} BTC
-
-
-
-
\ No newline at end of file
+
+
+
+ - Total Hashrate:
+ - {{hashrate hash_rate}}
+ - Difficulty:
+ - {{number difficulty precision="2"}}
+
+
+ - Blocks Mined:
+ - {{number n_blocks_mined}}
+ - Time between Blocks:
+ - {{number minutes_between_blocks precision="2"}} Minutes
+
+
+ - Number of Transactions:
+ - {{number n_tx}}
+ - Total Output Volume:
+ - {{number total_btc_sent}} BTC
+ - Estimated Transaction Volume:
+ - {{number estimated_btc_sent precision="2"}} BTC
+
+
+
\ No newline at end of file
diff --git a/test/specs/lib/App.js b/test/specs/lib/App.js
index ee937c3..b8d195c 100644
--- a/test/specs/lib/App.js
+++ b/test/specs/lib/App.js
@@ -42,6 +42,7 @@ describe('App', function () {
},
app;
+ module.id = moduleConfig.id;
constructorStub.prototype.viewId = 'json';
app = new App({
modules: [moduleConfig]
diff --git a/test/specs/lib/View.js b/test/specs/lib/View.js
index 0094f7f..bc5dd54 100644
--- a/test/specs/lib/View.js
+++ b/test/specs/lib/View.js
@@ -34,11 +34,50 @@ describe('View', function () {
view = new View(module);
expect(view.module).to.equal(module);
- expect(view.template).to.equal(jsonTemplate);
+ expect(view.compiledTemplate).to.equal(jsonTemplate);
expect(view.noDataTemplate).to.equal(noDataTemplate);
});
});
+ describe('className', function () {
+ var module,
+ view;
+
+ beforeEach(function () {
+ module = {
+ attributes: {},
+ has: sinon.stub(),
+ get: sinon.stub(),
+ viewId: 'someView'
+ };
+ view = new View(module);
+ });
+
+ it('should add panel-warning and noData classes when no data has been fetched yet', function () {
+ expect(view.className()).to.equal('panel panel-warning noData');
+ });
+
+ it('should add panel-success and viewId classes if there is no connection info for the module', function () {
+ module.attributes.foo = 'bar';
+ module.has.withArgs('connected').returns(false);
+ expect(view.className()).to.equal('panel panel-success someView');
+ });
+
+ it('should add panel-success and viewId classes if there is connection info and the connection is ok', function () {
+ module.attributes.foo = 'bar';
+ module.has.withArgs('connected').returns(true);
+ module.get.withArgs('connected').returns(true);
+ expect(view.className()).to.equal('panel panel-success someView');
+ });
+
+ it('should add panel-danger and viewId classes if there is connection info and the module is disconnected', function () {
+ module.attributes.foo = 'bar';
+ module.has.withArgs('connected').returns(true);
+ module.get.withArgs('connected').returns(false);
+ expect(view.className()).to.equal('panel panel-danger someView');
+ });
+ });
+
describe('renderViewWithoutData', function () {
it('should render the default no-data view', function () {
var module = {
@@ -66,16 +105,17 @@ describe('View', function () {
id: 'foo',
template: 'json',
title: 'bar',
- attributes: { some: 'json', data: 'of', the: 'module' }
+ attributes: { some: 'json', data: 'of', the: 'module' },
+ has: sinon.stub().returns(false)
},
view = new View(module);
- view.template = sinon.stub();
+ view.compiledTemplate = sinon.stub();
view.renderViewWithData();
- expect(view.template).to.have.been.calledOnce;
- expect(view.template).to.have.been.calledWithMatch({
+ expect(view.compiledTemplate).to.have.been.calledOnce;
+ expect(view.compiledTemplate).to.have.been.calledWithMatch({
id: module.id,
title: module.title,
json: JSON.stringify(module.attributes),