2011-06-14 21:16:34 +08:00
|
|
|
dispatcher_add(function(sammy) {
|
|
|
|
sammy.get('#/traces', function() {
|
2011-06-18 00:45:06 +08:00
|
|
|
render({'traces': '/traces',
|
|
|
|
'vhosts': '/vhosts',
|
|
|
|
'files': '/trace-files'},
|
2011-06-14 21:16:34 +08:00
|
|
|
'traces', '#/traces');
|
|
|
|
});
|
|
|
|
sammy.get('#/traces/:vhost/:name', function() {
|
|
|
|
var path = '/traces/' + esc(this.params['vhost']) + '/' + esc(this.params['name']);
|
|
|
|
render({'trace': path},
|
|
|
|
'trace', '#/traces');
|
|
|
|
});
|
|
|
|
sammy.put('#/traces', function() {
|
|
|
|
if (sync_put(this, '/traces/:vhost/:name'))
|
|
|
|
update();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
sammy.del('#/traces', function() {
|
|
|
|
if (sync_delete(this, '/traces/:vhost/:name'))
|
2011-06-18 00:45:06 +08:00
|
|
|
partial_update();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
sammy.del('#/trace-files', function() {
|
|
|
|
if (sync_delete(this, '/trace-files/:name'))
|
|
|
|
partial_update();
|
2011-06-14 21:16:34 +08:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#tabs").append('<li class="administrator-only"><a href="#/traces">Tracing</a></li>');
|
2012-02-24 23:41:59 +08:00
|
|
|
|
|
|
|
function link_trace(name) {
|
|
|
|
return _link_to(fmt_escape_html(name), 'api/trace-files/' + esc(name));
|
|
|
|
}
|
|
|
|
|
|
|
|
function link_trace_queue(trace) {
|
|
|
|
return _link_to('(queue)', '#/queues/' + esc(trace.vhost) + '/' + esc(trace.queue.name));
|
|
|
|
}
|