mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-28 05:16:34 +08:00
可以修复单页或者全部服务日志
This commit is contained in:
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
})
|
||||
@@ -2,24 +2,12 @@
|
||||
{$template "menu"}
|
||||
|
||||
<!-- 错误日志 -->
|
||||
<div v-if="errorLogs.length > 0">
|
||||
<div v-if="countNeedFixLogs > 0">
|
||||
<div class="margin"></div>
|
||||
<div class="ui menu tabular attached">
|
||||
<span class="ui item active"><span class="red">需要修复的错误 <a href="" title="本页已修复" @click.prevent="fixPageLogs"><i class="icon remove small"></i> </a></span></span>
|
||||
</div>
|
||||
<div class="ui segment attached node-logs-box">
|
||||
<div class="ui icon message small" v-for="log in errorLogs" :class="{error: log.level == 'error', success: log.level == 'success'}">
|
||||
<i class="icon warning circle"></i>
|
||||
<div class="content">
|
||||
[{{log.createdTime}}]
|
||||
<a :href="'/clusters/cluster/node?clusterId=' + log.clusterId + '&nodeId=' + log.nodeId">[节点:{{log.nodeName}}]</a>
|
||||
<a :href="'/servers/server/settings?serverId=' + log.serverId"><span v-if="log.serverName.length > 0">[服务:{{log.serverName}}]</span><span v-else>[服务]</span></a>
|
||||
<span v-if="log.level == 'error'">[错误]</span>
|
||||
<span v-if="log.level == 'success'">[成功]</span>
|
||||
{{log.description}}
|
||||
</div>
|
||||
<a href="" title="关闭" @click.prevent="fixLog(log.id)"><i class="ui icon remove small"></i></a>
|
||||
</div>
|
||||
|
||||
<div class="ui icon message small error">
|
||||
<i class="icon warning circle"></i>
|
||||
<div class="content"><a href="/clusters/logs?type=needFix">有{{countNeedFixLogs}}个网站服务相关的错误需要修复。</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -46,41 +46,4 @@ Tea.context(function () {
|
||||
this.showLatest = function () {
|
||||
this.latestVisible = !this.latestVisible
|
||||
}
|
||||
|
||||
/**
|
||||
* 错误日志相关
|
||||
*/
|
||||
this.fixLog = function (logId) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要关闭此错误提示吗?", function () {
|
||||
that.$post(".fixLog")
|
||||
.params({
|
||||
logIds: logId
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.fixPageLogs = function () {
|
||||
let logIds = this.errorLogs.map(function (v) {
|
||||
return v.id
|
||||
})
|
||||
if (logIds.length == 0) {
|
||||
teaweb.reload()
|
||||
return
|
||||
}
|
||||
|
||||
let that = this
|
||||
teaweb.confirm("确定要关闭此页错误提示吗?", function () {
|
||||
that.$post(".fixLog")
|
||||
.params({
|
||||
logIds: logIds
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user