diff --git a/src/assets/css/components/views/charts/panel.scss b/src/assets/css/components/views/charts/panel.scss index 7448512e..ccf30365 100644 --- a/src/assets/css/components/views/charts/panel.scss +++ b/src/assets/css/components/views/charts/panel.scss @@ -30,7 +30,7 @@ justify-content:space-between; align-items:center; padding: 10px 20px 10px 18px; - height: 47px; + flex: 0 0 40px; font-size: 16px; color: $--color-text-primary; @@ -214,7 +214,7 @@ position: relative; border-radius: 2px; flex-grow: 1; - overflow: auto; + overflow: hidden; width: 100%; .chart-drawing { height: 100%; diff --git a/src/assets/css/components/views/detections/detections.scss b/src/assets/css/components/views/detections/detections.scss index 0507ea03..ad0cb22b 100644 --- a/src/assets/css/components/views/detections/detections.scss +++ b/src/assets/css/components/views/detections/detections.scss @@ -21,7 +21,7 @@ justify-content:space-between; align-items:center; padding: 10px 20px 10px 0px; - height: 40px; + flex: 0 0 40px; font-size: 14px; color: $--color-text-primary; diff --git a/src/assets/css/font/iconfont.css b/src/assets/css/font/iconfont.css index 2417058e..537462f7 100644 --- a/src/assets/css/font/iconfont.css +++ b/src/assets/css/font/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: "cn-icon"; /* Project id 2614877 */ - src: url('iconfont.woff2?t=1645687921203') format('woff2'), - url('iconfont.woff?t=1645687921203') format('woff'), - url('iconfont.ttf?t=1645687921203') format('truetype'); + src: url('iconfont.woff2?t=1647073084945') format('woff2'), + url('iconfont.woff?t=1647073084945') format('woff'), + url('iconfont.ttf?t=1647073084945') format('truetype'); } .cn-icon { @@ -13,6 +13,26 @@ -moz-osx-font-smoothing: grayscale; } +.cn-icon-intercept:before { + content: "\e600"; +} + +.cn-icon-fraudulent-app:before { + content: "\e601"; +} + +.cn-icon-fraudulent-ip:before { + content: "\e602"; +} + +.cn-icon-fraudulent-domain:before { + content: "\e603"; +} + +.cn-icon-partly-cloudy:before { + content: "\e604"; +} + .cn-icon-detection:before { content: "\e766"; } @@ -21,7 +41,7 @@ content: "\e764"; } -.cn-icon-qingchu:before { +.cn-icon-clear:before { content: "\e765"; } diff --git a/src/assets/css/font/iconfont.js b/src/assets/css/font/iconfont.js index 4befa1ff..004c214c 100644 --- a/src/assets/css/font/iconfont.js +++ b/src/assets/css/font/iconfont.js @@ -1 +1 @@ -!(function (c) { let a; let l; let h; let o; let i; let m = ''; var t = (t = document.getElementsByTagName('script'))[t.length - 1].getAttribute('data-injectcss'); const n = function (c, a) { a.parentNode.insertBefore(c, a) }; if (t && !c.__iconfont__svg__cssinject__) { c.__iconfont__svg__cssinject__ = !0; try { document.write('') } catch (c) { console && console.log(c) } } function v () { i || (i = !0, h()) } function z () { try { o.documentElement.doScroll('left') } catch (c) { return void setTimeout(z, 50) }v() }a = function () { let c; let a = document.createElement('div'); a.innerHTML = m, m = null, (a = a.getElementsByTagName('svg')[0]) && (a.setAttribute('aria-hidden', 'true'), a.style.position = 'absolute', a.style.width = 0, a.style.height = 0, a.style.overflow = 'hidden', a = a, (c = document.body).firstChild ? n(a, c.firstChild) : c.appendChild(a)) }, document.addEventListener ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) ? setTimeout(a, 0) : (l = function () { document.removeEventListener('DOMContentLoaded', l, !1), a() }, document.addEventListener('DOMContentLoaded', l, !1)) : document.attachEvent && (h = a, o = c.document, i = !1, z(), o.onreadystatechange = function () { o.readyState == 'complete' && (o.onreadystatechange = null, v()) }) }(window)) +!function(c){var a,l,h,o,i,m='',v=(v=document.getElementsByTagName("script"))[v.length-1].getAttribute("data-injectcss"),t=function(c,a){a.parentNode.insertBefore(c,a)};if(v&&!c.__iconfont__svg__cssinject__){c.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(c){console&&console.log(c)}}function z(){i||(i=!0,h())}function n(){try{o.documentElement.doScroll("left")}catch(c){return void setTimeout(n,50)}z()}a=function(){var c,a=document.createElement("div");a.innerHTML=m,m=null,(a=a.getElementsByTagName("svg")[0])&&(a.setAttribute("aria-hidden","true"),a.style.position="absolute",a.style.width=0,a.style.height=0,a.style.overflow="hidden",a=a,(c=document.body).firstChild?t(a,c.firstChild):c.appendChild(a))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(a,0):(l=function(){document.removeEventListener("DOMContentLoaded",l,!1),a()},document.addEventListener("DOMContentLoaded",l,!1)):document.attachEvent&&(h=a,o=c.document,i=!1,n(),o.onreadystatechange=function(){"complete"==o.readyState&&(o.onreadystatechange=null,z())})}(window); \ No newline at end of file diff --git a/src/assets/css/font/iconfont.ttf b/src/assets/css/font/iconfont.ttf index 816e08b2..9f6b0d97 100644 Binary files a/src/assets/css/font/iconfont.ttf and b/src/assets/css/font/iconfont.ttf differ diff --git a/src/assets/css/font/iconfont.woff b/src/assets/css/font/iconfont.woff index 2a479cdd..b236117a 100644 Binary files a/src/assets/css/font/iconfont.woff and b/src/assets/css/font/iconfont.woff differ diff --git a/src/assets/css/font/iconfont.woff2 b/src/assets/css/font/iconfont.woff2 index aa2c2721..5490c39e 100644 Binary files a/src/assets/css/font/iconfont.woff2 and b/src/assets/css/font/iconfont.woff2 differ diff --git a/src/components/advancedSearch/Index.vue b/src/components/advancedSearch/Index.vue index e1e507c2..72b42154 100644 --- a/src/components/advancedSearch/Index.vue +++ b/src/components/advancedSearch/Index.vue @@ -20,7 +20,6 @@ @changeMode="changeMode" @search="search" > - @@ -102,8 +101,20 @@ export default { ElMessage.error(this.$t('tip.invalidExpression')) } } + }, + enterListener (event) { + if (event.keyCode === 13) { + this.$refs.tagMode && this.$refs.tagMode.search() + this.$refs.textMode && this.$refs.textMode.search() + } } }, + mounted () { + document.addEventListener('keydown', this.enterListener) + }, + unmounted () { + document.removeEventListener('keydown', this.enterListener) + }, setup (props) { // 默认为文本模式 let searchMode = ref('text') diff --git a/src/components/advancedSearch/TagMode.vue b/src/components/advancedSearch/TagMode.vue index 2f71e8bf..0be32174 100644 --- a/src/components/advancedSearch/TagMode.vue +++ b/src/components/advancedSearch/TagMode.vue @@ -308,6 +308,12 @@ export default { }) } }, + mounted () { + const vm = this + this.emitter.on('advanced-search', function () { + vm.search() + }) + }, watch: { convertMetaList: { immediate: true, diff --git a/src/components/advancedSearch/TextMode.vue b/src/components/advancedSearch/TextMode.vue index 9426ac3e..c057e56b 100644 --- a/src/components/advancedSearch/TextMode.vue +++ b/src/components/advancedSearch/TextMode.vue @@ -23,6 +23,7 @@ import CodeMirror from 'codemirror' import { toRaw } from 'vue' import { columnType } from '@/components/advancedSearch/meta/meta' import { ElMessage } from 'element-plus' +import { reg } from '@/utils/constants' export default { name: 'TextMode', @@ -53,7 +54,20 @@ export default { search () { let originalSql = this.codeMirror.getValue() if (originalSql) { - originalSql = originalSql.replace(/"/g, '') + originalSql = originalSql.replaceAll(/"/g, '') + // 为解决ip无法校验通过的问题,先将带引号的ip转为不带引号的,再把不带引号的转为带引号的 + originalSql = originalSql.replaceAll(reg.notStrictWithQuotIpv4, function (word) { + return word.replaceAll(/'/g, '') + }) + originalSql = originalSql.replaceAll(reg.notStrictIpv4, function (word) { + return `'${word}'` + }) + originalSql = originalSql.replaceAll(reg.notStrictWithQuotIpv6, function (word) { + return word.replaceAll(/'/g, '') + }) + originalSql = originalSql.replaceAll(reg.notStrictIpv6, function (word) { + return `'${word}'` + }) const parser = new SqlParser(originalSql, this.columnList) const errorList = parser.validate() if (this.$_.isEmpty(errorList)) { @@ -144,6 +158,10 @@ export default { }, mounted () { this.initCodeMirror() + const vm = this + this.emitter.on('advanced-search', function () { + vm.search() + }) } } diff --git a/src/utils/api.js b/src/utils/api.js index aba989fa..b09f1cf9 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -130,13 +130,21 @@ export async function getEntityFilter (params) { export async function getDictList (params) { return await getData(api.dict, params, true) } - +function handleResult (response) { + if (response.data.list || response.data.result) { + return response.data.list || response.data.result + } else if (response.data.result === 0) { + return response.data.result + } else { + return response.data + } +} export async function getData (url, params = {}, isQueryList) { const request = new Promise((resolve, reject) => { try { get(url, params).then(response => { if (response.code === 200) { - resolve(isQueryList ? response.data.list || response.data.result : response.data.result || response.data) + resolve(handleResult(response)) } else { reject(response) } diff --git a/src/utils/constants.js b/src/utils/constants.js index d6bdc96f..caea85c5 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -410,3 +410,14 @@ export const iso36112 = { SZ: 'eswatiniLow', MN: 'mongoliaLow' } + +export const reg = { + // 不严格ipv4 + notStrictIpv4: /(?:[0-9]{1,}\.){0,}[0-9]{1,}(\.)?/g, + // 不严格Ipv4带单引号 + notStrictWithQuotIpv4: /'(?:[0-9]{1,}\.){0,}[0-9]{1,}(\.)?'/g, + // 不严格ipv6 + notStrictIpv6: /(:{0,}[a-fA-F\d]{0,}){0,}:+([a-fA-F\d]{0,}:{0,}){0,}/g, + // 不严格Ipv6带单引号 + notStrictWithQuotIpv6: /'(:{0,}[a-fA-F\d]{0,}){0,}:+([a-fA-F\d]{0,}:{0,}){0,}'/g +} diff --git a/src/views/charts/Chart.vue b/src/views/charts/Chart.vue index f1135d52..6ce29805 100644 --- a/src/views/charts/Chart.vue +++ b/src/views/charts/Chart.vue @@ -6,6 +6,7 @@ @@ -14,6 +15,7 @@ v-else-if="isMap && !isIpBasicInfo" :chart-info="chartInfo" :chart-data="chartData" + :time-filter="timeFilter" :query-params="queryParams" :entity="entity" @getChartData="getChartData" @@ -24,14 +26,16 @@ v-else-if="isSingleValue" :chart-info="chartInfo" :chart-data="chartData" + :time-filter="timeFilter" :query-params="queryParams" @showLoading="showLoading" > @@ -66,6 +74,7 @@ :chart-info="chartInfo" :chart-data="chartData" :result-type="resultType" + :time-filter="timeFilter" :query-params="queryParams" @showLoading="showLoading" > @@ -75,6 +84,7 @@ :chart-info="chartInfo" :chart-data="chartData" :result-type="resultType" + :time-filter="timeFilter" :query-params="queryParams" @showLoading="showLoading" > @@ -84,6 +94,7 @@ :chart-info="chartInfo" :chart-data="chartData" :table="table" + :time-filter="timeFilter" :query-params="queryParams" @showLoading="showLoading" > @@ -93,6 +104,7 @@ :chart-info="chartInfo" :chart-data="chartData" :table="table" + :time-filter="timeFilter" :query-params="queryParams" > @@ -100,6 +112,7 @@ v-else-if="isAppBasicInfo" :chart-info="chartInfo" :chart-data="chartData" + :time-filter="timeFilter" :query-params="queryParams" > @@ -107,6 +120,7 @@ v-else-if="isDomainWhois" :chart-info="chartInfo" :chart-data="chartData" + :time-filter="timeFilter" :query-params="queryParams" > @@ -114,6 +128,7 @@ v-else-if="isDomainDnsRecord" :chart-info="chartInfo" :chart-data="chartData" + :time-filter="timeFilter" :query-params="queryParams" > @@ -121,6 +136,7 @@ v-else-if="isCryptocurrencyEventList" :chart-info="chartInfo" :chart-data="chartData" + :time-filter="timeFilter" :query-params="queryParams" > @@ -128,6 +144,7 @@ v-else-if="isRelationShip" :chart-info="chartInfo" :chart-data="chartData" + :time-filter="timeFilter" :query-params="queryParams" > @@ -135,6 +152,7 @@ v-else-if="isSankey" :chart-info="chartInfo" :chart-data="chartData" + :time-filter="timeFilter" :query-params="queryParams" :entity="entity" > @@ -144,6 +162,8 @@ :chart-info="chartInfo" :chart-data="chartData" :result-type="resultType" + :time-filter="timeFilter" + :query-params="queryParams" @showLoading="showLoading" > @@ -152,6 +172,8 @@ :chart-info="chartInfo" :chart-data="chartData" :result-type="resultType" + :time-filter="timeFilter" + :query-params="queryParams" @showLoading="showLoading" > @@ -160,6 +182,7 @@ :chart-info="chartInfo" :chart-data="chartData" :query-params="queryParams" + :time-filter="timeFilter" :result-type="resultType" :order-pie-table="orderPieTable" @showLoading="showLoading" @@ -167,8 +190,10 @@ @@ -179,6 +204,8 @@ :chart-data="chartData" @showLoading="showLoading" :entity="entity" + :time-filter="timeFilter" + :query-params="queryParams" > + + @@ -242,6 +279,7 @@ import ChartSanKey from '@/views/charts/charts/ChartSanKey' import ChartOneSituationStatistics from '@/views/charts/charts/ChartOneSituationStatistics' import ChartTwoSituationStatistics from '@/views/charts/charts/ChartTwoSituationStatistics' import ChartAlarmInfo from '@/views/charts/charts/ChartAlarmInfo' +import ChartDomainRecursiveResolve from '@/views/charts/charts/ChartDomainRecursiveResolve' import { isEcharts, isEchartsLine, @@ -278,6 +316,7 @@ import { isSingleSupportStatistics, isTwoSupportStatistics, isAlarmInfo, + isDomainRecursiveResolve } from './charts/tools' import _ from 'lodash' @@ -311,6 +350,7 @@ export default { ChartOneSituationStatistics, ChartTwoSituationStatistics, ChartAlarmInfo, + ChartDomainRecursiveResolve }, data() { return { @@ -329,8 +369,9 @@ export default { entity: Object, isError: Boolean, table: Object, + timeFilter: Object, orderPieTable: Object, - tabHandleClickType: String, + tabHandleClickType: String }, computed: { isNoData() { @@ -381,19 +422,12 @@ export default { }, }, watch: { - chartData: { - deep: true, - handler(n) {}, - }, tabHandleClickType: { deep: true, handler(n) { this.tabHandleClickType = n }, - }, - queryParams: { - deep: true, - }, + } }, setup(props) { return { @@ -428,17 +462,17 @@ export default { isDomainWhois: isDomainWhois(props.chartInfo.type), isDomainDnsRecord: isDomainDnsRecord(props.chartInfo.type), isCryptocurrencyEventList: isCryptocurrencyEventList( - props.chartInfo.type, + props.chartInfo.type ), isAppBasicInfo: isAppBasicInfo(props.chartInfo.type), isAppRelatedDomain: isAppRelatedDomain(props.chartInfo.type), isSingleSupportStatistics: isSingleSupportStatistics( - props.chartInfo.type, + props.chartInfo.type ), isTwoSupportStatistics: isTwoSupportStatistics(props.chartInfo.type), isAlarmInfo: isAlarmInfo(props.chartInfo.type), - + isDomainRecursiveResolve: isDomainRecursiveResolve(props.chartInfo.type) } - }, + } } diff --git a/src/views/charts/ChartHeader.vue b/src/views/charts/ChartHeader.vue index 6e034e90..0e56634a 100644 --- a/src/views/charts/ChartHeader.vue +++ b/src/views/charts/ChartHeader.vue @@ -311,11 +311,12 @@ export default { this.$emit('refresh') }, timeRefreshChange() { + // 不是自选时间 if (!this.$refs.dateTimeRange.isCustom) { const value = this.chartTimeFilter.dateRangeValue this.$refs.dateTimeRange.quickChange(value) } else { - this.$emit('refresh') + this.$emit('refresh', this.chartTimeFilter) } }, reload(s, e, v) { @@ -326,7 +327,6 @@ export default { }, dateTimeRangeChange(s, e, v) { this.chartTimeFilter = { startTime: s, endTime: e, dateRangeValue: v } - console.log(this.chartTimeFilter) this.$emit('refresh', this.chartTimeFilter) }, tableLimitChange() { diff --git a/src/views/charts/Panel.vue b/src/views/charts/Panel.vue index e2d278df..bf3b3579 100644 --- a/src/views/charts/Panel.vue +++ b/src/views/charts/Panel.vue @@ -146,6 +146,7 @@ export default { callback({ startTime: myStartTime, endTime: myEndTime }) }, timeRefreshChange () { + // 不是自选时间 if (!this.$refs.dateTimeRange.isCustom) { const value = this.timeFilter.dateRangeValue this.$refs.dateTimeRange.quickChange(value) diff --git a/src/views/charts/PanelChart.vue b/src/views/charts/PanelChart.vue index 0d92ba55..649af453 100644 --- a/src/views/charts/PanelChart.vue +++ b/src/views/charts/PanelChart.vue @@ -38,6 +38,7 @@ :table="table" :is-fullscreen="isFullscreen" :order-pie-table="orderPieTable" + :time-filter="timeFilter" @getChartData="getChartData" @showLoading="showLoading" :tabHandleClickType="tabHandleClickType" @@ -191,7 +192,7 @@ export default { ...this.handleQueryParams(), ...this.queryTimeRange, ...this.entity, - + ...extraParams } const requestUrl = url || (chartParams && chartParams.url) @@ -288,13 +289,20 @@ export default { this.$refs.chart.resize() }, refresh (chartTimeFilter) { - const myEndTime = window.$dayJs.tz().valueOf() - const myStartTime = myEndTime - this.chartTimeFilter.dateRangeValue * 60 * 1000 - this.standaloneTimeRange.use = true - this.standaloneTimeRange.startTime = myStartTime - this.standaloneTimeRange.endTime = myEndTime - this.emitter.emit('chart-pageNo') - this.getChartData(null, {}, true, chartTimeFilter) + if (chartTimeFilter) { + this.timeFilter.startTime = chartTimeFilter.startTime + this.timeFilter.endTime = chartTimeFilter.endTime + this.timeFilter.dateRangeValue = chartTimeFilter.dateRangeValue + this.getChartData(null, {}, true, chartTimeFilter) + } else { + const myEndTime = window.$dayJs.tz().valueOf() + const myStartTime = myEndTime - this.timeFilter.dateRangeValue * 60 * 1000 + this.standaloneTimeRange.use = true + this.standaloneTimeRange.startTime = myStartTime + this.standaloneTimeRange.endTime = myEndTime + this.emitter.emit('chart-pageNo') + this.getChartData(null, {}, true) + } }, tabHandleClick (value) { this.tabHandleClickType = value @@ -371,9 +379,6 @@ export default { mounted () { this.showLoading(true) this.getChartData() - // setTimeout(() => { - // this.getChartData() - // }, 200) }, setup (props) { const dateRangeValue = 60 diff --git a/src/views/charts/PanelChartList.vue b/src/views/charts/PanelChartList.vue index fcf88881..7f3a0423 100644 --- a/src/views/charts/PanelChartList.vue +++ b/src/views/charts/PanelChartList.vue @@ -66,7 +66,7 @@ diff --git a/src/views/charts/charts/ChartEchartWithTable.vue b/src/views/charts/charts/ChartEchartWithTable.vue index d2c6531b..0e68b92e 100644 --- a/src/views/charts/charts/ChartEchartWithTable.vue +++ b/src/views/charts/charts/ChartEchartWithTable.vue @@ -47,7 +47,7 @@ export default { }, methods: { handleQueryParams (queryParams) { - this.timeFilter = { + return this.timeFilter = { startTime: Number(queryParams.startTime) * 1000, endTime: Number(queryParams.endTime) * 1000 } diff --git a/src/views/charts/charts/ChartGroup.vue b/src/views/charts/charts/ChartGroup.vue index 84cca306..987f0bfb 100644 --- a/src/views/charts/charts/ChartGroup.vue +++ b/src/views/charts/charts/ChartGroup.vue @@ -1,6 +1,7 @@