运行日志显示未读的日志数量

This commit is contained in:
刘祥超
2021-10-15 12:54:23 +08:00
parent 408de6af63
commit c7a8a40e22
14 changed files with 161 additions and 23 deletions

View File

@@ -239,12 +239,20 @@ p.margin {
}
.main-menu .ui.menu .sub-items .item {
padding-left: 2.8em !important;
padding-right: 0.4em !important;
}
.main-menu .ui.menu .sub-items .item .icon {
position: absolute;
left: 1.1em;
top: 0.93em;
}
.main-menu .ui.menu .sub-items .item .label {
margin-left: 0;
margin-right: 0;
padding-left: 0.4em;
padding-right: 0.4em;
min-width: 2em;
}
@media screen and (max-width: 512px) {
.main-menu .ui.menu .sub-items .item {
padding-left: 1em !important;

File diff suppressed because one or more lines are too long

View File

@@ -92,7 +92,9 @@
<div class="subtitle" v-if="module.subtitle != null && module.subtitle.length > 0">{{module.subtitle}}</div>
</a>
<div v-if="teaMenu == module.code" class="sub-items">
<a class="item" v-for="subItem in module.subItems" v-if="subItem.isOn !== false" :href="subItem.url"><i class="icon angle right" v-if="subItem.code == teaSubMenu"></i> {{subItem.name}}</a>
<a class="item" v-for="subItem in module.subItems" v-if="subItem.isOn !== false" :href="subItem.url"><i class="icon angle right" v-if="subItem.code == teaSubMenu"></i> {{subItem.name}}
<span class="ui label tiny red" v-if="subItem.badge != null && subItem.badge > 0">{{subItem.badge}}</span>
</a>
</div>
</div>
</div>

View File

@@ -179,12 +179,21 @@ div.margin, p.margin {
.sub-items {
.item {
padding-left: 2.8em !important;
padding-right: 0.4em !important;
.icon {
position: absolute;
left: 1.1em;
top: 0.93em;
}
.label {
margin-left: 0;
margin-right: 0;
padding-left: 0.4em;
padding-right: 0.4em;
min-width: 2em;
}
}
@media screen and (max-width: 512px) {

View File

@@ -0,0 +1,4 @@
<first-menu>
<menu-item href="/clusters/logs" code="index">所有</menu-item>
<menu-item href="/clusters/logs?type=unread" code="unread">未读<span :class="{red: countUnreadLogs > 0}">({{countUnreadLogs}})</span></menu-item>
</first-menu>

View File

@@ -1,9 +1,11 @@
{$layout}
{$template "/datepicker"}
{$template "menu"}
<div class="margin"></div>
<form method="get" action="/clusters/logs" class="ui form" autocomplete="off">
<input type="hidden" name="type" :value="type"/>
<div class="ui fields inline">
<div class="ui field">
<input type="text" name="dayFrom" placeholder="开始日期" v-model="dayFrom" value="" style="width:8em" id="day-from-picker"/>
@@ -27,7 +29,7 @@
<button type="submit" class="ui button">查询</button>
</div>
<div class="ui field" v-if="dayFrom.length > 0 || dayTo.length > 0 || keyword.length > 0 || level.length > 0">
<a href="/clusters/logs">[清除条件]</a>
<a :href="'/clusters/logs?type=' + type">[清除条件]</a>
</div>
</div>
</form>
@@ -40,6 +42,7 @@
<th>集群</th>
<th>节点</th>
<th>信息</th>
<th class="one op">操作</th>
</tr>
</thead>
<tr v-for="log in logs">
@@ -48,6 +51,9 @@
<td>
<node-log-row :v-log="log" :v-keyword="keyword"></node-log-row>
</td>
<td>
<a href="" @click.prevent="updateRead(log.id)" v-if="!log.isRead">已读</a>
</td>
</tr>
</table>

View File

@@ -3,4 +3,27 @@ Tea.context(function () {
teaweb.datepicker("day-from-picker")
teaweb.datepicker("day-to-picker")
})
this.updateRead = function (logId) {
this.$post(".readLogs")
.params({
logIds: [logId]
})
.success(function () {
teaweb.reload()
})
}
this.updatePageRead = function () {
let logIds = this.logs.map(function (v) {
return v.id
})
this.$post(".readLogs")
.params({
logIds: logIds
})
.success(function () {
teaweb.reload()
})
}
})