CN-752 dns下钻后q查询条件有些与文档不符

This commit is contained in:
hyx
2022-10-19 15:45:31 +08:00
parent 15cfd48770
commit 59ae26e078
2 changed files with 36 additions and 9 deletions

View File

@@ -953,6 +953,7 @@ export const dnsServiceInsightsTabList = [
prop: 'dnsServerRole', prop: 'dnsServerRole',
queryCycleTotalProp: 'roles', queryCycleTotalProp: 'roles',
dillDownProp: ['dns_server_role'], dillDownProp: ['dns_server_role'],
queryCondition:['has(dns_server_role,\'$param\')'],
checked: true, checked: true,
disabled: false, disabled: false,
panelId: drillDownPanelTypeMapping.dnsFourthMenu panelId: drillDownPanelTypeMapping.dnsFourthMenu
@@ -971,6 +972,7 @@ export const dnsServiceInsightsTabList = [
prop: 'sld', prop: 'sld',
queryCycleTotalProp: 'slds', queryCycleTotalProp: 'slds',
dillDownProp: ['dns_qname'], dillDownProp: ['dns_qname'],
queryCondition: ['cutToFirstSignificantSubdomain(dns_qname) = \'$param\''],
checked: true, checked: true,
disabled: false, disabled: false,
panelId: drillDownPanelTypeMapping.dnsFourthMenu panelId: drillDownPanelTypeMapping.dnsFourthMenu
@@ -980,6 +982,7 @@ export const dnsServiceInsightsTabList = [
prop: 'tld', prop: 'tld',
queryCycleTotalProp: 'tlds', queryCycleTotalProp: 'tlds',
dillDownProp: ['dns_qname'], dillDownProp: ['dns_qname'],
queryCondition: [' topLevelDomain(dns_qname) = \'$param\''],
checked: true, checked: true,
disabled: false, disabled: false,
panelId: drillDownPanelTypeMapping.dnsFourthMenu panelId: drillDownPanelTypeMapping.dnsFourthMenu
@@ -989,6 +992,7 @@ export const dnsServiceInsightsTabList = [
prop: 'qtype', prop: 'qtype',
queryCycleTotalProp: 'qtypes', queryCycleTotalProp: 'qtypes',
dillDownProp: ['dns_qtype'], dillDownProp: ['dns_qtype'],
queryCondition: ['dns_qtype = $param'],
checked: true, checked: true,
disabled: false, disabled: false,
panelId: drillDownPanelTypeMapping.dnsFourthMenu panelId: drillDownPanelTypeMapping.dnsFourthMenu
@@ -998,6 +1002,7 @@ export const dnsServiceInsightsTabList = [
prop: 'rcode', prop: 'rcode',
queryCycleTotalProp: 'rcodes', queryCycleTotalProp: 'rcodes',
dillDownProp: ['dns_rcode'], dillDownProp: ['dns_rcode'],
queryCondition: ['dns_rcode = $param'],
checked: true, checked: true,
disabled: false, disabled: false,
panelId: drillDownPanelTypeMapping.dnsFourthMenu panelId: drillDownPanelTypeMapping.dnsFourthMenu
@@ -1007,6 +1012,7 @@ export const dnsServiceInsightsTabList = [
prop: 'a', prop: 'a',
queryCycleTotalProp: 'a', queryCycleTotalProp: 'a',
dillDownProp: ['rr_a'], dillDownProp: ['rr_a'],
queryCondition: ['notEmpty(dns_rr) AND has(JSONExtractArrayRaw(JSON_QUERY(\'$.rr[*].type\', dns_rr) ), \'1\') AND arrayJoin(tupleElement(tupleElement(JSONExtract(dns_rr,\'Tuple(rr Nested(name String, type UInt32, a String))\'), \'rr\'), \'a\')) = \'$param\''],
checked: true, checked: true,
disabled: false, disabled: false,
panelId: drillDownPanelTypeMapping.dnsFourthMenu panelId: drillDownPanelTypeMapping.dnsFourthMenu
@@ -1016,6 +1022,7 @@ export const dnsServiceInsightsTabList = [
prop: 'aaaa', prop: 'aaaa',
queryCycleTotalProp: 'aaaa', queryCycleTotalProp: 'aaaa',
dillDownProp: ['rr_aaaa'], dillDownProp: ['rr_aaaa'],
queryCondition: ['notEmpty(dns_rr) and has(JSONExtractArrayRaw(JSON_QUERY(\'$.rr[*].type\', dns_rr) ), \'28\') AND arrayJoin(tupleElement(tupleElement(JSONExtract(dns_rr,\'Tuple(rr Nested(name String, type UInt32, aaaa String))\'), \'rr\'), \'aaaa\')) = \'$param\''],
checked: true, checked: true,
disabled: false, disabled: false,
panelId: drillDownPanelTypeMapping.dnsFourthMenu panelId: drillDownPanelTypeMapping.dnsFourthMenu
@@ -1025,6 +1032,7 @@ export const dnsServiceInsightsTabList = [
prop: 'cname', prop: 'cname',
queryCycleTotalProp: 'cnames', queryCycleTotalProp: 'cnames',
dillDownProp: ['rr_cname'], dillDownProp: ['rr_cname'],
queryCondition: ['notEmpty(dns_rr) and has(JSONExtractArrayRaw(JSON_QUERY(\'$.rr[*].type\', dns_rr) ), \'5\') AND arrayJoin(tupleElement(tupleElement(JSONExtract(dns_rr,\'Tuple(rr Nested(name String, type UInt32, cname String))\'), \'rr\'), \'cname\')) = \'$param\''],
checked: true, checked: true,
disabled: false, disabled: false,
panelId: drillDownPanelTypeMapping.dnsFourthMenu panelId: drillDownPanelTypeMapping.dnsFourthMenu

View File

@@ -1096,8 +1096,7 @@ export default {
}, },
setQueryCondition (tab, value) { setQueryCondition (tab, value) {
value = value.replaceAll("'", "\\\\'") value = value.replaceAll("'", "\\\\'")
const queryCondition = [] let queryCondition = []
const searchProps = tab.dillDownProp
if (tab.prop === 'protocolPort') { if (tab.prop === 'protocolPort') {
const valueGroup = value.split(':') const valueGroup = value.split(':')
if (valueGroup) { if (valueGroup) {
@@ -1106,9 +1105,17 @@ export default {
} }
this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' AND ') this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' AND ')
} else { } else {
searchProps.forEach(item => { if(tab.queryCondition){
tab.queryCondition.forEach(item => {
queryCondition.push(item.replace('$param',value))
})
}else {
if(tab.dillDownProp){
tab.dillDownProp.forEach(item => {
queryCondition.push(item + "='" + value + "'") queryCondition.push(item + "='" + value + "'")
}) })
}
}
this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' OR ') this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' OR ')
} }
}, },
@@ -1202,7 +1209,6 @@ export default {
columnValue = columnValue.replaceAll("'", "\\\\'") columnValue = columnValue.replaceAll("'", "\\\\'")
const queryCondition = [] const queryCondition = []
const curTab = this.getCurTab() const curTab = this.getCurTab()
const searchProps = curTab.dillDownProp
if (curTab.prop === 'protocolPort') { if (curTab.prop === 'protocolPort') {
const valueGroup = columnValue.split(':') const valueGroup = columnValue.split(':')
if (valueGroup) { if (valueGroup) {
@@ -1211,9 +1217,20 @@ export default {
} }
this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' AND ') this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' AND ')
} else { } else {
searchProps.forEach(item => { if(curTab.queryCondition){
curTab.queryCondition.forEach(item => {
queryCondition.push(item.replace('$param',columnValue))
})
}else {
if(curTab.dillDownProp){
curTab.dillDownProp.forEach(item => {
queryCondition.push(item + "='" + columnValue + "'") queryCondition.push(item + "='" + columnValue + "'")
}) })
}
}
this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' OR ') this.urlChangeParams[this.curTabState.queryCondition] = queryCondition.join(' OR ')
} }
}, },
@@ -1473,6 +1490,7 @@ export default {
let tabInCode = listInCode ? listInCode.find(item => item.label === tab.label) : {} let tabInCode = listInCode ? listInCode.find(item => item.label === tab.label) : {}
tab.queryCycleTotalProp = tabInCode ? tabInCode.queryCycleTotalProp : null tab.queryCycleTotalProp = tabInCode ? tabInCode.queryCycleTotalProp : null
tab.dillDownProp = tabInCode ? tabInCode.dillDownProp : [] tab.dillDownProp = tabInCode ? tabInCode.dillDownProp : []
tab.queryCondition = tabInCode ? tabInCode.queryCondition : []
}) })
// 设置drilldownTabs未下钻状态设置已下钻状态无需设置 // 设置drilldownTabs未下钻状态设置已下钻状态无需设置
let thirdMenu = this.getUrlParam(this.curTabState.thirdMenu, '') let thirdMenu = this.getUrlParam(this.curTabState.thirdMenu, '')
@@ -1500,6 +1518,7 @@ export default {
let tabInCode = listInCode ? listInCode.find(item => item.label === fullTab.label) : {} let tabInCode = listInCode ? listInCode.find(item => item.label === fullTab.label) : {}
drilldownTabWithAllInfo.queryCycleTotalProp = tabInCode ? tabInCode.queryCycleTotalProp : null drilldownTabWithAllInfo.queryCycleTotalProp = tabInCode ? tabInCode.queryCycleTotalProp : null
drilldownTabWithAllInfo.dillDownProp = tabInCode ? tabInCode.dillDownProp : [] drilldownTabWithAllInfo.dillDownProp = tabInCode ? tabInCode.dillDownProp : []
drilldownTabWithAllInfo.queryCondition = tabInCode ? tabInCode.queryCondition : []
drilldownTabFull.push(drilldownTabWithAllInfo) drilldownTabFull.push(drilldownTabWithAllInfo)
} }
} }