Add configuration options

This commit is contained in:
John Furrow
2016-02-11 18:26:00 -08:00
parent 0fd6fd7d11
commit 366cb1b428
8 changed files with 24 additions and 16 deletions
@@ -212,7 +212,6 @@ const TorrentActions = {
},
setFilePriority: function(hash, fileIndices, priority) {
console.log(hash, fileIndices, priority);
return axios.patch(`/client/torrents/${hash}/priority`, {
hash,
fileIndices,
@@ -69,7 +69,7 @@ export default class DirectoryFiles extends React.Component {
return (
<div className="directory-tree__node directory-tree__node--file file"
key={`${index}`} title={file.filename}>
key={`${index}-${file.filename}`} title={file.filename}>
<div className="file__detail file__name">
<File />
{file.filename}
@@ -83,7 +83,8 @@ export default class DirectoryFiles extends React.Component {
</div>
<div className="file__detail file__detail--priority">
<PriorityMeter level={this.state.priorities[file.index]}
fileIndex={file.index} onChange={this.handlePriorityChange} />
fileIndex={file.index} onChange={this.handlePriorityChange}
key={`${file.index}-${file.filename}`} />
</div>
</div>
);
@@ -26,12 +26,12 @@ export default class DirectoryTree extends React.Component {
if (branchName === 'files') {
return (
<DirectoryFileList branch={branch} hash={hash}
key={`${index}${depth}`} />
key={`${index}${depth}${branchName}`} />
);
} else {
return (
<DirectoryTreeNode depth={depth} directoryName={branchName}
hash={hash} subTree={branch} key={`${index}${depth}`} />
hash={hash} subTree={branch} key={`${index}${depth}${branchName}`} />
);
}
});
@@ -25,7 +25,7 @@ export default class DirectoryTreeNode extends React.Component {
return (
<div className="directory-tree__node directory-tree__node--group">
<DirectoryTree tree={this.props.subTree} depth={this.props.depth}
hash={this.props.hash} />
hash={this.props.hash} key={`${this.state.expanded}-${this.props.depth}`} />
</div>
);
} else {
+2
View File
@@ -1,5 +1,7 @@
const config = {
databasePath: './server/db/',
host: 'localhost',
hostPort: 5000,
maxHistoryStates: 30,
pollInterval: 5000,
uiDatabaseCleanInterval: 1000 * 60 * 60 // 1 hour
+5 -5
View File
File diff suppressed because one or more lines are too long
+7 -3
View File
@@ -56,8 +56,6 @@ class HistoryEra {
let currentTime = Date.now();
if (currentTime - this.lastUpdate >= this.opts.interval - CUMULATIVE_DATA_BUFFER) {
console.log(`creating new record in ${this.opts.name}`);
this.lastUpdate = currentTime;
this.db.insert({
@@ -76,7 +74,13 @@ class HistoryEra {
let downAvg = ((currentDownAvg * numUpdates + Number(data.download)) / (numUpdates + 1)).toFixed(1);
let upAvg = ((currentUpAvg * numUpdates + Number(data.upload)) / (numUpdates + 1)).toFixed(1);
console.log(`updating, old avg: ${doc.dn}, new number: ${data.download}, new avg: ${downAvg}`);
if (downAvg == null || upAvg == null) {
console.log('\n\n');
console.log('Warning: null values set in database!');
console.log(`DB: ${this.opts.name}`);
console.log(`numUpdates: ${numUpdates}\ncurrentDownAvg: ${currentDownAvg}\ncurrentUpAvg: ${currentUpAvg}\ndownAvg: ${downAvg}\nupAvg: ${upAvg}`);
console.log('\n\n');
}
this.db.update({ts: this.lastUpdate}, {ts: this.lastUpdate, up: Number(upAvg), dn: Number(downAvg), num: numUpdates + 1});
}
+4 -2
View File
@@ -1,5 +1,7 @@
var Q = require('q');
var net = require('net');
var config = require('../../config');
var Deserializer = require('../util/deserializer');
var Serializer = require('../util/serializer');
@@ -8,8 +10,8 @@ var rtorrent = {
get: function(api, array) {
var stream = net.connect({
port: 5000,
host: 'localhost'
port: config.hostPort,
host: config.host
});
var deferred = Q.defer();