Skip to content

Commit

Permalink
fix 实时日志
Browse files Browse the repository at this point in the history
  • Loading branch information
thsrite committed Feb 8, 2023
1 parent a9e136b commit 79ea2c9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 65 deletions.
34 changes: 1 addition & 33 deletions web/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,36 +157,4 @@ body, .page {

.select_logger h5{
padding-right:5px
}

.select_logger svg{
cursor: pointer;
}

.logger-select{
position: absolute;
top: 43px;
left: 57px;
width:80px;
height:210px;
background:#fff;
border-radius:10px;
box-shadow: 0 0 10px 0 #ccc;
display:none;
overflow-y: scroll;
}

.logger-select .logger-li{
width:100%;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
font-size:13px;
color:#333;
cursor: pointer;
}

.logger-select .logger-li:hover {
background: #f2f2f2;
}
}
10 changes: 10 additions & 0 deletions web/templates/macro/svg.html
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,16 @@
</svg>
{% endmacro %}

<!-- 日志筛选 -->
<!-- http://tabler-icons.io/i/tex -->
{% macro log_select(class) %}

<svg focusable="false" class="logger-btn" data-icon="filter" width="1em" height="1em"
fill="currentColor" aria-hidden="true" viewBox="64 64 896 896">
<path d="M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"></path>
</svg>
{% endmacro %}

<!-- 详情圆角 -->
<!-- http://tabler-icons.io/i/info-square-rounded -->
{% macro info_square_rounded(class) %}
Expand Down
50 changes: 18 additions & 32 deletions web/templates/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,25 +273,13 @@ <h4 class="card-title mb-3">
<div class="modal-header">
<div class="select_logger">
<h5 class="modal-title">实时日志</h5>
<svg focusable="false" class="logger-btn" data-icon="filter" width="1em" height="1em" fill="currentColor" aria-hidden="true" viewBox="64 64 896 896"><path d="M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"></path></svg>
<div class="logger-select">
<div class="logger-li">All</div>
<div class="logger-li">System</div>
<div class="logger-li">Rss</div>
<div class="logger-li">Rmt</div>
<div class="logger-li">Meta</div>
<div class="logger-li">Sync</div>
<div class="logger-li">Sites</div>
<div class="logger-li">Brush</div>
<div class="logger-li">Douban</div>
<div class="logger-li">Spider</div>
<div class="logger-li">Message</div>
<div class="logger-li">Indexer</div>
<div class="logger-li">Searcher</div>
<div class="logger-li">Subscribe</div>
<div class="logger-li">Downloader</div>
<div class="logger-li">TorrentRemover</div>
</div>
<div class="dropdown">
<a href='#' class="btn-action" data-bs-toggle="dropdown" aria-expanded="false" onclick="get_logging_source()">
{{ SVG.log_select() }}
</a>
<div class="dropdown-menu dropdown-menu-end" id="dropdown-menu-logger">
</div>
</div>
</div>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" id="logging_close_head"></button>
</div>
Expand Down Expand Up @@ -2264,20 +2252,18 @@ <h5 class="modal-title">高级搜索</h5>
$('#modal-logging').modal('show');
}

// 显示日志来源筛选
$(".logger-btn").bind("click").click(function (e) {
if (e.stopPropagation) e.stopPropagation();
$('.logger-select').css('display','block')
});

// 隐藏日志来源筛选
$('.modal-content').unbind("click").click(function () {
$('.logger-select').css('display','none')
});
// 渲染日志来源下拉列表
function get_logging_source(){
$("#dropdown-menu-logger").html('')
var menu=['All', 'System', 'Rss', 'Rmt', 'Meta', 'Sync', 'Sites', 'Brush', 'Douban', 'Spider', 'Message', 'Indexer', 'Searcher', 'Subscribe', 'Downloader', 'TorrentRemover']
for(var i=0;i<menu.length;i++){
$("#dropdown-menu-logger").append(`<a class="dropdown-item" href="javascript:logger_select('${menu[i]}')">${menu[i]}</a>`);
}
}

// 日志来源筛选
$('.logger-li').click(function(e){
logger_source = $(this).text();
function logger_select(source){
logger_source = source
if (logger_source === "All") logger_source = "";

// 关闭之前的定时刷新日志
Expand All @@ -2288,7 +2274,7 @@ <h5 class="modal-title">高级搜索</h5>

// 重新拉取日志
refresh_logging()
})
}

//刷新消息中心
function refresh_message(time_str) {
Expand Down

0 comments on commit 79ea2c9

Please sign in to comment.