fix:1、CN-1133 增加IP段格式验证;2、情报分析无数据时样式错误
This commit is contained in:
@@ -1,18 +1,12 @@
|
|||||||
.information-aggregation__table {
|
.information-aggregation__table {
|
||||||
.intelligence-content {
|
|
||||||
padding-top:10px !important;
|
|
||||||
padding-bottom:4px !important;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: flex-start;
|
|
||||||
.information-aggregation-tags {
|
.information-aggregation-tags {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: center;
|
justify-content: left;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
margin-bottom:6px;
|
margin-bottom:6px;
|
||||||
}
|
padding-top:10px !important;
|
||||||
|
padding-bottom:4px !important;
|
||||||
}
|
}
|
||||||
.information-aggregation__valid {
|
.information-aggregation__valid {
|
||||||
background: #eff3e9;
|
background: #eff3e9;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
<!--初步方案:error提示替换table。后续若改为table内error提示,记得在此修改-->
|
<!--初步方案:error提示替换table。后续若改为table内error提示,记得在此修改-->
|
||||||
<chart-error v-if="showError" :content="errorMsg" class="entity-detail-event-error"></chart-error>
|
<chart-error v-if="showError" :content="errorMsg" class="entity-detail-event-error"></chart-error>
|
||||||
<chart-no-data v-if="isNoData && !showError" test-id="no-data"></chart-no-data>
|
<chart-no-data v-if="isNoData && !showError" test-id="no-data"></chart-no-data>
|
||||||
|
|
||||||
<div v-if="!isNoData && !showError && !loading" class="information-aggregation__table">
|
<div v-if="!isNoData && !showError && !loading" class="information-aggregation__table">
|
||||||
<el-table
|
<el-table
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@@ -40,32 +39,12 @@
|
|||||||
prop="intelligenceContent"
|
prop="intelligenceContent"
|
||||||
>
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div class="intelligence-content">
|
|
||||||
<!-- <div class="information-aggregation-tags">
|
|
||||||
<template v-for="ic in scope.row.intelligenceContent" >
|
|
||||||
<template v-if="ic.type === 0" >
|
|
||||||
<div v-if="ic.threatLevel === -1" class="entity-tag entity-tag--small entity-tag--level-one-negative margin-r-6">
|
|
||||||
{{ic.value}}
|
|
||||||
</div>
|
|
||||||
<div v-else-if="ic.threatLevel === 0" class="entity-tag entity-tag--small entity-tag--level-one-normal margin-r-6">
|
|
||||||
{{ic.value}}
|
|
||||||
</div>
|
|
||||||
<div v-else-if="ic.threatLevel === 1" class="entity-tag entity-tag--small entity-tag--level-one-positive margin-r-6">
|
|
||||||
{{ic.value}}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</div>-->
|
|
||||||
<div class="information-aggregation-tags">
|
<div class="information-aggregation-tags">
|
||||||
<div v-for="ic in scope.row.intelligenceContent" :key="ic.key">
|
<div v-for="ic in scope.row.intelligenceContent" :key="ic.key"
|
||||||
<div>
|
class="entity-tag entity-tag--small margin-r-6" :test-id="`entity-tag${scope.$index}`" :class="`entity-tag--level-two-${ic.type}`">
|
||||||
<div class="entity-tag entity-tag--small margin-r-6" :test-id="`entity-tag${scope.$index}`" :class="`entity-tag--level-two-${ic.type}`">
|
|
||||||
{{ic.value}}
|
{{ic.value}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
@@ -126,14 +105,15 @@ export default {
|
|||||||
},
|
},
|
||||||
getData () {
|
getData () {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
this.showError = false
|
||||||
this.toggleLoading(true)
|
this.toggleLoading(true)
|
||||||
this.informationAggregationList = []
|
this.informationAggregationList = []
|
||||||
axios.get(`${api.entity.informationAggregation}/${this.entity.entityType}?resource=${this.entity.entityName}&pageSize=100&pageNo=1`).then(response => {
|
axios.get(`${api.entity.informationAggregation}/${this.entity.entityType}?resource=${this.entity.entityName}&pageSize=100&pageNo=1`).then(response => {
|
||||||
const res = response.data
|
const res = response.data
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.isNoData = res.data.result.length === 0
|
//this.isNoData = res.data.result.length === 0
|
||||||
this.showError = false
|
this.showError = false
|
||||||
if (!this.isNoData) {
|
if (res.data.result.length > 0) {
|
||||||
res.data.result.forEach(r => {
|
res.data.result.forEach(r => {
|
||||||
Object.keys(r).forEach(k => {
|
Object.keys(r).forEach(k => {
|
||||||
const aggregation = {
|
const aggregation = {
|
||||||
@@ -161,15 +141,18 @@ export default {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.showError = true
|
this.showError = true
|
||||||
this.isNoData = false
|
|
||||||
this.errorMsg = this.errorMsgHandler(res)
|
this.errorMsg = this.errorMsgHandler(res)
|
||||||
}
|
}
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
this.showError = true
|
this.showError = true
|
||||||
this.isNoData = false
|
|
||||||
this.errorMsg = this.errorMsgHandler(e)
|
this.errorMsg = this.errorMsgHandler(e)
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
if(this.informationAggregationList.length > 0){
|
||||||
|
this.isNoData = false
|
||||||
|
}else {
|
||||||
|
this.isNoData = true
|
||||||
|
}
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.toggleLoading(false)
|
this.toggleLoading(false)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -314,6 +314,35 @@ export default {
|
|||||||
this.showImportedData[index].isValid = 0
|
this.showImportedData[index].isValid = 0
|
||||||
callback(new Error())
|
callback(new Error())
|
||||||
}
|
}
|
||||||
|
} else if(formal.indexOf('-') !== -1) {
|
||||||
|
let split2 = formal.split('-')
|
||||||
|
let startIp = split2[0].replace(/\s+/g, '');
|
||||||
|
let endIp = split2[1].replace(/\s+/g, '');
|
||||||
|
if (regular.ipv4Range.test(startIp) && regular.ipv4Range.test(endIp)) {
|
||||||
|
//ipv4对比大小
|
||||||
|
if (!(regular.compareIP4(startIp) <= regular.compareIP4(endIp))) {
|
||||||
|
validate = false
|
||||||
|
this.editTagErrorTip = rule.message
|
||||||
|
this.showImportedData[index].msg = rule.message
|
||||||
|
this.showImportedData[index].isValid = 0
|
||||||
|
callback(new Error())
|
||||||
|
}
|
||||||
|
} else if (regular.ipv6Range.test(startIp) && regular.ipv6Range.test(endIp)) {
|
||||||
|
//ipv6对比大小
|
||||||
|
if (!regular.ipv6Reg(startIp, endIp)) {
|
||||||
|
validate = false
|
||||||
|
this.editTagErrorTip = rule.message
|
||||||
|
this.showImportedData[index].msg = rule.message
|
||||||
|
this.showImportedData[index].isValid = 0
|
||||||
|
callback(new Error())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
validate = false
|
||||||
|
this.editTagErrorTip = rule.message
|
||||||
|
this.showImportedData[index].msg = rule.message
|
||||||
|
this.showImportedData[index].isValid = 0
|
||||||
|
callback(new Error())
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!regular.ip.test(formal)) {
|
if (!regular.ip.test(formal)) {
|
||||||
validate = false
|
validate = false
|
||||||
@@ -481,7 +510,7 @@ export default {
|
|||||||
} else if (format === 'CIDR') {
|
} else if (format === 'CIDR') {
|
||||||
item.tagName = item.ip1 + '/' + item.ip2
|
item.tagName = item.ip1 + '/' + item.ip2
|
||||||
} else if (format === 'Range') {
|
} else if (format === 'Range') {
|
||||||
item.tagName = item.ip1 + '~' + item.ip2
|
item.tagName = item.ip1 + '-' + item.ip2
|
||||||
}
|
}
|
||||||
} else if (this.editObject.source === knowledgeSourceValue.domainTag) {
|
} else if (this.editObject.source === knowledgeSourceValue.domainTag) {
|
||||||
item.tagName = item.domain
|
item.tagName = item.domain
|
||||||
@@ -915,13 +944,21 @@ export default {
|
|||||||
isValid: 1
|
isValid: 1
|
||||||
}
|
}
|
||||||
if (this.editObject.source === knowledgeSourceValue.ipTag) {
|
if (this.editObject.source === knowledgeSourceValue.ipTag) {
|
||||||
const sepIndex = data.tagName.indexOf('/')
|
const sepCidrIndex = data.tagName.indexOf('/')
|
||||||
if (sepIndex > -1) { // CIDR
|
const sepRangeIndex = data.tagName.indexOf('-')
|
||||||
|
if (sepCidrIndex > -1) { // CIDR
|
||||||
updateItemData = {
|
updateItemData = {
|
||||||
...updateItemData,
|
...updateItemData,
|
||||||
addrFormat: 'CIDR',
|
addrFormat: 'CIDR',
|
||||||
ip1: data.tagName.substring(0, sepIndex),
|
ip1: data.tagName.substring(0, sepCidrIndex),
|
||||||
ip2: data.tagName.substring(sepIndex + 1)
|
ip2: data.tagName.substring(sepCidrIndex + 1)
|
||||||
|
}
|
||||||
|
} else if(sepRangeIndex > -1){
|
||||||
|
updateItemData = {
|
||||||
|
...updateItemData,
|
||||||
|
addrFormat: 'Range',
|
||||||
|
ip1: data.tagName.substring(0, sepRangeIndex),
|
||||||
|
ip2: data.tagName.substring(sepRangeIndex + 1)
|
||||||
}
|
}
|
||||||
} else { // Single
|
} else { // Single
|
||||||
updateItemData = {
|
updateItemData = {
|
||||||
@@ -956,13 +993,21 @@ export default {
|
|||||||
}
|
}
|
||||||
let addItem = data
|
let addItem = data
|
||||||
if (this.editObject.source === knowledgeSourceValue.ipTag) {
|
if (this.editObject.source === knowledgeSourceValue.ipTag) {
|
||||||
const sepIndex = data.tagName.indexOf('/')
|
const sepCidrIndex = data.tagName.indexOf('/')
|
||||||
if (sepIndex > -1) { // CIDR
|
const sepRangeIndex = data.tagName.indexOf('-')
|
||||||
|
if (sepCidrIndex > -1) { // CIDR
|
||||||
addItem = {
|
addItem = {
|
||||||
...addItem,
|
...addItem,
|
||||||
addrFormat: 'CIDR',
|
addrFormat: 'CIDR',
|
||||||
ip1: data.tagName.substring(0, sepIndex),
|
ip1: data.tagName.substring(0, sepCidrIndex),
|
||||||
ip2: data.tagName.substring(sepIndex + 1)
|
ip2: data.tagName.substring(sepCidrIndex + 1)
|
||||||
|
}
|
||||||
|
} else if(sepRangeIndex > -1){
|
||||||
|
addItem = {
|
||||||
|
...addItem,
|
||||||
|
addrFormat: 'Range',
|
||||||
|
ip1: data.tagName.substring(0, sepRangeIndex),
|
||||||
|
ip2: data.tagName.substring(sepRangeIndex + 1)
|
||||||
}
|
}
|
||||||
} else { // Single
|
} else { // Single
|
||||||
addItem = {
|
addItem = {
|
||||||
|
|||||||
Reference in New Issue
Block a user