fix: 纠正拼写错误、逻辑调整等

This commit is contained in:
chenjinsong
2022-12-21 11:40:49 +08:00
parent eca783fb71
commit 9c88eb5cbf
3 changed files with 17 additions and 21 deletions

View File

@@ -228,7 +228,7 @@ import {
getTabList, getTabList,
overwriteUrl, overwriteUrl,
urlParamsHandler, urlParamsHandler,
combinDrilldownTableWithUserConfig, combineDrilldownTableWithUserConfig,
getDnsMapData, getDnsMapData,
handleSpecialValue handleSpecialValue
} from '@/utils/tools' } from '@/utils/tools'
@@ -594,7 +594,7 @@ export default {
// const userId = localStorage.getItem(storageKey.userId) // const userId = localStorage.getItem(storageKey.userId)
const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview'
const metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s') const metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s')
const drillDownTableConfigs = await combinDrilldownTableWithUserConfig() const drillDownTableConfigs = await combineDrilldownTableWithUserConfig()
const currentTableConfig = drillDownTableConfigs.find(config => config.route === tableType) const currentTableConfig = drillDownTableConfigs.find(config => config.route === tableType)
const tables = currentTableConfig ? currentTableConfig.tables : [] const tables = currentTableConfig ? currentTableConfig.tables : []
const commonTabList = currentTableConfig ? currentTableConfig.tabs : [] const commonTabList = currentTableConfig ? currentTableConfig.tabs : []

View File

@@ -415,7 +415,6 @@ export function extensionEchartY (chart) {
// 该div用来盛放文本显示内容的方便对其悬浮位置进行处理 // 该div用来盛放文本显示内容的方便对其悬浮位置进行处理
const id = document.getElementById('extension') const id = document.getElementById('extension')
if (!id) { if (!id) {
const div = "<div id = 'extension' style=\"display:block\"></div>"
const contentDiv = document.createElement('div') const contentDiv = document.createElement('div')
contentDiv.setAttribute('id', 'extension') contentDiv.setAttribute('id', 'extension')
contentDiv.setAttribute('style', 'display:block') contentDiv.setAttribute('style', 'display:block')
@@ -938,28 +937,25 @@ export async function getDefaultCurTab (tableType, metric, columnName) {
export async function readDrilldownTableConfigByUser () { export async function readDrilldownTableConfigByUser () {
// 获取用户定制的自定义配置 // 获取用户定制的自定义配置
const userId = localStorage.getItem(storageKey.userId) const userId = localStorage.getItem(storageKey.userId)
const userLocalCongfig = await db[dbDrilldownTableConfig].get({ id: userId }) const userLocalConfig = await db[dbDrilldownTableConfig].get({ id: userId })
let defaultDrillDownTableConfigs = [] let defaultDrillDownTableConfigs = []
if (userLocalCongfig) { if (userLocalConfig) {
defaultDrillDownTableConfigs = userLocalCongfig.config defaultDrillDownTableConfigs = userLocalConfig.config
} }
return defaultDrillDownTableConfigs return defaultDrillDownTableConfigs
} }
export async function getConfigVersion (id) { export async function getConfigVersion (id) {
let defaultCongfigInDb = await db[dbDrilldownTableConfig].get({ id: id }) let defaultConfigInDb = await db[dbDrilldownTableConfig].get({ id: id })
let version if (!defaultConfigInDb) {
if (defaultCongfigInDb) { defaultConfigInDb = await db[dbDrilldownTableConfig].get({ id: 'default' })
version = defaultCongfigInDb ? defaultCongfigInDb.version : ''
} else {
defaultCongfigInDb = await db[dbDrilldownTableConfig].get({ id: 'default' })
} }
return version return defaultConfigInDb.version || ''
} }
export async function combinDrilldownTableWithUserConfig () { export async function combineDrilldownTableWithUserConfig () {
const defaultCongfigInDb = await db[dbDrilldownTableConfig].get({ id: 'default' }) const defaultConfigInDb = await db[dbDrilldownTableConfig].get({ id: 'default' })
const defaultConfigGroup = defaultCongfigInDb ? defaultCongfigInDb.config : [] const defaultConfigGroup = defaultConfigInDb ? defaultConfigInDb.config : []
const currentUserConfigGroup = await readDrilldownTableConfigByUser() const currentUserConfigGroup = await readDrilldownTableConfigByUser()
if (defaultConfigGroup && currentUserConfigGroup && currentUserConfigGroup.length > 0) { if (defaultConfigGroup && currentUserConfigGroup && currentUserConfigGroup.length > 0) {
defaultConfigGroup.forEach(defaultConfig => { defaultConfigGroup.forEach(defaultConfig => {
@@ -976,7 +972,7 @@ export async function combinDrilldownTableWithUserConfig () {
defaultTab.checked = currentUserTab.checked defaultTab.checked = currentUserTab.checked
if (defaultTab && defaultTab.hasMetricSearch === true) { if (defaultTab && defaultTab.hasMetricSearch === true) {
defaultTab.metrics.forEach(metric => { defaultTab.metrics.forEach(metric => {
if(currentUserTableConfig.columns) { if (currentUserTableConfig.columns) {
const sortColumns = [] const sortColumns = []
sortColumns.push(metric.columns[0]) sortColumns.push(metric.columns[0])
currentUserTableConfig.columns.forEach((column, index) => { currentUserTableConfig.columns.forEach((column, index) => {
@@ -995,7 +991,7 @@ export async function combinDrilldownTableWithUserConfig () {
} }
}) })
} else { } else {
if(currentUserTableConfig.columns) { if (currentUserTableConfig.columns) {
const sortColumns = [] const sortColumns = []
sortColumns.push(defaultTab.columns[0]) sortColumns.push(defaultTab.columns[0])
currentUserTableConfig.columns.forEach((column, index) => { currentUserTableConfig.columns.forEach((column, index) => {
@@ -1026,7 +1022,7 @@ export async function combinDrilldownTableWithUserConfig () {
export async function getUserDrilldownTableConfig (tableType, curMetric) { export async function getUserDrilldownTableConfig (tableType, curMetric) {
let list = [] let list = []
// 获取用户定制的自定义配置,如果没有,则使用默认的自定义配置 // 获取用户定制的自定义配置,如果没有,则使用默认的自定义配置
const drillDownTableConfigs = await combinDrilldownTableWithUserConfig() const drillDownTableConfigs = await combineDrilldownTableWithUserConfig()
const currentTableConfig = drillDownTableConfigs.find(config => config.route === tableType) const currentTableConfig = drillDownTableConfigs.find(config => config.route === tableType)
const commonTabList = currentTableConfig ? currentTableConfig.tabs : [] const commonTabList = currentTableConfig ? currentTableConfig.tabs : []
const tables = currentTableConfig ? currentTableConfig.tables : [] const tables = currentTableConfig ? currentTableConfig.tables : []

View File

@@ -201,7 +201,7 @@ import { ref } from 'vue'
import { operationType, unitTypes, networkTable, tableColumnType, networkDefaultLimit, curTabState, storageKey, dbDrilldownTableConfig, fromRoute } from '@/utils/constants' import { operationType, unitTypes, networkTable, tableColumnType, networkDefaultLimit, curTabState, storageKey, dbDrilldownTableConfig, fromRoute } from '@/utils/constants'
import { get } from '@/utils/http' import { get } from '@/utils/http'
import unitConvert from '@/utils/unit-convert' import unitConvert from '@/utils/unit-convert'
import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combinDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue, getConfigVersion } from '@/utils/tools' import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combineDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue, getConfigVersion } from '@/utils/tools'
import { getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
import chartMixin from '@/views/charts2/chart-mixin' import chartMixin from '@/views/charts2/chart-mixin'
import { db } from '@/indexedDB' import { db } from '@/indexedDB'
@@ -1866,7 +1866,7 @@ export default {
this.commonColumnList = null this.commonColumnList = null
this.userId = localStorage.getItem(storageKey.userId) this.userId = localStorage.getItem(storageKey.userId)
this.drillDownTableConfigs = await combinDrilldownTableWithUserConfig() this.drillDownTableConfigs = await combineDrilldownTableWithUserConfig()
this.tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' this.tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview'
// 是否需要dns的qtype和rcode的数据字典 // 是否需要dns的qtype和rcode的数据字典
if (this.tableType === fromRoute.dnsServiceInsights) { if (this.tableType === fromRoute.dnsServiceInsights) {