Browse Source

rename a bunch of things.

main
Robey 5 years ago
parent
commit
582db838b7
  1. 1
      .gitignore
  2. 4
      fix-dygraphs.sh
  3. 5
      package.json
  4. 39
      site/demo.html
  5. 19
      site/index.html
  6. 16
      site/netgraph.css
  7. 14
      webpack.config.js

1
.gitignore

@ -1,3 +1,4 @@
/lib/
/node_modules/
/site/netgraph.js
/site/dygraph.min.js

4
fix-dygraphs.sh

@ -0,0 +1,4 @@
#!/bin/sh
# copy dygraph.min.js into site, and add one line that fixes an ES6 import bug.
cat node_modules/dygraphs/dist/dygraph.min.js | awk -e '/^\/\/\#/ { print "Dygraph.default = Dygraph;" } { print }' > site/dygraph.min.js

5
package.json

@ -29,11 +29,10 @@
"webpack": "^3.5.5"
},
"scripts": {
"build": "npm run webpack",
"clean": "rm -rf lib site/lib",
"build": "npm run webpack && ./fix-dygraphs.sh",
"clean": "rm -rf lib site/netgraph.js",
"distclean": "npm run clean && rm -rf node_modules npm-debug.log",
"prepublish": "npm run build",
"push": "npm run webpack && rsync -avP site/ farnsworth.local:/web/collectd/",
"test": "tsc && mocha -R spec --colors --recursive lib/test",
"webpack": "webpack --display-error-details"
}

39
site/demo.html

@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<title> netgraph demo </title>
<script src="dygraph.min.js"></script>
<script src="netgraph.js"></script>
<style type="text/css">
.netgraph-group {
display: flex;
flex-direction: row;
margin-top: 1em;
margin-bottom: 1em;
width: 100%;
height: 15em;
}
.netgraph {
display: flex;
flex: 1 1 auto;
width: 100%;
margin-left: 1em;
margin-right: 1em;
}
</style>
<rrd name="ping" path="collectd/ping/ping-8.8.8.8.rrd" data="value:AVERAGE"></rrd>
<rrd name="ping-max" path="collectd/ping/ping-8.8.8.8.rrd" data="value:MAX"></rrd>
<rrd name="dropped" path="collectd/ping/ping_droprate-8.8.8.8.rrd" data="value:MAX"></rrd>
</head>
<body>
<h3> Latency to 8.8.8.8 </h3>
<div class="netgraph-group" line="ping, ping-max" error="dropped" error-threshold="0.5" unit="ms" colors="blue, red">
<div class="netgraph" timespan="hour"></div>
<div class="netgraph" timespan="day"></div>
<div class="netgraph" timespan="week"></div>
</div>
</body>
</html>

19
site/index.html

@ -1,19 +0,0 @@
<!doctype html>
<html>
<head>
<script src="netgraph.js"></script>
<link rel="stylesheet" type="text/css" href="netgraph.css"></link>
<rrd name="ping" path="data/ping/ping-8.8.8.8.rrd" data="value:AVERAGE"></rrd>
<rrd name="ping-max" path="data/ping/ping-8.8.8.8.rrd" data="value:MAX"></rrd>
<rrd name="dropped" path="data/ping/ping_droprate-8.8.8.8.rrd" data="value:MAX"></rrd>
</head>
<body>
<h3> Latency to 8.8.8.8 </h3>
<div class="graph-row" line="ping, ping-max" error="dropped" error-threshold="0.5" unit="ms" colors="red, orange">
<div class="graph" timespan="hour"></div>
<div class="graph" timespan="day"></div>
<div class="graph" timespan="week"></div>
</div>
</body>
</html>

16
site/netgraph.css

@ -1,16 +0,0 @@
.graph-row {
display: flex;
flex-direction: row;
margin-top: 1em;
margin-bottom: 1em;
width: 100%;
height: 15em;
}
.graph {
display: flex;
flex: 1 1 auto;
width: 100%;
margin-left: 1em;
margin-right: 1em;
}

14
webpack.config.js

@ -5,25 +5,19 @@ module.exports = {
filename: "netgraph.js",
library: "netgraph"
},
// skip these node-only modules.
externals: [
{ "fs": "null" }
// { "aws-sdk": "null" },
// allow dygraph to be installed separately
{ "dygraphs": "Dygraph" }
],
node: {
Buffer: false
},
resolve: {
extensions: [ ".ts", ".js", ".handlebars" ],
alias: {
"handlebars": "handlebars/dist/handlebars.js"
}
extensions: [ ".ts", ".js" ]
},
module: {
loaders: [
{ test: /.json$/, loader: "json-loader" },
{ test: /\.ts$/, loader: "ts-loader" },
{ test: /\.handlebars$/, loader: "handlebars-loader" }
{ test: /\.ts$/, loader: "ts-loader" }
]
}
};

Loading…
Cancel
Save