AI修复建议接口对接
This commit is contained in:
@@ -98,15 +98,11 @@ export function getDepencyList(softwareId: string) {
|
||||
}
|
||||
|
||||
// 获取AI修复建议
|
||||
export function getRepairInfo() {
|
||||
export function getRepairInfo(data) {
|
||||
return request({
|
||||
url: '/api/v1/repo/repair/info',
|
||||
method: 'POST',
|
||||
data: {
|
||||
"current": 1,
|
||||
"size": 10,
|
||||
"softwareId": 47
|
||||
}
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -13,63 +13,67 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="ai-container">
|
||||
<div class="ai-container-card" style="width: 100%;" v-for="(rowItem, index) in list" :key="index">
|
||||
<Panel :expand="rowItem.expand">
|
||||
<template #header>
|
||||
<div class="ai-panel-header">
|
||||
<div style="padding: 25px 8px 0px 20px;">
|
||||
<img style="width: 36px; height: 33px;" src="@/assets/imgs/jyh/warning.png">
|
||||
</div>
|
||||
<div style="width: 100%; padding: 20px 20px 0px 0;">
|
||||
<div class="ai-panel-header-title">
|
||||
<div>
|
||||
<d-tag color="red-w98" class="mr-1" size="sm">严重</d-tag>
|
||||
<span>{{ rowItem.title }}</span>
|
||||
</div>
|
||||
<div style="cursor: pointer; display: flex; gap: 8px; align-items: center;" @click="rowItem.expand = !rowItem.expand">
|
||||
<img style="width: 14px; height: 14px;" src="@/assets/imgs/jyh/collapseIcon.png">
|
||||
<span>全部收起</span>
|
||||
</div>
|
||||
<template v-if="tableData.length>0">
|
||||
<div class="ai-container-card" style="width: 100%;" v-for="(rowItem, index) in tableData" :key="index">
|
||||
<Panel :expand="!rowItem.expand">
|
||||
<template #header>
|
||||
<div class="ai-panel-header">
|
||||
<div style="padding: 25px 8px 0px 20px;">
|
||||
<img style="width: 36px; height: 33px;" src="@/assets/imgs/jyh/warning.png">
|
||||
</div>
|
||||
<div class="ai-panel-header-sub-title">
|
||||
<div>
|
||||
<span class="weak-text">安全问题</span>
|
||||
<span>2</span>
|
||||
<div style="width: 100%; padding: 20px 20px 0px 0;">
|
||||
<div class="ai-panel-header-title">
|
||||
<div>
|
||||
<d-tag color="red-w98" class="mr-1" size="sm">{{'严重'}}</d-tag>
|
||||
<span>{{rowItem.libraryName||'--'}}</span>
|
||||
</div>
|
||||
<div style="cursor: pointer; display: flex; gap: 8px; align-items: center;" @click="rowItem.expand == rowItem.expand">
|
||||
<img style="width: 14px; height: 14px;" src="@/assets/imgs/jyh/collapseIcon.png">
|
||||
<span>全部收起</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<span class="weak-text">修复兼容性</span>
|
||||
<span>2</span>
|
||||
<img src="@/assets/imgs/jyh/help.png" class="icon-sm">
|
||||
<d-tag class="ml-1" type="warning" size="sm">中</d-tag>
|
||||
</div>
|
||||
<div>
|
||||
<span class="weak-text">升级版本</span>
|
||||
<span>1.7.0</span>
|
||||
<img src="@/assets/imgs/jyh/ic_digital_power_next_step_@2x.png" class="icon-sm">
|
||||
<span>1.9.1</span>
|
||||
<div class="ai-panel-header-sub-title">
|
||||
<div>
|
||||
<span class="weak-text">安全问题</span>
|
||||
<span>{{rowItem.vulnerabilities.length ||'--'}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="weak-text">修复兼容性</span>
|
||||
<span>{{rowItem.vulnerabilities.length ||'--'}}</span>
|
||||
<img src="@/assets/imgs/jyh/help.png" class="icon-sm">
|
||||
<d-tag class="ml-1" type="warning" size="sm">{{rowItem.vulnerabilities.length>0?rowItem.vulnerabilities[0].severity:'--'}}</d-tag>
|
||||
</div>
|
||||
<div>
|
||||
<span class="weak-text">升级版本</span>
|
||||
<span>{{rowItem.currentVersion ||'--'}}</span>
|
||||
<img src="@/assets/imgs/jyh/ic_digital_power_next_step_@2x.png" class="icon-sm">
|
||||
<span>{{rowItem.currentVersion ||'--'}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template #body>
|
||||
<div style="padding: 8px 20px 20px 20px; width: 100%;">
|
||||
<Table :tableConfig="tableConfig" :dataSource="rowItem.data.listData"/>
|
||||
<div class="w-full flex items-center justify-end"><span>共{{ rowItem.data.listData.length }}条</span></div>
|
||||
</div>
|
||||
</template>
|
||||
</Panel>
|
||||
</div>
|
||||
<template #body>
|
||||
<div style="padding: 8px 20px 20px 20px; width: 100%;">
|
||||
<Table class="jyh-table" :tableConfig="tableConfig" :dataSource="rowItem.vulnerabilities"/>
|
||||
<div class="w-full flex items-center justify-end"><span>共{{ rowItem.vulnerabilities.length }}条</span></div>
|
||||
</div>
|
||||
</template>
|
||||
</Panel>
|
||||
</div>
|
||||
</template>
|
||||
<NoData v-else :small="false"></NoData>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref,onMounted,defineProps } from 'vue';
|
||||
import Panel from '@/components/AIRepair/Panel.vue';
|
||||
import Table from '@/components/AIRepair/Table.vue';
|
||||
import NoData from '@/components/NoData/NoData.vue';
|
||||
import { getRepairInfo } from '@/api/jyh';
|
||||
|
||||
const propsData = defineProps(['versionId']);
|
||||
const infoList = ref([
|
||||
'当前代码主要风险为易受常见的注入攻击,包括命令注入、SQL注入、表达式注入,针对每种攻击,应提供相应的防范措施,如数据校验、使用安全函数和限制程序权限。',
|
||||
'相对上一次检查,【提升点】在于代码基础编码问题少了47.8%,问题总数降低29.3%;'
|
||||
@@ -77,25 +81,25 @@ const infoList = ref([
|
||||
|
||||
const tableConfig = ref([
|
||||
{
|
||||
field: 'securityProblemCode',
|
||||
field: 'vulnId',
|
||||
header: '安全问题编号',
|
||||
sortable: true,
|
||||
sortMethod: null
|
||||
},
|
||||
{
|
||||
field: 'type',
|
||||
field: 'vulnType',
|
||||
header: '安全问题类型',
|
||||
sortable: false,
|
||||
sortMethod: null
|
||||
},
|
||||
{
|
||||
field: 'CWEcode',
|
||||
field: 'vulnId',
|
||||
header: 'CWE编号',
|
||||
sortable: false,
|
||||
sortMethod: null
|
||||
},
|
||||
{
|
||||
field: 'score',
|
||||
field: 'cvssScore',
|
||||
header: '分值',
|
||||
sortable: true,
|
||||
sortMethod: null
|
||||
@@ -147,9 +151,22 @@ const list = ref([
|
||||
])
|
||||
|
||||
const getInfo = async() => {
|
||||
const res = await getRepairInfo();
|
||||
const { data } = await getRepairInfo({
|
||||
"current": 1,
|
||||
"size": 10,
|
||||
"softwareId": 47,
|
||||
// softwareId: propsData.versionId,
|
||||
});
|
||||
debugger
|
||||
if(data.code===200) {
|
||||
tableData.value = data?.data?.components || [];
|
||||
// pager.value.total = data?.data?.data?.total || [];
|
||||
}
|
||||
}
|
||||
getInfo();
|
||||
const tableData = ref([]);
|
||||
onMounted( () => {
|
||||
getInfo()
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -233,4 +250,4 @@ getInfo();
|
||||
line-height: 22px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user