22
Gruntfile.js
@ -1,12 +1,12 @@
|
||||
var src = 'public/';
|
||||
var src = 'src/';
|
||||
var dest = 'dist/';
|
||||
|
||||
var scripts = [
|
||||
'public/js/app.js',
|
||||
'public/js/controllers.js',
|
||||
'public/js/filters.js',
|
||||
'public/js/directives.js',
|
||||
'public/js/script.js'
|
||||
'src/js/app.js',
|
||||
'src/js/controllers.js',
|
||||
'src/js/filters.js',
|
||||
'src/js/directives.js',
|
||||
'src/js/script.js'
|
||||
];
|
||||
|
||||
var vendor = [
|
||||
@ -49,7 +49,7 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
files: {
|
||||
'dist/index.html': 'views/index.jade'
|
||||
'dist/index.html': 'src/views/index.jade'
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -58,28 +58,28 @@ module.exports = function(grunt) {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'public/fonts/',
|
||||
cwd: 'src/fonts/',
|
||||
src: ['minimal-*.*'],
|
||||
dest: 'dist/fonts/',
|
||||
filter: 'isFile'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'public/images/',
|
||||
cwd: 'src/images/',
|
||||
src: ['*.ico'],
|
||||
dest: 'dist/',
|
||||
filter: 'isFile'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'public/css/',
|
||||
cwd: 'src/css/',
|
||||
src: styles,
|
||||
dest: 'dist/css/',
|
||||
filter: 'isFile'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'public/js/lib/',
|
||||
cwd: 'src/js/lib/',
|
||||
src: ['*.*'],
|
||||
dest: 'dist/js/lib'
|
||||
}
|
||||
|
3
app.js
@ -19,11 +19,10 @@ if( process.env.NODE_ENV !== 'production' )
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
var path = require('path');
|
||||
var favicon = require('serve-favicon');
|
||||
var bodyParser = require('body-parser');
|
||||
|
||||
// view engine setup
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('views', path.join(__dirname, 'src/views'));
|
||||
app.set('view engine', 'jade');
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
|
2
dist/index.html
vendored
2
dist/js/netstats.min.js
vendored
2
dist/js/netstats.min.js.map
vendored
@ -21,7 +21,6 @@
|
||||
"primus": "3.0.2",
|
||||
"primus-emit": "0.1.2",
|
||||
"primus-spark-latency": "0.1.1",
|
||||
"serve-favicon": "2.2.1",
|
||||
"ws": "0.7.2"
|
||||
},
|
||||
"repository": {
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 574 B After Width: | Height: | Size: 574 B |
Before Width: | Height: | Size: 574 B After Width: | Height: | Size: 574 B |
Before Width: | Height: | Size: 442 KiB After Width: | Height: | Size: 442 KiB |
Before Width: | Height: | Size: 722 KiB After Width: | Height: | Size: 722 KiB |
Before Width: | Height: | Size: 881 KiB After Width: | Height: | Size: 881 KiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
@ -50,6 +50,46 @@ angular.module('netStatsApp.directives', [])
|
||||
// };
|
||||
// }])
|
||||
|
||||
.directive('minerblock', function ($compile) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: '<div></div>',
|
||||
replace: true,
|
||||
link: function (scope, element, attrs)
|
||||
{
|
||||
var makeClass = function (value)
|
||||
{
|
||||
if(value <= 6)
|
||||
return 'success';
|
||||
|
||||
if(value <= 12)
|
||||
return 'info';
|
||||
|
||||
if(value <= 18)
|
||||
return 'warning';
|
||||
|
||||
if(value <= 24)
|
||||
return 'orange';
|
||||
|
||||
return 'danger';
|
||||
}
|
||||
|
||||
attrs.$observe("blocks", function (newValue)
|
||||
{
|
||||
var content = '';
|
||||
var blockClass = 'bg-' + makeClass(newValue);
|
||||
|
||||
for(var i = 0; i < newValue; i++)
|
||||
{
|
||||
content += '<div class="block ' + blockClass + '"></div>';
|
||||
}
|
||||
|
||||
element.empty();
|
||||
element.html(content);
|
||||
});
|
||||
}
|
||||
};
|
||||
})
|
||||
.directive('sparkchart', function () {
|
||||
return {
|
||||
restrict: 'E',
|
@ -542,15 +542,17 @@ angular.module('netStatsApp.filters', [])
|
||||
};
|
||||
});
|
||||
|
||||
function compareVersions(v1, comparator, v2) {
|
||||
"use strict";
|
||||
console.log(v1, comparator, v2);
|
||||
function compareVersions(v1, comparator, v2)
|
||||
{
|
||||
comparator = comparator == '=' ? '==' : comparator;
|
||||
|
||||
var v1parts = v1.split('.'), v2parts = v2.split('.');
|
||||
var maxLen = Math.max(v1parts.length, v2parts.length);
|
||||
var part1, part2;
|
||||
var cmp = 0;
|
||||
for(var i = 0; i < maxLen && !cmp; i++) {
|
||||
|
||||
for(var i = 0; i < maxLen && !cmp; i++)
|
||||
{
|
||||
part1 = parseInt(v1parts[i], 10) || 0;
|
||||
part2 = parseInt(v2parts[i], 10) || 0;
|
||||
if(part1 < part2)
|
||||
@ -558,6 +560,7 @@ function compareVersions(v1, comparator, v2) {
|
||||
if(part1 > part2)
|
||||
cmp = -1;
|
||||
}
|
||||
|
||||
return eval('0' + comparator + cmp);
|
||||
}
|
||||
|
0
public/js/lib/d3.js → src/js/lib/d3.js
vendored
@ -113,10 +113,10 @@ block content
|
||||
div.col-xs-3.stat-holder.pull-right
|
||||
div.big-info.chart.double-chart
|
||||
span.small-title last blocks miners
|
||||
div.blocks-holder(ng-repeat='miner in miners', data-toggle="tooltip", data-placement="right", title="{{miner.blocks}}")
|
||||
div.blocks-holder(ng-repeat='miner in miners track by miner.miner', data-toggle="tooltip", data-placement="right", data-original-title="{{miner.blocks}}")
|
||||
div.block-count(class="{{miner.blocks | minerBlocksClass : 'text-'}}") {{miner.blocks}}
|
||||
div.small-title-miner {{miner.miner | minerNameFilter : miner.name}}
|
||||
div.block(ng-repeat="i in getNumber(miner.blocks) track by $index", class="{{miner.blocks | minerBlocksClass}}")
|
||||
minerblock(blocks="{{miner.blocks}}")
|
||||
div.clearfix
|
||||
|
||||
div.col-xs-3.stat-holder
|
||||
@ -167,7 +167,7 @@ block content
|
||||
i.icon-network(data-toggle="tooltip", data-placement="top", title="Pending transactions", ng-click="orderTable(['-stats.pending'], false)")
|
||||
th
|
||||
i.icon-block(data-toggle="tooltip", data-placement="top", title="Last block", ng-click="orderTable(['-stats.block.number', 'stats.block.propagation'], false)")
|
||||
th.th-blockhash
|
||||
th.th-blockhash
|
||||
th.th-blockhash
|
||||
i.icon-difficulty(data-toggle="tooltip", data-placement="top", title="Total difficulty", ng-click="orderTable(['-stats.block.totalDifficulty'], false)")
|
||||
th
|
||||
@ -189,7 +189,7 @@ block content
|
||||
i(ng-click="node.pinned = !node.pinned", class="{{ node.pinned | nodePinClass }}", data-toggle="tooltip", data-placement="right", data-original-title="Click to {{ node.pinned ? 'un' : '' }}pin")
|
||||
td.nodeInfo(rel="{{node.id}}")
|
||||
span.small(data-toggle="tooltip", data-placement="top", data-html="true", data-original-title="{{node | geoTooltip}}") {{node.info.name}}
|
||||
span.small ({{node.info.ip}})
|
||||
span.small ({{node.info.ip}})
|
||||
a.small(href="https://github.com/ethereum/wiki/wiki/Network-Status#updating", target="_blank", data-toggle="tooltip", data-placement="top", data-html="true", data-original-title="Netstats client needs update.<br>Click this icon for instructions.", class="{{ node.info | nodeClientClass : currentApiVersion }}")
|
||||
i.icon-warning-o
|
||||
td
|