CN-1080: 实体详情--域名解析和开放端口tab接口对接
This commit is contained in:
@@ -28,6 +28,9 @@
|
|||||||
background: #38ACD2;
|
background: #38ACD2;
|
||||||
border-radius: 1px;
|
border-radius: 1px;
|
||||||
}
|
}
|
||||||
|
.type-title-word {
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.type-content {
|
.type-content {
|
||||||
@@ -50,5 +53,18 @@
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.type-error-content {
|
||||||
|
width:100%;
|
||||||
|
height: 40px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.type-error-content__block {
|
||||||
|
position: absolute;
|
||||||
|
left: -12px;
|
||||||
|
top: -12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -352,6 +352,105 @@ if (openMock) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Mock.mock(new RegExp(urlAndVersion + '/entity/detail/ip/relate/ports.*'), 'get', function (requestObj) {
|
||||||
|
const result = [
|
||||||
|
{
|
||||||
|
port: 80,
|
||||||
|
l7Protocol: 'HTTP'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
port: 443,
|
||||||
|
l7Protocol: 'HTTPS'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
port: 53,
|
||||||
|
l7Protocol: 'DNS'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
return {
|
||||||
|
msg: 'success',
|
||||||
|
code: 200,
|
||||||
|
data: {
|
||||||
|
result: result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Mock.mock(new RegExp(urlAndVersion + '/entity/detail/ip/relate/apps.*'), 'get', function (requestObj) {
|
||||||
|
const result = ['Wechat', 'baidu', 'Wechat', 'baidu', 'Wechat', 'baidu', 'Wechat']
|
||||||
|
|
||||||
|
return {
|
||||||
|
msg: 'success',
|
||||||
|
code: 200,
|
||||||
|
data: {
|
||||||
|
result: result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Mock.mock(new RegExp(urlAndVersion + '/entity/detail/ip/relate/domains.*'), 'get', function (requestObj) {
|
||||||
|
const result = ['-*.pangolin-sdk-toutiao.com', '-*.pangolin-sdk-toutiao.com', '-*.pangolin-sdk-toutiao.com', '-*.pangolin-sdk-toutiao.com']
|
||||||
|
|
||||||
|
return {
|
||||||
|
msg: 'success',
|
||||||
|
code: 200,
|
||||||
|
data: {
|
||||||
|
result: result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Mock.mock(new RegExp(urlAndVersion + '/entity/detail/app/relate/ips.*'), 'get', function (requestObj) {
|
||||||
|
const result = ['116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242']
|
||||||
|
return {
|
||||||
|
msg: 'success',
|
||||||
|
code: 200,
|
||||||
|
data: {
|
||||||
|
result: result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Mock.mock(new RegExp(urlAndVersion + '/entity/detail/app/relate/domains.*'), 'get', function (requestObj) {
|
||||||
|
const result = ['-*.pangolin-sdk-toutiao.com', '-*.pangolin-sdk-toutiao.com', '-*.pangolin-sdk-toutiao.com', '-*.pangolin-sdk-toutiao.com']
|
||||||
|
|
||||||
|
return {
|
||||||
|
msg: 'success',
|
||||||
|
code: 200,
|
||||||
|
data: {
|
||||||
|
result: result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Mock.mock(new RegExp(urlAndVersion + '/entity/detail/domain/relate/ips.*'), 'get', function (requestObj) {
|
||||||
|
const result = ['116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242']
|
||||||
|
return {
|
||||||
|
msg: 'success',
|
||||||
|
code: 200,
|
||||||
|
data: {
|
||||||
|
result: result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Mock.mock(new RegExp(urlAndVersion + '/entity/detail/domain/relate/apps.*'), 'get', function (requestObj) {
|
||||||
|
const result = ['Wechat', 'baidu', 'Wechat', 'baidu', 'Wechat', 'baidu', 'Wechat']
|
||||||
|
|
||||||
|
return {
|
||||||
|
msg: 'success',
|
||||||
|
code: 200,
|
||||||
|
data: {
|
||||||
|
result: result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Mock.mock(new RegExp(urlAndVersion + '/entity/detail/domain/relate/fqdns.*'), 'get', function (requestObj) {
|
||||||
|
const result = ['-*.pangolin-sdk-toutiao.com', '-*.pangolin-sdk-toutiao.com', '-*.pangolin-sdk-toutiao.com', '-*.pangolin-sdk-toutiao.com']
|
||||||
|
|
||||||
|
return {
|
||||||
|
msg: 'success',
|
||||||
|
code: 200,
|
||||||
|
data: {
|
||||||
|
result: result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const getQuery = (url) => {
|
const getQuery = (url) => {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { get, post } from '@/utils/http'
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { sortByOrderNum } from '@/permission'
|
import { sortByOrderNum } from '@/permission'
|
||||||
import { storageKey } from '@/utils/constants'
|
import { storageKey } from '@/utils/constants'
|
||||||
|
const apiVersion = BASE_CONFIG.apiVersion
|
||||||
|
|
||||||
export const api = {
|
export const api = {
|
||||||
// 系统相关
|
// 系统相关
|
||||||
@@ -232,16 +233,26 @@ export const api = {
|
|||||||
drilldownTrafficAnalysis: '/interface/dns/overview/drilldown/trafficAnalysis'
|
drilldownTrafficAnalysis: '/interface/dns/overview/drilldown/trafficAnalysis'
|
||||||
},
|
},
|
||||||
entity: {
|
entity: {
|
||||||
throughput: BASE_CONFIG.apiVersion + '/entity/detail/traffic/throughput',
|
throughput: apiVersion + '/entity/detail/traffic/throughput',
|
||||||
security: BASE_CONFIG.apiVersion + '/entity/detail/event/security',
|
security: apiVersion + '/entity/detail/event/security',
|
||||||
performance: BASE_CONFIG.apiVersion + '/entity/detail/event/performance',
|
performance: apiVersion + '/entity/detail/event/performance',
|
||||||
domainNameResolutionRelatedApp: 'interface/entity/detail/overview/ip/relatedApp',
|
// 域名解析:ip相关app、domain
|
||||||
domainNameResolutionRelatedIP: 'interface/entity/detail/overview/ip/relatedIp',
|
domainNameResolutionAboutAppsOfIp: apiVersion + '/entity/detail/ip/relate/apps',
|
||||||
domainNameResolutionRelatedDomain: 'interface/entity/detail/overview/ip/relatedDomain',
|
domainNameResolutionAboutDomainsOfIp: apiVersion + '/entity/detail/ip/relate/domains',
|
||||||
openPort: '',
|
// 域名解析:app相关ip、domain
|
||||||
basicInfo: BASE_CONFIG.apiVersion + '/entity/detail/basic',
|
domainNameResolutionAboutIpsOfApp: apiVersion + '/entity/detail/app/relate/ips',
|
||||||
tags: BASE_CONFIG.apiVersion + '/entity/detail/kb/intelligence/tag',
|
domainNameResolutionAboutDomainsOfApp: apiVersion + '/entity/detail/app/relate/domains',
|
||||||
informationAggregation: BASE_CONFIG.apiVersion + '/entity/detail/kb/intelligence/list'
|
// 域名解析:domain相关ip、app、fqdn
|
||||||
|
domainNameResolutionAboutAppsOfDomain: apiVersion + '/entity/detail/domain/relate/apps',
|
||||||
|
domainNameResolutionAboutIpsOfDomain: apiVersion + '/entity/detail/domain/relate/ips',
|
||||||
|
domainNameResolutionAboutFQDNsOfDomain: apiVersion + '/entity/detail/domain/relate/fqdns',
|
||||||
|
// 开放端口:ip、domain、app相关
|
||||||
|
openPortOfIp: apiVersion + '/entity/detail/ip/relate/ports',
|
||||||
|
openPortOfDomain: apiVersion + '/entity/detail/domain/relate/ports',
|
||||||
|
openPortOfApp: apiVersion + '/entity/detail/app/relate/ports',
|
||||||
|
basicInfo: apiVersion + '/entity/detail/basic',
|
||||||
|
tags: apiVersion + '/entity/detail/kb/intelligence/tag',
|
||||||
|
informationAggregation: apiVersion + '/entity/detail/kb/intelligence/list'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,11 @@
|
|||||||
<i v-if="tab.warnFlag" :class="tab.warnIcon" class="tab-pane-warn--icon"></i>
|
<i v-if="tab.warnFlag" :class="tab.warnIcon" class="tab-pane-warn--icon"></i>
|
||||||
</template>
|
</template>
|
||||||
<information-aggregation v-if="tab.name === entityDetailTabsName.informationAggregation && tab.name === activeTab" @toggleLoading="setLoading" :entity="entity"></information-aggregation>
|
<information-aggregation v-if="tab.name === entityDetailTabsName.informationAggregation && tab.name === activeTab" @toggleLoading="setLoading" :entity="entity"></information-aggregation>
|
||||||
<domain-name-resolution v-else-if="tab.name === entityDetailTabsName.domainNameResolution && tab.name === activeTab" @toggleLoading="setLoading"></domain-name-resolution>
|
<domain-name-resolution v-else-if="tab.name === entityDetailTabsName.domainNameResolution && tab.name === activeTab" @toggleLoading="setLoading" :entity="entity" :timeFilter="oneDayTimeFilter"></domain-name-resolution>
|
||||||
<digital-certificate v-else-if="tab.name === entityDetailTabsName.digitalCertificate && tab.name === activeTab" @toggleLoading="setLoading" :timeFilter="oneDayTimeFilter" />
|
<digital-certificate v-else-if="tab.name === entityDetailTabsName.digitalCertificate && tab.name === activeTab" @toggleLoading="setLoading" :timeFilter="oneDayTimeFilter" />
|
||||||
<security-event v-else-if="tab.name === entityDetailTabsName.securityEvent && tab.name === activeTab" @toggleLoading="setLoading" :timeFilter="oneDayTimeFilter" @checkWarn="setWarn" />
|
<security-event v-else-if="tab.name === entityDetailTabsName.securityEvent && tab.name === activeTab" @toggleLoading="setLoading" :timeFilter="oneDayTimeFilter" @checkWarn="setWarn" />
|
||||||
<performance-event v-else-if="tab.name === entityDetailTabsName.performanceEvent && tab.name === activeTab" @toggleLoading="setLoading" :timeFilter="oneDayTimeFilter" @checkWarn="setWarn" />
|
<performance-event v-else-if="tab.name === entityDetailTabsName.performanceEvent && tab.name === activeTab" @toggleLoading="setLoading" :timeFilter="oneDayTimeFilter" @checkWarn="setWarn" />
|
||||||
<open-port v-else-if="tab.name === entityDetailTabsName.openPort && tab.name === activeTab" @toggleLoading="setLoading"></open-port>
|
<open-port v-else-if="tab.name === entityDetailTabsName.openPort && tab.name === activeTab" @toggleLoading="setLoading" :entity="entity" :timeFilter="oneDayTimeFilter"></open-port>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
@@ -80,8 +80,8 @@ export default {
|
|||||||
const entityType = props.entity.entityType
|
const entityType = props.entity.entityType
|
||||||
|
|
||||||
const tabs = reactive([
|
const tabs = reactive([
|
||||||
// { name: entityDetailTabsName.domainNameResolution, label: i18n.global.t('entities.domainNameResolution'), icon: 'cn-icon cn-icon-domain-name-resolution' },
|
{ name: entityDetailTabsName.domainNameResolution, label: i18n.global.t('entities.domainNameResolution'), icon: 'cn-icon cn-icon-domain-name-resolution' },
|
||||||
// { name: entityDetailTabsName.openPort, label: i18n.global.t('entities.openPort'), icon: 'cn-icon cn-icon-open-port' },
|
{ name: entityDetailTabsName.openPort, label: i18n.global.t('entities.openPort'), icon: 'cn-icon cn-icon-open-port' },
|
||||||
// { name: entityDetailTabsName.digitalCertificate, label: i18n.global.t('entities.digitalCertificate'), icon: 'cn-icon cn-icon-digital-certificate' },
|
// { name: entityDetailTabsName.digitalCertificate, label: i18n.global.t('entities.digitalCertificate'), icon: 'cn-icon cn-icon-digital-certificate' },
|
||||||
{ name: entityDetailTabsName.securityEvent, label: i18n.global.t('overall.securityEvent'), icon: 'cn-icon cn-icon-security-event', warnIcon: 'cn-icon cn-icon-warn', warnFlag: false },
|
{ name: entityDetailTabsName.securityEvent, label: i18n.global.t('overall.securityEvent'), icon: 'cn-icon cn-icon-security-event', warnIcon: 'cn-icon cn-icon-warn', warnFlag: false },
|
||||||
{ name: entityDetailTabsName.performanceEvent, label: i18n.global.t('overall.performanceEvent'), icon: 'cn-icon cn-icon-a-PerformanceEvent', warnIcon: 'cn-icon cn-icon-warn', warnFlag: false }
|
{ name: entityDetailTabsName.performanceEvent, label: i18n.global.t('overall.performanceEvent'), icon: 'cn-icon cn-icon-a-PerformanceEvent', warnIcon: 'cn-icon cn-icon-warn', warnFlag: false }
|
||||||
|
|||||||
@@ -1,162 +1,200 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<chart-error v-if="showError" :content="errorMsg" class="entity-detail-event-error"></chart-error>
|
<chart-no-data v-if="isNoData"></chart-no-data>
|
||||||
<chart-no-data v-if="isNoData && !showError"></chart-no-data>
|
|
||||||
|
<div v-if="!isNoData && initFlag" class="type-data__column">
|
||||||
|
<div class="type-data" v-if="entity.entityType !== 'app'">
|
||||||
|
<div class="type-title">
|
||||||
|
<span class="title-mark"></span>
|
||||||
|
{{ $t('entities.tab.relatedApp') }} ({{ relatedAppList.length }})
|
||||||
|
</div>
|
||||||
|
<div class="type-content" v-if="!showError0">
|
||||||
|
<div v-for="(entity, index) in relatedAppList" class="data-item" :key="index">
|
||||||
|
{{ entity.appName ? entity.appName : entity }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="type-error-content" v-else>
|
||||||
|
<chart-error class="type-error-content__block" :content="errorMsg0"></chart-error>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="type-data" v-if="entity.entityType !== 'ip'">
|
||||||
|
<div class="type-title">
|
||||||
|
<span class="title-mark"></span>
|
||||||
|
{{ $t('entities.tab.relatedIp') }} ({{ relatedIpList.length }})
|
||||||
|
</div>
|
||||||
|
<div class="type-content" v-if="!showError1">
|
||||||
|
<div v-for="(entity, index) in relatedIpList" :key="index" class="data-item">
|
||||||
|
{{ entity.ip ? entity.ip : entity }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="type-error-content" v-else>
|
||||||
|
<chart-error class="type-error-content__block" :content="errorMsg1"></chart-error>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-if="!isNoData && !showError && !loading" class="type-data__column">
|
|
||||||
<div class="type-data">
|
<div class="type-data">
|
||||||
<div class="type-title">
|
<div class="type-title">
|
||||||
<span class="title-mark" ></span>{{ $t('entities.tab.relatedApp') }} ({{relatedAppList.length}})</div>
|
<span class="title-mark"></span>
|
||||||
<div class="type-content">
|
{{ $t('entities.tab.relatedDomain') }} ({{ relatedDomainList.length }})
|
||||||
<div v-for="entity in relatedAppList" class="data-item">{{entity.appName?entity.appName:entity}}</div>
|
</div>
|
||||||
|
<div class="type-content" v-if="!showError2">
|
||||||
|
<div v-for="(entity, index) in relatedDomainList" class="data-item" :key="index">
|
||||||
|
{{ entity.domain ? entity.domain : entity }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="type-data">
|
<div class="type-error-content" v-else>
|
||||||
<div class="type-title">
|
<chart-error class="type-error-content__block" :content="errorMsg2"></chart-error>
|
||||||
<span class="title-mark" ></span>{{ $t('entities.tab.relatedIp') }} ({{relatedIpList.length}})</div>
|
|
||||||
<div class="type-content">
|
|
||||||
<div v-for="entity in relatedIpList" class="data-item">{{entity.ip?entity.ip:entity}}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="type-data">
|
|
||||||
<div class="type-title">
|
|
||||||
<span class="title-mark" ></span>{{ $t('entities.tab.relatedDomain') }} ({{relatedDomainList.length}})</div>
|
|
||||||
<div class="type-content">
|
|
||||||
<div v-for="entity in relatedDomainList" class="data-item">{{entity.domain?entity.domain:entity}}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getNowTime, getSecond } from '@/utils/date-util'
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { api } from '@/utils/api'
|
import { api } from '@/utils/api'
|
||||||
import { ref } from 'vue'
|
|
||||||
import { useRoute } from 'vue-router'
|
|
||||||
import chartMixin from '@/views/charts2/chart-mixin'
|
import chartMixin from '@/views/charts2/chart-mixin'
|
||||||
|
import { getSecond } from '@/utils/date-util'
|
||||||
|
import chartNoData from '@/views/charts/charts/ChartNoData'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DomainNameResolution',
|
name: 'DomainNameResolution',
|
||||||
mixins: [chartMixin],
|
mixins: [chartMixin],
|
||||||
props: {
|
props: {
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
chartNoData
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
relatedAppList: [],
|
relatedAppList: [],
|
||||||
relatedIpList: [],
|
relatedIpList: [],
|
||||||
relatedDomainList: [],
|
relatedDomainList: [],
|
||||||
showError: false,
|
initFlag: false, // 初始化标识,请求接口之后再显示,避免标题初始化会闪一下
|
||||||
errorMsg: '',
|
showError0: false,
|
||||||
loading: true
|
errorMsg0: '',
|
||||||
|
showError1: false,
|
||||||
|
errorMsg1: '',
|
||||||
|
showError2: false,
|
||||||
|
errorMsg2: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.initData()
|
this.initData()
|
||||||
},
|
},
|
||||||
setup () {
|
|
||||||
const { query } = useRoute()
|
|
||||||
// 获取url携带的range、startTime、endTime
|
|
||||||
const rangeParam = query.range
|
|
||||||
const startTimeParam = query.startTime
|
|
||||||
const endTimeParam = query.endTime
|
|
||||||
// 若url携带了,使用携带的值,否则使用默认值。
|
|
||||||
const dateRangeValue = rangeParam ? parseInt(query.range) : 60
|
|
||||||
const timeFilter = ref({ dateRangeValue })
|
|
||||||
if (!startTimeParam || !endTimeParam) {
|
|
||||||
const {
|
|
||||||
startTime,
|
|
||||||
endTime
|
|
||||||
} = getNowTime(60)
|
|
||||||
timeFilter.value.startTime = startTime
|
|
||||||
timeFilter.value.endTime = endTime
|
|
||||||
} else {
|
|
||||||
timeFilter.value.startTime = parseInt(startTimeParam)
|
|
||||||
timeFilter.value.endTime = parseInt(endTimeParam)
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
timeFilter
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
initData () {
|
initData () {
|
||||||
const params = {
|
const params = {
|
||||||
|
resource: this.entity.entityName,
|
||||||
startTime: getSecond(this.timeFilter.startTime),
|
startTime: getSecond(this.timeFilter.startTime),
|
||||||
endTime: getSecond(this.timeFilter.endTime),
|
endTime: getSecond(this.timeFilter.endTime)
|
||||||
ip: '116.178.70.242'
|
|
||||||
}
|
}
|
||||||
this.loading = true
|
if (this.entity.entityType === 'app') {
|
||||||
this.toggleLoading(true)
|
const ipsOfApp = axios.get(api.entity.domainNameResolutionAboutIpsOfApp, { params: params })
|
||||||
const relatedApp = new Promise(resolve => {
|
const domainsOfApp = axios.get(api.entity.domainNameResolutionAboutDomainsOfApp, { params: params })
|
||||||
axios.get(api.entity.domainNameResolutionRelatedApp, { params: params }).then(response => {
|
this.promiseData(ipsOfApp, domainsOfApp)
|
||||||
const res = response.data
|
|
||||||
if (res.code === 200) {
|
|
||||||
this.isNoData = res.data.result.length === 0
|
|
||||||
this.showError = false
|
|
||||||
if (!this.isNoData) {
|
|
||||||
this.relatedAppList = res.data.result
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.httpError(res)
|
if (this.entity.entityType === 'ip') {
|
||||||
|
const appsOfIp = axios.get(api.entity.domainNameResolutionAboutAppsOfIp, { params: params })
|
||||||
|
const domainsOfIp = axios.get(api.entity.domainNameResolutionAboutDomainsOfIp, { params: params })
|
||||||
|
this.promiseData(appsOfIp, domainsOfIp)
|
||||||
}
|
}
|
||||||
}).catch(e => {
|
|
||||||
// console.error(e)
|
if (this.entity.entityType === 'domain') {
|
||||||
this.httpError(e)
|
const appsOfDomain = axios.get(api.entity.domainNameResolutionAboutAppsOfDomain, { params: params })
|
||||||
}).finally(() => {
|
const ipsOfDomain = axios.get(api.entity.domainNameResolutionAboutIpsOfDomain, { params: params })
|
||||||
// this.toggleLoading(false)
|
const fqdnsOfDomain = axios.get(api.entity.domainNameResolutionAboutFQDNsOfDomain, { params: params })
|
||||||
resolve()
|
this.promiseData(appsOfDomain, ipsOfDomain, fqdnsOfDomain)
|
||||||
})
|
|
||||||
})
|
|
||||||
const relatedIp = new Promise(resolve => {
|
|
||||||
axios.get(api.entity.domainNameResolutionRelatedIP, { params: params }).then(response => {
|
|
||||||
const res = response.data
|
|
||||||
if (res.code === 200) {
|
|
||||||
this.isNoData = res.data.result.length === 0
|
|
||||||
this.showError = false
|
|
||||||
if (!this.isNoData) {
|
|
||||||
this.relatedIpList = res.data.result
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.httpError(res)
|
|
||||||
}
|
|
||||||
}).catch(e => {
|
|
||||||
// console.error(e)
|
|
||||||
this.httpError(e)
|
|
||||||
}).finally(() => {
|
|
||||||
resolve()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
const relatedDomain = new Promise(resolve => {
|
|
||||||
axios.get(api.entity.domainNameResolutionRelatedDomain, { params: params }).then(response => {
|
|
||||||
const res = response.data
|
|
||||||
if (res.code === 200) {
|
|
||||||
this.isNoData = res.data.result.length === 0
|
|
||||||
this.showError = false
|
|
||||||
if (!this.isNoData) {
|
|
||||||
this.relatedDomainList = res.data.result
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.httpError(res)
|
|
||||||
}
|
|
||||||
}).catch(e => {
|
|
||||||
// console.error(e)
|
|
||||||
this.httpError(e)
|
|
||||||
}).finally(() => {
|
|
||||||
resolve()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
Promise.all([relatedApp, relatedIp, relatedDomain]).finally(response => {
|
|
||||||
this.toggleLoading(false)
|
|
||||||
this.loading = false
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
httpError (e) {
|
promiseData (data1, data2, data3) {
|
||||||
this.isNoData = false
|
this.showError0 = false
|
||||||
this.showError = true
|
this.showError1 = false
|
||||||
this.errorMsg = this.errorMsgHandler(e)
|
this.showError2 = false
|
||||||
this.relatedAppList = ['Wechat', 'baidu', 'Wechat', 'baidu', 'Wechat', 'baidu', 'Wechat']
|
this.toggleLoading(true)
|
||||||
this.relatedIpList = ['116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242', '116.178.70.242']
|
Promise.all([data1, data2, data3]).then(res => {
|
||||||
this.relatedDomainList = ['-*.pangolin-sdk-toutiao.com', '-*.pangolin-sdk-toutiao.com', '-*.pangolin-sdk-toutiao.com', '-*.pangolin-sdk-toutiao.com']
|
const res0 = res[0].data
|
||||||
|
const res1 = res[1].data
|
||||||
|
if (res0.code === 200 && res1.code === 200) {
|
||||||
|
this.isNoData = res0.data.result.length === 0 && res1.data.result.length === 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// app相关,显示ip、domain
|
||||||
|
if (this.entity.entityType === 'app' && !this.isNoData) {
|
||||||
|
if (res0.code === 200) {
|
||||||
|
this.relatedIpList = res0.data.result
|
||||||
|
} else {
|
||||||
|
this.showError1 = true
|
||||||
|
this.errorMsg1 = this.errorMsgHandler(res0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res1.code === 200) {
|
||||||
|
this.relatedDomainList = res1.data.result
|
||||||
|
} else {
|
||||||
|
this.showError2 = true
|
||||||
|
this.errorMsg2 = this.errorMsgHandler(res1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ip相关,显示app,domain
|
||||||
|
if (this.entity.entityType === 'ip' && !this.isNoData) {
|
||||||
|
if (res0.code === 200) {
|
||||||
|
this.relatedAppList = res0.data.result
|
||||||
|
} else {
|
||||||
|
this.showError0 = true
|
||||||
|
this.errorMsg0 = this.errorMsgHandler(res0)
|
||||||
|
}
|
||||||
|
if (res1.code === 200) {
|
||||||
|
this.relatedDomainList = res1.data.result
|
||||||
|
} else {
|
||||||
|
this.showError2 = true
|
||||||
|
this.errorMsg2 = this.errorMsgHandler(res1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// domain相关,显示app,ip,domain
|
||||||
|
if (this.entity.entityType === 'domain') {
|
||||||
|
const res2 = res[2].data
|
||||||
|
if (res0.code === 200 && res1.code === 200 && res2.code === 200) {
|
||||||
|
this.isNoData = res0.data.result.length === 0 && res1.data.result.length === 0 && res2.data.result.length === 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res0.code === 200) {
|
||||||
|
this.relatedAppList = res0.data.result
|
||||||
|
} else {
|
||||||
|
this.showError0 = true
|
||||||
|
this.errorMsg0 = this.errorMsgHandler(res0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res1.code === 200) {
|
||||||
|
this.relatedIpList = res1.data.result
|
||||||
|
} else {
|
||||||
|
this.showError1 = true
|
||||||
|
this.errorMsg1 = this.errorMsgHandler(res1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res2.code === 200) {
|
||||||
|
this.relatedDomainList = res2.data.result
|
||||||
|
} else {
|
||||||
|
this.showError2 = true
|
||||||
|
this.errorMsg2 = this.errorMsgHandler(res2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
console.log(e)
|
||||||
|
this.showError0 = true
|
||||||
|
this.showError1 = true
|
||||||
|
this.showError2 = true
|
||||||
|
this.errorMsg0 = this.errorMsgHandler(e)
|
||||||
|
this.errorMsg1 = this.errorMsgHandler(e)
|
||||||
|
this.errorMsg2 = this.errorMsgHandler(e)
|
||||||
|
}).finally(() => {
|
||||||
|
this.initFlag = true
|
||||||
|
this.toggleLoading(false)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,24 +3,27 @@
|
|||||||
<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"></chart-no-data>
|
<chart-no-data v-if="isNoData && !showError"></chart-no-data>
|
||||||
|
|
||||||
<div v-if="!showError && !isNoData && !loading" class="type-data__column">
|
<div v-if="!showError && !isNoData && initFlag" class="type-data__column">
|
||||||
<div class="type-data">
|
<div class="type-data">
|
||||||
<div class="type-title">
|
<div class="type-title">
|
||||||
<span class="title-mark" ></span>{{ $t('entities.tab.currentDevelopmentPortsAndServices') }} (5)</div>
|
<span class="title-mark"></span>
|
||||||
|
<span class="type-title-word">{{ $t('entities.tab.currentDevelopmentPortsAndServices') }}</span>({{ openPortList.length }})
|
||||||
|
</div>
|
||||||
<div class="type-content">
|
<div class="type-content">
|
||||||
<div v-for="openPort in openPortList" class="data-item">{{openPort}}</div>
|
<div v-for="(openPort, index) in openPortList" :key="index" class="data-item">
|
||||||
|
{{ openPort.port }}/{{ openPort.l7Protocol }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getNowTime, getSecond } from '@/utils/date-util'
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { api } from '@/utils/api'
|
|
||||||
import { ref } from 'vue'
|
|
||||||
import { useRoute } from 'vue-router'
|
|
||||||
import chartMixin from '@/views/charts2/chart-mixin'
|
import chartMixin from '@/views/charts2/chart-mixin'
|
||||||
|
import { api } from '@/utils/api'
|
||||||
|
import { getSecond } from '@/utils/date-util'
|
||||||
|
import chartNoData from '@/views/charts/charts/ChartNoData'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OpenPort',
|
name: 'OpenPort',
|
||||||
@@ -32,46 +35,28 @@ export default {
|
|||||||
openPortList: [],
|
openPortList: [],
|
||||||
showError: false,
|
showError: false,
|
||||||
errorMsg: '',
|
errorMsg: '',
|
||||||
loading: true
|
initFlag: false // 初始化标识,请求接口之后再显示,避免标题初始化会闪一下
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
chartNoData
|
||||||
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.initData()
|
this.initData()
|
||||||
},
|
},
|
||||||
setup () {
|
setup () {
|
||||||
const { query } = useRoute()
|
|
||||||
// 获取url携带的range、startTime、endTime
|
|
||||||
const rangeParam = query.range
|
|
||||||
const startTimeParam = query.startTime
|
|
||||||
const endTimeParam = query.endTime
|
|
||||||
// 若url携带了,使用携带的值,否则使用默认值。
|
|
||||||
const dateRangeValue = rangeParam ? parseInt(query.range) : 60
|
|
||||||
const timeFilter = ref({ dateRangeValue })
|
|
||||||
if (!startTimeParam || !endTimeParam) {
|
|
||||||
const {
|
|
||||||
startTime,
|
|
||||||
endTime
|
|
||||||
} = getNowTime(60)
|
|
||||||
timeFilter.value.startTime = startTime
|
|
||||||
timeFilter.value.endTime = endTime
|
|
||||||
} else {
|
|
||||||
timeFilter.value.startTime = parseInt(startTimeParam)
|
|
||||||
timeFilter.value.endTime = parseInt(endTimeParam)
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
timeFilter
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initData () {
|
initData () {
|
||||||
const params = {
|
const params = {
|
||||||
|
resource: this.entity.entityName,
|
||||||
startTime: getSecond(this.timeFilter.startTime),
|
startTime: getSecond(this.timeFilter.startTime),
|
||||||
endTime: getSecond(this.timeFilter.endTime)
|
endTime: getSecond(this.timeFilter.endTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.toggleLoading(true)
|
this.toggleLoading(true)
|
||||||
this.loading = true
|
const url = this.getUrlByEntityType(this.entity.entityType)
|
||||||
axios.get(api.entity.openPort, { params: params }).then(response => {
|
axios.get(url, { params: params }).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
|
||||||
@@ -86,15 +71,21 @@ export default {
|
|||||||
// console.error(e)
|
// console.error(e)
|
||||||
this.httpError(e)
|
this.httpError(e)
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
|
this.initFlag = true
|
||||||
this.toggleLoading(false)
|
this.toggleLoading(false)
|
||||||
this.loading = false
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
httpError (e) {
|
httpError (e) {
|
||||||
this.isNoData = false
|
this.isNoData = false
|
||||||
this.showError = true
|
this.showError = true
|
||||||
this.errorMsg = this.errorMsgHandler(e)
|
this.errorMsg = this.errorMsgHandler(e)
|
||||||
this.openPortList = ['11/rpcbind', '22/rpcbind', '231/zmpt', '22/rpcbind', '231/zmpt']
|
},
|
||||||
|
getUrlByEntityType (type) {
|
||||||
|
switch (type) {
|
||||||
|
case 'ip': return api.entity.openPortOfIp
|
||||||
|
case 'domain': return api.entity.openPortOfDomain
|
||||||
|
case 'app': return api.entity.openPortOfApp
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user