Prefix HTTP api calls with node with '/n/' to distinguish from the others

[#157481542]
This commit is contained in:
Diana Corbacho 2018-07-26 16:18:35 +01:00
parent f67b238543
commit 608d67c97e
3 changed files with 19 additions and 19 deletions

View File

@ -58,7 +58,7 @@
</td>
<% } %>
<td>
<form action="#/traces/<%= node.name %>" method="delete">
<form action="#/traces/n/<%= node.name %>" method="delete">
<input type="hidden" name="vhost" value="<%= fmt_string(trace.vhost) %>"/>
<input type="hidden" name="name" value="<%= fmt_string(trace.name) %>"/>
<input type="submit" value="Stop"/>
@ -92,7 +92,7 @@
<td><%= link_trace(node.name, file.name) %></td>
<td class="r"><%= fmt_bytes(file.size) %></td>
<td>
<form action="#/trace-files/<%= node.name %>" method="delete" class="inline-form">
<form action="#/trace-files/n/<%= node.name %>" method="delete" class="inline-form">
<input type="hidden" name="name" value="<%= fmt_string(file.name) %>"/>
<input type="submit" value="Delete" />
</form>
@ -113,7 +113,7 @@
<div class="section">
<h2>Add a new trace</h2>
<div class="hider">
<form action="#/traces/<%= node.name %>" method="put">
<form action="#/traces/n/<%= node.name %>" method="put">
<table class="form">
<% if (vhosts_interesting) { %>
<tr>

View File

@ -4,19 +4,19 @@ dispatcher_add(function(sammy) {
go_to('#/traces/' + nodes[0].name);
});
sammy.get('#/traces/:node', function() {
render({'traces': '/traces/' + esc(this.params['node']),
render({'traces': '/traces/n/' + esc(this.params['node']),
'vhosts': '/vhosts',
'node': '/nodes/' + esc(this.params['node']),
'nodes': '/nodes',
'files': '/trace-files/' + esc(this.params['node'])},
'files': '/trace-files/n/' + esc(this.params['node'])},
'traces', '#/traces')
});
sammy.get('#/traces/:node/:vhost/:name', function() {
var path = '/traces/' + esc(this.params['node']) + '/' + esc(this.params['vhost']) + '/' + esc(this.params['name']);
sammy.get('#/traces/n/:node/:vhost/:name', function() {
var path = '/traces/n/' + esc(this.params['node']) + '/' + esc(this.params['vhost']) + '/' + esc(this.params['name']);
render({'trace': path},
'trace', '#/traces');
});
sammy.put('#/traces/:node', function() {
sammy.put('#/traces/n/:node', function() {
if (this.params['max_payload_bytes'] === '') {
delete this.params['max_payload_bytes'];
}
@ -24,18 +24,18 @@ dispatcher_add(function(sammy) {
this.params['max_payload_bytes'] =
parseInt(this.params['max_payload_bytes']);
}
if (sync_put(this, '/traces/' + esc(this.params['node']) + '/:vhost/:name'))
if (sync_put(this, '/traces/n/' + esc(this.params['node']) + '/:vhost/:name'))
update();
return false;
});
sammy.del('#/traces/:node', function() {
if (sync_delete(this, '/traces/' + esc(this.params['node'])
sammy.del('#/traces/n/:node', function() {
if (sync_delete(this, '/traces/n/' + esc(this.params['node'])
+ '/:vhost/:name'))
partial_update();
return false;
});
sammy.del('#/trace-files/:node', function() {
if (sync_delete(this, '/trace-files/' + esc(this.params['node']) + '/:name'))
sammy.del('#/trace-files/n/:node', function() {
if (sync_delete(this, '/trace-files/n/' + esc(this.params['node']) + '/:name'))
partial_update();
return false;
});
@ -52,7 +52,7 @@ $(document).on('change', 'select#traces-node', function() {
});
function link_trace(node, name) {
return _link_to(name, 'api/trace-files/' + esc(node) + '/' + esc(name));
return _link_to(name, 'api/trace-files/n/' + esc(node) + '/' + esc(name));
}
function link_trace_queue(trace) {

View File

@ -21,14 +21,14 @@
-export([dispatcher/0, web_ui/0]).
dispatcher() -> [{"/traces", rabbit_tracing_wm_traces, []},
{"/traces/:node", rabbit_tracing_wm_traces, []},
{"/traces/n/:node", rabbit_tracing_wm_traces, []},
{"/traces/:vhost", rabbit_tracing_wm_traces, []},
{"/traces/:node/:vhost", rabbit_tracing_wm_traces, []},
{"/traces/n/:node/:vhost", rabbit_tracing_wm_traces, []},
{"/traces/:vhost/:name", rabbit_tracing_wm_trace, []},
{"/traces/:node/:vhost/:name", rabbit_tracing_wm_trace, []},
{"/traces/n/:node/:vhost/:name", rabbit_tracing_wm_trace, []},
{"/trace-files", rabbit_tracing_wm_files, []},
{"/trace-files/:node", rabbit_tracing_wm_files, []},
{"/trace-files/n/:node", rabbit_tracing_wm_files, []},
{"/trace-files/:name", rabbit_tracing_wm_file, []},
{"/trace-files/:node/:name", rabbit_tracing_wm_file, []}].
{"/trace-files/n/:node/:name", rabbit_tracing_wm_file, []}].
web_ui() -> [{javascript, <<"tracing.js">>}].