Skip to content

Commit

Permalink
Fix #137 Type and org info in GET /queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Romero Brox committed May 23, 2013
1 parent 64744fd commit e78a5ae
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
10 changes: 5 additions & 5 deletions lib/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ var start = function start(done) {
emitter = emitterModule.getEmitter();

app = express();
app.prefix = 'UNSEC:';
app.prefix = 'UNSEC';
app.port = config.agent.port;
app._backlog = 2048;
apps.push(app);

var secureOptions;
var secureOptions, options;
dirModule = path.dirname(module.filename);
logger.info('config.enableSecure', config.enableSecure);

Expand All @@ -114,7 +114,7 @@ var start = function start(done) {
fs.statSync(secureOptions.key).isFile() &&
fs.statSync(secureOptions.cert).isFile()) {

var options = {
options = {
key: fs.readFileSync(secureOptions.key),
cert: fs.readFileSync(secureOptions.cert)
};
Expand All @@ -126,7 +126,7 @@ var start = function start(done) {

appSec = express();
appSec.secOptions = options;
appSec.prefix = 'SEC:';
appSec.prefix = 'SEC';
appSec.isSecure = true;
appSec.port = Number(config.agent.port) + 1;

Expand Down Expand Up @@ -157,7 +157,7 @@ var start = function start(done) {
app.server = http.createServer(app).listen(app.port);
}
configureSocketIO(app);
logger.info('PopBox listening on', app.prefix + app.port);
logger.info('PopBox listening on', app.prefix + ':' + app.port);
});
}
});
Expand Down
10 changes: 5 additions & 5 deletions lib/agentLogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,11 @@ function queueSize(req, res) {
}

function getQueue(req, res) {
'use strict';
var queueId = req.param('id');
var prefix = req.prefix;

req.template = 'queues.jade';
var queueId = req.param('id'),
prefix = req.prefix;

req.template = 'queues.jade';

dataSrv.getQueue(prefix, queueId, function onGetQueue(err, hQ, lQ, lastPop, blocked) {
if (err) {
Expand All @@ -338,7 +338,7 @@ function getQueue(req, res) {
req.info
]);
res.send({ok: true, host: req.headers.host, lastPop: lastPop, blocked: blocked,
size: hQ.length + lQ.length, high: hQ, low: lQ });
size: hQ.length + lQ.length, high: hQ, low: lQ , type: req.type, org: req.org});
}
});
}
Expand Down
8 changes: 6 additions & 2 deletions lib/prefixer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
For those usages not covered by the GNU Affero General Public License
please contact with::[email protected]
*/
'use strict';

var config = require('./config.js');
function prefixer(prefix) {
'use strict';
function prefixer(type) {
var prefix = type + ":";
return function (req, res, next) {
var orgName = config.oauthIdToken || req.param('id_org');
req.type = type;
req.org = orgName;
req.prefix = (orgName ? orgName + ':' : '') + prefix;
next();
};
Expand Down
4 changes: 4 additions & 0 deletions lib/views/queues.jade
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ p last pop:
end
p Blocked:
span#blocked #{blocked}
p Type:
span#type #{type}
p Org:
span#org #{org}
p HIGH PRIORITY QUEUES
- var baseurl ='http://'+host+'/trans/'
#high
Expand Down

0 comments on commit e78a5ae

Please sign in to comment.