diff --git a/.env b/.env index 46ee672a..53c6cb97 100644 --- a/.env +++ b/.env @@ -2,6 +2,8 @@ # base api VUE_APP_BASE_API = '/api/v1' VUE_APP_BASE_API_V2 = '/api/v2' +VUE_APP_BASE_SCA_V2 = '/api/sca/v2' +VUE_APP_BASE_SCA_V1 = '/api/sca/v1' VUE_APP_UPLOAD = '/upload' VUE_APP_OPEN_API = '/openapi' VUE_APP_ATOM_API = '/atom-webapi' diff --git a/.github/workflows/deploy-to-test.yml b/.github/workflows/deploy-dev.yml similarity index 70% rename from .github/workflows/deploy-to-test.yml rename to .github/workflows/deploy-dev.yml index ae8a9cbc..f752b0ae 100644 --- a/.github/workflows/deploy-to-test.yml +++ b/.github/workflows/deploy-dev.yml @@ -71,22 +71,27 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: | - registry.cn-hongkong.aliyuncs.com/huoxian_pub/dongtai-web-test:1.0.${{github.run_number}}-${{ steps.version.outputs.GITHUB_REF }} - registry.cn-hongkong.aliyuncs.com/huoxian_pub/dongtai-web-test:latest-${{ steps.version.outputs.GITHUB_REF }} + registry.cn-hongkong.aliyuncs.com/secnium/dongtai-web:${{ steps.version.outputs.GITHUB_REF }}-latest + registry.cn-hongkong.aliyuncs.com/secnium/dongtai-web:${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}} + + - name: Set the value + id: release + run: | + if [ ${{ steps.version.outputs.GITHUB_REF }} = develop ] ; then echo "helm_ns=test" >> $GITHUB_ENV; echo "helm_mysql=test" >> $GITHUB_ENV + elif [ ${{ steps.version.outputs.GITHUB_REF }} = beta ] ; then echo "helm_ns=beta" >> $GITHUB_ENV; echo "helm_mysql=beta" >> $GITHUB_ENV + else echo "helm_ns=main" >> $GITHUB_ENV ; echo "helm_mysql=temp" >> $GITHUB_ENV ;fi - - uses: actions/checkout@master - name: deploy to cluster uses: wahyd4/kubectl-helm-action@master env: KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_TEST_DATA }} with: args: | - if [ ${{ steps.version.outputs.GITHUB_REF }} = beta ] ; then find deploy/deploy-eks-iast-saas-web-test.yml -type f -exec sed -i 's/iast-test/iast-beta/g' {} \; - elif [ ${{ steps.version.outputs.GITHUB_REF }} = develop ] ; then echo 'testing !!!' - else find deploy/deploy-eks-iast-saas-web-test.yml -type f -exec sed -i 's/iast-test/iast-main/g' {} \; ;fi - find deploy/deploy-eks-iast-saas-web-test.yml -type f -exec sed -i 's/VERSION/1.0.${{github.run_number}}-${{ steps.version.outputs.GITHUB_REF }}/g' {} \; - ls deploy/deploy-eks-iast-saas-web-test.yml | xargs -I {} kubectl apply -f {} - + git clone https://github.com/HXSecurity/DongTai.git + helm upgrade --install huoxian --create-namespace -n iast-${{ env.helm_ns }} ./DongTai/deploy/kubernetes/helm/ \ + --set develop.agentZip=${{ env.helm_ns }} --set sca.sca_token=${{ secrets.TOKEN_SCA }} --set usb.usb_token=${{ secrets.TOKEN_SCA }} --set mysql.host=iast-mysql-${{ env.helm_mysql }}.huoxian.cn \ + --set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.web_number=iast${{github.run_number}} --values https://charts.dongtai.io/devops.yaml + - name: finish build uses: joelwmale/webhook-action@master with: diff --git a/deploy/deploy-eks-iast-saas-web-dev.yml b/deploy/deploy-eks-iast-saas-web-dev.yml deleted file mode 100644 index a0fce693..00000000 --- a/deploy/deploy-eks-iast-saas-web-dev.yml +++ /dev/null @@ -1,34 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: dongtai-web - namespace: iast-dev - annotations: - kubesphere.io/description: dongtai前端项目 - labels: - app: dongtai-web -spec: - replicas: 1 - selector: - matchLabels: - app: dongtai-web - template: - metadata: - labels: - app: dongtai-web - spec: - containers: - - name: dongtai-web-container - image: registry.cn-beijing.aliyuncs.com/secnium/iast-saas-web-dev:VERSION - imagePullPolicy: Always - - resources: - limits: - cpu: "500m" - memory: 1000Mi - requests: - cpu: "500m" - memory: 1000Mi - imagePullSecrets: - - name: aliyun-registry-secret - diff --git a/deploy/deploy-eks-iast-saas-web-prod.yml b/deploy/deploy-eks-iast-saas-web-prod.yml deleted file mode 100644 index 01f08a19..00000000 --- a/deploy/deploy-eks-iast-saas-web-prod.yml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: dongtai-web - namespace: iast-prod - annotations: - kubesphere.io/description: dongtai前端项目 - labels: - app: dongtai-web -spec: - replicas: 1 - selector: - matchLabels: - app: dongtai-web - template: - metadata: - labels: - app: dongtai-web - spec: - containers: - - name: dongtai-web-container - image: dongtai/dongtai-web:VERSION - imagePullPolicy: Always - volumeMounts: - - name: configfile - mountPath: /etc/nginx/nginx.conf - subPath: nginx.conf - resources: - limits: - cpu: "500m" - memory: 1000Mi - requests: - cpu: "500m" - memory: 1000Mi - volumes: - - name: configfile - configMap: - name: dongtai-web-nginx-conf diff --git a/deploy/deploy-eks-iast-saas-web-test.yml b/deploy/deploy-eks-iast-saas-web-test.yml deleted file mode 100644 index b9432213..00000000 --- a/deploy/deploy-eks-iast-saas-web-test.yml +++ /dev/null @@ -1,44 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: dongtai-web - namespace: iast-test - annotations: - kubesphere.io/description: dongtai前端项目 - labels: - app: dongtai-web - version: v1 -spec: - replicas: 1 - selector: - matchLabels: - app: dongtai-web - template: - metadata: - annotations: - sidecar.istio.io/inject: "true" - labels: - app: dongtai-web - version: v1 - spec: - containers: - - name: dongtai-web-container - image: registry.cn-hongkong.aliyuncs.com/huoxian_pub/dongtai-web-test:VERSION - imagePullPolicy: Always - volumeMounts: - - name: configfile - mountPath: /etc/nginx/nginx.conf - subPath: nginx.conf - resources: - limits: - cpu: "500m" - memory: 1000Mi - requests: - cpu: "500m" - memory: 1000Mi - volumes: - - name: configfile - configMap: - name: dongtai-web-nginx-conf - imagePullSecrets: - - name: aliyun-registry-secret diff --git a/src/config/lang/en.ts b/src/config/lang/en.ts index de2fbe9f..c7c71a86 100644 --- a/src/config/lang/en.ts +++ b/src/config/lang/en.ts @@ -101,6 +101,7 @@ export default { scaList: 'Component management list', scaDetail: 'Component management details', scanDetail: 'Scan vulnerability details', + scalistDetail: 'Scan details', changeLogo: 'Site Identity', setting: 'Settings', agentManage: 'Agent', diff --git a/src/config/lang/zh_cn.ts b/src/config/lang/zh_cn.ts index a766bc96..a63536d9 100644 --- a/src/config/lang/zh_cn.ts +++ b/src/config/lang/zh_cn.ts @@ -95,9 +95,10 @@ export default { vulnDetail: '应用漏洞详情', sca: '组件', scaList: '组件管理列表', + scalistDetail: '组件详情', scaDetail: '组件管理详情', scanDetail: '扫描漏洞详情', - setting: '系统配置', + setting: '系统设置', changeLogo: '品牌配置', agentManage: 'Agent', sensitive: '敏感信息', diff --git a/src/router/routes.ts b/src/router/routes.ts index c0cfbf5f..5480f214 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -190,6 +190,15 @@ const routes: Array = [ }, component: () => import('@/views/sca/ScaList.vue'), }, + { + path: 'scalistDetail/:page/:id', + name: 'scalistDetail/:page/:id', + meta: { + i18n: 'menu.scalistDetail', + name: i18n.t('menu.vulnDetail'), + }, + component: () => import('@/views/sca/ScaDialog.vue'), + }, ], }, { @@ -561,6 +570,15 @@ const adminRoutes: Array = [ }, component: () => import('@/views/sca/ScaList.vue'), }, + { + path: 'scalistDetail/:page/:id', + name: 'scalistDetail/:page/:id', + meta: { + i18n: 'menu.scalistDetail', + name: i18n.t('menu.vulnDetail'), + }, + component: () => import('@/views/sca/ScaDialog.vue'), + }, ], }, { @@ -965,6 +983,15 @@ const userRoutes: Array = [ }, component: () => import('@/views/sca/ScaList.vue'), }, + { + path: 'scalistDetail/:page/:id', + name: 'scalistDetail/:page/:id', + meta: { + i18n: 'menu.scalistDetail', + name: i18n.t('menu.scalistDetail'), + }, + component: () => import('@/views/sca/ScaDialog.vue'), + }, ], }, { diff --git a/src/services/project.ts b/src/services/project.ts index 416bea21..bad91423 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -7,14 +7,6 @@ interface ProjectListParams { name: string } -interface ProjectAddParams { - pid?: number | string - name: string - mode: string - agent_ids: string - scan_id: number -} - export default () => new (class { // 项目列表 @@ -43,7 +35,7 @@ export default () => } //新增项目 编辑 - projectAdd(params: ProjectAddParams): Promise { + projectAdd(params: any): Promise { return request.post('/project/add', params) } diff --git a/src/services/sca.ts b/src/services/sca.ts index 1e12e7bc..413336f0 100644 --- a/src/services/sca.ts +++ b/src/services/sca.ts @@ -29,29 +29,81 @@ export default () => }) } - assetVuls(aggr_id: any): Promise { - return request.get('/asset_vuls/' + aggr_id, { - baseURL: '/openapi/sca/v1', - }) + assetVuls(row: any): Promise { + return request.get( + `/package_vuls/${row.language_id}/${row.package_name}/${row.package_version}?page=${row.page}&page_size=${row.page_size}`, + { + baseURL: '/api/sca/v2', + } + ) } - assetProjects(aggr_id: any): Promise { - return request.get('/asset_projects/' + aggr_id, { - baseURL: '/openapi/sca/v1', + assetProjects(row: any): Promise { + if (row.project_id) { + return request.get( + `/package/${row.language_id}/${row.package_name}/${row.package_version}/relation_projects?page=${row.page}&page_size=${row.page_size}&project_id=${row.project_id}`, + { + baseURL: '/api/sca/v2', + } + ) + } + return request.get( + `/package/${row.language_id}/${row.package_name}/${row.package_version}/relation_projects?page=${row.page}&page_size=${row.page_size}`, + { + baseURL: '/api/sca/v2', + } + ) + } + assetProjectId(row: any): Promise { + return request.get( + `/package/${row.language_id}/${row.package_name}/${row.package_version}/relation_project/${row.project_id}`, + { + baseURL: '/api/sca/v2', + } + ) + } + vulPackId(row: any): Promise { + return request.get(`/package_vul/${row.vul_id}`, { + baseURL: '/api/sca/v2', }) } - // scaList + // scaList /api/sca/v2/package + // scaList(data: any): Promise { + // return request.post('/scas', data) + // } scaList(data: any): Promise { - return request.post('/scas', data) + return request.post('/package/', data, { + baseURL: '/api/sca/v2', + }) } // scaSummary + // scaSummary(data: any): Promise { + // return request.post('/sca/summary', data) + // } scaSummary(data: any): Promise { - return request.post('/sca/summary', data) + if (data.project_id) { + return request.get( + `/package_summary?project_id=${data.project_id}&project_version_id=${data.version_id}&keyword=${data.keyword}`, + { + baseURL: '/api/sca/v2', + // baseURL: '/openapi/sca/v2', + } + ) + } + return request.get(`/package_summary?keyword=${data.keyword}`, { + baseURL: '/api/sca/v2', + // baseURL: '/openapi/sca/v2', + }) } // getScaDetail - getScaDetail(id: number): Promise { - return request.get(`/sca/${id}`) + getScaDetail(row: any): Promise { + return request.get( + `/package/${row.language_id}/${row.package_name}/${row.package_version}/detail`, + { + baseURL: '/api/sca/v2', + } + ) } })() diff --git a/src/styles/iconfont/demo_index.html b/src/styles/iconfont/demo_index.html index 9b74f8bf..59b73019 100644 --- a/src/styles/iconfont/demo_index.html +++ b/src/styles/iconfont/demo_index.html @@ -3,8 +3,8 @@ iconfont Demo - - + + @@ -54,6 +54,30 @@

    +
  • + +
    grip
    +
    
    +
  • + +
  • + +
    latesttime
    +
    
    +
  • + +
  • + +
    firsttime
    +
    
    +
  • + +
  • + +
    left
    +
    
    +
  • +
  • new
    @@ -660,9 +684,9 @@

    第一步:拷贝项目下面生成的 @font-face@font-face { font-family: 'iconfont'; - src: url('iconfont.woff2?t=1653984795567') format('woff2'), - url('iconfont.woff?t=1653984795567') format('woff'), - url('iconfont.ttf?t=1653984795567') format('truetype'); + src: url('iconfont.woff2?t=1686049012669') format('woff2'), + url('iconfont.woff?t=1686049012669') format('woff'), + url('iconfont.ttf?t=1686049012669') format('truetype'); }

    第二步:定义使用 iconfont 的样式

    @@ -688,6 +712,42 @@

    第三步:挑选相应图标并获取字体编码,应用于页面
      +
    • + +
      + grip +
      +
      .icongrip +
      +
    • + +
    • + +
      + latesttime +
      +
      .iconlatesttime +
      +
    • + +
    • + +
      + firsttime +
      +
      .iconfirsttime +
      +
    • + +
    • + +
      + left +
      +
      .iconleft +
      +
    • +
    • @@ -1597,6 +1657,38 @@

      第二步:挑选相应图标并获取类名,应用于页面:
        +
      • + +
        grip
        +
        #icongrip
        +
      • + +
      • + +
        latesttime
        +
        #iconlatesttime
        +
      • + +
      • + +
        firsttime
        +
        #iconfirsttime
        +
      • + +
      • + +
        left
        +
        #iconleft
        +
      • +
      • - 返回列表 + 返回项目列表
        @@ -49,7 +49,7 @@ {{ $t('views.projectDetail.projectComponent') }} - {{ $t('views.projectDetail.apiList') }} - + -->
        -

      @@ -74,66 +38,6 @@ :placeholder="$t('views.projectEdit.namePlaceholder')" > - -
      - - - - - {{ $t('views.projectEdit.scanAdd') }} - -
      -
      - -
      - - - -
      -
      - - - - - - -
      - - - - - {{ $t('views.projectEdit.scanAdd') }} - -
      -
      - -
      - - - -
      -
      - - - - - - scanId: number | undefined version_name: string description: string vul_validation: number base_url: string test_req_header_key: string test_req_header_value: string - department_id: any - template_id: any log_level: any enable_log: any } = { name: '', mode: this.$t('views.projectEdit.mode1') as string, agentIdList: [], - scanId: undefined, version_name: '', description: '', vul_validation: 0, base_url: '', test_req_header_key: '', test_req_header_value: '', - department_id: '', - template_id: '', log_level: '', enable_log: '', } @@ -659,27 +496,6 @@ export default class ProjectEdit extends VueBase { trigger: 'blur', }, ], - scanId: [ - { - required: true, - message: this.$t('views.projectEdit.scanPlaceholder'), - trigger: 'change', - }, - ], - department_id: [ - { - required: true, - message: this.$t('views.projectEdit.departmentPlaceholder'), - trigger: 'change', - }, - ], - template_id: [ - { - required: true, - message: this.$t('views.projectEdit.templatePlaceholder'), - trigger: 'change', - }, - ], } private scanAddDialogOpen = false @@ -713,24 +529,12 @@ export default class ProjectEdit extends VueBase { } this.$message.error(res.msg) } - private async getListProjecttemplat() { - const res = await this.services.setting.listProjecttemplat({ - page: 1, - page_size: 100, - }) - if (res.status === 201) { - this.projectList = res.data - return - } - this.$message.error(res.msg) - } async created() { if (this.$route.params.pid) { this.newEdit = true } await this.getEngineList() await this.getListDepartment() - await this.getListProjecttemplat() await this.strategyUserList() if (this.$route.params.pid) { await this.projectDetail() @@ -771,15 +575,12 @@ export default class ProjectEdit extends VueBase { this.submitForm.agentIdList = data.agents.map((item: { id: any }) => { return item.id }) - this.submitForm.scanId = data.scan_id this.submitForm.version_name = data.versionData?.version_name this.submitForm.description = data.versionData?.description this.submitForm.vul_validation = data.vul_validation this.submitForm.base_url = data.base_url this.submitForm.test_req_header_key = data.test_req_header_key this.submitForm.test_req_header_value = data.test_req_header_value - this.submitForm.department_id = data.department_id - this.submitForm.template_id = data.template_id this.submitForm.enable_log = data.enable_log this.submitForm.log_level = data.log_level this.agentChange() @@ -933,7 +734,6 @@ export default class ProjectEdit extends VueBase { } this.scanAddDialogOpen = false this.strategyUserList() - this.submitForm.scanId = data.id } private agentChange() { @@ -966,7 +766,6 @@ export default class ProjectEdit extends VueBase { name: string mode: string | any agent_ids: string - scan_id: number pid?: string version_name: string | undefined description: string | undefined @@ -974,15 +773,12 @@ export default class ProjectEdit extends VueBase { base_url: string test_req_header_key: string test_req_header_value: string - department_id: any - template_id: any enable_log: any log_level: any } = { name: this.submitForm.name, mode: this.submitForm.mode, agent_ids: this.submitForm.agentIdList.join(','), - scan_id: this.submitForm.scanId as number, version_name: this.submitForm.version_name ? this.submitForm.version_name : undefined, @@ -993,8 +789,6 @@ export default class ProjectEdit extends VueBase { base_url: this.submitForm.base_url, test_req_header_key: this.submitForm.test_req_header_key, test_req_header_value: this.submitForm.test_req_header_value, - department_id: this.submitForm.department_id, - template_id: this.submitForm.template_id, enable_log: this.submitForm.enable_log, log_level: this.submitForm.log_level, } diff --git a/src/views/project/VulListComponent.vue b/src/views/project/VulListComponent.vue index 5fd95470..6a5737fb 100644 --- a/src/views/project/VulListComponent.vue +++ b/src/views/project/VulListComponent.vue @@ -32,31 +32,30 @@
    -
    - 关联项目 -
    -
    + +
    + 漏洞状态 +
    - {{ item.name || item.project__name }} + {{ item.name }}
    - {{ item.num || item.total }} + {{ item.num }}
    -
    -
    - 语言 -
    - -
    -
    - {{ item.name }} -
    -
    - {{ item.num }} -
    -
    -
    @@ -239,18 +192,18 @@ > 应用漏洞
    -
    组件漏洞 -
    -
    --> +
    @@ -285,7 +238,7 @@ :label="status.label" > -
    - + --> {{ coverRate }} + +
    已覆盖测试 API 数量: {{ coverCount }}

    全部 API 数量: {{ totalCount }}
    + {{ `(${coverCount}/${totalCount})` }} +
    @@ -213,6 +217,8 @@ export default class Index extends VueBase { private page_index = 1 private pageSize = 20 private coverRate = '' + private totalCount = '' + private coverCount = '' private openCollapse = [0] private apiList = [] private getColor(type: string) { @@ -346,6 +352,8 @@ export default class Index extends VueBase { this.$message.error(res.msg) } this.coverRate = res.data.cover_rate + this.totalCount = res.data.total_count + this.coverCount = res.data.covered_count } async mounted() { diff --git a/src/views/project/components/distribution.vue b/src/views/project/components/distribution.vue index 58bdbff1..aaae5364 100644 --- a/src/views/project/components/distribution.vue +++ b/src/views/project/components/distribution.vue @@ -38,11 +38,11 @@ export default class Index extends VueBase { trigger: 'item', formatter: (params: any) => { const colorMap = { - 高危: '#E56363', - 中危: '#F49E0B', - 低危: '#2F90EA', - 提示: '#ACB4C4', - 无风险: '#D8D8D8', + 严重: '#E56363', + 高危: '#F49E0B', + 中危: '#2F90EA', + 低危: '#ACB4C4', + 提示: '#D8D8D8', } return `
    diff --git a/src/views/sca/ScaDetail_tab.vue b/src/views/sca/ScaDetail_tab.vue new file mode 100644 index 00000000..2af1ffaf --- /dev/null +++ b/src/views/sca/ScaDetail_tab.vue @@ -0,0 +1,747 @@ + + + + + + + + + diff --git a/src/views/sca/ScaDialog copy.vue b/src/views/sca/ScaDialog copy.vue new file mode 100644 index 00000000..3fed3afa --- /dev/null +++ b/src/views/sca/ScaDialog copy.vue @@ -0,0 +1,288 @@ + + + + + diff --git a/src/views/sca/ScaDialog.vue b/src/views/sca/ScaDialog.vue index 3fed3afa..67af0720 100644 --- a/src/views/sca/ScaDialog.vue +++ b/src/views/sca/ScaDialog.vue @@ -1,12 +1,74 @@ +
    + + + + + @@ -89,49 +245,159 @@ import { Component, Prop } from 'vue-property-decorator' import VueBase from '@/VueBase' import Distribution from '@/views/project/components/distribution.vue' -@Component({ name: 'ScaDialog', components: { Distribution } }) +import ScaDetail from '@/views/sca/ScaDetail_tab.vue' + +@Component({ name: 'ScaDialog', components: { Distribution, ScaDetail } }) export default class ScaDialog extends VueBase { - @Prop() dialogInfo: any + private dialogInfo: any = {} + private detailInfo: any = {} private tableLoading = false private tableData: any = [] + private activeName: any = [] + private dialogFlag = false + async getAssetVuls() { this.tableLoading = true - const res = await this.services.sca.assetVuls(this.dialogInfo.id) + const res = await this.services.sca.assetVuls({ + package_name: this.$route.query.package_name, + package_version: this.$route.query.package_version, + language_id: this.$route.query.language_id, + page: this.page, + page_size: this.pageSize, + }) this.tableLoading = false - this.tableData.push(...res.data) + this.tableData = res.data + this.total = res.page.alltotal } private projects: any = [] + private projects_total = 0 + private projects_pageSize = 10 + private projects_page = 1 + private total = 0 + private pageSize = 10 + private page = 1 async getProjects() { - const res = await this.services.sca.assetProjects(this.dialogInfo.id) - this.projects.push(...res.data) + let params: any = { + package_name: this.$route.query.package_name, + package_version: this.$route.query.package_version, + language_id: this.$route.query.language_id, + page: this.projects_page, + page_size: this.projects_pageSize, + } + if (this.$route.query.projectId) { + params.project_id = this.$route.query.projectId + } + const res = await this.services.sca.assetProjects(params) + this.projects = res.data + this.projects_total = res.page.alltotal + } + tableSizeChange(val: number) { + this.pageSize = val + this.getAssetVuls() + } + tableCurrentChange(val: number) { + this.page = val + this.getAssetVuls() + } + handleSizeChange(val: number) { + this.projects_pageSize = val + this.getProjects() + } + handleCurrentChange(val: number) { + this.projects_page = val + this.getProjects() + } + async handleChange(val: any) { + if (val) { + console.log('val', val) + const res = await this.services.sca.assetProjectId({ + package_name: this.$route.query.package_name, + package_version: this.$route.query.package_version, + language_id: this.$route.query.language_id, + project_id: val, + }) + this.projects = this.projects.map((item: any) => { + if (item.project_id === val) { + this.$set(item, 'content', res.data) + } + return item + }) + } } - private toVulnD(item: any) { - this.$router.push( - `/vuln/scaDetail/${item.asset_vul_id}/1?status=1&id=${item.asset_vul_id}` - ) + this.dialogFlag = true + this.dialogInfo = item + // this.$router.push( + // `/vuln/scaDetail/${item.asset_vul_id}/1?status=1&id=${item.asset_vul_id}` + // ) } - toProject(id: any) { + toProject(id: any, index: any) { + if (index === 0 && this.$route.query.projectId) { + return + } this.$router.push('/project/projectDetail/' + id) } + goBack = () => { + this.$router.go(-1) + } created() { + this.getDetail() this.getAssetVuls() this.getProjects() } - + private level_data: any = [] + async getDetail() { + const res = await this.services.sca.getScaDetail({ + package_name: this.$route.query.package_name, + package_version: this.$route.query.package_version, + language_id: this.$route.query.language_id, + }) + if (res.status !== 201) { + this.$message.error(res.msg) + return + } + this.detailInfo = res.data + this.level_data = res.data.vul_count_groupby_level.map( + (item: any, index: any) => { + return { + level_id: index + 1, + level_name: item.label, + num: item.count || 0, + } + } + ) + } + private getTagColoe(language: string) { + switch (language) { + case 'Java': + return 'danger' + case 'PYTHON': + return '' + default: + return '' + } + } + private levelObj = { + 1: '高危', + 2: '中危', + 3: '低危', + 4: '提示', + } private levelColor(level: any) { switch (level) { - case '高危': + case '严重': return { label: '高', color: '#E56363', bg: 'rgba(229, 99, 99, 0.1)' } - case '中危': + case '高危': return { label: '中', color: '#F49E0B', bg: 'rgba(244, 158, 11, 0.1)' } - case '低危': + case '中危': return { label: '低', color: '#2F90EA', bg: 'rgba(47, 144, 234, 0.1)' } - case '无风险': + case '低危': + return { label: '无', color: '#ABB2C0', bg: 'rgba(172, 180, 196, 0.1)' } + default: return { label: '无', color: '#ABB2C0', bg: 'rgba(172, 180, 196, 0.1)' } } } @@ -146,32 +412,85 @@ export default class ScaDialog extends VueBase { return { label: '低', color: '#2F90EA', bg: 'rgba(47, 144, 234, 0.1)' } case 0: return { - label: '无风险', + label: '提示', + color: '#ABB2C0', + bg: 'rgba(172, 180, 196, 0.1)', + } + default: + return { + label: '提示', color: '#ABB2C0', bg: 'rgba(172, 180, 196, 0.1)', } } } - - private level_data: any = [ - { - level_id: 1, - level_name: '高危', - num: this.dialogInfo.vul_high_count, - }, - { level_id: 2, level_name: '中危', num: this.dialogInfo.vul_medium_count }, - { level_id: 3, level_name: '低危', num: this.dialogInfo.vul_low_count }, - { - level_id: 4, - level_name: '无风险', - num: this.dialogInfo.vul_info_count, - }, - ] } + diff --git a/src/views/sca/ScaList.vue b/src/views/sca/ScaList.vue index 494a85b8..43261491 100644 --- a/src/views/sca/ScaList.vue +++ b/src/views/sca/ScaList.vue @@ -47,7 +47,7 @@ v-for="item in searchOptionsObj.language" :key="item.language" v-model="searchObj.language" - :label="item.language" + :label="item.language_id" class="flex-row-space-between module-line" @change="getTableData(true)" > @@ -128,56 +128,30 @@ label="组件名称" prop="package_name" fixed="left" - width="240" + min-width="240" > - - - - + - -