Skip to content

Commit fbe458d

Browse files
authored
Merge pull request #245 from safe1ine/main
增加了代码扫描查看详情的功能
2 parents ccbd5c8 + 7dfdf90 commit fbe458d

File tree

6 files changed

+286
-92
lines changed

6 files changed

+286
-92
lines changed

ui/src/api/CodeSnippet.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111
*/
1212

1313
import { ContentType, RequestParams } from "./httpClient";
14-
import {
15-
DomainCodeSnippet,
16-
InternalCodesnippetHandlerHttpV1GetContextReq,
17-
WebResp,
18-
} from "./types";
14+
import { DomainCodeSnippet, V1GetContextReq, WebResp } from "./types";
1915

2016
/**
2117
* @description 为IDE端提供代码片段上下文检索功能,使用API Key认证。支持单个查询和批量查询。
@@ -32,7 +28,7 @@ import {
3228
*/
3329

3430
export const postGetContext = (
35-
request: InternalCodesnippetHandlerHttpV1GetContextReq,
31+
request: V1GetContextReq,
3632
params: RequestParams = {},
3733
) =>
3834
request<

ui/src/api/License.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111
*/
1212

1313
import request, { ContentType, RequestParams } from "./httpClient";
14-
import {
15-
GithubComChaitinMonkeyCodeBackendProDomainLicenseResp,
16-
V1LicenseCreatePayload,
17-
WebResp,
18-
} from "./types";
14+
import { DomainLicenseResp, V1LicenseCreatePayload, WebResp } from "./types";
1915

2016
/**
2117
* @description Get license
@@ -25,15 +21,15 @@ import {
2521
* @summary Get license
2622
* @request GET:/api/v1/license
2723
* @response `200` `(WebResp & {
28-
data?: GithubComChaitinMonkeyCodeBackendProDomainLicenseResp,
24+
data?: DomainLicenseResp,
2925
3026
})` OK
3127
*/
3228

3329
export const v1LicenseList = (params: RequestParams = {}) =>
3430
request<
3531
WebResp & {
36-
data?: GithubComChaitinMonkeyCodeBackendProDomainLicenseResp;
32+
data?: DomainLicenseResp;
3733
}
3834
>({
3935
path: `/api/v1/license`,
@@ -51,7 +47,7 @@ export const v1LicenseList = (params: RequestParams = {}) =>
5147
* @summary Upload license
5248
* @request POST:/api/v1/license
5349
* @response `200` `(WebResp & {
54-
data?: GithubComChaitinMonkeyCodeBackendProDomainLicenseResp,
50+
data?: DomainLicenseResp,
5551
5652
})` OK
5753
*/
@@ -62,7 +58,7 @@ export const v1LicenseCreate = (
6258
) =>
6359
request<
6460
WebResp & {
65-
data?: GithubComChaitinMonkeyCodeBackendProDomainLicenseResp;
61+
data?: DomainLicenseResp;
6662
}
6763
>({
6864
path: `/api/v1/license`,

ui/src/api/types.ts

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
* ---------------------------------------------------------------
1111
*/
1212

13+
export enum DomainLicenseEdition {
14+
LicenseEditionFree = 0,
15+
LicenseEditionContributor = 1,
16+
LicenseEditionEnterprise = 2,
17+
}
18+
1319
export enum DomainCodeLanguageType {
1420
CodeLanguageTypeGo = "go",
1521
CodeLanguageTypePython = "python",
@@ -557,6 +563,13 @@ export interface DomainInviteResp {
557563
code?: string;
558564
}
559565

566+
export interface DomainLicenseResp {
567+
edition?: DomainLicenseEdition;
568+
expired_at?: number;
569+
started_at?: number;
570+
state?: number;
571+
}
572+
560573
export interface DomainListAdminLoginHistoryResp {
561574
has_next_page?: boolean;
562575
login_histories?: DomainAdminLoginHistory[];
@@ -824,6 +837,8 @@ export interface DomainSecurityScanningBrief {
824837
export interface DomainSecurityScanningResult {
825838
/** 扫描开始时间 */
826839
created_at?: number;
840+
/** 错误信息 */
841+
error?: string;
827842
/** 扫描任务id */
828843
id?: string;
829844
/** 扫描任务 */
@@ -841,10 +856,12 @@ export interface DomainSecurityScanningResult {
841856
}
842857

843858
export interface DomainSecurityScanningRiskDetail {
859+
/** 代码内容 */
860+
content?: string;
844861
/** 风险描述 */
845862
desc?: string;
846863
/** 风险代码行结束位置 */
847-
end?: GithubComChaitinMonkeyCodeBackendEntTypesPosition;
864+
end?: TypesPosition;
848865
/** 风险文件名 */
849866
filename?: string;
850867
/** 修复建议 */
@@ -856,7 +873,7 @@ export interface DomainSecurityScanningRiskDetail {
856873
/** 风险代码行 */
857874
lines?: string;
858875
/** 风险代码行开始位置 */
859-
start?: GithubComChaitinMonkeyCodeBackendEntTypesPosition;
876+
start?: TypesPosition;
860877
}
861878

862879
export interface DomainSecurityScanningRiskResult {
@@ -1173,31 +1190,24 @@ export interface DomainWorkspaceFile {
11731190
workspace_id?: string;
11741191
}
11751192

1176-
export interface GithubComChaitinMonkeyCodeBackendEntTypesPosition {
1193+
export interface TypesPosition {
11771194
col?: number;
11781195
line?: number;
11791196
offset?: number;
11801197
}
11811198

1182-
export interface GithubComChaitinMonkeyCodeBackendProDomainLicenseResp {
1183-
edition?: number;
1184-
expired_at?: number;
1185-
started_at?: number;
1186-
state?: number;
1187-
}
1188-
1189-
export interface InternalCodesnippetHandlerHttpV1GetContextReq {
1199+
export interface V1GetContextReq {
11901200
/** 返回结果数量限制,默认10 */
11911201
limit?: number;
11921202
/** 批量查询参数 */
1193-
queries?: InternalCodesnippetHandlerHttpV1Query[];
1203+
queries?: V1Query[];
11941204
/** 单个查询参数 */
1195-
query?: InternalCodesnippetHandlerHttpV1Query;
1205+
query?: V1Query;
11961206
/** 工作区路径(必填) */
11971207
workspacePath?: string;
11981208
}
11991209

1200-
export interface InternalCodesnippetHandlerHttpV1Query {
1210+
export interface V1Query {
12011211
/** 编程语言(可选) */
12021212
language?: string;
12031213
/** 代码片段名称(可选) */

0 commit comments

Comments
 (0)