This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cyber-narrator-cn-ui/src/views/detections/DetectionSearch.vue

134 lines
3.4 KiB
Vue
Raw Normal View History

2022-02-14 22:22:31 +08:00
<template>
2022-02-15 23:27:55 +08:00
<div class="explorer-search explorer-search--show-list">
2022-02-14 22:22:31 +08:00
<div class="explorer-search__input-case explorer-search__input-case--question-mark-in-line">
<div class="explorer-search__input">
<advanced-search
ref="search"
:column-list="columnList[pageType]"
2022-02-14 22:22:31 +08:00
:connection-list="connectionList"
:default-mode="defaultMode"
2022-02-14 22:22:31 +08:00
class="advanced-search--show-list"
:full-text="true"
:show-list="showList"
2022-02-14 22:22:31 +08:00
@search="search"
></advanced-search>
</div>
<!-- <div class="search-symbol-inline">-->
<!-- <i class="cn-icon cn-icon-help"></i>-->
<!-- </div>-->
2022-02-14 22:22:31 +08:00
</div>
</div>
</template>
<script>
import AdvancedSearch from '@/components/advancedSearch/Index'
import { schemaDetectionSecurity } from '@/utils/static-data'
import { useRoute } from 'vue-router'
import { ref } from 'vue'
2022-02-14 22:22:31 +08:00
export default {
name: 'DetectionSearch',
props: {
pageType: String
},
2022-02-14 22:22:31 +08:00
components: {
AdvancedSearch
},
data () {
return {
columnList: {
securityEvent: schemaDetectionSecurity,
performanceEvent: [
{
name: 'event_severity',
type: 'string',
// label: 'Event severity'
label: 'event_severity',
doc: {
constraints: {
operator_functions: '=,in'
}
}
},
{
name: 'app_name',
type: 'string',
// label: 'APP name'
label: 'app_name',
doc: {
constraints: {
operator_functions: '=,in'
}
}
},
{
name: 'domain',
type: 'string',
// label: 'Domain'
label: 'domain',
doc: {
constraints: {
operator_functions: '=,in'
}
}
},
{
name: 'server_ip',
type: 'string',
// label: 'IP'
label: 'server_ip',
doc: {
constraints: {
operator_functions: '=,in'
}
}
}
]
},
2023-06-07 15:58:59 +08:00
operatorList: ['=', '!=', /* '>', '<', '>=', '<=', */'IN', 'NOT IN', 'LIKE', 'NOT LIKE'],
2022-02-15 23:27:55 +08:00
connectionList: [
{
value: 'AND',
label: 'AND'
},
{
value: 'OR',
label: 'OR'
}
],
showList: true
2022-02-14 22:22:31 +08:00
}
},
emits: ['search'],
setup () {
// 根据地址栏添加mode即text和tag模式默认text
const { query } = useRoute()
const defaultMode = ref(query.mode || 'text')
return {
defaultMode
}
},
2022-02-14 22:22:31 +08:00
methods: {
2022-12-08 16:09:46 +08:00
/* search (metaList, formatSql) {
let sql = formatSql
// 全文搜索处理
if (metaList && this.$_.isArray(metaList)) {
const hasFullText = metaList.some(meta => {
return meta.column && meta.column.type === columnType.fullText
})
if (hasFullText) {
const parser = new SqlParser(metaList, this.columnList[this.pageType])
sql = parser.parseMetaToSql(metaList, true)
}
}
this.$emit('search', metaList, sql)
2022-12-08 16:09:46 +08:00
}, */
2022-06-06 17:34:55 +08:00
search ({ q, metaList }) {
this.$emit('search', { q, metaList })
2022-02-18 10:07:43 +08:00
},
changeParams (params) {
this.$refs.search.addParams(params)
2022-02-14 22:22:31 +08:00
}
}
}
</script>