Skip to content

Commit dd53710

Browse files
Merge branch 'release/0.8.0'
2 parents c11d4c7 + 059fda0 commit dd53710

File tree

146 files changed

+19255
-5122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+19255
-5122
lines changed

CONTRIBUTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
**Table of Contents**
4+
5+
- [Contributing to cgm-remote-monitor](#contributing-to-cgm-remote-monitor)
6+
- [Design](#design)
7+
- [Develop on `dev`](#develop-on-dev)
8+
- [Style Guide](#style-guide)
9+
- [Create a prototype](#create-a-prototype)
10+
- [Submit a pull request](#submit-a-pull-request)
11+
- [Comments and issues](#comments-and-issues)
12+
- [Co-ordination](#co-ordination)
13+
- [Other Dev Tips](#other-dev-tips)
14+
15+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
16+
117

218
# Contributing to cgm-remote-monitor
319

@@ -30,6 +46,24 @@ design.
3046
We develop on the `dev` branch.
3147
You can get the dev branch checked out using `git checkout dev`.
3248

49+
## Style Guide
50+
51+
Some simple rules, that will make it easier to maintain our codebase:
52+
53+
* All indenting should use 2 space where possible (js, css, html, etc)
54+
* A space before function parameters, such as: `function boom (name, callback) { }`, this makes searching for calls easier
55+
* Name your callback functions, such as `boom('the name', function afterBoom ( result ) { }`
56+
* Don't include author names in the header of your files, if you need to give credit to someone else do it in the commit comment.
57+
* Use the comma first style, for example:
58+
59+
```javascript
60+
var data = {
61+
value: 'the value'
62+
, detail: 'the details...'
63+
, time: Date.now()
64+
};
65+
```
66+
3367
## Create a prototype
3468

3569
Fork cgm-remote-monitor and create a branch.
@@ -77,3 +111,13 @@ the version correctly. See sem-ver for versioning strategy.
77111
Every commit is tested by travis. We encourage adding tests to
78112
validate your design. We encourage discussing your use cases to help
79113
everyone get a better understanding of your design.
114+
115+
## Other Dev Tips
116+
117+
* Join the [Gitter chat][gitter-url]
118+
* Get a local dev environment setup if you haven't already
119+
* Try breaking up big features/improvements into small parts. It's much easier to accept small PR's
120+
* Create tests for your new code, and for the old code too. We are aiming for a full test coverage.
121+
* If your going to be working in old code that needs lots of reformatting consider doing the clean as a separate PR.
122+
* If you can find others to help test your PR is will help get them merged in sooner.
123+

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ MONGO_CONNECTION?=mongodb://localhost/test_db
55
CUSTOMCONNSTR_mongo_settings_collection?=test_settings
66
CUSTOMCONNSTR_mongo_collection?=test_sgvs
77
MONGO_SETTINGS=MONGO_CONNECTION=${MONGO_CONNECTION} \
8-
CUSTOMCONNSTR_mongo_collection=${CUSTOMCONNSTR_mongo_collection} \
9-
CUSTOMCONNSTR_mongo_settings_collection=${CUSTOMCONNSTR_mongo_settings_collection}
8+
CUSTOMCONNSTR_mongo_collection=${CUSTOMCONNSTR_mongo_collection}
109

1110
# XXX.bewest: Mocha is an odd process, and since things are being
1211
# wrapped and transformed, this odd path needs to be used, not the
@@ -23,6 +22,7 @@ MOCHA=./node_modules/mocha/bin/_mocha
2322
# Pinned from dependency list.
2423
ISTANBUL=./node_modules/.bin/istanbul
2524
ANALYZED=./coverage/lcov.info
25+
export CODACY_REPO_TOKEN=e29ae5cf671f4f918912d9864316207c
2626

2727
all: test
2828

@@ -34,6 +34,12 @@ report:
3434
test -f ${ANALYZED} && \
3535
(npm install coveralls && cat ${ANALYZED} | \
3636
./node_modules/.bin/coveralls) || echo "NO COVERAGE"
37+
test -f ${ANALYZED} && \
38+
(npm install codecov.io && cat ${ANALYZED} | \
39+
./node_modules/codecov.io/bin/codecov.io.js) || echo "NO COVERAGE"
40+
test -f ${ANALYZED} && \
41+
(npm install codacy-coverage && cat ${ANALYZED} | \
42+
YOURPACKAGE_COVERAGE=1 ./node_modules/codacy-coverage/bin/codacy-coverage.js) || echo "NO COVERAGE"
3743

3844
test:
3945
${MONGO_SETTINGS} ${MOCHA} -R tap ${TESTS}

README.md

Lines changed: 192 additions & 24 deletions
Large diffs are not rendered by default.

Release.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

app.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,18 @@ function create (env, ctx) {
55
///////////////////////////////////////////////////
66
// api and json object variables
77
///////////////////////////////////////////////////
8-
var api = require('./lib/api/')(env, ctx.entries, ctx.settings, ctx.treatments, ctx.profiles, ctx.devicestatus);
9-
var pebble = ctx.pebble;
8+
var api = require('./lib/api/')(env, ctx);
109

1110
var app = express();
12-
app.entries = ctx.entries;
13-
app.treatments = ctx.treatments;
14-
app.profiles = ctx.profiles;
15-
app.devicestatus = ctx.devicestatus;
1611
var appInfo = env.name + ' ' + env.version;
1712
app.set('title', appInfo);
1813
app.enable('trust proxy'); // Allows req.secure test on heroku https connections.
1914

20-
app.use(compression({filter: shouldCompress}));
21-
22-
function shouldCompress(req, res) {
23-
//TODO: return false here if we find a condition where we don't want to compress
24-
// fallback to standard filter function
25-
return compression.filter(req, res);
26-
}
15+
app.use(compression({filter: function shouldCompress(req, res) {
16+
//TODO: return false here if we find a condition where we don't want to compress
17+
// fallback to standard filter function
18+
return compression.filter(req, res);
19+
}}));
2720

2821
//if (env.api_secret) {
2922
// console.log("API_SECRET", env.api_secret);
@@ -32,7 +25,12 @@ function create (env, ctx) {
3225

3326

3427
// pebble data
35-
app.get('/pebble', pebble(ctx.entries, ctx.treatments, ctx.profiles, ctx.devicestatus, env));
28+
app.get('/pebble', ctx.pebble);
29+
30+
// expose swagger.yaml
31+
app.get('/swagger.yaml', function (req, res) {
32+
res.sendFile(__dirname + '/swagger.yaml');
33+
});
3634

3735
//app.get('/package.json', software);
3836

@@ -46,8 +44,6 @@ function create (env, ctx) {
4644
var bundle = require('./bundle')();
4745
app.use(bundle);
4846

49-
// Handle errors with express's errorhandler, to display more readable error messages.
50-
5147
// Handle errors with express's errorhandler, to display more readable error messages.
5248
var errorhandler = require('errorhandler');
5349
//if (process.env.NODE_ENV === 'development') {

app.json

Lines changed: 109 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,27 @@
88
"required": true
99
},
1010
"API_SECRET": {
11-
"description": "REQUIRED: User generated password used for REST API and optional features (12 character minimum).",
11+
"description": "REQUIRED: A secret passphrase that must be at least 12 characters long, required to enable POST and PUT; also required for the Care Portal",
1212
"value": "",
1313
"required": true
1414
},
1515
"DISPLAY_UNITS": {
16-
"description": "Server display units for BG values. Default null value implies 'mg/dl'. Set to 'mmol' to change the server to mmol mode.",
16+
"description": "Choices: mg/dl and mmol. Setting to mmol puts the entire server into mmol mode by default, no further settings needed.",
1717
"value": "",
1818
"required": false
1919
},
2020
"ENABLE": {
21-
"description": "Space delimited list of optional features to enable, such as 'careportal'.",
21+
"description": "Used to enable optional features, expects a space delimited list, such as: careportal rawbg iob, see https://github.com/nightscout/cgm-remote-monitor/blob/master/README.md for more info",
22+
"value": "",
23+
"required": false
24+
},
25+
"DISABLE": {
26+
"description": "Used to disable default features, expects a space delimited list, such as: direction upbat, see https://github.com/nightscout/cgm-remote-monitor/blob/master/README.md for more info",
2227
"value": "",
2328
"required": false
2429
},
2530
"ALARM_TYPES": {
26-
"description": "Nightscout alarm behavior control. Default null value implies 'predict'. For adjustable alarm thresholds (set below), set to 'simple'.",
31+
"description": "Alarm behavior currently 2 alarm types are supported simple and predict, and can be used independently or combined. The simple alarm type only compares the current BG to BG_ thresholds above, the predict alarm type uses highly tuned formula that forecasts where the BG is going based on it's trend. predict DOES NOT currently use any of the BG_* ENV's",
2732
"value": "",
2833
"required": false
2934
},
@@ -56,6 +61,106 @@
5661
"description": "Pushover user key, required for Pushover notifications. Leave blank if not using Pushover.",
5762
"value": "",
5863
"required": false
64+
},
65+
"PUSHOVER_ANNOUNCEMENT_KEY": {
66+
"description": "An optional Pushover user/group key, will be used for system wide user generated announcements. If not defined this will fallback to `PUSHOVER_USER_KEY`. A possible use for this is sending important messages and alarms to a CWD that you don't want to send all notification too. This also support a space delimited list of keys. Leave blank if not using Pushover",
67+
"value": "",
68+
"required": false
69+
},
70+
"CUSTOM_TITLE": {
71+
"description": "Customize the name of the website, usually the name of T1.",
72+
"value": "",
73+
"required": false
74+
},
75+
"THEME": {
76+
"description": "Possible values default or colors",
77+
"value": "",
78+
"required": false
79+
},
80+
"SHOW_RAWBG": {
81+
"description": "Possible values always, never or noise",
82+
"value": "",
83+
"required": false
84+
},
85+
"BRIDGE_USER_NAME": {
86+
"description": "Share bridge - Your user name for the Share service. ENSURE bridge is in ENABLE if you want to use the share bridge",
87+
"value": "",
88+
"required": false
89+
},
90+
"BRIDGE_PASSWORD": {
91+
"description": "Share bridge - Your password for the Share service. ENSURE bridge is in ENABLE if you want to use the share bridge",
92+
"value": "",
93+
"required": false
94+
},
95+
"TIME_FORMAT": {
96+
"description": "Browser default time mode valid settings are 12 or 24",
97+
"value": "12",
98+
"required": false
99+
},
100+
"NIGHT_MODE": {
101+
"description": "Browser defaults to night mode valid settings are on or off",
102+
"value": "off",
103+
"required": false
104+
},
105+
"SHOW_RAWBG": {
106+
"description": "Browser default raw display mode vaild settings are always never or noise",
107+
"value": "never",
108+
"required": false
109+
},
110+
"THEME": {
111+
"description": "Browser default theme setting vaild settings are default or colors",
112+
"value": "default",
113+
"required": false
114+
},
115+
"ALARM_URGENT_HIGH": {
116+
"description": "Browser default urgent high alarm enabled vaild settings are on or off",
117+
"value": "on",
118+
"required": false
119+
},
120+
"ALARM_HIGH": {
121+
"description": "Browser default high alarm enabled vaild settings are on or off",
122+
"value": "on",
123+
"required": false
124+
},
125+
"ALARM_LOW": {
126+
"description": "Browser default low alarm enabled vaild settings are on or off",
127+
"value": "on",
128+
"required": false
129+
},
130+
"ALARM_URGENT_LOW": {
131+
"description": "Browser default urgent low alarm enabled vaild settings are on or off",
132+
"value": "on",
133+
"required": false
134+
},
135+
"ALARM_TIMEAGO_WARN": {
136+
"description": "Browser default warn after time of last data exceeds ALARM_TIMEAGO_WARN_MINS alarm enabled vaild settings are on or off",
137+
"value": "on",
138+
"required": false
139+
},
140+
"ALARM_TIMEAGO_WARN_MINS": {
141+
"description": "Browser default minutes since the last reading to trigger a warning",
142+
"value": "15",
143+
"required": false
144+
},
145+
"ALARM_TIMEAGO_URGENT": {
146+
"description": "Browser default urgent warning after time of last data exceeds ALARM_TIMEAGO_URGENT_MINS alarm enabled vaild settings are on or off",
147+
"value": "on",
148+
"required": false
149+
},
150+
"ALARM_TIMEAGO_URGENT_MINS": {
151+
"description": "Browser default minutes since last reading to trigger an urgent alarm",
152+
"value": "30",
153+
"required": false
154+
},
155+
"MAKER_KEY": {
156+
"description": "Maker Key - Set this to your secret key Note for additional info see https://github.com/nightscout/cgm-remote-monitor/blob/dev/README.md#ifttt-maker , maker should be added to enable if you want to use maker, Leave blank if not using maker",
157+
"value": "",
158+
"required": false
159+
},
160+
"MAKER_ANNOUNCEMENT_KEY": {
161+
"description": "Maker Announcement Key - Set this to your secret key for announcements Note for additional info see https://github.com/nightscout/cgm-remote-monitor/blob/dev/README.md#ifttt-maker , maker should be added to enable if you want to use maker Leave blank if not using maker",
162+
"value": "",
163+
"required": false
59164
}
60165
},
61166
"addons": [

bin/post-sgv.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
# "date": "1413782506964"
3+
4+
curl -H "Content-Type: application/json" -H "api-secret: $API_SECRET" -XPOST 'http://localhost:1337/api/v1/entries/' -d '{
5+
"sgv": 100,
6+
"type": "sgv",
7+
"direction": "Flat",
8+
"date": "1415950912800"
9+
}'

bower.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "nightscout",
3-
"version": "0.7.0",
3+
"version": "0.8.0",
44
"dependencies": {
55
"angularjs": "1.3.0-beta.19",
66
"bootstrap": "~3.2.0",
7-
"d3": "3.4.3",
87
"jquery": "2.1.0",
98
"jQuery-Storage-API": "~1.7.2",
109
"tipsy-jmalonzo": "~1.0.1",
11-
"jsSHA": "~1.5.0"
10+
"jquery-ui": "~1.11.3",
11+
"swagger-ui": "~2.1.2"
1212
},
1313
"resolutions": {
1414
"jquery": "2.1.0"

bundle/bundle.source.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
(function () {
22

3-
window.Nightscout = window.Nightscout || {};
3+
window._ = require('lodash');
4+
window.$ = window.jQuery = require('jquery');
5+
window.moment = require('moment-timezone');
6+
window.Nightscout = window.Nightscout || {};
47

5-
window.Nightscout = {
6-
iob: require('../lib/iob')()
7-
, units: require('../lib/units')()
8-
};
8+
window.Nightscout = {
9+
client: require('../lib/client')
10+
, plugins: require('../lib/plugins/')().registerClientDefaults()
11+
};
912

10-
console.info("Nightscout bundle ready", window.Nightscout);
13+
console.info('Nightscout bundle ready');
1114

1215
})();
1316

0 commit comments

Comments
 (0)