fix: 调整networkoverview的图表位置,增加app-card图的resize逻辑
This commit is contained in:
@@ -9,7 +9,8 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #353636;
|
color: #353636;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
height: 32px;
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line-select-metric {
|
.line-select-metric {
|
||||||
@@ -59,7 +60,6 @@
|
|||||||
grid-gap: 20px;
|
grid-gap: 20px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
height: calc(100% - 24px);
|
|
||||||
|
|
||||||
.app-card {
|
.app-card {
|
||||||
border: 1px solid #E2E5EC;
|
border: 1px solid #E2E5EC;
|
||||||
|
|||||||
@@ -162,6 +162,12 @@ export function valueToRangeValue (value, unitType) {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
case unitTypes.qps: {
|
||||||
|
if (values[0] < 0.01) {
|
||||||
|
return ['<0.01', 'qps']
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
default: break
|
default: break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
:col-num="24"
|
:col-num="24"
|
||||||
:is-draggable="!panelLock"
|
:is-draggable="!panelLock"
|
||||||
:is-resizable="!panelLock"
|
:is-resizable="!panelLock"
|
||||||
:margin="[20, 20]"
|
:margin="[rowMargin, colMargin]"
|
||||||
:row-height="40"
|
:row-height="rowHeight"
|
||||||
:vertical-compact="true"
|
:vertical-compact="true"
|
||||||
:use-css-transforms="false"
|
:use-css-transforms="false"
|
||||||
>
|
>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
import VueGridLayout from 'vue-grid-layout'
|
import VueGridLayout from 'vue-grid-layout'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import Chart from '@/views/charts2/Chart'
|
import Chart from '@/views/charts2/Chart'
|
||||||
import { panelTypeAndRouteMapping, storageKey, drillDownPanelTypeMapping } from '@/utils/constants'
|
import { panelTypeAndRouteMapping, drillDownPanelTypeMapping } from '@/utils/constants'
|
||||||
import { typeMapping } from '@/views/charts2/chart-tools'
|
import { typeMapping } from '@/views/charts2/chart-tools'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
@@ -54,7 +54,11 @@ export default {
|
|||||||
return {
|
return {
|
||||||
panelTypeAndRouteMapping,
|
panelTypeAndRouteMapping,
|
||||||
typeMapping,
|
typeMapping,
|
||||||
layout: []
|
layout: [],
|
||||||
|
rowHeight: 40,
|
||||||
|
rowMargin: 20,
|
||||||
|
colMargin: 20,
|
||||||
|
debounceFunc: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -73,14 +77,16 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
chartList (n) {
|
chartList (n) {
|
||||||
if (!_.isEmpty(n)) {
|
if (!_.isEmpty(n)) {
|
||||||
|
let layout = []
|
||||||
if (this.panelType === panelTypeAndRouteMapping.networkAppPerformance) {
|
if (this.panelType === panelTypeAndRouteMapping.networkAppPerformance) {
|
||||||
this.layout = n.filter(c => c.type === typeMapping.npm.npmTabs || c.params.tabIndex === this.npmTabIndex)
|
layout = n.filter(c => c.type === typeMapping.npm.npmTabs || c.params.tabIndex === this.npmTabIndex)
|
||||||
} else if (Object.values(drillDownPanelTypeMapping).indexOf(this.panelType) >= -1) {
|
} else if (Object.values(drillDownPanelTypeMapping).indexOf(this.panelType) >= -1) {
|
||||||
this.layout = n.filter(c => c.type === typeMapping.npm.npmTabs || c.params.tabIndex === this.npmTabIndex || !c.params.hasOwnProperty('tabIndex'))
|
layout = n.filter(c => c.type === typeMapping.npm.npmTabs || c.params.tabIndex === this.npmTabIndex || !c.params.hasOwnProperty('tabIndex'))
|
||||||
} else {
|
} else {
|
||||||
this.layout = [...n]
|
layout = [...n]
|
||||||
}
|
}
|
||||||
const overviewAppChart = n.find(c => c.type === typeMapping.networkOverview.appList)
|
|
||||||
|
/*const overviewAppChart = layout.find(c => c.type === typeMapping.networkOverview.appList)
|
||||||
let actuallyLength = 0
|
let actuallyLength = 0
|
||||||
if (overviewAppChart) {
|
if (overviewAppChart) {
|
||||||
const params = overviewAppChart.params.app ? overviewAppChart.params : { app: [] }
|
const params = overviewAppChart.params.app ? overviewAppChart.params : { app: [] }
|
||||||
@@ -90,6 +96,13 @@ export default {
|
|||||||
actuallyLength = params.app.find(p => p.user === 'default').list.length + 1
|
actuallyLength = params.app.find(p => p.user === 'default').list.length + 1
|
||||||
}
|
}
|
||||||
overviewAppChart.h = actuallyLength % 3 > 0 ? (Math.floor(actuallyLength / 3) + 1) * 2 + 2 : Math.floor(actuallyLength / 3) * 2 + 2
|
overviewAppChart.h = actuallyLength % 3 > 0 ? (Math.floor(actuallyLength / 3) + 1) * 2 + 2 : Math.floor(actuallyLength / 3) * 2 + 2
|
||||||
|
}*/
|
||||||
|
this.layout = layout
|
||||||
|
const overviewAppChart = layout.find(c => c.type === typeMapping.networkOverview.appList)
|
||||||
|
if (overviewAppChart) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.resizeAppChart()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -106,11 +119,27 @@ export default {
|
|||||||
},
|
},
|
||||||
resizeLine () {
|
resizeLine () {
|
||||||
this.$refs.chartGrid.resizeLine()
|
this.$refs.chartGrid.resizeLine()
|
||||||
|
},
|
||||||
|
resizeAppChart () {
|
||||||
|
const appCardsDom = document.querySelector('.app-cards')
|
||||||
|
const layout = _.cloneDeep(this.layout)
|
||||||
|
const overviewAppChart = layout.find(c => c.type === typeMapping.networkOverview.appList)
|
||||||
|
if (appCardsDom) {
|
||||||
|
const cardsHeight = appCardsDom.offsetHeight
|
||||||
|
if (cardsHeight) {
|
||||||
|
const headerHeight = 24
|
||||||
|
overviewAppChart.h = (cardsHeight + headerHeight + this.rowMargin) / (this.rowHeight + this.rowMargin)
|
||||||
|
this.layout = layout
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
this.debounceFunc = _.debounce(this.resizeAppChart, 400)
|
||||||
|
window.addEventListener('resize', this.debounceFunc)
|
||||||
|
},
|
||||||
|
beforeUnmount () {
|
||||||
|
window.removeEventListener('resize', this.debounceFunc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -42,19 +42,14 @@ import { useRoute } from 'vue-router'
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import {
|
import {
|
||||||
panelTypeAndRouteMapping,
|
panelTypeAndRouteMapping,
|
||||||
bytesColumnNameGroupForNpm,
|
|
||||||
scoreUrl,
|
|
||||||
customTableTitlesForAppPerformance,
|
|
||||||
operationType,
|
|
||||||
curTabState,
|
curTabState,
|
||||||
drillDownPanelTypeMapping
|
drillDownPanelTypeMapping
|
||||||
} from '@/utils/constants'
|
} from '@/utils/constants'
|
||||||
import { getPanelList, getChartList } from '@/utils/api'
|
import { getPanelList, getChartList } from '@/utils/api'
|
||||||
import { getNowTime, getSecond } from '@/utils/date-util'
|
import { getNowTime, getSecond } from '@/utils/date-util'
|
||||||
import { getTypeCategory } from '@/views/charts/charts/tools'
|
import { getTypeCategory } from '@/views/charts/charts/tools'
|
||||||
import { computeScore, urlParamsHandler, overwriteUrl } from '@/utils/tools'
|
import { urlParamsHandler, overwriteUrl } from '@/utils/tools'
|
||||||
import ChartList from '@/views/charts2/ChartList'
|
import ChartList from '@/views/charts2/ChartList'
|
||||||
import { get } from '@/utils/http'
|
|
||||||
import { useStore } from 'vuex'
|
import { useStore } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
Reference in New Issue
Block a user