diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/endpointQuery.vue b/nezha-fronted/src/components/common/bottomBox/tabs/endpointQuery.vue index 32288656c..4b9f1b112 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/endpointQuery.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/endpointQuery.vue @@ -6,6 +6,7 @@ :search-msg="searchMsg" :tabs="tabs" :targetTab="targetTab" + :showPagination="false" @changeTab="changeTab" :customTool="true" class="full-width-height" @@ -221,4 +222,10 @@ export default { width: 100%; height: 100%; } + /deep/ .nz-table2{ + padding: 0 !important; + } + /deep/ .sub-container { + box-sizing: border-box; + } diff --git a/nezha-fronted/src/components/common/js/constants.js b/nezha-fronted/src/components/common/js/constants.js index 9780f4e05..b4a3f8369 100644 --- a/nezha-fronted/src/components/common/js/constants.js +++ b/nezha-fronted/src/components/common/js/constants.js @@ -215,7 +215,8 @@ export const terminalLog = { dangerCmd: ['chmod', 'chown', 'kill', 'rm', 'su', 'sudo'], infoCmd: ['exit'] } - +// 需要隐藏的内置label +export const sameLabels = ['instance', 'module', 'project', 'asset', 'endpoint', 'datacenter', 'datacenter_id', 'endpoint_id', 'module_id', 'nz_agent_id', 'project_id'] // 公共组件的跳转来源 export const fromRoute = { panel: 'panel', diff --git a/nezha-fronted/src/components/common/multipleTime.vue b/nezha-fronted/src/components/common/multipleTime.vue index 7e6cd4571..c3b3f35d1 100644 --- a/nezha-fronted/src/components/common/multipleTime.vue +++ b/nezha-fronted/src/components/common/multipleTime.vue @@ -15,7 +15,7 @@ line-height:28px; padding-left:5px; margin-left:0px; - margin-top: 0px !important; + margin-top: -3px !important; text-align:left; border-radius:2px; min-width:80px; @@ -57,6 +57,7 @@ display: flex; justify-content: space-between; align-items: center; + margin-top: 4px; } .compare-box{ /*line-height: 50px;*/ diff --git a/nezha-fronted/src/components/common/pickTime.vue b/nezha-fronted/src/components/common/pickTime.vue index 68d3e085f..68f8a5410 100644 --- a/nezha-fronted/src/components/common/pickTime.vue +++ b/nezha-fronted/src/components/common/pickTime.vue @@ -2,7 +2,7 @@
- +
@@ -74,6 +77,7 @@ import chartBox from '@/components/page/dashboard/chartBox' import axios from 'axios' import bus from '../../../../libs/bus' import chart from '@/components/page/dashboard/overview/chart' +import { sameLabels } from '@/components/common/js/constants' export default { name: 'endpointTable', @@ -115,16 +119,23 @@ export default { data () { return { tableData: [], + currentTableData: [], batchDeleteObjs: [], currentEndpoint: {}, - sameLabels: ['instance', 'module', 'project', 'asset', 'endpoint', 'datacenter'], + sameLabels: sameLabels, loading: false, panelData: {}, graphShow: false, chartUnit: 5, rightBox: { show: false }, minusTime: 0, - searchTime: [new Date().setHours(new Date().getHours() - 1), new Date()] + searchTime: [new Date().setHours(new Date().getHours() - 1), new Date()], + tableId: 'alertSilenceTable', + pageObj: { + pageSize: 10, + pageNo: 1, + total: 0 + } } }, methods: { @@ -139,16 +150,18 @@ export default { this.tableData = [] this.tableDataCopy = '' setTimeout(() => { - this.$get("/prom/api/v1/query?query={endpoint='" + this.currentEndpoint.id + "'}&time=" + new Date(this.formatTime).getTime()).then(response => { + this.$get("/prom/api/v1/query?query={endpoint_id='" + this.currentEndpoint.id + "'}&time=" + this.$stringTimeParseToUnix(new Date(this.formatTime).getTime())).then(response => { this.loading = false if (response.status === 'success') { const results = response.data.result this.queryData = JSON.parse(JSON.stringify(results)) this.tableData = this.handlerTableData(results) this.tableDataCopy = JSON.stringify(this.tableData) + this.pageObj.total = this.tableData.length this.$nextTick(this.$refs.dataTable.doLayout()) if (!this.scrollbarWrap) { this.$nextTick(() => { + this.handleCurrentChange() // this.scrollbarWrap = this.$refs.dataTable.$refs.singleTable.bodyWrapper // this.toTopBtnHandler(this.scrollbarWrap) }) @@ -253,6 +266,8 @@ export default { const element = temp.hideSameLabels ? item.simpleElement : item.element return element.indexOf(this.queryExpression) !== -1 }) + this.pageObj.pageNo = 1 + this.handleCurrentChange() }, dragend () { this.$nextTick(() => { @@ -504,12 +519,29 @@ export default { } }) }) + }, + pageNo (val) { + this.pageObj.pageNo = val + this.handleCurrentChange() + }, + pageSize (val) { + this.pageObj.pageSize = val + localStorage.setItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId, val) + this.handleCurrentChange() + }, + handleCurrentChange () { + this.pageObj.total = this.tableData.length + this.currentTableData = this.tableData.slice( + (this.pageObj.pageNo - 1) * this.pageObj.pageSize, + this.pageObj.pageNo * this.pageObj.pageSize + ) } }, computed: { }, created () { // this.getPanelData() + this.pageObj.pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId) } } @@ -523,4 +555,24 @@ export default { padding-bottom: 0!important; width: calc(100% - 40px)!important; } + .query-page-option{ + width: 100%; + position: absolute; + background: #fff; + bottom: -34px; + } + /deep/ .pagination{ + padding-top: 0; + } + /deep/ .top-tool-btn--text{ + background: #fff; + border-radius: 2px 0 0 2px; + outline: none; + height: 32px; + border: 1px solid #d8dce1; + border-right: none; + line-height: 30px; + margin-right: -5px; + padding: 0 5px; + } diff --git a/nezha-fronted/src/components/layout/path_navigation/PathNavigation.vue b/nezha-fronted/src/components/layout/path_navigation/PathNavigation.vue index 8ab4cdac2..90863e755 100644 --- a/nezha-fronted/src/components/layout/path_navigation/PathNavigation.vue +++ b/nezha-fronted/src/components/layout/path_navigation/PathNavigation.vue @@ -177,6 +177,7 @@ +
@@ -208,11 +209,11 @@