Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
ae4941b
Ignore built files
fractalic Feb 9, 2018
605d0dd
Add readme section
fractalic Feb 9, 2018
b857a90
Add notes to readme
fractalic Feb 9, 2018
5ec4ee8
Merge pull request #1 from fractalic/master
fractalic Feb 9, 2018
3fcd43f
Remove serviceWorker and set doc root
fractalic Feb 9, 2018
4c263ec
Remove accidentally added backup software files
fractalic Feb 10, 2018
b67f07d
Remove refs to global intervalid
fractalic Feb 10, 2018
c3dd9c6
Add jshint dev dep
fractalic Feb 10, 2018
82afbfa
Style consistency fixes
fractalic Feb 10, 2018
1a52130
Lift some state up from components to controller
fractalic Feb 11, 2018
38d4eec
Reactify wifi range
fractalic Feb 11, 2018
fa90660
Add state for wifi direct percentage
fractalic Feb 11, 2018
eeb3985
Add state for internet sharer percentage
fractalic Feb 11, 2018
ea23ce4
Change come conf file parameters
fractalic Feb 12, 2018
c83337c
Move configuration to a react function
fractalic Feb 12, 2018
0638b80
Move the rest of the UI to react
fractalic Feb 12, 2018
a66319a
Stable version 0.2.0
fractalic Feb 13, 2018
3280d0e
Update to alpha of next version
fractalic Feb 13, 2018
fed95ce
Move some code into its own files
fractalic Feb 13, 2018
0b64e7a
Fix rerunning bug
fractalic Feb 13, 2018
7d694eb
Eject react app
fractalic Feb 13, 2018
cfa7654
Add enzyme setup script
fractalic Feb 13, 2018
223c600
Move setup script for enzyme tests
fractalic Feb 13, 2018
6f6fb0c
Finally add a working ui test
fractalic Feb 13, 2018
2e45fd6
Add test class for Device
fractalic Feb 13, 2018
9de45d1
Test Radio class and fix a huge bug
fractalic Feb 13, 2018
af2ebf0
Add radio tests
fractalic Feb 13, 2018
07584b5
Add limited device tests
fractalic Feb 13, 2018
1f3d369
Standardize formatting
fractalic Feb 17, 2018
2425c53
Move call from pause to running
fractalic Feb 17, 2018
843e8f7
Adjust comment text
fractalic Feb 17, 2018
d91aba6
Add more tests of Device
fractalic Feb 18, 2018
f9b4107
Shorten some test result syntax
fractalic Feb 18, 2018
5d1a69b
Add a class for manipulating device groups
fractalic Feb 18, 2018
605e9fe
Add simple graph with tests
fractalic Feb 19, 2018
68ecf8f
Add doc to DeviceGraph.addDevice
fractalic Feb 19, 2018
e8f0608
Add more devicegraph tests, and get wallaby working
fractalic Feb 19, 2018
e56b235
Add function to remove a device
fractalic Feb 19, 2018
20de561
Add some spacing and test to add a link
fractalic Feb 19, 2018
6e60e98
Change include path
fractalic Feb 19, 2018
88367f2
Add EnergyLink file
fractalic Feb 19, 2018
8ef7a9a
Add graph linking; modularise
fractalic Feb 19, 2018
93cea4e
Add some linking logic
fractalic Feb 20, 2018
266fa37
Remove dead unlink code until I can fix it
fractalic Feb 20, 2018
8a031be
Add History class and test class
fractalic Feb 20, 2018
132b247
Add startEntry to history class
fractalic Feb 20, 2018
ff5debf
Add rudimentary builder pattern for history
fractalic Feb 20, 2018
d26b57d
Enable adding of new entries to history
fractalic Feb 20, 2018
532fb1f
Enable adding of stats to history entry
fractalic Feb 20, 2018
66f11dc
Add prng and fix up dependencies
fractalic Feb 20, 2018
200d117
Add seedable prng, and use it to generate graphs
fractalic Feb 20, 2018
5d1536f
Add multirun and stat averaging
fractalic Feb 20, 2018
40d1bdb
Change project name, and bump version
fractalic Feb 20, 2018
8c2a2bc
Remove zip file
fractalic Feb 20, 2018
e7b1825
Ignore zip files
fractalic Feb 20, 2018
1ab26f6
Add EOF newlines and brackets
fractalic Feb 27, 2018
9934df9
Remove trailing semicolon
fractalic Feb 27, 2018
2b2cba0
Add new line
fractalic Feb 27, 2018
206b3a7
Remove extra space
fractalic Feb 27, 2018
2848a06
Begin adding new test for Link feature
fractalic Feb 27, 2018
49a26a2
Rename link.contains to contains2
fractalic Feb 27, 2018
f467f4f
Check for containment of non-contained devices
fractalic Feb 27, 2018
62c0306
Pass noncontainment test
fractalic Feb 27, 2018
bc204cb
Add failing containment ordering test
fractalic Feb 27, 2018
f95069a
Pass containment order test
fractalic Feb 27, 2018
94aad5e
Make use of new link containment checking
fractalic Feb 27, 2018
b5485ec
Pass some link removal tests
fractalic Feb 27, 2018
c8fb068
Test removing nonexistent links has no side effect
fractalic Feb 27, 2018
1a45f9d
Make my link removal test simpler
fractalic Feb 27, 2018
d1b4669
Fix link removal bug
fractalic Feb 27, 2018
6bde57e
Fix bug in test of device removal
fractalic Feb 27, 2018
9709a39
Fix bug in removal of devices
fractalic Feb 27, 2018
b8b1396
Add test for link type hinting
fractalic Feb 27, 2018
0b389ad
Remove only devices with matched hint type
fractalic Feb 27, 2018
8b28dc8
Remove extra space
fractalic Feb 27, 2018
66c3922
Remove unneeded assertions
fractalic Feb 27, 2018
fc6764a
Make sure null link type matches everything
fractalic Feb 27, 2018
f2f1e99
Add prng seeding input, rework ui
fractalic May 6, 2018
54c9b07
Recolor some buttons
fractalic May 6, 2018
eae42b3
New version for new ui
fractalic May 6, 2018
5419a94
Disable buttons when sim is in a bad state
fractalic May 6, 2018
95d67bd
Unfucked react
fractalic May 7, 2018
7189563
Begin adding more graph tools
fractalic May 7, 2018
9a6de1a
Remove placeholder text
fractalic May 7, 2018
967a025
Add cool module plugin
fractalic May 7, 2018
113c901
MeshGrouper skeleton
fractalic May 7, 2018
2abc867
Added simple grouping functionality to Grouper
fractalic May 7, 2018
1af6af1
Add generic input field event handlers
fractalic May 8, 2018
74d8ba5
Add more inputs, without wiring them up yet
fractalic May 8, 2018
f6c6157
Send more params to sim
fractalic May 8, 2018
601ceda
Move stats to right column
fractalic May 8, 2018
f16ff35
Add ui elements for power levels
fractalic May 8, 2018
19a0138
Correct spelling of Guatemala
fractalic May 8, 2018
2611c55
Fix incorrect state var, uncomment code
fractalic May 9, 2018
b771f74
Add proper energy and bluetooth controls
fractalic May 9, 2018
a852422
Move to 0.4.0
fractalic May 9, 2018
d1f44c8
Merge pull request #2 from fractalic/master
fractalic May 9, 2018
618860e
Merge pull request #3 from RightMesh/dev
fractalic May 9, 2018
c08c420
Cleaned up Readme, updated
Sep 14, 2018
56ab819
Changed the commands to "code"
Sep 14, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{
"presets": ["env", "react"]
"presets": ["env", "react"],
"plugins": [
["module-resolver", {
"root": ["./src"],
"alias": {
"models": "./src/models",
"graphtools": "./src/models/graphtools"
}
}]
]
}
17 changes: 16 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,22 @@ env:
browser: true
es6: true
jquery: true
jest: true

rules:
no-unused-vars:
- off
- off
quotes:
- off
comma-dangle:
- off
padded-blocks:
- off
space-infix-ops:
- off
operator-linebreak:
- off
no-return-assign:
- off
camelcase:
- off
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
node_modules
package-lock.json
yarn.lock
build

# Build files
bundle.js
bundle.js
build.zip
2,445 changes: 12 additions & 2,433 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ meshdensitytool:
wifiDirect:
hotspotPercentage: 10
internet:
sharerPercentage: 7
sharerPercentage: 5
93 changes: 93 additions & 0 deletions config/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
'use strict';

const fs = require('fs');
const path = require('path');
const paths = require('./paths');

// Make sure that including paths.js after env.js will read .env variables.
delete require.cache[require.resolve('./paths')];

const NODE_ENV = process.env.NODE_ENV;
if (!NODE_ENV) {
throw new Error(
'The NODE_ENV environment variable is required but was not specified.'
);
}

// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
var dotenvFiles = [
`${paths.dotenv}.${NODE_ENV}.local`,
`${paths.dotenv}.${NODE_ENV}`,
// Don't include `.env.local` for `test` environment
// since normally you expect tests to produce the same
// results for everyone
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
paths.dotenv,
].filter(Boolean);

// Load environment variables from .env* files. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables
// that have already been set. Variable expansion is supported in .env files.
// https://github.com/motdotla/dotenv
// https://github.com/motdotla/dotenv-expand
dotenvFiles.forEach(dotenvFile => {
if (fs.existsSync(dotenvFile)) {
require('dotenv-expand')(
require('dotenv').config({
path: dotenvFile,
})
);
}
});

// We support resolving modules according to `NODE_PATH`.
// This lets you use absolute paths in imports inside large monorepos:
// https://github.com/facebookincubator/create-react-app/issues/253.
// It works similar to `NODE_PATH` in Node itself:
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
// We also resolve them to make sure all tools using them work consistently.
const appDirectory = fs.realpathSync(process.cwd());
process.env.NODE_PATH = (process.env.NODE_PATH || '')
.split(path.delimiter)
.filter(folder => folder && !path.isAbsolute(folder))
.map(folder => path.resolve(appDirectory, folder))
.join(path.delimiter);

// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
// injected into the application via DefinePlugin in Webpack configuration.
const REACT_APP = /^REACT_APP_/i;

function getClientEnvironment(publicUrl) {
const raw = Object.keys(process.env)
.filter(key => REACT_APP.test(key))
.reduce(
(env, key) => {
env[key] = process.env[key];
return env;
},
{
// Useful for determining whether we’re running in production mode.
// Most importantly, it switches React into the correct mode.
NODE_ENV: process.env.NODE_ENV || 'development',
// Useful for resolving the correct path to static assets in `public`.
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
// This should only be used as an escape hatch. Normally you would put
// images into the `src` and `import` them in code to get their paths.
PUBLIC_URL: publicUrl,
}
);
// Stringify all values so we can feed into Webpack DefinePlugin
const stringified = {
'process.env': Object.keys(raw).reduce((env, key) => {
env[key] = JSON.stringify(raw[key]);
return env;
}, {}),
};

return { raw, stringified };
}

module.exports = getClientEnvironment;
14 changes: 14 additions & 0 deletions config/jest/cssTransform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

// This is a custom Jest transformer turning style imports into empty objects.
// http://facebook.github.io/jest/docs/en/webpack.html

module.exports = {
process() {
return 'module.exports = {};';
},
getCacheKey() {
// The output is always the same.
return 'cssTransform';
},
};
12 changes: 12 additions & 0 deletions config/jest/fileTransform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

const path = require('path');

// This is a custom Jest transformer turning file imports into filenames.
// http://facebook.github.io/jest/docs/en/webpack.html

module.exports = {
process(src, filename) {
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
},
};
55 changes: 55 additions & 0 deletions config/paths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
'use strict';

const path = require('path');
const fs = require('fs');
const url = require('url');

// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);

const envPublicUrl = process.env.PUBLIC_URL;

function ensureSlash(path, needsSlash) {
const hasSlash = path.endsWith('/');
if (hasSlash && !needsSlash) {
return path.substr(path, path.length - 1);
} else if (!hasSlash && needsSlash) {
return `${path}/`;
} else {
return path;
}
}

const getPublicUrl = appPackageJson =>
envPublicUrl || require(appPackageJson).homepage;

// We use `PUBLIC_URL` environment variable or "homepage" field to infer
// "public path" at which the app is served.
// Webpack needs to know it to put the right <script> hrefs into HTML even in
// single-page apps that may serve index.html for nested URLs like /todos/42.
// We can't use a relative path in HTML because we don't want to load something
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
function getServedPath(appPackageJson) {
const publicUrl = getPublicUrl(appPackageJson);
const servedUrl =
envPublicUrl || (publicUrl ? url.parse(publicUrl).pathname : '/');
return ensureSlash(servedUrl, true);
}

// config after eject: we're in ./config/
module.exports = {
dotenv: resolveApp('.env'),
appBuild: resolveApp('build'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveApp('src/index.js'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
yarnLockFile: resolveApp('yarn.lock'),
testsSetup: resolveApp('src/setupTests.js'),
appNodeModules: resolveApp('node_modules'),
publicUrl: getPublicUrl(resolveApp('package.json')),
servedPath: getServedPath(resolveApp('package.json')),
};
22 changes: 22 additions & 0 deletions config/polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

if (typeof Promise === 'undefined') {
// Rejection tracking prevents a common issue where React gets into an
// inconsistent state due to an error, but it gets swallowed by a Promise,
// and the user has no idea what causes React's erratic future behavior.
require('promise/lib/rejection-tracking').enable();
window.Promise = require('promise/lib/es6-extensions.js');
}

// fetch() polyfill for making API calls.
require('whatwg-fetch');

// Object.assign() is commonly used with React.
// It will use the native implementation if it's present and isn't buggy.
Object.assign = require('object-assign');

// In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet.
// We don't polyfill it in the browser--this is user's responsibility.
if (process.env.NODE_ENV === 'test') {
require('raf').polyfill(global);
}
Loading