Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +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

@@ -0,0 +1,12 @@
pre.log-box {
margin: 0;
padding: 0;
}
.search-keyword-label a {
opacity: 1!important;
}
.search-keyword-label span.small {
font-size: 0.8em;
color: #4183c4 !important;
}
/*# sourceMappingURL=index.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA,GAAG;EACF,SAAA;EACA,UAAA;;AAGD,qBACC;EACC,oBAAA;;AAFF,qBAKC,KAAI;EACH,gBAAA;EACA,cAAA","file":"index.css"}

View File

@@ -0,0 +1,97 @@
{$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">
<div class="ui field">
<input type="text" name="dayFrom" placeholder="开始日期" v-model="dayFrom" value="" style="width:8em" id="day-from-picker"/>
</div>
<div class="ui field">
<input type="text" name="dayTo" placeholder="结束日期" v-model="dayTo" value="" style="width:8em" id="day-to-picker"/>
</div>
<div class="ui field">
<select class="ui dropdown" name="level" v-model="level">
<option value="">[级别]</option>
<option value="error">错误</option>
<option value="warning">警告</option>
<option value="info">信息</option>
<option value="success">成功</option>
</select>
</div>
<div class="ui field">
<select class="ui dropdown" name="tag" v-model="tag">
<option value="">[标签]</option>
<option v-for="tag in tags" :value="tag.code">{{tag.name}}</option>
</select>
</div>
<div class="ui field">
<input type="text" name="keyword" style="width:10em" v-model="keyword" placeholder="关键词"/>
</div>
<div class="ui field">
<node-cluster-combo-box :v-cluster-id="clusterId" @change="changeCluster"></node-cluster-combo-box>
</div>
<div class="ui field" v-if="clusterId > 0">
<node-combo-box :v-cluster-id="clusterId" :v-node-id="nodeId"></node-combo-box>
</div>
<div class="ui field">
<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 || tag.length > 0 || clusterId > 0 || nodeId > 0">
<a :href="'/clusters/logs?type=' + type">[清除条件]</a>
</div>
</div>
</form>
<!-- 未读操作 -->
<div v-if="type == 'unread'">
<div class="ui divider" style="margin-bottom: 0"></div>
<second-menu v-if="logs.length > 0">
<a href="" class="item" @click.prevent="updatePageRead()">[本页已读]</a>
<a href="" class="item" @click.prevent="updateAllRead()">[全部已读]</a>
<a href="" class="item" @click.prevent="updateNodeRead(firstUnreadNode.id)" v-if="firstUnreadNode != null">["{{firstUnreadNode.name}}"节点已读]</a>
</second-menu>
</div>
<!-- 未修复操作 -->
<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>
<div v-if="countLogs > 0 && searchedKeyword.length > 0" class="search-keyword-label">
<div class="ui label basic small">正在搜索关键词"{{searchedKeyword}}",共{{countLogs}}条记录 &nbsp; <a href="" @click.prevent="deleteLogs"><span class="small">[清除日志]</span></a> </div>
</div>
<table class="ui table selectable celled" v-if="logs.length > 0">
<thead>
<tr>
<th class="two wide">集群</th>
<th class="two wide">节点</th>
<th>信息</th>
<th style="width: 5em">操作</th>
</tr>
</thead>
<tr v-for="log in logs">
<td nowrap=""><link-icon :href="'/clusters/cluster?clusterId=' + log.node.cluster.id">{{log.node.cluster.name}}</link-icon></td>
<td nowrap=""><link-icon :href="'/clusters/cluster/node?clusterId=' + log.node.cluster.id + '&nodeId=' + log.node.id">{{log.node.name}}</link-icon></td>
<td>
<node-log-row :v-log="log" :v-keyword="keyword"></node-log-row>
</td>
<td>
<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>
<div class="page" v-html="page"></div>

View File

@@ -0,0 +1,104 @@
Tea.context(function () {
this.$delay(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()
})
}
this.updateNodeRead = function (nodeId) {
this.$post(".readLogs")
.params({
nodeId: nodeId
})
.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(".fix")
.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
})
.success(function () {
teaweb.reload()
})
})
}
this.fixAllLogs = function () {
teaweb.confirm("确定已修复并消除所有的问题?", function () {
this.$post(".fixAll")
.success(function () {
teaweb.reload()
})
})
}
this.deleteLogs = function () {
teaweb.confirm("确定要删除当前关键词\"" + this.searchedKeyword + "\"匹配的" + this.countLogs + "个运行日志?", function () {
this.$post(".deleteAll")
.params({
dayFrom: this.dayFrom,
dayTo: this.dayTo,
keyword: this.keyword,
level: this.level,
type: this.type,
tag: this.tag,
clusterId: this.clusterId,
nodeId: this.nodeId
})
.success(function () {
teaweb.reload()
})
})
}
})

View File

@@ -0,0 +1,15 @@
pre.log-box {
margin: 0;
padding: 0;
}
.search-keyword-label {
a {
opacity: 1!important;
}
span.small {
font-size: 0.8em;
color: #4183c4!important;
}
}