2021-08-07 22:04:30 +08:00
|
|
|
// 访问日志搜索框
|
|
|
|
|
Vue.component("http-access-log-search-box", {
|
2022-01-11 12:04:03 +08:00
|
|
|
props: ["v-ip", "v-domain", "v-keyword", "v-cluster-id", "v-node-id", "v-clusters"],
|
|
|
|
|
mounted: function () {
|
|
|
|
|
if (this.vClusterId >0) {
|
|
|
|
|
this.changeCluster({
|
|
|
|
|
value: this.vClusterId
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-08-07 22:04:30 +08:00
|
|
|
data: function () {
|
|
|
|
|
let ip = this.vIp
|
|
|
|
|
if (ip == null) {
|
|
|
|
|
ip = ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let domain = this.vDomain
|
|
|
|
|
if (domain == null) {
|
|
|
|
|
domain = ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let keyword = this.vKeyword
|
|
|
|
|
if (keyword == null) {
|
|
|
|
|
keyword = ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
ip: ip,
|
|
|
|
|
domain: domain,
|
2022-01-11 12:04:03 +08:00
|
|
|
keyword: keyword,
|
|
|
|
|
nodes: []
|
2021-08-07 22:04:30 +08:00
|
|
|
}
|
|
|
|
|
},
|
2021-08-22 16:34:20 +08:00
|
|
|
methods: {
|
|
|
|
|
cleanIP: function () {
|
|
|
|
|
this.ip = ""
|
|
|
|
|
this.submit()
|
|
|
|
|
},
|
|
|
|
|
cleanDomain: function () {
|
|
|
|
|
this.domain = ""
|
|
|
|
|
this.submit()
|
|
|
|
|
},
|
|
|
|
|
cleanKeyword: function () {
|
|
|
|
|
this.keyword = ""
|
|
|
|
|
this.submit()
|
|
|
|
|
},
|
|
|
|
|
submit: function () {
|
|
|
|
|
let parent = this.$el.parentNode
|
|
|
|
|
while (true) {
|
|
|
|
|
if (parent == null) {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
if (parent.tagName == "FORM") {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
parent = parent.parentNode
|
|
|
|
|
}
|
|
|
|
|
if (parent != null) {
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
parent.submit()
|
|
|
|
|
}, 500)
|
|
|
|
|
}
|
2022-01-11 12:04:03 +08:00
|
|
|
},
|
|
|
|
|
changeCluster: function (item) {
|
|
|
|
|
this.nodes = []
|
|
|
|
|
if (item != null) {
|
|
|
|
|
let that = this
|
|
|
|
|
Tea.action("/servers/logs/nodeOptions")
|
|
|
|
|
.params({
|
|
|
|
|
clusterId: item.value
|
|
|
|
|
})
|
|
|
|
|
.post()
|
|
|
|
|
.success(function (resp) {
|
|
|
|
|
that.nodes = resp.data.nodes
|
|
|
|
|
})
|
|
|
|
|
}
|
2021-08-22 16:34:20 +08:00
|
|
|
}
|
|
|
|
|
},
|
2022-01-11 12:04:03 +08:00
|
|
|
template: `<div style="z-index: 10">
|
2021-08-07 22:04:30 +08:00
|
|
|
<div class="margin"></div>
|
|
|
|
|
<div class="ui fields inline">
|
|
|
|
|
<div class="ui field">
|
2021-08-22 16:34:20 +08:00
|
|
|
<div class="ui input left right labeled small">
|
2021-08-07 22:04:30 +08:00
|
|
|
<span class="ui label basic" style="font-weight: normal">IP</span>
|
|
|
|
|
<input type="text" name="ip" placeholder="x.x.x.x" size="15" v-model="ip"/>
|
2021-08-22 16:34:20 +08:00
|
|
|
<a class="ui label basic" :class="{disabled: ip.length == 0}" @click.prevent="cleanIP"><i class="icon remove small"></i></a>
|
2021-08-07 22:04:30 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ui field">
|
2021-08-22 16:49:15 +08:00
|
|
|
<div class="ui input left right labeled small" >
|
2021-08-07 22:04:30 +08:00
|
|
|
<span class="ui label basic" style="font-weight: normal">域名</span>
|
|
|
|
|
<input type="text" name="domain" placeholder="xxx.com" size="15" v-model="domain"/>
|
2021-08-22 16:34:20 +08:00
|
|
|
<a class="ui label basic" :class="{disabled: domain.length == 0}" @click.prevent="cleanDomain"><i class="icon remove small"></i></a>
|
2021-08-07 22:04:30 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ui field">
|
2021-08-22 16:49:15 +08:00
|
|
|
<div class="ui input left right labeled small">
|
2021-08-07 22:04:30 +08:00
|
|
|
<span class="ui label basic" style="font-weight: normal">关键词</span>
|
|
|
|
|
<input type="text" name="keyword" v-model="keyword" placeholder="路径、UserAgent等..." size="18"/>
|
2021-08-22 16:34:20 +08:00
|
|
|
<a class="ui label basic" :class="{disabled: keyword.length == 0}" @click.prevent="cleanKeyword"><i class="icon remove small"></i></a>
|
2021-08-07 22:04:30 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<slot></slot>
|
2022-01-11 12:04:03 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="ui fields inline" style="margin-top: 0.5em">
|
|
|
|
|
<div class="ui field" v-if="vClusters != null && vClusters.length > 0">
|
|
|
|
|
<combo-box title="集群" name="clusterId" placeholder="集群名称" :v-items="vClusters" :v-value="vClusterId" @change="changeCluster"></combo-box>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ui field" v-if="nodes.length > 0">
|
|
|
|
|
<combo-box title="节点" name="nodeId" placeholder="节点名称" :v-items="nodes" :v-value="vNodeId"></combo-box>
|
|
|
|
|
</div>
|
2021-08-07 22:04:30 +08:00
|
|
|
<div class="ui field">
|
2022-01-11 12:04:03 +08:00
|
|
|
<button class="ui button small" type="submit">搜索日志</button>
|
2021-08-07 22:04:30 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>`
|
|
|
|
|
})
|