Skip to content

Commit 4e97c91

Browse files
committed
🚧 初步完成拓展管理页面
1 parent 9d13b22 commit 4e97c91

12 files changed

Lines changed: 636 additions & 40 deletions

File tree

frontend/src/client/api/schemas.gen.ts

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ export const AdapterSchema = {
5555
type: 'boolean',
5656
default: false
5757
},
58+
version: {
59+
title: 'Version',
60+
type: 'string',
61+
default: '0.0.0'
62+
},
5863
is_download: {
5964
title: 'Is Download',
6065
type: 'boolean',
@@ -238,6 +243,11 @@ export const DriverSchema = {
238243
type: 'boolean',
239244
default: false
240245
},
246+
version: {
247+
title: 'Version',
248+
type: 'string',
249+
default: '0.0.0'
250+
},
241251
is_download: {
242252
title: 'Is Download',
243253
type: 'boolean',
@@ -305,6 +315,36 @@ export const GenericResponse_List_nb_cli_plugin_webui_app_handlers_process_schem
305315
}
306316
} as const
307317

318+
export const GenericResponse_List_nb_cli_plugin_webui_app_models_base_ModuleInfo__Schema = {
319+
title: 'GenericResponse[List[nb_cli_plugin_webui.app.models.base.ModuleInfo]]',
320+
required: ['detail'],
321+
type: 'object',
322+
properties: {
323+
detail: {
324+
title: 'Detail',
325+
type: 'array',
326+
items: {
327+
$ref: '#/components/schemas/nb_cli_plugin_webui__app__models__base__ModuleInfo'
328+
}
329+
}
330+
}
331+
} as const
332+
333+
export const GenericResponse_List_nb_cli_plugin_webui_app_models_base_Plugin__Schema = {
334+
title: 'GenericResponse[List[nb_cli_plugin_webui.app.models.base.Plugin]]',
335+
required: ['detail'],
336+
type: 'object',
337+
properties: {
338+
detail: {
339+
title: 'Detail',
340+
type: 'array',
341+
items: {
342+
$ref: '#/components/schemas/nb_cli_plugin_webui__app__models__base__Plugin'
343+
}
344+
}
345+
}
346+
} as const
347+
308348
export const GenericResponse_List_str__Schema = {
309349
title: 'GenericResponse[List[str]]',
310350
required: ['detail'],
@@ -940,6 +980,11 @@ export const nb_cli_plugin_webui__app__models__base__ModuleInfoSchema = {
940980
type: 'boolean',
941981
default: false
942982
},
983+
version: {
984+
title: 'Version',
985+
type: 'string',
986+
default: '0.0.0'
987+
},
943988
is_download: {
944989
title: 'Is Download',
945990
type: 'boolean',
@@ -1003,6 +1048,11 @@ export const nb_cli_plugin_webui__app__models__base__PluginSchema = {
10031048
type: 'boolean',
10041049
default: false
10051050
},
1051+
version: {
1052+
title: 'Version',
1053+
type: 'string',
1054+
default: '0.0.0'
1055+
},
10061056
is_download: {
10071057
title: 'Is Download',
10081058
type: 'boolean',
@@ -1071,6 +1121,11 @@ export const nb_cli_plugin_webui__app__models__store__ModuleInfoSchema = {
10711121
type: 'boolean',
10721122
default: false
10731123
},
1124+
version: {
1125+
title: 'Version',
1126+
type: 'string',
1127+
default: '0.0.0'
1128+
},
10741129
is_download: {
10751130
title: 'Is Download',
10761131
type: 'boolean',
@@ -1087,7 +1142,7 @@ export const nb_cli_plugin_webui__app__models__store__ModuleInfoSchema = {
10871142

10881143
export const nb_cli_plugin_webui__app__models__store__PluginSchema = {
10891144
title: 'Plugin',
1090-
required: ['valid', 'time', 'version', 'skip_test'],
1145+
required: ['version', 'valid', 'time', 'skip_test'],
10911146
type: 'object',
10921147
properties: {
10931148
module_name: {
@@ -1141,6 +1196,10 @@ export const nb_cli_plugin_webui__app__models__store__PluginSchema = {
11411196
type: 'boolean',
11421197
default: false
11431198
},
1199+
version: {
1200+
title: 'Version',
1201+
type: 'string'
1202+
},
11441203
is_download: {
11451204
title: 'Is Download',
11461205
type: 'boolean',
@@ -1169,10 +1228,6 @@ export const nb_cli_plugin_webui__app__models__store__PluginSchema = {
11691228
title: 'Time',
11701229
type: 'string'
11711230
},
1172-
version: {
1173-
title: 'Version',
1174-
type: 'string'
1175-
},
11761231
skip_test: {
11771232
title: 'Skip Test',
11781233
type: 'boolean'

frontend/src/client/api/services.gen.ts

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,16 @@ import type {
8787
ListProjectV1ProjectListGetResponse,
8888
CheckProjectTomlV1ProjectCheckTomlPostData,
8989
CheckProjectTomlV1ProjectCheckTomlPostError,
90-
CheckProjectTomlV1ProjectCheckTomlPostResponse
90+
CheckProjectTomlV1ProjectCheckTomlPostResponse,
91+
GetPluginsV1ProjectPluginsGetData,
92+
GetPluginsV1ProjectPluginsGetError,
93+
GetPluginsV1ProjectPluginsGetResponse,
94+
GetAdaptersV1ProjectAdaptersGetData,
95+
GetAdaptersV1ProjectAdaptersGetError,
96+
GetAdaptersV1ProjectAdaptersGetResponse,
97+
GetDriversV1ProjectDriversGetData,
98+
GetDriversV1ProjectDriversGetError,
99+
GetDriversV1ProjectDriversGetResponse
91100
} from './types.gen'
92101

93102
export const client = createClient(createConfig())
@@ -602,4 +611,55 @@ export class ProjectService {
602611
url: '/v1/project/check_toml'
603612
})
604613
}
614+
615+
/**
616+
* Get Plugins
617+
* - 获取实例的插件列表
618+
*/
619+
public static getPluginsV1ProjectPluginsGet<ThrowOnError extends boolean = false>(
620+
options: Options<GetPluginsV1ProjectPluginsGetData, ThrowOnError>
621+
) {
622+
return (options?.client ?? client).get<
623+
GetPluginsV1ProjectPluginsGetResponse,
624+
GetPluginsV1ProjectPluginsGetError,
625+
ThrowOnError
626+
>({
627+
...options,
628+
url: '/v1/project/plugins'
629+
})
630+
}
631+
632+
/**
633+
* Get Adapters
634+
* - 获取实例的适配器列表
635+
*/
636+
public static getAdaptersV1ProjectAdaptersGet<ThrowOnError extends boolean = false>(
637+
options: Options<GetAdaptersV1ProjectAdaptersGetData, ThrowOnError>
638+
) {
639+
return (options?.client ?? client).get<
640+
GetAdaptersV1ProjectAdaptersGetResponse,
641+
GetAdaptersV1ProjectAdaptersGetError,
642+
ThrowOnError
643+
>({
644+
...options,
645+
url: '/v1/project/adapters'
646+
})
647+
}
648+
649+
/**
650+
* Get Drivers
651+
* - 获取实例的驱动器列表
652+
*/
653+
public static getDriversV1ProjectDriversGet<ThrowOnError extends boolean = false>(
654+
options: Options<GetDriversV1ProjectDriversGetData, ThrowOnError>
655+
) {
656+
return (options?.client ?? client).get<
657+
GetDriversV1ProjectDriversGetResponse,
658+
GetDriversV1ProjectDriversGetError,
659+
ThrowOnError
660+
>({
661+
...options,
662+
url: '/v1/project/drivers'
663+
})
664+
}
605665
}

frontend/src/client/api/types.gen.ts

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type Adapter = {
1313
}
1414
tags?: Array<ModuleTag>
1515
is_official?: boolean
16+
version?: string
1617
is_download?: boolean
1718
}
1819

@@ -58,6 +59,7 @@ export type Driver = {
5859
}
5960
tags?: Array<ModuleTag>
6061
is_official?: boolean
62+
version?: string
6163
is_download?: boolean
6264
}
6365

@@ -77,6 +79,14 @@ export type GenericResponse_List_nb_cli_plugin_webui_app_handlers_process_schema
7779
detail: Array<ProcessLog>
7880
}
7981

82+
export type GenericResponse_List_nb_cli_plugin_webui_app_models_base_ModuleInfo__ = {
83+
detail: Array<nb_cli_plugin_webui__app__models__base__ModuleInfo>
84+
}
85+
86+
export type GenericResponse_List_nb_cli_plugin_webui_app_models_base_Plugin__ = {
87+
detail: Array<nb_cli_plugin_webui__app__models__base__Plugin>
88+
}
89+
8090
export type GenericResponse_List_str__ = {
8191
detail: Array<string>
8292
}
@@ -245,6 +255,7 @@ export type nb_cli_plugin_webui__app__models__base__ModuleInfo = {
245255
}
246256
tags?: Array<ModuleTag>
247257
is_official?: boolean
258+
version?: string
248259
is_download?: boolean
249260
}
250261

@@ -261,6 +272,7 @@ export type nb_cli_plugin_webui__app__models__base__Plugin = {
261272
}
262273
tags?: Array<ModuleTag>
263274
is_official?: boolean
275+
version?: string
264276
is_download?: boolean
265277
config?: {
266278
[key: string]: unknown
@@ -280,6 +292,7 @@ export type nb_cli_plugin_webui__app__models__store__ModuleInfo = {
280292
}
281293
tags?: Array<ModuleTag>
282294
is_official?: boolean
295+
version?: string
283296
is_download?: boolean
284297
module_type?: 'module'
285298
}
@@ -303,6 +316,7 @@ export type nb_cli_plugin_webui__app__models__store__Plugin = {
303316
}
304317
tags?: Array<ModuleTag>
305318
is_official?: boolean
319+
version: string
306320
is_download?: boolean
307321
config?: {
308322
[key: string]: unknown
@@ -311,7 +325,6 @@ export type nb_cli_plugin_webui__app__models__store__Plugin = {
311325
supported_adapters?: Array<string>
312326
valid: boolean
313327
time: string
314-
version: string
315328
skip_test: boolean
316329
module_type?: 'plugin'
317330
}
@@ -634,3 +647,36 @@ export type CheckProjectTomlV1ProjectCheckTomlPostData = {
634647
export type CheckProjectTomlV1ProjectCheckTomlPostResponse = GenericResponse_ProjectTomlDetail_
635648

636649
export type CheckProjectTomlV1ProjectCheckTomlPostError = HTTPValidationError
650+
651+
export type GetPluginsV1ProjectPluginsGetData = {
652+
query: {
653+
project_id: string
654+
}
655+
}
656+
657+
export type GetPluginsV1ProjectPluginsGetResponse =
658+
GenericResponse_List_nb_cli_plugin_webui_app_models_base_Plugin__
659+
660+
export type GetPluginsV1ProjectPluginsGetError = HTTPValidationError
661+
662+
export type GetAdaptersV1ProjectAdaptersGetData = {
663+
query: {
664+
project_id: string
665+
}
666+
}
667+
668+
export type GetAdaptersV1ProjectAdaptersGetResponse =
669+
GenericResponse_List_nb_cli_plugin_webui_app_models_base_ModuleInfo__
670+
671+
export type GetAdaptersV1ProjectAdaptersGetError = HTTPValidationError
672+
673+
export type GetDriversV1ProjectDriversGetData = {
674+
query: {
675+
project_id: string
676+
}
677+
}
678+
679+
export type GetDriversV1ProjectDriversGetResponse =
680+
GenericResponse_List_nb_cli_plugin_webui_app_models_base_ModuleInfo__
681+
682+
export type GetDriversV1ProjectDriversGetError = HTTPValidationError

frontend/src/client/utils.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,31 @@ export const generateURLForWebUI = (path: string, isWebsocket = false) => {
3232
export const sleep = (ms: number) => {
3333
return new Promise((resolve) => setTimeout(resolve, ms))
3434
}
35+
36+
export const compareSemanticVersion = (v1: string, v2: string) => {
37+
const parseVersion = (v: string) => {
38+
const [main, pre] = v.split('-')
39+
const parts = main.split('.').map(Number)
40+
return { parts, pre: pre || null }
41+
}
42+
43+
const v1Parsed = parseVersion(v1)
44+
const v2Parsed = parseVersion(v2)
45+
46+
// 逐位比较主版本号
47+
const maxLength = Math.max(v1Parsed.parts.length, v2Parsed.parts.length)
48+
for (let i = 0; i < maxLength; i++) {
49+
const part1 = v1Parsed.parts[i] || 0
50+
const part2 = v2Parsed.parts[i] || 0
51+
52+
if (part1 > part2) return 1
53+
if (part1 < part2) return -1
54+
}
55+
56+
// 比较预发行版本
57+
if (!v1Parsed.pre && v2Parsed.pre) return 1 // v1 是正式版,v2 是预发行版
58+
if (v1Parsed.pre && !v2Parsed.pre) return -1 // v1 是预发行版,v2 是正式版
59+
if (v1Parsed.pre && v2Parsed.pre) return v1Parsed.pre.localeCompare(v2Parsed.pre) // 按字典顺序比较预发行版本
60+
61+
return 0 // 完全相等
62+
}

frontend/src/router/client.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ export const defaultRoutes: NavItem[] = [
4242
component: () => import('@/views/Store/StoreIndex.vue')
4343
}
4444
},
45+
{
46+
googleIcon: 'power',
47+
name: '拓展管理',
48+
routeData: {
49+
path: '/extension',
50+
name: 'ExtensionManage',
51+
component: () => import('@/views/ExtensionManage/ExtensionManageIndex.vue')
52+
}
53+
},
4554
{
4655
googleIcon: 'settings',
4756
name: '实例设置',

0 commit comments

Comments
 (0)