@@ -95,7 +121,6 @@ export default {
return this.$store.getters.getGlobalShow
},
noMore () {
- console.log((this.pageObj.pageNo * this.pageObj.pageSize) >= this.pageObj.total)
return (this.pageObj.pageNo * this.pageObj.pageSize) >= this.pageObj.total
},
disabled () {
@@ -110,6 +135,7 @@ export default {
nextLoading: false,
selectIndex: '',
tableData: [],
+ isNoData: false,
pageObj: {
pageNo: 1,
pageSize: 50,
@@ -139,6 +165,7 @@ export default {
isSelect: true
}
],
+ skeletonArr: 20,
timer: null,
searchTimer: null,
scopeChangeTimer: null,
@@ -194,21 +221,21 @@ export default {
window.removeEventListener('keyup', this.keyup)
},
scroll () {
- // const ulBox = this.$refs.list
+ const ulBox = this.$refs.list
const liBox = this.$refs['item' + this.selectIndex][0]
- // const liHeight = liBox.clientHeight
- // const height = ulBox.clientHeight - liHeight
- // const offsetTop = liBox.offsetTop
- liBox.focus()
- // if ((this.selectIndex + 1) * liHeight > height) {
- // ulBox.scrollTop = (this.selectIndex + 1) * liHeight - height
- // } else {
- // ulBox.scrollTop = 0
- // }
- // console.log(height, liHeight, offsetTop, ulBox.scrollTop)
+ const liHeight = liBox.clientHeight
+ const height = ulBox.clientHeight
+ const offsetTop = liBox.offsetTop - ulBox.offsetTop
+ const scrollTop = ulBox.scrollTop
+ // liBox.focus()
+ // console.log(height, liHeight, offsetTop, scrollTop)
+ if (offsetTop - scrollTop < 0) {
+ ulBox.scrollTop = offsetTop
+ } else if (offsetTop - scrollTop >= height - liHeight) {
+ ulBox.scrollTop = offsetTop - height + liHeight
+ }
},
changeSelectIndex (index) {
- console.log('changeSelectIndex', this.isKeyDown)
if (this.isKeyDown) {
this.getItemInfo()
return
@@ -217,7 +244,6 @@ export default {
this.getItemInfo()
},
keyDown (e) {
- console.log('keyDown')
// console.log(e, e.target, e.keyCode)
if (e.keyCode === 13) {
this.jumpTo()
@@ -266,6 +292,7 @@ export default {
this.searchTimer = null
}
this.loading = true
+ this.firstShow = false
this.searchTimer = setTimeout(() => {
this.selectIndex = 0
this.pageObj.pageNo = 1
@@ -305,6 +332,7 @@ export default {
}, 100)
},
getData () {
+ this.isNoData = false
const param = {
pageNo: this.pageObj.pageNo,
pageSize: this.pageObj.pageSize,
@@ -316,12 +344,17 @@ export default {
this.loading = false
this.nextLoading = false
return
+ } else {
+ this.firstShow = false
}
this.$get('/stat/search', param).then(res => {
this.firstShow = false
this.nextLoading = false
if (res.code === 200) {
this.tableData = this.tableData.concat(res.data.list)
+ if (!this.tableData.length) {
+ this.isNoData = true
+ }
this.pageObj.total = res.data.total
this.stat = res.stat
} else {
diff --git a/nezha-fronted/src/components/common/globalSearch/searchItemInfo.vue b/nezha-fronted/src/components/common/globalSearch/searchItemInfo.vue
index 026d1c4cf..f1698f2d6 100644
--- a/nezha-fronted/src/components/common/globalSearch/searchItemInfo.vue
+++ b/nezha-fronted/src/components/common/globalSearch/searchItemInfo.vue
@@ -1,16 +1,34 @@
-
-
-
-
-
-
{{obj.name}}
-
-
- {{item.label}}
+
+
+
-
-
+
+
+
+
+
+
+
+
{{obj.name}}
+
+
+ {{item.label}}
+
+
+
{{$t('project.endpoint.metrics')}}
@@ -22,7 +40,7 @@
-
+
{{$t('project.endpoint.logs')}}
@@ -34,20 +52,22 @@
-
-
-
-
{{ $t('overall.enabled') }}
-
{{ $t('overall.disabled') }}
-
-
-
-
+
+
+
+
{{ $t('overall.enabled') }}
+
{{ $t('overall.disabled') }}
+
+
+
+
{{getPathContent(item.key)}}
+
+
-
-
+
+