可以修复单页或者全部服务日志

This commit is contained in:
GoEdgeLab
2022-03-23 17:31:53 +08:00
parent 3d45db8f3e
commit ee24baf7d6
11 changed files with 144 additions and 138 deletions

View File

@@ -1,4 +1,5 @@
<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>
<menu-item href="/clusters/logs?type=needFix" code="needFix">需修复<span :class="{red: countNeedFixLogs > 0}">({{countNeedFixLogs}})</span></menu-item>
</first-menu>

View File

@@ -46,6 +46,7 @@
</div>
</form>
<!-- 未读操作 -->
<div v-if="type == 'unread'">
<div class="ui divider" style="margin-bottom: 0"></div>
<second-menu v-if="logs.length > 0">
@@ -54,7 +55,17 @@
</second-menu>
</div>
<p class="comment" v-if="logs.length == 0">暂时还没有日志。</p>
<!-- 未修复操作 -->
<div v-if="type == 'needFix'">
<div class="ui divider" style="margin-bottom: 0"></div>
<second-menu v-if="logs.length > 0">
<a href="" class="item" @click.prevent="fixPageLogs()">[本页已修复]</a>
<a href="" class="item" @click.prevent="fixAllLogs()">[全部已修复]</a>
</second-menu>
<p class="ui message" v-if="logs.length > 0">已合并重复内容,当前显示数据和总数量可能不一致。</p>
</div>
<p class="comment" v-if="logs.length == 0">暂时还没有<span v-if="type == 'unread'">未读</span><span v-if="type == 'needFix'">需修复</span>日志。</p>
<table class="ui table selectable celled" v-if="logs.length > 0">
<thead>
@@ -62,7 +73,7 @@
<th>集群</th>
<th>节点</th>
<th>信息</th>
<th class="one op">操作</th>
<th style="width: 5em">操作</th>
</tr>
</thead>
<tr v-for="log in logs">
@@ -72,7 +83,8 @@
<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>
<a href="" v-if="!log.isFixed" @click.prevent="fixLog(log.id)">修复</a>
<a href="" @click.prevent="updateRead(log.id)" v-if="log.isFixed && !log.isRead">已读</a>
</td>
</tr>
</table>

View File

@@ -18,8 +18,43 @@ Tea.context(function () {
let logIds = this.logs.map(function (v) {
return v.id
})
teaweb.confirm("确定要设置本页日志为已读吗?", function () {
this.$post(".readLogs")
this.$post(".readLogs")
.params({
logIds: logIds
})
.success(function () {
teaweb.reload()
})
}
this.updateAllRead = function () {
this.$post(".readAllLogs")
.params({})
.success(function () {
teaweb.reload()
})
}
this.changeCluster = function (clusterId) {
this.clusterId = clusterId
}
this.fixLog = function (logId) {
this.$post(".fixLogs")
.params({
logIds: [logId]
})
.success(function () {
teaweb.reload()
})
}
this.fixPageLogs = function () {
let logIds = this.logs.map(function (v) {
return v.id
})
teaweb.confirm("确定已修复并消除当前页的问题?", function () {
this.$post(".fix")
.params({
logIds: logIds
})
@@ -29,17 +64,12 @@ Tea.context(function () {
})
}
this.updateAllRead = function () {
teaweb.confirm("确定要设置所有日志为已读吗", function () {
this.$post(".readAllLogs")
.params({})
this.fixAllLogs = function () {
teaweb.confirm("确定已修复并消除所有的问题", function () {
this.$post(".fixAll")
.success(function () {
teaweb.reload()
})
})
}
this.changeCluster = function (clusterId) {
this.clusterId = clusterId
}
})