rabbitmq-server/deps/rabbitmq_tracing/priv/www/js/tracing.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
2.4 KiB
JavaScript
Raw Normal View History

2011-06-14 21:16:34 +08:00
dispatcher_add(function(sammy) {
sammy.get('#/traces', function() {
var nodes = JSON.parse(sync_get('/nodes'));
go_to('#/traces/' + nodes[0].name);
2011-06-14 21:16:34 +08:00
});
sammy.get('#/traces/:node', function() {
2018-07-30 07:05:25 +08:00
render({'traces': '/traces/node/' + esc(this.params['node']),
'vhosts': '/vhosts',
'node': '/nodes/' + esc(this.params['node']),
'nodes': '/nodes',
2018-07-30 07:05:25 +08:00
'files': '/trace-files/node/' + esc(this.params['node'])},
'traces', '#/traces');
});
2018-07-30 07:05:25 +08:00
sammy.get('#/traces/node/:node/:vhost/:name', function() {
var path = '/traces/node/' + esc(this.params['node']) + '/' + esc(this.params['vhost']) + '/' + esc(this.params['name']);
2011-06-14 21:16:34 +08:00
render({'trace': path},
'trace', '#/traces');
});
2018-07-30 07:05:25 +08:00
sammy.put('#/traces/node/:node', function() {
2015-03-02 23:42:37 +08:00
if (this.params['max_payload_bytes'] === '') {
delete this.params['max_payload_bytes'];
}
else {
this.params['max_payload_bytes'] =
parseInt(this.params['max_payload_bytes']);
}
2018-07-30 07:05:25 +08:00
if (sync_put(this, '/traces/node/' + esc(this.params['node']) + '/:vhost/:name'))
2011-06-14 21:16:34 +08:00
update();
return false;
});
2018-07-30 07:05:25 +08:00
sammy.del('#/traces/node/:node', function() {
if (sync_delete(this, '/traces/node/' + esc(this.params['node'])
+ '/:vhost/:name'))
partial_update();
return false;
});
2018-07-30 07:05:25 +08:00
sammy.del('#/trace-files/node/:node', function() {
if (sync_delete(this, '/trace-files/node/' + esc(this.params['node']) + '/:name'))
partial_update();
2011-06-14 21:16:34 +08:00
return false;
});
});
2013-10-23 18:27:10 +08:00
NAVIGATION['Admin'][0]['Tracing'] = ['#/traces', 'administrator'];
2012-02-24 23:41:59 +08:00
HELP['tracing-max-payload'] =
'Maximum size of payload to log, in bytes. Payloads larger than this limit will be truncated. Leave blank to prevent truncation. Set to 0 to prevent logging of payload altogether.';
$(document).on('change', 'select#traces-node', function() {
var url='#/traces/' + $(this).val();
go_to(url);
});
function link_trace(node, name) {
2018-07-30 07:05:25 +08:00
return _link_to(name, 'api/trace-files/node/' + esc(node) + '/' + esc(name));
2012-02-24 23:41:59 +08:00
}
function link_trace_queue(trace) {
return _link_to('(queue)', '#/queues/' + esc(trace.vhost) + '/' + esc(trace.queue.name));
}