Skip to content

Commit 67fb01c

Browse files
committed
addChannel tweaks
1 parent 7844b58 commit 67fb01c

1 file changed

Lines changed: 22 additions & 16 deletions

File tree

src/js/LogDumper.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,6 @@ var logDumper = (function($, module) {
402402
+'</div>'
403403
+'</div>'
404404
+'<div class="panel-body collapse debug">'
405-
+'<fieldset class="channels" style="display:none;">'
406-
+'<legend>Channels</legend>'
407-
+'<ul class="list-unstyled">'
408-
+'</ul>'
409-
+'</fieldset>'
410405
+'<div class="debug-header m_group"></div>'
411406
+'<div class="debug-content m_group"></div>'
412407
+'<i class="fa fa-spinner fa-pulse"></i>'
@@ -496,7 +491,7 @@ var logDumper = (function($, module) {
496491
$node = methods.default(method, args, meta, info);
497492
}
498493
if (meta.channel !== undefined && channels.indexOf(meta.channel) < 0) {
499-
addChannel(info.$container, meta.channel);
494+
addChannel(meta.channel, info);
500495
}
501496
if ($node) {
502497
info.$currentNode.append($node);
@@ -520,18 +515,29 @@ var logDumper = (function($, module) {
520515
}
521516
};
522517

523-
function addChannel($container, channel, info) {
524-
var channels = $container.data("channels") || [],
525-
$li = $('<li><label>'
526-
+'<input checked data-is-root="false" data-toggle="channel" type="checkbox" value="" /> '
527-
+channel
528-
+'</label></li>');
518+
function addChannel(channel, info) {
519+
var $container = info.$container,
520+
$channels = $container.find(".channels"),
521+
channels = $container.data("channels") || [],
522+
channelRoot = $container.data("channelRoot") || "general",
523+
$ul;
524+
channel = channel || channelRoot;
525+
if (channel == "phpError" || channels.indexOf(channel) > -1) {
526+
return;
527+
}
529528
channels.push(channel);
530529
$container.data("channels", channels);
531-
$li.find("input").val(channel);
532-
$container.find(".channels ul").append($li);
533-
if (channels.length > 1) {
534-
$container.find(".channels").show();
530+
$ul = $().debugEnhance("buildChannelList", channels, channelRoot);
531+
if ($channels.length) {
532+
$channels.find("> ul").replaceWith($ul);
533+
$channels.show();
534+
} else {
535+
$channels = $("<fieldset />", {
536+
class: "channels",
537+
})
538+
.append('<legend>Channels</legend>')
539+
.append($ul);
540+
$container.find(".panel-body").prepend($channels);
535541
}
536542
}
537543

0 commit comments

Comments
 (0)