Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
magiconair committed Feb 25, 2019
2 parents 922eca9 + 18e5fca commit 2f9acc4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 26 deletions.
6 changes: 5 additions & 1 deletion admin/ui/manual.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ $(function(){
if (val == "") {
val = "default"
}
d.append('<li><a href="/manual'+path+'">'+val+'</a></li>');
d.append(
$('<li />').append(
$('<a />').attr('href', '/manual'+path).text(val)
)
);
});
});
Expand Down
60 changes: 35 additions & 25 deletions admin/ui/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,38 +74,45 @@ $(function(){
var params={};window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(str,key,value){params[key] = value;});
function renderRoutes(routes) {
var $table = $("table.routes");
var tbl = '<thead><tr>';
tbl += '<th>#</th>';
tbl += '<th>Service</th>';
tbl += '<th>Source</th>';
tbl += '<th>Dest</th>';
tbl += '<th>Options</th>';
tbl += '<th>Weight</th>';
tbl += '</tr></thead><tbody>'
tbl += '<tbody>'
var $table = $('table.routes');
var thead = '<thead><tr>';
thead += '<th>#</th>';
thead += '<th>Service</th>';
thead += '<th>Source</th>';
thead += '<th>Dest</th>';
thead += '<th>Options</th>';
thead += '<th>Weight</th>';
thead += '</tr></thead>';
var $tbody = $('<tbody />');
for (var i=0; i < routes.length; i++) {
var r = routes[i];
tbl += '<tr>';
tbl += '<td>' + (i+1) + '</td>';
tbl += '<td>' + r.service + '</td>';
tbl += '<td>' + r.src + '</td>';
tbl += '<td><a href="' + r.dst + '">' + r.dst + '</a></td>';
tbl += '<td>' + r.opts + '</td>';
tbl += '<td>' + (r.weight * 100).toFixed(2) + '%</td>';
tbl += '</tr>';
var $tr = $('<tr />')
$tr.append($('<td />').text(i+1));
$tr.append($('<td />').text(r.service));
$tr.append($('<td />').text(r.src));
$tr.append($('<td />').text(r.dst));
$tr.append($('<td />').append($('<a />').attr('href', r.dst).text(r.dst)));
$tr.append($('<td />').text(r.opts));
$tr.append($('<td />').text((r.weight * 100).toFixed(2) + '%'));
$tr.appendTo($tbody);
}
tbl += '</tbody>';
$table.html(tbl);
$table.empty().
append($(thead)).
append($tbody);
}
var $filter = $('#filter');
function doFilter(v) {
$("tr").show();
if (!v) return;
var words = v.split(' ');
console.log('words: ', words);
for (var i=0; i < words.length; i++) {
var w = words[i].trim();
if (w == "") continue;
Expand Down Expand Up @@ -135,11 +142,14 @@ $(function(){
if (val == "") {
val = "default"
}
d.append('<li><a href="/manual'+path+'">'+val+'</a></li>');
d.append(
$('<li />').append(
$('<a />').attr('href', '/manual'+path).text(val)
)
);
});
});
})
});
</script>
</body>
Expand Down

0 comments on commit 2f9acc4

Please sign in to comment.