Skip to content

Commit

Permalink
Add remove button for streams
Browse files Browse the repository at this point in the history
  • Loading branch information
kennedyoliveira committed Aug 28, 2016
1 parent 86760bd commit 417b249
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hystrix-dashboard/src/main/webapp/index.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
table {
width: 80%;
width: 100%;
border-collapse: collapse;
}

Expand Down
16 changes: 15 additions & 1 deletion hystrix-dashboard/src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

streams.push(s);
$('#streams').html('<table>' + _.reduce(streams, function(html, s) {
return html + '<tr><td>' + s.name + '</td><td>' + s.stream + '</td></tr>';
return html + '<tr><td>' + s.name + '</td><td>' + s.stream + '</td> <td><a href="#" onclick="removeStream(this);">Remove</a></td> </tr>';
}, '') + '</table>');

$('#message').html("");
Expand Down Expand Up @@ -64,6 +64,20 @@
$("#title").val(appName);
};

var removeStream = function(element) {
var $tr = $(element).closest("tr");
var url = $tr.find("td:nth-child(2)").text();

for (var i = 0; i < streams.length; i++) {
if(streams[i].stream === url) {
streams.splice(i, 1);
break;
}
}

$tr.remove();
};

var fetchEurekaAppList = function (e) {
var url = window.location.pathname + "eureka?url=" + $('#eurekaURL').val();
var $eurekaApp = $('#eurekaApp');
Expand Down

0 comments on commit 417b249

Please sign in to comment.