fix: 执行lint

This commit is contained in:
chenjinsong
2022-12-08 16:09:46 +08:00
parent 136d98649d
commit 4bba03d41d
26 changed files with 362 additions and 371 deletions

View File

@@ -12,8 +12,9 @@ module.exports = {
], ],
plugins: [ plugins: [
'@vue/babel-plugin-jsx', '@vue/babel-plugin-jsx',
['@babel/proposal-class-properties', { loose: true }], ['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-proposal-private-methods', { loose: true }], ['@babel/plugin-proposal-private-methods', { loose: true }],
['@babel/plugin-proposal-private-property-in-object', { loose: true }],
'@babel/transform-runtime', '@babel/transform-runtime',
'lodash' 'lodash'
], ],

File diff suppressed because one or more lines are too long

View File

@@ -23,7 +23,7 @@ import CodeMirror from 'codemirror'
import { toRaw } from 'vue' import { toRaw } from 'vue'
import _ from 'lodash' import _ from 'lodash'
import { columnType } from '@/components/advancedSearch/meta/meta' import { columnType } from '@/components/advancedSearch/meta/meta'
import {handleErrorTip} from "@/components/advancedSearch/meta/error"; import { handleErrorTip } from '@/components/advancedSearch/meta/error'
export default { export default {
name: 'TextMode', name: 'TextMode',

View File

@@ -233,6 +233,7 @@ export default class Parser {
break break
} }
} else if (s === ' ') { } else if (s === ' ') {
// 预留
} else if (s === '(') { } else if (s === '(') {
token = new Token(types.leftBracket, s) token = new Token(types.leftBracket, s)
token.setStart(i) token.setStart(i)

View File

@@ -4,7 +4,7 @@ import { riskLevelMapping } from '@/utils/constants'
import _ from 'lodash' import _ from 'lodash'
// 补全语句,用于解析 // 补全语句,用于解析
const sqlPrev = 'select a from b where ' const sqlPrev = 'select a from b where '
export default class SqlParser/* extends SqlParserVisitor*/ { export default class SqlParser/* extends SqlParserVisitor */ {
constructor (init, columnList) { constructor (init, columnList) {
// super() // super()
this.tempMeta = null this.tempMeta = null

View File

@@ -23,8 +23,8 @@
</template> </template>
<script> <script>
import { defaultPageSize } from '@/utils/constants' import { defaultPageSize, storageKey } from '@/utils/constants'
import { storageKey } from '@/utils/constants'
import { urlParamsHandler, overwriteUrl } from '@/utils/tools' import { urlParamsHandler, overwriteUrl } from '@/utils/tools'
import { ref } from 'vue' import { ref } from 'vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'

View File

@@ -383,7 +383,7 @@ export default {
async mounted () { async mounted () {
this.from = Object.keys(this.entityType)[0] this.from = Object.keys(this.entityType)[0]
// 是否需要dns的qtype和rcode的数据字典 // 是否需要dns的qtype和rcode的数据字典
if(this.$route.params.typeName === fromRoute.dnsServiceInsights) { if (this.$route.params.typeName === fromRoute.dnsServiceInsights) {
this.dnsQtypeMapData = await getDnsMapData('dnsQtype') this.dnsQtypeMapData = await getDnsMapData('dnsQtype')
this.dnsRcodeMapData = await getDnsMapData('dnsRcode') this.dnsRcodeMapData = await getDnsMapData('dnsRcode')
} }
@@ -463,7 +463,7 @@ export default {
get(curTableInCode.url.drilldownList, params).then(async response => { get(curTableInCode.url.drilldownList, params).then(async response => {
if (response.code === 200) { if (response.code === 200) {
this.breadcrumbColumnValueListShow = response.data.result this.breadcrumbColumnValueListShow = response.data.result
if(this.from === fromRoute.dnsServiceInsights) { if (this.from === fromRoute.dnsServiceInsights) {
this.dnsQtypeMapData = await getDnsMapData('dnsQtype') this.dnsQtypeMapData = await getDnsMapData('dnsQtype')
this.dnsRcodeMapData = await getDnsMapData('dnsRcode') this.dnsRcodeMapData = await getDnsMapData('dnsRcode')
} }

View File

@@ -4,27 +4,27 @@ const openMock = false
if (openMock) { if (openMock) {
Mock.mock(new RegExp(BASE_CONFIG.baseUrl + 'visual/panel.*'), 'get', function (requestObj) { Mock.mock(new RegExp(BASE_CONFIG.baseUrl + 'visual/panel.*'), 'get', function (requestObj) {
return { return {
"msg": "success", msg: 'success',
"code": 200, code: 200,
"data": { data: {
"total": 1, total: 1,
"pageSize": 10, pageSize: 10,
"pages": 1, pages: 1,
"pageNo": 1, pageNo: 1,
"list": [ list: [
{ {
"id": 2, id: 2,
"name": "Network & App", name: 'Network & App',
"i18n": "npm.npm", i18n: 'npm.npm',
"type": 2, type: 2,
"params": "", params: '',
"cby": 1, cby: 1,
"ctime": "2021-06-03 08:27:32", ctime: '2021-06-03 08:27:32',
"uby": 1, uby: 1,
"utime": "2021-06-03 08:28:10", utime: '2021-06-03 08:28:10',
"remark": "", remark: '',
"state": 1, state: 1,
"buildIn": 1 buildIn: 1
} }
] ]
} }

View File

@@ -58,8 +58,8 @@ const panel = {
httpCancel: null, // 终止http请求 httpCancel: null, // 终止http请求
rangeEchartsData: {}, // 框选echarts图表 rangeEchartsData: {}, // 框选echarts图表
routerHistoryList: [], // 路由跳转记录列表 routerHistoryList: [], // 路由跳转记录列表
dnsQtypeMapData:[], dnsQtypeMapData: [],
dnsRcodeMapData:[] dnsRcodeMapData: []
}, },
mutations: { mutations: {
setShowRightBox (state, flag) { setShowRightBox (state, flag) {

View File

@@ -64,9 +64,9 @@ const user = {
if (tempArr[1]) { if (tempArr[1]) {
tempArr = tempArr[1].split('&') tempArr = tempArr[1].split('&')
tempArr.forEach(t => { tempArr.forEach(t => {
let firstEqualIndex = t.indexOf('=') const firstEqualIndex = t.indexOf('=')
let key = t.substring(0, firstEqualIndex) const key = t.substring(0, firstEqualIndex)
let value = t.substring(firstEqualIndex + 1) const value = t.substring(firstEqualIndex + 1)
query[key] = value query[key] = value
}) })
} }
@@ -97,9 +97,9 @@ const user = {
version: defaultConfigs.version, version: defaultConfigs.version,
config: defaultConfigs.config config: defaultConfigs.config
}) })
let userId = localStorage.getItem(storageKey.userId) const userId = localStorage.getItem(storageKey.userId)
let oldVersion = await getConfigVersion(userId) const oldVersion = await getConfigVersion(userId)
if(oldVersion !== defaultConfigs.version ){ if (oldVersion !== defaultConfigs.version) {
db[dbDrilldownTableConfig].delete(userId) db[dbDrilldownTableConfig].delete(userId)
} }
} }

View File

@@ -877,10 +877,10 @@ export async function getDnsMapData (type) {
} }
return codeValueMap return codeValueMap
} }
export function handleSpecialValue(value){ export function handleSpecialValue (value) {
value = value.replaceAll("'", "\\\\'") value = value.replaceAll("'", "\\\\'")
.replaceAll('"','\\"') .replaceAll('"', '\\"')
.replaceAll('&','%26') .replaceAll('&', '%26')
return value return value
} }
export function combineTabList (tableType, list, commonTabList) { export function combineTabList (tableType, list, commonTabList) {
@@ -946,9 +946,9 @@ export async function readDrilldownTableConfigByUser () {
export async function getConfigVersion (id) { export async function getConfigVersion (id) {
let defaultCongfigInDb = await db[dbDrilldownTableConfig].get({ id: id }) let defaultCongfigInDb = await db[dbDrilldownTableConfig].get({ id: id })
let version let version
if(defaultCongfigInDb) { if (defaultCongfigInDb) {
version = defaultCongfigInDb ? defaultCongfigInDb.version : '' version = defaultCongfigInDb ? defaultCongfigInDb.version : ''
}else { } else {
defaultCongfigInDb = await db[dbDrilldownTableConfig].get({ id: 'default' }) defaultCongfigInDb = await db[dbDrilldownTableConfig].get({ id: 'default' })
} }
return version return version

View File

@@ -42,6 +42,7 @@
</template> </template>
<script> <script>
import _ from 'lodash'
export default { export default {
name: 'ChartDomainRecursiveResolve', name: 'ChartDomainRecursiveResolve',
props: { props: {

View File

@@ -47,7 +47,7 @@ export default {
}, },
methods: { methods: {
handleQueryParams (queryParams) { handleQueryParams (queryParams) {
return this.timeFilter = { this.timeFilter = {
startTime: Number(queryParams.startTime) * 1000, startTime: Number(queryParams.startTime) * 1000,
endTime: Number(queryParams.endTime) * 1000 endTime: Number(queryParams.endTime) * 1000
} }

View File

@@ -17,7 +17,6 @@
</template> </template>
<script> <script>
import _ from 'lodash'
export default { export default {
name: 'ChartOneSituationStatistics', name: 'ChartOneSituationStatistics',
props: { props: {

View File

@@ -100,7 +100,7 @@
<div class="ship-body-list-title">{{$t('relationShip.alert')}}</div> <div class="ship-body-list-title">{{$t('relationShip.alert')}}</div>
<div class="ship-body-list-value security"> <div class="ship-body-list-value security">
<template v-if="shipSeverity.length > 0"> <template v-if="shipSeverity.length > 0">
<span v-for="ship in shipSeverity" class="ship-severity"> <span v-for="ship in shipSeverity" class="ship-severity" :key="ship">
<span class="ship-body-list-security-alert" :class="iconClass(ship)">{{ ship.eventSeverity }}</span> <span class="ship-body-list-security-alert" :class="iconClass(ship)">{{ ship.eventSeverity }}</span>
<span class="ship-body-list-security-length">{{ ship.totalNumberOfEvents }}</span> <span class="ship-body-list-security-length">{{ ship.totalNumberOfEvents }}</span>
</span> </span>

View File

@@ -88,7 +88,7 @@ export default {
layout = [...n] layout = [...n]
} }
/*const overviewAppChart = layout.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: [] }
@@ -98,7 +98,7 @@ 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 this.layout = layout
const overviewAppChart = layout.find(c => c.type === typeMapping.networkOverview.appList) const overviewAppChart = layout.find(c => c.type === typeMapping.networkOverview.appList)
if (overviewAppChart) { if (overviewAppChart) {

View File

@@ -1,12 +1,12 @@
export const appTestData = [ export const appTestData = [
{ {
"type": "bytes", type: 'bytes',
"l11": { l11: {
"analysis": { analysis: {
"rate": 2, rate: 2,
"total":2245435 total: 2245435
}, },
"values": [ values: [
[ [
1435781430781, 1435781430781,
3 3
@@ -17,12 +17,12 @@ export const appTestData = [
] ]
] ]
}, },
"a0": { a0: {
"analysis": { analysis: {
"rate": 2, rate: 2,
"total":3245435 total: 3245435
}, },
"values": [ values: [
[ [
1435781430781, 1435781430781,
1 1
@@ -35,13 +35,13 @@ export const appTestData = [
} }
}, },
{ {
"type": "packets", type: 'packets',
"l11": { l11: {
"analysis": { analysis: {
"rate": 3, rate: 3,
"total":4245435 total: 4245435
}, },
"values": [ values: [
[ [
1435781430781, 1435781430781,
4 4
@@ -52,12 +52,12 @@ export const appTestData = [
] ]
] ]
}, },
"a0": { a0: {
"analysis": { analysis: {
"rate": 3, rate: 3,
"total":2245435 total: 2245435
}, },
"values": [ values: [
[ [
1435781430781, 1435781430781,
2 2
@@ -70,13 +70,13 @@ export const appTestData = [
} }
}, },
{ {
"type": "sessions", type: 'sessions',
"l11": { l11: {
"analysis": { analysis: {
"rate": 2, rate: 2,
"total": 2245435 total: 2245435
}, },
"values": [ values: [
[ [
1435781430781, 1435781430781,
3 3
@@ -87,12 +87,12 @@ export const appTestData = [
] ]
] ]
}, },
"a0": { a0: {
"analysis": { analysis: {
"rate": 3, rate: 3,
"total": 3245435 total: 3245435
}, },
"values": [ values: [
[ [
1435781430781, 1435781430781,
1 1
@@ -107,64 +107,64 @@ export const appTestData = [
] ]
export const appPrevTestData = [ export const appPrevTestData = [
{ {
"type": "bytes", type: 'bytes',
"l11": { l11: {
"rate": 2, rate: 2,
"total":3245435 total: 3245435
}, },
"a0": { a0: {
"rate": 3, rate: 3,
"total":4245435 total: 4245435
} }
}, },
{ {
"type": "packets", type: 'packets',
"l11": { l11: {
"rate": 2, rate: 2,
"total":3245435 total: 3245435
}, },
"a0": { a0: {
"rate": 4, rate: 4,
"total":4245435 total: 4245435
} }
}, },
{ {
"type": "sessions", type: 'sessions',
"l11": { l11: {
"rate": 3, rate: 3,
"total":233451 total: 233451
}, },
"a0": { a0: {
"rate": 3, rate: 3,
"total":4245435 total: 4245435
} }
} }
] ]
export const providerTestData = [ export const providerTestData = [
{ {
"type": "bytes", type: 'bytes',
"d3": { d3: {
"analysis": { analysis: {
"rate": 4, rate: 4,
"total":4245435 total: 4245435
}, },
"values": [ values: [
[ [
1435781430781, 1435781430781,
"1" '1'
], ],
[ [
1435781431781, 1435781431781,
"1" '1'
] ]
] ]
}, },
"a0": { a0: {
"analysis": { analysis: {
"rate": 2, rate: 2,
"total":3245435 total: 3245435
}, },
"values": [ values: [
[ [
1435781430781, 1435781430781,
1 1
@@ -177,13 +177,13 @@ export const providerTestData = [
} }
}, },
{ {
"type": "packets", type: 'packets',
"d3": { d3: {
"analysis": { analysis: {
"rate": 3, rate: 3,
"total": 1245435 total: 1245435
}, },
"values": [ values: [
[ [
1435781430781, 1435781430781,
2 2
@@ -194,12 +194,12 @@ export const providerTestData = [
] ]
] ]
}, },
"a0": { a0: {
"analysis": { analysis: {
"rate": 3, rate: 3,
"total": 3245435 total: 3245435
}, },
"values": [ values: [
[ [
1435781430781, 1435781430781,
5 5
@@ -212,29 +212,29 @@ export const providerTestData = [
} }
}, },
{ {
"type": "sessions", type: 'sessions',
"d3": { d3: {
"analysis": { analysis: {
"rate": 2, rate: 2,
"total":2245435 total: 2245435
}, },
"values": [ values: [
[ [
1435781430781, 1435781430781,
"1" '1'
], ],
[ [
1435781431781, 1435781431781,
"1" '1'
] ]
] ]
}, },
"a0": { a0: {
"analysis": { analysis: {
"rate": 3, rate: 3,
"total": 3245435 total: 3245435
}, },
"values": [ values: [
[ [
1435781430781, 1435781430781,
1 1
@@ -249,36 +249,36 @@ export const providerTestData = [
] ]
export const providerPrevTestData = [ export const providerPrevTestData = [
{ {
"type": "bytes", type: 'bytes',
"d3": { d3: {
"rate": 2, rate: 2,
"total":2245435 total: 2245435
}, },
"a0": { a0: {
"rate": 3, rate: 3,
"total":4245435 total: 4245435
} }
}, },
{ {
"type": "packets", type: 'packets',
"d3": { d3: {
"rate": 2, rate: 2,
"total":3245435 total: 3245435
}, },
"a0": { a0: {
"rate": 4, rate: 4,
"total":4245435 total: 4245435
} }
}, },
{ {
"type": "sessions", type: 'sessions',
"d3": { d3: {
"rate": 3, rate: 3,
"total":233451 total: 233451
}, },
"a0": { a0: {
"rate": 3, rate: 3,
"total":4245435 total: 4245435
} }
} }
] ]

View File

@@ -60,7 +60,7 @@
<script> <script>
import { api } from '@/utils/api' import { api } from '@/utils/api'
import { dateFormatByAppearance, getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
import { get } from '@/utils/http' import { get } from '@/utils/http'
import chartMixin from '@/views/charts2/chart-mixin' import chartMixin from '@/views/charts2/chart-mixin'

View File

@@ -1,233 +1,233 @@
export const mapData = [ export const mapData = [
{ {
"score": 5, score: 5,
"locationId": "AU", locationId: 'AU',
"direction": "server", direction: 'server',
"locationCountry": "australia" locationCountry: 'australia'
}, },
{ {
"score": 3, score: 3,
"locationId": "AT", locationId: 'AT',
"direction": "server", direction: 'server',
"locationCountry": "austria" locationCountry: 'austria'
}, },
{ {
"score": 1, score: 1,
"locationId": "", locationId: '',
"direction": "server", direction: 'server',
"locationCountry": "bolivia" locationCountry: 'bolivia'
}, },
{ {
"score": 5, score: 5,
"locationId": "BR", locationId: 'BR',
"direction": "server", direction: 'server',
"locationCountry": "brazil" locationCountry: 'brazil'
}, },
{ {
"score": 1, score: 1,
"locationId": "CM", locationId: 'CM',
"direction": "server", direction: 'server',
"locationCountry": "cameroon" locationCountry: 'cameroon'
}, },
{ {
"score": 5, score: 5,
"locationId": "CL", locationId: 'CL',
"direction": "server", direction: 'server',
"locationCountry": "chile" locationCountry: 'chile'
}, },
{ {
"score": 4, score: 4,
"locationId": "CN", locationId: 'CN',
"direction": "server", direction: 'server',
"locationCountry": "china" locationCountry: 'china'
}, },
{ {
"score": 1, score: 1,
"locationId": "CY", locationId: 'CY',
"direction": "server", direction: 'server',
"locationCountry": "cyprus" locationCountry: 'cyprus'
}, },
{ {
"score": 1, score: 1,
"locationId": "CZ", locationId: 'CZ',
"direction": "server", direction: 'server',
"locationCountry": "czech republic" locationCountry: 'czech republic'
}, },
{ {
"score": 5, score: 5,
"locationId": "FR", locationId: 'FR',
"direction": "server", direction: 'server',
"locationCountry": "france" locationCountry: 'france'
}, },
{ {
"score": 2, score: 2,
"locationId": "ID", locationId: 'ID',
"direction": "server", direction: 'server',
"locationCountry": "indonesia" locationCountry: 'indonesia'
}, },
{ {
"score": 2, score: 2,
"locationId": "IE", locationId: 'IE',
"direction": "server", direction: 'server',
"locationCountry": "ireland" locationCountry: 'ireland'
}, },
{ {
"score": 5, score: 5,
"locationId": "JP", locationId: 'JP',
"direction": "server", direction: 'server',
"locationCountry": "japan" locationCountry: 'japan'
}, },
{ {
"score": 1, score: 1,
"locationId": "KW", locationId: 'KW',
"direction": "server", direction: 'server',
"locationCountry": "kuwait" locationCountry: 'kuwait'
}, },
{ {
"score": 1, score: 1,
"locationId": "KG", locationId: 'KG',
"direction": "server", direction: 'server',
"locationCountry": "kyrgyzstan" locationCountry: 'kyrgyzstan'
}, },
{ {
"score": 2, score: 2,
"locationId": "MX", locationId: 'MX',
"direction": "server", direction: 'server',
"locationCountry": "mexico" locationCountry: 'mexico'
}, },
{ {
"score": 1, score: 1,
"locationId": "CN-AH", locationId: 'CN-AH',
"direction": "server", direction: 'server',
"locationCountry": "moldova" locationCountry: 'moldova'
}, },
{ {
"score": 4, score: 4,
"locationId": "MN", locationId: 'MN',
"direction": "server", direction: 'server',
"locationCountry": "mongolia" locationCountry: 'mongolia'
}, },
{ {
"score": 1, score: 1,
"locationId": "MZ", locationId: 'MZ',
"direction": "server", direction: 'server',
"locationCountry": "mozambique" locationCountry: 'mozambique'
}, },
{ {
"score": 1, score: 1,
"locationId": "NZ", locationId: 'NZ',
"direction": "server", direction: 'server',
"locationCountry": "new zealand" locationCountry: 'new zealand'
}, },
{ {
"score": 4, score: 4,
"locationId": "NE", locationId: 'NE',
"direction": "server", direction: 'server',
"locationCountry": "niger" locationCountry: 'niger'
}, },
{ {
"score": 1, score: 1,
"locationId": "PT", locationId: 'PT',
"direction": "server", direction: 'server',
"locationCountry": "portugal" locationCountry: 'portugal'
}, },
{ {
"score": 3, score: 3,
"locationId": "RO", locationId: 'RO',
"direction": "server", direction: 'server',
"locationCountry": "romania" locationCountry: 'romania'
}, },
{ {
"score": 1, score: 1,
"locationId": "SR", locationId: 'SR',
"direction": "server", direction: 'server',
"locationCountry": "suriname" locationCountry: 'suriname'
}, },
{ {
"score": 4, score: 4,
"locationId": "SE", locationId: 'SE',
"direction": "server", direction: 'server',
"locationCountry": "sweden" locationCountry: 'sweden'
}, },
{ {
"score": 3, score: 3,
"locationId": "CH", locationId: 'CH',
"direction": "server", direction: 'server',
"locationCountry": "switzerland" locationCountry: 'switzerland'
}, },
{ {
"score": 1, score: 1,
"locationId": "TH", locationId: 'TH',
"direction": "server", direction: 'server',
"locationCountry": "thailand" locationCountry: 'thailand'
}, },
{ {
"score": 5, score: 5,
"locationId": "", locationId: '',
"direction": "server", direction: 'server',
"locationCountry": "the netherlands" locationCountry: 'the netherlands'
}, },
{ {
"score": 1, score: 1,
"locationId": "TK", locationId: 'TK',
"direction": "server", direction: 'server',
"locationCountry": "tokelau" locationCountry: 'tokelau'
}, },
{ {
"score": 2, score: 2,
"locationId": "AE", locationId: 'AE',
"direction": "server", direction: 'server',
"locationCountry": "united arab emirates" locationCountry: 'united arab emirates'
}, },
{ {
"score": 6, score: 6,
"locationId": "RU", locationId: 'RU',
"direction": "server", direction: 'server',
"locationCountry": "russia" locationCountry: 'russia'
}, },
{ {
"score": 6, score: 6,
"locationId": "US", locationId: 'US',
"direction": "server", direction: 'server',
"locationCountry": "united states" locationCountry: 'united states'
}, },
{ {
"score": 3, score: 3,
"locationId": "UZ", locationId: 'UZ',
"direction": "server", direction: 'server',
"locationCountry": "uzbekistan" locationCountry: 'uzbekistan'
}, },
{ {
"score": 1, score: 1,
"locationId": "", locationId: '',
"direction": "server", direction: 'server',
"locationCountry": "venezuela" locationCountry: 'venezuela'
} }
] ]
export const drillDownData = [ export const drillDownData = [
{ {
"score": 1, score: 1,
"locationId": "CN-AH", locationId: 'CN-AH',
"direction": "server", direction: 'server',
"locationCountry": "moldova" locationCountry: 'moldova'
}, },
{ {
"score": 3, score: 3,
"locationId": "CN-SH", locationId: 'CN-SH',
"direction": "server", direction: 'server',
"locationCountry": "moldova" locationCountry: 'moldova'
}, },
{ {
"score": 6, score: 6,
"locationId": "CN-CQ", locationId: 'CN-CQ',
"direction": "server", direction: 'server',
"locationCountry": "moldova" locationCountry: 'moldova'
}, },
{ {
"score": 2, score: 2,
"locationId": "CN-FJ", locationId: 'CN-FJ',
"direction": "server", direction: 'server',
"locationCountry": "moldova" locationCountry: 'moldova'
} }
] ]

View File

@@ -201,12 +201,11 @@ 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, getUserDrilldownTableGeo, readDrilldownTableConfigByUser, combinDrilldownTableWithUserConfig, getDnsMapData,handleSpecialValue,getConfigVersion } from '@/utils/tools' import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combinDrilldownTableWithUserConfig, 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 ChartNoData from '@/views/charts/charts/ChartNoData'
import { db } from '@/indexedDB' import { db } from '@/indexedDB'
import { api, getDictList } from '@/utils/api' import _ from 'lodash'
export default { export default {
name: 'NetworkOverviewTabs', name: 'NetworkOverviewTabs',
@@ -274,9 +273,6 @@ export default {
default: 'Bits/s' default: 'Bits/s'
} }
}, },
components: {
ChartNoData
},
watch: { watch: {
timeFilter: { timeFilter: {
handler (n) { handler (n) {
@@ -623,14 +619,14 @@ export default {
endTime: getSecond(this.timeFilter.endTime) endTime: getSecond(this.timeFilter.endTime)
} }
if (tabList.length > 0) { if (tabList.length > 0) {
let conditionGroup = tabList.filter(item => item != '') const conditionGroup = tabList.filter(item => item != '')
let conditionHandleRlt = [] const conditionHandleRlt = []
conditionGroup.forEach(condition => { conditionGroup.forEach(condition => {
condition = handleSpecialValue(condition)//condition.replaceAll("'", "\\\\'") condition = handleSpecialValue(condition)// condition.replaceAll("'", "\\\\'")
condition = "'"+condition+ "'" condition = "'" + condition + "'"
conditionHandleRlt.push(condition) conditionHandleRlt.push(condition)
}) })
queryParams.params = conditionHandleRlt.join(",") queryParams.params = conditionHandleRlt.join(',')
queryParams.type = curTab.prop queryParams.type = curTab.prop
} }
@@ -692,7 +688,7 @@ export default {
} }
item[tableColumn.prop] = [(item[tableColumn.prop] || item[tableColumn.prop] === 0) ? item[tableColumn.prop] : '', trend, trendPercent] item[tableColumn.prop] = [(item[tableColumn.prop] || item[tableColumn.prop] === 0) ? item[tableColumn.prop] : '', trend, trendPercent]
}) })
}else { } else {
tableColumn.showError = true tableColumn.showError = true
tableColumn.errorMsg = response.message || 'Unknown' tableColumn.errorMsg = response.message || 'Unknown'
} }
@@ -730,12 +726,12 @@ export default {
} }
if (Object.keys(item.scoreGroup).length >= 5) { if (Object.keys(item.scoreGroup).length >= 5) {
item.score = computeScore(item.scoreGroup) item.score = computeScore(item.scoreGroup)
if(!_.isNumber(item.score)){ if (!_.isNumber(item.score)) {
item.score = 0 item.score = 0
} }
} }
}) })
}else { } else {
tableColumn.showError = true tableColumn.showError = true
tableColumn.errorMsg = response.message || 'Unknown' tableColumn.errorMsg = response.message || 'Unknown'
} }
@@ -752,7 +748,7 @@ export default {
} }
get(self.gerColumnUrl(tableColumn), queryCycleParams).then(response => { get(self.gerColumnUrl(tableColumn), queryCycleParams).then(response => {
if (response.code === 200) { if (response.code === 200) {
if(!tableColumn.showError){ if (!tableColumn.showError) {
tableColumn.showError = false tableColumn.showError = false
tableColumn.errorMsg = '' tableColumn.errorMsg = ''
} }
@@ -803,7 +799,7 @@ export default {
item[tableColumn.prop] = [(item[tableColumn.prop] || item[tableColumn.prop] === 0) ? item[tableColumn.prop] : '', trend, trendPercent] item[tableColumn.prop] = [(item[tableColumn.prop] || item[tableColumn.prop] === 0) ? item[tableColumn.prop] : '', trend, trendPercent]
} }
}) })
}else { } else {
tableColumn.showError = true tableColumn.showError = true
tableColumn.errorMsg = response.message || 'Unknown' tableColumn.errorMsg = response.message || 'Unknown'
} }
@@ -871,7 +867,7 @@ export default {
this.tableData.forEach(val => { this.tableData.forEach(val => {
arr.push(val) arr.push(val)
}) })
if (column.order == 'descending') { if (column.order === 'descending') {
arr.sort((a, b) => { arr.sort((a, b) => {
const str1 = Array.isArray(a[column.prop]) ? a[column.prop][0] : a[column.prop] const str1 = Array.isArray(a[column.prop]) ? a[column.prop][0] : a[column.prop]
const str2 = Array.isArray(b[column.prop]) ? b[column.prop][0] : b[column.prop] const str2 = Array.isArray(b[column.prop]) ? b[column.prop][0] : b[column.prop]
@@ -892,7 +888,7 @@ export default {
const char1 = aObj[i] const char1 = aObj[i]
const char2 = bObj[i] const char2 = bObj[i]
const char1Type = this.getChartType(char1) const char1Type = this.getChartType(char1)
const char2Type = this.getChartType(char2) // const char2Type = this.getChartType(char2)
if (char1 === char2) { if (char1 === char2) {
continue continue
} else { } else {
@@ -911,7 +907,7 @@ export default {
} }
}) })
this.tableData = arr this.tableData = arr
} else if (column.order == 'ascending') { } else if (column.order === 'ascending') {
arr.sort((a, b) => { arr.sort((a, b) => {
const str1 = Array.isArray(a[column.prop]) ? a[column.prop][0] : a[column.prop] const str1 = Array.isArray(a[column.prop]) ? a[column.prop][0] : a[column.prop]
const str2 = Array.isArray(b[column.prop]) ? b[column.prop][0] : b[column.prop] const str2 = Array.isArray(b[column.prop]) ? b[column.prop][0] : b[column.prop]
@@ -932,7 +928,7 @@ export default {
const char1 = aObj[i] const char1 = aObj[i]
const char2 = bObj[i] const char2 = bObj[i]
const char1Type = this.getChartType(char1) const char1Type = this.getChartType(char1)
const char2Type = this.getChartType(char2) // const char2Type = this.getChartType(char2)
if (char1 === char2) { if (char1 === char2) {
continue continue
} else { } else {
@@ -966,7 +962,6 @@ export default {
} }
this.urlChangeParams[this.curTabState.tabOperationType] = operationType.changeMetric this.urlChangeParams[this.curTabState.tabOperationType] = operationType.changeMetric
const curTab = this.getCurTab() const curTab = this.getCurTab()
const label = curTab.label
this.urlChangeParams[this.curTabState.tableMetric] = this.metric this.urlChangeParams[this.curTabState.tableMetric] = this.metric
let queryParams = { let queryParams = {
@@ -1111,7 +1106,7 @@ export default {
this.urlChangeParams[this.curTabState.networkOverviewBeforeTab] = tab.prop this.urlChangeParams[this.curTabState.networkOverviewBeforeTab] = tab.prop
}, },
setQueryCondition (tab, value) { setQueryCondition (tab, value) {
value = handleSpecialValue(value)//value.replaceAll("'", "\\\\'") value = handleSpecialValue(value)// value.replaceAll("'", "\\\\'")
const queryCondition = [] const queryCondition = []
if (tab.prop === 'protocolPort') { if (tab.prop === 'protocolPort') {
const valueGroup = value.split(':') const valueGroup = value.split(':')
@@ -1180,11 +1175,11 @@ export default {
} }
}) })
} else { } else {
const changeTab = tabList.find(item => item.name == tabName)// 下钻的tab const changeTab = tabList.find(item => item.name === tabName)// 下钻的tab
this.list = changeTab.drilldownTabs this.list = changeTab.drilldownTabs
this.list.forEach(tab => { /* this.list.forEach(tab => {
const hiddenTab = tabList.find(item => item.name == tab.name) const hiddenTab = tabList.find(item => item.name == tab.name)
}) }) */
const curTab = this.getCurTab(clickTab) const curTab = this.getCurTab(clickTab)
tabList.forEach(tab => { tabList.forEach(tab => {
if (tab.name === curTab.name) { if (tab.name === curTab.name) {
@@ -1194,14 +1189,14 @@ export default {
} }
await this.saveUserLocalConfig() await this.saveUserLocalConfig()
let forthMenuName = '' /* let forthMenuName = ''
if (clickTab.prop === 'qtype') { if (clickTab.prop === 'qtype') {
forthMenuName = this.dnsQtypeMapData.get(columnValue) forthMenuName = this.dnsQtypeMapData.get(columnValue)
} else if (clickTab.prop === 'rcode') { } else if (clickTab.prop === 'rcode') {
forthMenuName = this.dnsRcodeMapData.get(columnValue) forthMenuName = this.dnsRcodeMapData.get(columnValue)
} else { } else {
forthMenuName = columnValue forthMenuName = columnValue
} } */
this.$store.getters.menuList.forEach(menu => { this.$store.getters.menuList.forEach(menu => {
if (this.$_.isEmpty(menu.children) && menu.route) { if (this.$_.isEmpty(menu.children) && menu.route) {
if (this.$route.path === menu.route) { if (this.$route.path === menu.route) {
@@ -1226,10 +1221,10 @@ export default {
} }
}) })
if (!this.getUrlParam(this.curTabState.tabIndex)) { if (!this.getUrlParam(this.curTabState.tabIndex)) {
let thirdMenu = this.urlChangeParams[this.curTabState.thirdMenu] const thirdMenu = this.urlChangeParams[this.curTabState.thirdMenu]
if(thirdMenu === 'network.serverIps'){ if (thirdMenu === 'network.serverIps') {
this.urlChangeParams[this.curTabState.tabIndex] = 1 this.urlChangeParams[this.curTabState.tabIndex] = 1
}else if(thirdMenu === 'network.clientIps' || thirdMenu === 'network.ips'){ } else if (thirdMenu === 'network.clientIps' || thirdMenu === 'network.ips') {
this.urlChangeParams[this.curTabState.tabIndex] = 0 this.urlChangeParams[this.curTabState.tabIndex] = 0
} }
} }
@@ -1275,7 +1270,7 @@ export default {
this.$store.commit('setRouterHistoryList', historyList) this.$store.commit('setRouterHistoryList', historyList)
}, },
handleSearchParams (columnValue) { handleSearchParams (columnValue) {
columnValue = handleSpecialValue(columnValue)//columnValue.replaceAll("'", "\\\\'") columnValue = handleSpecialValue(columnValue)// columnValue.replaceAll("'", "\\\\'")
const queryCondition = [] const queryCondition = []
const curTab = this.getCurTab() const curTab = this.getCurTab()
if (curTab.prop === 'protocolPort') { if (curTab.prop === 'protocolPort') {
@@ -1618,8 +1613,6 @@ export default {
if (tab && tab.hasMetricSearch === true) { if (tab && tab.hasMetricSearch === true) {
const columnsForMetric = tab.metrics.find(metric => metric.name === this.metric) const columnsForMetric = tab.metrics.find(metric => metric.name === this.metric)
columnsForMetric.columns = columns columnsForMetric.columns = columns
} else {
tab.columns = tab.columns
} }
}, },
combineColumnList (tabName) { combineColumnList (tabName) {
@@ -1824,10 +1817,10 @@ export default {
this.drillDownTableConfigs = await combinDrilldownTableWithUserConfig() this.drillDownTableConfigs = await combinDrilldownTableWithUserConfig()
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) {
this.dnsQtypeMapData = this.$store.getters.getDnsQtypeMapData this.dnsQtypeMapData = this.$store.getters.getDnsQtypeMapData
this.dnsRcodeMapData = this.$store.getters.getDnsRcodeMapData this.dnsRcodeMapData = this.$store.getters.getDnsRcodeMapData
if(!this.dnsQtypeMapData || this.dnsQtypeMapData.size === 0){ if (!this.dnsQtypeMapData || this.dnsQtypeMapData.size === 0) {
this.dnsQtypeMapData = await getDnsMapData('dnsQtype') this.dnsQtypeMapData = await getDnsMapData('dnsQtype')
this.dnsRcodeMapData = await getDnsMapData('dnsRcode') this.dnsRcodeMapData = await getDnsMapData('dnsRcode')
this.$store.commit('setDnsQtypeMapData', this.dnsQtypeMapData) this.$store.commit('setDnsQtypeMapData', this.dnsQtypeMapData)

View File

@@ -177,7 +177,7 @@ export default {
} else { } else {
this.npmNetworkLastCycleData = [res] this.npmNetworkLastCycleData = [res]
} }
let timer = null const timer = null
if (timer) { if (timer) {
clearTimeout(timer) clearTimeout(timer)
} }
@@ -185,7 +185,7 @@ export default {
this.npmNetworkQuantity(this.npmNetworkCycleData, this.npmNetworkLastCycleData, 0) this.npmNetworkQuantity(this.npmNetworkCycleData, this.npmNetworkLastCycleData, 0)
}, 300) }, 300)
}).catch((e) => { }).catch((e) => {
let timer = null const timer = null
if (timer) { if (timer) {
clearTimeout(timer) clearTimeout(timer)
} }

View File

@@ -30,7 +30,7 @@ export default {
return { return {
leftOffset: 27, leftOffset: 27,
currentTab: ref(0), currentTab: ref(0),
isCurTabReady:false isCurTabReady: false
} }
}, },
mixins: [chartMixin], mixins: [chartMixin],
@@ -63,7 +63,7 @@ export default {
} }
}, },
methods: { methods: {
handleClick(tab){ handleClick (tab) {
const { query } = this.$route const { query } = this.$route
const newUrl = urlParamsHandler(window.location.href, query, { const newUrl = urlParamsHandler(window.location.href, query, {
tabIndex: tab.index tabIndex: tab.index
@@ -80,16 +80,16 @@ export default {
activeBar.style.cssText += `width: ${clientWidth + 2}px; left: ${offsetLeft + this.leftOffset + clientLeft - 1}px;` activeBar.style.cssText += `width: ${clientWidth + 2}px; left: ${offsetLeft + this.leftOffset + clientLeft - 1}px;`
} }
}, },
disableTab(n){ disableTab (n) {
this.tabs[n].disable = true this.tabs[n].disable = true
const tabEle = document.getElementById('tab-'+n) const tabEle = document.getElementById('tab-' + n)
tabEle.style.cssText = 'cursor: not-allowed;' tabEle.style.cssText = 'cursor: not-allowed;'
} }
}, },
mounted () { mounted () {
const { query } = useRoute() const { query } = useRoute()
const tabIndexParam = query.tabIndex const tabIndexParam = query.tabIndex
let curTabIndexInUrl = tabIndexParam ? parseInt(tabIndexParam) : null const curTabIndexInUrl = tabIndexParam ? parseInt(tabIndexParam) : null
if (this.chart.panelId === drillDownPanelTypeMapping.npmOverviewIp) { if (this.chart.panelId === drillDownPanelTypeMapping.npmOverviewIp) {
const self = this const self = this
// 当client或server的session数为0时对应tab置灰不可选默认高亮另一个不为0的tab // 当client或server的session数为0时对应tab置灰不可选默认高亮另一个不为0的tab
@@ -107,37 +107,37 @@ export default {
self.serverSessions = self.sessionData.serverSessions / (self.sessionData.clientSessions * 1 + self.sessionData.serverSessions * 1) self.serverSessions = self.sessionData.serverSessions / (self.sessionData.clientSessions * 1 + self.sessionData.serverSessions * 1)
} }
}).finally(() => { }).finally(() => {
let thirdMenu = this.$route.query['thirdMenu'] const thirdMenu = this.$route.query.thirdMenu
self.tabs[0].disable = false self.tabs[0].disable = false
self.tabs[1].disable = false self.tabs[1].disable = false
let curTabIndex = 0 let curTabIndex = 0
if(thirdMenu === 'network.clientIps'){ if (thirdMenu === 'network.clientIps') {
curTabIndex = 0 curTabIndex = 0
if (self.serverSessions === 0) { if (self.serverSessions === 0) {
self.disableTab(1) self.disableTab(1)
}else if(curTabIndexInUrl !== null){ } else if (curTabIndexInUrl !== null) {
curTabIndex = curTabIndexInUrl curTabIndex = curTabIndexInUrl
} }
}else if(thirdMenu === 'network.serverIps'){ } else if (thirdMenu === 'network.serverIps') {
curTabIndex = 1 curTabIndex = 1
if (self.clientSessions === 0) { if (self.clientSessions === 0) {
self.disableTab(0) self.disableTab(0)
}else if(curTabIndexInUrl !== null){ } else if (curTabIndexInUrl !== null) {
curTabIndex = curTabIndexInUrl curTabIndex = curTabIndexInUrl
} }
}else if (self.clientSessions === 0) { } else if (self.clientSessions === 0) {
curTabIndex = 1 curTabIndex = 1
self.disableTab(0) self.disableTab(0)
} else if (self.serverSessions === 0) { } else if (self.serverSessions === 0) {
curTabIndex = 0 curTabIndex = 0
self.disableTab(1) self.disableTab(1)
} else if(curTabIndexInUrl !== null){ } else if (curTabIndexInUrl !== null) {
curTabIndex = curTabIndexInUrl curTabIndex = curTabIndexInUrl
} }
this.$nextTick(() => { this.$nextTick(() => {
self.currentTab = curTabIndex self.currentTab = curTabIndex
self.isCurTabReady = true self.isCurTabReady = true
//URL中tabIndex的设置client初始化时查询条件需要side条件 // URL中tabIndex的设置client初始化时查询条件需要side条件
const { query } = this.$route const { query } = this.$route
const newUrl = urlParamsHandler(window.location.href, query, { const newUrl = urlParamsHandler(window.location.href, query, {
tabIndex: self.currentTab tabIndex: self.currentTab
@@ -152,7 +152,7 @@ export default {
}) })
}) })
} else { } else {
this.currentTab = curTabIndexInUrl ? curTabIndexInUrl : 0 this.currentTab = curTabIndexInUrl || 0
this.isCurTabReady = true this.isCurTabReady = true
setTimeout(() => { setTimeout(() => {
this.handleActiveBar(this.currentTab) this.handleActiveBar(this.currentTab)

View File

@@ -1,5 +1,4 @@
import { import {
chartColor,
chartColor1, chartColor1,
chartColor2, chartColor2,
chartColor3, chartColor3,

View File

@@ -107,7 +107,7 @@ export default {
} }
}, },
methods: { methods: {
/*search (metaList, formatSql) { /* search (metaList, formatSql) {
let sql = formatSql let sql = formatSql
// 全文搜索处理 // 全文搜索处理
if (metaList && this.$_.isArray(metaList)) { if (metaList && this.$_.isArray(metaList)) {
@@ -120,7 +120,7 @@ export default {
} }
} }
this.$emit('search', metaList, sql) this.$emit('search', metaList, sql)
},*/ }, */
search ({ q, metaList }) { search ({ q, metaList }) {
this.$emit('search', { q, metaList }) this.$emit('search', { q, metaList })
}, },

View File

@@ -1,7 +1,5 @@
import { import {
chartColor, tooLongFormatter
tooLongFormatter,
axisFormatter
} from '@/views/charts/charts/tools' } from '@/views/charts/charts/tools'
import unitConvert from '@/utils/unit-convert' import unitConvert from '@/utils/unit-convert'
import _ from 'lodash' import _ from 'lodash'
@@ -94,7 +92,7 @@ export const multipleBarOption = {
splitLine: { splitLine: {
show: false show: false
}, },
minInterval:1 minInterval: 1
}, },
grid: { grid: {
top: 40, top: 40,

View File

@@ -2,14 +2,13 @@ import _ from 'lodash'
import { get } from '@/utils/http' import { get } from '@/utils/http'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { entityListLineOption } from '@/views/charts/charts/chart-options' import { entityListLineOption } from '@/views/charts/charts/chart-options'
import { riskLevelMapping, unitTypes, storageKey } from '@/utils/constants' import { riskLevelMapping, unitTypes } from '@/utils/constants'
import unitConvert from '@/utils/unit-convert' import unitConvert from '@/utils/unit-convert'
import { shallowRef, markRaw } from 'vue' import { shallowRef, markRaw } from 'vue'
import { metricOption } from '@/views/detections/options/detectionOptions' import { metricOption } from '@/views/detections/options/detectionOptions'
import { sortBy, reverseSortBy } from '@/utils/tools' import { sortBy, reverseSortBy } from '@/utils/tools'
import { getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import axios from 'axios'
export default { export default {
props: { props: {